summaryrefslogtreecommitdiffstats
path: root/clang/lib/Rewrite
diff options
context:
space:
mode:
authorLubos Lunak <l.lunak@suse.cz>2013-07-20 14:30:01 +0000
committerLubos Lunak <l.lunak@suse.cz>2013-07-20 14:30:01 +0000
commitba5ee4da1dcb6aad861e63467c8fc9ddd69bf8f7 (patch)
treeaf4edb8b687344a1f081e231b34a017dd145913e /clang/lib/Rewrite
parent4c22f6a695f2ffcb37a3bb6dd56972209bbbd200 (diff)
downloadbcm5719-llvm-ba5ee4da1dcb6aad861e63467c8fc9ddd69bf8f7.tar.gz
bcm5719-llvm-ba5ee4da1dcb6aad861e63467c8fc9ddd69bf8f7.zip
avoid bogus warnings about "unknown" pragmas with -frewrite-includes (pr#14831)
llvm-svn: 186764
Diffstat (limited to 'clang/lib/Rewrite')
-rw-r--r--clang/lib/Rewrite/Frontend/InclusionRewriter.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Rewrite/Frontend/InclusionRewriter.cpp b/clang/lib/Rewrite/Frontend/InclusionRewriter.cpp
index 0c3269a0472..93ad9b88d60 100644
--- a/clang/lib/Rewrite/Frontend/InclusionRewriter.cpp
+++ b/clang/lib/Rewrite/Frontend/InclusionRewriter.cpp
@@ -16,6 +16,7 @@
#include "clang/Basic/SourceManager.h"
#include "clang/Frontend/PreprocessorOutputOptions.h"
#include "clang/Lex/HeaderSearch.h"
+#include "clang/Lex/Pragma.h"
#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/raw_ostream.h"
@@ -503,6 +504,13 @@ void clang::RewriteIncludesInInput(Preprocessor &PP, raw_ostream *OS,
InclusionRewriter *Rewrite = new InclusionRewriter(PP, *OS,
Opts.ShowLineMarkers);
PP.addPPCallbacks(Rewrite);
+ // Ignore all pragmas, otherwise there will be warnings about unknown pragmas
+ // (because there's nothing to handle them).
+ PP.AddPragmaHandler(new EmptyPragmaHandler());
+ // Ignore also all pragma in all namespaces created
+ // in Preprocessor::RegisterBuiltinPragmas().
+ PP.AddPragmaHandler("GCC", new EmptyPragmaHandler());
+ PP.AddPragmaHandler("clang", new EmptyPragmaHandler());
// First let the preprocessor process the entire file and call callbacks.
// Callbacks will record which #include's were actually performed.
OpenPOWER on IntegriCloud