diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-11-18 20:06:41 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-11-18 20:06:41 +0000 |
commit | 33e4e70c8c0a17e0ccb7465d96556b077a68ecb1 (patch) | |
tree | 7f65080a9221d10495e43911e7bbaeb2724084f7 /tools/driver/cc1_main.cpp | |
parent | 9313aac61d425f14fa0b82c3dfe1eb2c3626d38c (diff) |
Refactoring of Diagnostic class.
-Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class.
-DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units.
-The rest of the state in Diagnostic object is considered related and tied to one translation unit.
-Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a
SourceLocation instead of a FullSourceLoc.
-Reflect the changes to various interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119730 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/driver/cc1_main.cpp')
-rw-r--r-- | tools/driver/cc1_main.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp index de5e8bf043..1f8d1129da 100644 --- a/tools/driver/cc1_main.cpp +++ b/tools/driver/cc1_main.cpp @@ -116,13 +116,14 @@ static int cc1_test(Diagnostic &Diags, int cc1_main(const char **ArgBegin, const char **ArgEnd, const char *Argv0, void *MainAddr) { llvm::OwningPtr<CompilerInstance> Clang(new CompilerInstance()); + llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); Clang->setLLVMContext(new llvm::LLVMContext()); // Run clang -cc1 test. if (ArgBegin != ArgEnd && llvm::StringRef(ArgBegin[0]) == "-cc1test") { - Diagnostic Diags(new TextDiagnosticPrinter(llvm::errs(), - DiagnosticOptions())); + Diagnostic Diags(DiagID, new TextDiagnosticPrinter(llvm::errs(), + DiagnosticOptions())); return cc1_test(Diags, ArgBegin + 1, ArgEnd); } @@ -134,7 +135,7 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, // Buffer diagnostics from argument parsing so that we can output them using a // well formed diagnostic object. TextDiagnosticBuffer *DiagsBuffer = new TextDiagnosticBuffer; - Diagnostic Diags(DiagsBuffer); + Diagnostic Diags(DiagID, DiagsBuffer); CompilerInvocation::CreateFromArgs(Clang->getInvocation(), ArgBegin, ArgEnd, Diags); |