diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2010-06-11 20:10:12 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2010-06-11 20:10:12 +0000 |
| commit | d839e77b12313c0150b11835c9302b24fc70b95a (patch) | |
| tree | 9fb01a8605b52b2d156b529a1f6f78c4ddee4fdd /clang/lib/Frontend | |
| parent | afe54f1625f57ab65a8446d582621a167eec5c9a (diff) | |
| download | bcm5719-llvm-d839e77b12313c0150b11835c9302b24fc70b95a.tar.gz bcm5719-llvm-d839e77b12313c0150b11835c9302b24fc70b95a.zip | |
Preprocessor: Ignore unknown pragmas in -E -dM and -Eonly modes.
llvm-svn: 105830
Diffstat (limited to 'clang/lib/Frontend')
| -rw-r--r-- | clang/lib/Frontend/FrontendActions.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/Frontend/PrintPreprocessedOutput.cpp | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index 6cd960be20d..421d69d2430 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -9,6 +9,7 @@ #include "clang/Frontend/FrontendActions.h" #include "clang/AST/ASTConsumer.h" +#include "clang/Lex/Pragma.h" #include "clang/Lex/Preprocessor.h" #include "clang/Parse/Parser.h" #include "clang/Basic/FileManager.h" @@ -223,6 +224,9 @@ void ParseOnlyAction::ExecuteAction() { void PreprocessOnlyAction::ExecuteAction() { Preprocessor &PP = getCompilerInstance().getPreprocessor(); + // Ignore unknown pragmas. + PP.AddPragmaHandler(0, new EmptyPragmaHandler()); + Token Tok; // Start parsing the specified input file. PP.EnterMainSourceFile(); diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp index b6c18b77316..e89c425f470 100644 --- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -454,6 +454,9 @@ static int MacroIDCompare(const void* a, const void* b) { } static void DoPrintMacros(Preprocessor &PP, llvm::raw_ostream *OS) { + // Ignore unknown pragmas. + PP.AddPragmaHandler(0, new EmptyPragmaHandler()); + // -dM mode just scans and ignores all tokens in the files, then dumps out // the macro table at the end. PP.EnterMainSourceFile(); |

