File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -189,6 +189,21 @@ SourceLoc ModuleFile::getSourceLoc() const {
189
189
return SourceMgr.getLocForBufferStart (*bufferID);
190
190
}
191
191
192
+ SourceLoc ModularizationError::getSourceLoc () const {
193
+ auto &SourceMgr = referenceModule->getContext ().Diags .SourceMgr ;
194
+ auto filename = referenceModule->getModuleFilename ();
195
+
196
+ // Synthesize some context. We don't have an actual decl here
197
+ // so try to print a simple representation of the reference.
198
+ std::string S;
199
+ llvm::raw_string_ostream OS (S);
200
+ OS << expectedModule->getName () << " ." << name;
201
+
202
+ // If we enable these remarks by default we may want to reuse these buffers.
203
+ auto bufferID = SourceMgr.addMemBufferCopy (S, filename);
204
+ return SourceMgr.getLocForBufferStart (bufferID);
205
+ }
206
+
192
207
void
193
208
ModularizationError::diagnose (const ModuleFile *MF,
194
209
DiagnosticBehavior limit) const {
Original file line number Diff line number Diff line change @@ -402,6 +402,8 @@ class ModularizationError : public llvm::ErrorInfo<ModularizationError> {
402
402
path.print (OS);
403
403
}
404
404
405
+ SourceLoc getSourceLoc () const ;
406
+
405
407
std::error_code convertToErrorCode () const override {
406
408
return llvm::inconvertibleErrorCode ();
407
409
}
You can’t perform that action at this time.
0 commit comments