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/Sema/Sema.cpp b/Sema/Sema.cpp
index 7a657cd..5ec5fa7 100644
--- a/Sema/Sema.cpp
+++ b/Sema/Sema.cpp
@@ -118,51 +118,54 @@
//===----------------------------------------------------------------------===//
bool Sema::Diag(SourceLocation Loc, unsigned DiagID) {
- PP.getDiagnostics().Report(Loc, DiagID);
+ PP.getDiagnostics().Report(Loc, DiagID, PP.getSourceManager());
return true;
}
bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg) {
- PP.getDiagnostics().Report(Loc, DiagID, &Msg, 1);
+ PP.getDiagnostics().Report(Loc, DiagID, PP.getSourceManager(), &Msg, 1);
return true;
}
bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1,
const std::string &Msg2) {
std::string MsgArr[] = { Msg1, Msg2 };
- PP.getDiagnostics().Report(Loc, DiagID, MsgArr, 2);
+ PP.getDiagnostics().Report(Loc, DiagID, PP.getSourceManager(), MsgArr, 2);
return true;
}
bool Sema::Diag(SourceLocation Loc, unsigned DiagID, SourceRange Range) {
- PP.getDiagnostics().Report(Loc, DiagID, 0, 0, &Range, 1);
+ PP.getDiagnostics().Report(Loc, DiagID, PP.getSourceManager(), 0,0, &Range,1);
return true;
}
bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
SourceRange Range) {
- PP.getDiagnostics().Report(Loc, DiagID, &Msg, 1, &Range, 1);
+ PP.getDiagnostics().Report(Loc,DiagID,PP.getSourceManager(),&Msg,1,&Range,1);
return true;
}
bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1,
const std::string &Msg2, SourceRange Range) {
std::string MsgArr[] = { Msg1, Msg2 };
- PP.getDiagnostics().Report(Loc, DiagID, MsgArr, 2, &Range, 1);
+ PP.getDiagnostics().Report(Loc,DiagID,PP.getSourceManager(),
+ MsgArr,2,&Range,1);
return true;
}
bool Sema::Diag(SourceLocation Loc, unsigned DiagID,
SourceRange R1, SourceRange R2) {
SourceRange RangeArr[] = { R1, R2 };
- PP.getDiagnostics().Report(Loc, DiagID, 0, 0, RangeArr, 2);
+ PP.getDiagnostics().Report(Loc, DiagID, PP.getSourceManager(),
+ 0, 0, RangeArr, 2);
return true;
}
bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
SourceRange R1, SourceRange R2) {
SourceRange RangeArr[] = { R1, R2 };
- PP.getDiagnostics().Report(Loc, DiagID, &Msg, 1, RangeArr, 2);
+ PP.getDiagnostics().Report(Loc, DiagID, PP.getSourceManager(), &Msg,
+ 1, RangeArr, 2);
return true;
}
@@ -170,7 +173,8 @@
const std::string &Msg2, SourceRange R1, SourceRange R2) {
std::string MsgArr[] = { Msg1, Msg2 };
SourceRange RangeArr[] = { R1, R2 };
- PP.getDiagnostics().Report(Range, DiagID, MsgArr, 2, RangeArr, 2);
+ PP.getDiagnostics().Report(Range, DiagID, PP.getSourceManager(), MsgArr, 2,
+ RangeArr, 2);
return true;
}