Preprocessor: Ignore unknown pragmas in -E -dM and -Eonly modes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105830 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PrintPreprocessedOutput.cpp b/lib/Frontend/PrintPreprocessedOutput.cpp
index b6c18b7..e89c425 100644
--- a/lib/Frontend/PrintPreprocessedOutput.cpp
+++ b/lib/Frontend/PrintPreprocessedOutput.cpp
@@ -454,6 +454,9 @@
}
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();