[cfe-commits] r66478 - in /cfe/trunk: Driver/ASTConsumers.h Driver/Backend.cpp Driver/clang.cpp include/clang/Frontend/CompileOptions.h

Chris Lattner sabre at nondot.org
Mon Mar 9 15:00:34 PDT 2009


Author: lattner
Date: Mon Mar  9 17:00:34 2009
New Revision: 66478

URL: http://llvm.org/viewvc/llvm-project?rev=66478&view=rev
Log:
move debug info generation flag into CompileOptions.

Modified:
    cfe/trunk/Driver/ASTConsumers.h
    cfe/trunk/Driver/Backend.cpp
    cfe/trunk/Driver/clang.cpp
    cfe/trunk/include/clang/Frontend/CompileOptions.h

Modified: cfe/trunk/Driver/ASTConsumers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/ASTConsumers.h?rev=66478&r1=66477&r2=66478&view=diff

==============================================================================
--- cfe/trunk/Driver/ASTConsumers.h (original)
+++ cfe/trunk/Driver/ASTConsumers.h Mon Mar  9 17:00:34 2009
@@ -56,8 +56,7 @@
                                    const LangOptions &Features,
                                    const CompileOptions &CompileOpts,
                                    const std::string& InFile,
-                                   const std::string& OutFile,
-                                   bool GenerateDebugInfo);
+                                   const std::string& OutFile);
 
 ASTConsumer* CreateHTMLPrinter(const std::string &OutFile, Diagnostic &D,
                                Preprocessor *PP, PreprocessorFactory* PPF);

Modified: cfe/trunk/Driver/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/Backend.cpp?rev=66478&r1=66477&r2=66478&view=diff

==============================================================================
--- cfe/trunk/Driver/Backend.cpp (original)
+++ cfe/trunk/Driver/Backend.cpp Mon Mar  9 17:00:34 2009
@@ -44,7 +44,6 @@
     CompileOptions CompileOpts;
     const std::string &InputFile;
     std::string OutputFile;
-    bool GenerateDebugInfo;
     ASTContext *Context;
 
     Timer LLVMIRGeneration;
@@ -79,16 +78,14 @@
   public:  
     BackendConsumer(BackendAction action, Diagnostic &Diags, 
                     const LangOptions &langopts, const CompileOptions &compopts,
-                    const std::string &infile, const std::string &outfile,
-                    bool debug) :
+                    const std::string &infile, const std::string &outfile) :
       Action(action), 
       CompileOpts(compopts),
       InputFile(infile), 
       OutputFile(outfile), 
-      GenerateDebugInfo(debug),
       LLVMIRGeneration("LLVM IR Generation Time"),
       CodeGenerationTime("Code Generation Time"),
-      Gen(CreateLLVMCodeGen(Diags, langopts, InputFile, GenerateDebugInfo)),
+      Gen(CreateLLVMCodeGen(Diags, langopts, InputFile, compopts.DebugInfo)),
       TheModule(0), TheTargetData(0), AsmOutStream(0), ModuleProvider(0),
       CodeGenPasses(0), PerModulePasses(0), PerFunctionPasses(0) {
       
@@ -427,14 +424,13 @@
                                           const LangOptions &LangOpts,
                                           const CompileOptions &CompileOpts,
                                           const std::string& InFile,
-                                          const std::string& OutFile,
-                                          bool GenerateDebugInfo) {
+                                          const std::string& OutFile) {
   // FIXME: If optimizing, disable all debug info generation.  The LLVM
   // optimizer and backend is not ready to handle it when optimizations
   // are enabled.
   if (CompileOpts.OptimizationLevel > 0)
-    GenerateDebugInfo = false;
+    const_cast<CompileOptions&>(CompileOpts).DebugInfo = false;
     
   return new BackendConsumer(Action, Diags, LangOpts, CompileOpts,
-                             InFile, OutFile, GenerateDebugInfo);  
+                             InFile, OutFile);  
 }

Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=66478&r1=66477&r2=66478&view=diff

==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Mon Mar  9 17:00:34 2009
@@ -1167,6 +1167,7 @@
 
 static void InitializeCompileOptions(CompileOptions &Opts) {
   Opts.OptimizeSize = OptSize;
+  Opts.DebugInfo = GenerateDebugInfo;
   if (OptSize) {
     // -Os implies -O2
     // FIXME: Diagnose conflicting options.
@@ -1246,7 +1247,7 @@
     CompileOptions Opts;
     InitializeCompileOptions(Opts);
     return CreateBackendConsumer(Act, Diag, LangOpts, Opts, 
-                                 InFile, OutputFile, GenerateDebugInfo);
+                                 InFile, OutputFile);
   }
 
   case SerializeAST:

Modified: cfe/trunk/include/clang/Frontend/CompileOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompileOptions.h?rev=66478&r1=66477&r2=66478&view=diff

==============================================================================
--- cfe/trunk/include/clang/Frontend/CompileOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/CompileOptions.h Mon Mar  9 17:00:34 2009
@@ -21,6 +21,7 @@
 struct CompileOptions {
   unsigned OptimizationLevel : 3; /// The -O[0-4] option specified.
   unsigned OptimizeSize      : 1; /// If -Os is specified.
+  unsigned DebugInfo         : 1; /// Should generate deubg info (-g).
   unsigned UnitAtATime       : 1; /// Unused. For mirroring GCC
                                   /// optimization selection.
   unsigned InlineFunctions   : 1; /// Should functions be inlined?
@@ -42,6 +43,7 @@
   CompileOptions() {
     OptimizationLevel = 0;
     OptimizeSize = 0;
+    DebugInfo = 0;
     UnitAtATime = 1;
     InlineFunctions = SimplifyLibCalls = UnrollLoops = 0;
     VerifyModule = 1;





More information about the cfe-commits mailing list