diff options
| -rw-r--r-- | clang/include/clang/Basic/Diagnostic.h | 4 | ||||
| -rw-r--r-- | clang/include/clang/Frontend/ChainedDiagnosticClient.h | 7 | ||||
| -rw-r--r-- | clang/include/clang/Frontend/TextDiagnosticPrinter.h | 2 | ||||
| -rw-r--r-- | clang/tools/clang-cc/clang-cc.cpp | 5 |
4 files changed, 11 insertions, 7 deletions
diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index ba086ebf7a3..3a70e134b82 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -32,6 +32,7 @@ namespace clang { class IdentifierInfo; class LangOptions; class PartialDiagnostic; + class Preprocessor; class SourceRange; // Import the diagnostic enums themselves. @@ -791,7 +792,8 @@ public: /// \arg LO - The language options for the source file being processed. /// \arg PP - The preprocessor object being used for the source; this optional /// and may not be present, for example when processing AST source files. - virtual void BeginSourceFile(const LangOptions &LangOpts) {} + virtual void BeginSourceFile(const LangOptions &LangOpts, + const Preprocessor *PP = 0) {} /// EndSourceFile - Callback to inform the diagnostic client that processing /// of a source file has ended. The diagnostic client should assume that any diff --git a/clang/include/clang/Frontend/ChainedDiagnosticClient.h b/clang/include/clang/Frontend/ChainedDiagnosticClient.h index 9dc3898f4ef..d65eb4ad9eb 100644 --- a/clang/include/clang/Frontend/ChainedDiagnosticClient.h +++ b/clang/include/clang/Frontend/ChainedDiagnosticClient.h @@ -30,9 +30,10 @@ public: Secondary.reset(_Secondary); } - virtual void BeginSourceFile(const LangOptions &LO) { - Primary->BeginSourceFile(LO); - Secondary->BeginSourceFile(LO); + virtual void BeginSourceFile(const LangOptions &LO, + const Preprocessor *PP) { + Primary->BeginSourceFile(LO, PP); + Secondary->BeginSourceFile(LO, PP); } virtual void EndSourceFile() { diff --git a/clang/include/clang/Frontend/TextDiagnosticPrinter.h b/clang/include/clang/Frontend/TextDiagnosticPrinter.h index 29a9c305b11..d727e480072 100644 --- a/clang/include/clang/Frontend/TextDiagnosticPrinter.h +++ b/clang/include/clang/Frontend/TextDiagnosticPrinter.h @@ -42,7 +42,7 @@ public: bool OwnsOutputStream = false); virtual ~TextDiagnosticPrinter(); - void BeginSourceFile(const LangOptions &LO) { + void BeginSourceFile(const LangOptions &LO, const Preprocessor *PP) { LangOpts = &LO; } diff --git a/clang/tools/clang-cc/clang-cc.cpp b/clang/tools/clang-cc/clang-cc.cpp index 16af1cb203d..6ae474289a6 100644 --- a/clang/tools/clang-cc/clang-cc.cpp +++ b/clang/tools/clang-cc/clang-cc.cpp @@ -579,7 +579,7 @@ static void ProcessASTInputFile(CompilerInstance &CI, const std::string &InFile, AST->getSourceManager().createMainFileIDForMemBuffer(SB); // Stream the input AST to the consumer. - CI.getDiagnostics().getClient()->BeginSourceFile(PP.getLangOptions()); + CI.getDiagnostics().getClient()->BeginSourceFile(PP.getLangOptions(), &PP); ParseAST(PP, Consumer.get(), AST->getASTContext(), CI.getFrontendOpts().ShowStats); CI.getDiagnostics().getClient()->EndSourceFile(); @@ -767,7 +767,8 @@ int main(int argc, char **argv) { Clang.createPreprocessor(); // Process the source file. - Clang.getDiagnostics().getClient()->BeginSourceFile(Clang.getLangOpts()); + Clang.getDiagnostics().getClient()->BeginSourceFile(Clang.getLangOpts(), + &Clang.getPreprocessor()); ProcessInputFile(Clang, InFile, ProgAction); Clang.getDiagnostics().getClient()->EndSourceFile(); } |

