diff options
author | Lubos Lunak <l.lunak@suse.cz> | 2013-07-20 14:30:01 +0000 |
---|---|---|
committer | Lubos Lunak <l.lunak@suse.cz> | 2013-07-20 14:30:01 +0000 |
commit | 8ee6a0dcc985c65bf5fd61a63e3f86e3ac516f5e (patch) | |
tree | a4870fd1a0cbbea253f1beff69613eacfa00abfc /lib/Rewrite | |
parent | ce6af1189fb8f6d2a6fa083cff84a796c8377504 (diff) |
avoid bogus warnings about "unknown" pragmas with -frewrite-includes (pr#14831)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186764 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Rewrite')
-rw-r--r-- | lib/Rewrite/Frontend/InclusionRewriter.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Rewrite/Frontend/InclusionRewriter.cpp b/lib/Rewrite/Frontend/InclusionRewriter.cpp index 0c3269a047..93ad9b88d6 100644 --- a/lib/Rewrite/Frontend/InclusionRewriter.cpp +++ b/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. |