aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Analysis/DeadStores.cpp4
-rw-r--r--Driver/ASTStreamers.cpp12
-rw-r--r--Driver/LLVMCodegen.cpp3
-rw-r--r--include/clang/AST/ASTContext.h5
4 files changed, 16 insertions, 8 deletions
diff --git a/Analysis/DeadStores.cpp b/Analysis/DeadStores.cpp
index 91034e3894..e898f3ca57 100644
--- a/Analysis/DeadStores.cpp
+++ b/Analysis/DeadStores.cpp
@@ -29,7 +29,9 @@ class DeadStoreObserver : public LiveVariablesObserver {
ASTContext Ctx;
public:
DeadStoreObserver(Preprocessor& pp) :
- PP(pp), Ctx(PP.getTargetInfo(), PP.getIdentifierTable()) {}
+ PP(pp), Ctx(PP.getSourceManager(), PP.getTargetInfo(),
+ PP.getIdentifierTable()) {
+ }
virtual ~DeadStoreObserver() {}
diff --git a/Driver/ASTStreamers.cpp b/Driver/ASTStreamers.cpp
index 6fe6fac411..342ee6b327 100644
--- a/Driver/ASTStreamers.cpp
+++ b/Driver/ASTStreamers.cpp
@@ -27,7 +27,8 @@ void clang::BuildASTs(Preprocessor &PP, unsigned MainFileID, bool Stats) {
Stmt::CollectingStats(true);
}
- ASTContext Context(PP.getTargetInfo(), PP.getIdentifierTable());
+ ASTContext Context(PP.getSourceManager(), PP.getTargetInfo(),
+ PP.getIdentifierTable());
ASTStreamerTy *Streamer = ASTStreamer_Init(PP, Context, MainFileID);
while (ASTStreamer_ReadTopLevelDecl(Streamer))
@@ -106,7 +107,8 @@ static void PrintObjcInterfaceDecl(ObjcInterfaceDecl *OID) {
}
void clang::PrintASTs(Preprocessor &PP, unsigned MainFileID, bool Stats) {
- ASTContext Context(PP.getTargetInfo(), PP.getIdentifierTable());
+ ASTContext Context(PP.getSourceManager(), PP.getTargetInfo(),
+ PP.getIdentifierTable());
ASTStreamerTy *Streamer = ASTStreamer_Init(PP, Context, MainFileID);
while (Decl *D = ASTStreamer_ReadTopLevelDecl(Streamer)) {
@@ -137,7 +139,8 @@ void clang::PrintASTs(Preprocessor &PP, unsigned MainFileID, bool Stats) {
}
void clang::DumpASTs(Preprocessor &PP, unsigned MainFileID, bool Stats) {
- ASTContext Context(PP.getTargetInfo(), PP.getIdentifierTable());
+ ASTContext Context(PP.getSourceManager(), PP.getTargetInfo(),
+ PP.getIdentifierTable());
ASTStreamerTy *Streamer = ASTStreamer_Init(PP, Context, MainFileID);
while (Decl *D = ASTStreamer_ReadTopLevelDecl(Streamer)) {
@@ -184,7 +187,8 @@ static void VisitCFGs(CFGVisitor& Visitor, Preprocessor& PP,
unsigned MainFileID, bool Stats) {
bool printFDecl = Visitor.printFuncDeclStart();
- ASTContext Context(PP.getTargetInfo(), PP.getIdentifierTable());
+ ASTContext Context(PP.getSourceManager(), PP.getTargetInfo(),
+ PP.getIdentifierTable());
ASTStreamerTy *Streamer = ASTStreamer_Init(PP, Context, MainFileID);
while (Decl *D = ASTStreamer_ReadTopLevelDecl(Streamer)) {
diff --git a/Driver/LLVMCodegen.cpp b/Driver/LLVMCodegen.cpp
index b969ff81ca..95d23f584e 100644
--- a/Driver/LLVMCodegen.cpp
+++ b/Driver/LLVMCodegen.cpp
@@ -29,7 +29,8 @@ void clang::EmitLLVMFromASTs(Preprocessor &PP, unsigned MainFileID,
bool PrintStats) {
Diagnostic &Diags = PP.getDiagnostics();
// Create the streamer to read the file.
- ASTContext Context(PP.getTargetInfo(), PP.getIdentifierTable());
+ ASTContext Context(PP.getSourceManager(), PP.getTargetInfo(),
+ PP.getIdentifierTable());
ASTStreamerTy *Streamer = ASTStreamer_Init(PP, Context, MainFileID);
// Create the module to codegen into.
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h
index f1e0959e0c..cc7ac8e0a9 100644
--- a/include/clang/AST/ASTContext.h
+++ b/include/clang/AST/ASTContext.h
@@ -40,6 +40,7 @@ class ASTContext {
RecordDecl *CFConstantStringTypeDecl;
llvm::StringMap<char> SelectorNames;
public:
+ SourceManager &SourceMgr;
TargetInfo &Target;
IdentifierTable &Idents;
Builtin::Context BuiltinInfo;
@@ -54,8 +55,8 @@ public:
QualType FloatTy, DoubleTy, LongDoubleTy;
QualType FloatComplexTy, DoubleComplexTy, LongDoubleComplexTy;
- ASTContext(TargetInfo &t, IdentifierTable &idents) :
- CFConstantStringTypeDecl(0), Target(t), Idents(idents) {
+ ASTContext(SourceManager &SM, TargetInfo &t, IdentifierTable &idents) :
+ CFConstantStringTypeDecl(0), SourceMgr(SM), Target(t), Idents(idents) {
InitBuiltinTypes();
BuiltinInfo.InitializeBuiltins(idents, Target);
}