Mega-patch: ripped SourceManager out of Diagnostic/DiagnosticClient. Now
SourceManager is passed by reference, allowing the SourceManager to be
associated with a specific translation unit, and not the entire execution
of the driver.
Modified all users of Diagnostics to comply with this new interface.
Integrated SourceManager as a member variable of TargetInfo. TargetInfo will
eventually be associated with a single translation unit (just like
SourceManager).
Made the SourceManager reference in ASTContext private. Provided accessor
getSourceManager() for clients to use instead. Modified clients to comply with
new interface.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44878 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/TextDiagnosticPrinter.h b/Driver/TextDiagnosticPrinter.h
index beb9d80..c87c20e 100644
--- a/Driver/TextDiagnosticPrinter.h
+++ b/Driver/TextDiagnosticPrinter.h
@@ -24,17 +24,20 @@
class TextDiagnosticPrinter : public TextDiagnostics {
SourceLocation LastWarningLoc;
public:
- TextDiagnosticPrinter(SourceManager &sourceMgr)
- : TextDiagnostics(sourceMgr) {}
+ TextDiagnosticPrinter() {}
- void PrintIncludeStack(SourceLocation Pos);
- void HighlightRange(const SourceRange &R, unsigned LineNo,
+ void PrintIncludeStack(SourceLocation Pos, SourceManager& SrcMgr);
+ void HighlightRange(const SourceRange &R,
+ SourceManager& SrcMgr,
+ unsigned LineNo,
std::string &CaratLine,
const std::string &SourceLine);
virtual void HandleDiagnostic(Diagnostic &Diags, Diagnostic::Level DiagLevel,
SourceLocation Pos,
- diag::kind ID, const std::string *Strs,
+ diag::kind ID,
+ SourceManager& SrcMgr,
+ const std::string *Strs,
unsigned NumStrs,
const SourceRange *Ranges,
unsigned NumRanges);