]> granicus.if.org Git - clang/commitdiff
Move the Wno-rewrite-macros option out of RewriteObjC.cpp in prepration
authorEli Friedman <eli.friedman@gmail.com>
Mon, 18 May 2009 22:39:16 +0000 (22:39 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Mon, 18 May 2009 22:39:16 +0000 (22:39 +0000)
for moving ASTConsumers.h to include/clang/Frontend.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72059 91177308-0d34-0410-b5e6-96231b3b80d8

tools/clang-cc/ASTConsumers.h
tools/clang-cc/RewriteObjC.cpp
tools/clang-cc/clang-cc.cpp

index 73c3b83f0b7217a331abb2305aaa3c550809c093..6d4373e033abcf939e17c5909f8b74de663aec72 100644 (file)
@@ -58,7 +58,8 @@ ASTConsumer *CreateDeclContextPrinter();
 ASTConsumer *CreateObjCRewriter(const std::string& InFile,
                                 llvm::raw_ostream* OS,
                                 Diagnostic &Diags,
-                                const LangOptions &LOpts);
+                                const LangOptions &LOpts,
+                                bool SilenceRewriteMacroWarning);
 
 // LLVM code generator: uses the code generation backend to generate LLVM
 // assembly. This runs optimizations depending on the CompileOptions
index 394e6b7c66d0c40577cde2986dd3fd189a021baf..493f5654a51be36d3f6c66f7bb9e4129be3bb1c5 100644 (file)
 using namespace clang;
 using llvm::utostr;
 
-static llvm::cl::opt<bool>
-SilenceRewriteMacroWarning("Wno-rewrite-macros", llvm::cl::init(false),
-                           llvm::cl::desc("Silence ObjC rewriting warnings"));
-
 namespace {
   class RewriteObjC : public ASTConsumer {
     Rewriter Rewrite;
@@ -94,7 +90,9 @@ namespace {
     
     std::string InFileName;
     llvm::raw_ostream* OutFile;
-     
+
+    bool SilenceRewriteMacroWarning;
+
     std::string Preamble;
 
     // Block expressions.
@@ -137,7 +135,8 @@ namespace {
     void HandleTopLevelSingleDecl(Decl *D);
     void HandleDeclInMainFile(Decl *D);
     RewriteObjC(std::string inFile, llvm::raw_ostream *OS,
-                Diagnostic &D, const LangOptions &LOpts);
+                Diagnostic &D, const LangOptions &LOpts,
+                bool silenceMacroWarn);
 
     ~RewriteObjC() {}
     
@@ -417,8 +416,10 @@ static bool IsHeaderFile(const std::string &Filename) {
 }    
 
 RewriteObjC::RewriteObjC(std::string inFile, llvm::raw_ostream* OS,
-                         Diagnostic &D, const LangOptions &LOpts)
-      : Diags(D), LangOpts(LOpts), InFileName(inFile), OutFile(OS) {
+                         Diagnostic &D, const LangOptions &LOpts,
+                         bool silenceMacroWarn)
+      : Diags(D), LangOpts(LOpts), InFileName(inFile), OutFile(OS),
+        SilenceRewriteMacroWarning(silenceMacroWarn) {
   IsHeader = IsHeaderFile(inFile);
   RewriteFailedDiag = Diags.getCustomDiagID(Diagnostic::Warning, 
                "rewriting sub-expression within a macro (may not be correct)");
@@ -430,8 +431,9 @@ RewriteObjC::RewriteObjC(std::string inFile, llvm::raw_ostream* OS,
 ASTConsumer *clang::CreateObjCRewriter(const std::string& InFile,
                                        llvm::raw_ostream* OS,
                                        Diagnostic &Diags, 
-                                       const LangOptions &LOpts) {
-  return new RewriteObjC(InFile, OS, Diags, LOpts);
+                                       const LangOptions &LOpts,
+                                       bool SilenceRewriteMacroWarning) {
+  return new RewriteObjC(InFile, OS, Diags, LOpts, SilenceRewriteMacroWarning);
 }
 
 void RewriteObjC::Initialize(ASTContext &context) {
index e60ece8a9fce3496c35145f7c416317a98f33c1f..fdc370e22f07d9f5032e48e9108d214b626d9eb1 100644 (file)
@@ -1489,6 +1489,13 @@ static llvm::cl::list<ParsedSourceLocation>
 FixItAtLocations("fixit-at", llvm::cl::value_desc("source-location"),
    llvm::cl::desc("Perform Fix-It modifications at the given source location"));
 
+//===----------------------------------------------------------------------===//
+// ObjC Rewriter Options
+//===----------------------------------------------------------------------===//
+static llvm::cl::opt<bool>
+SilenceRewriteMacroWarning("Wno-rewrite-macros", llvm::cl::init(false),
+                           llvm::cl::desc("Silence ObjC rewriting warnings"));
+
 //===----------------------------------------------------------------------===//
 // -dump-build-information Stuff
 //===----------------------------------------------------------------------===//
@@ -1692,7 +1699,8 @@ static void ProcessInputFile(Preprocessor &PP, PreprocessorFactory &PPF,
   case RewriteObjC:
     OS.reset(ComputeOutFile(InFile, "cpp", true, OutPath));
     Consumer.reset(CreateObjCRewriter(InFile, OS.get(), PP.getDiagnostics(),
-                                      PP.getLangOptions()));
+                                      PP.getLangOptions(),
+                                      SilenceRewriteMacroWarning));
     break;
 
   case RewriteBlocks: