diff options
author | Devang Patel <dpatel@apple.com> | 2009-03-27 23:16:32 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-03-27 23:16:32 +0000 |
commit | afc1c1d405e91e8a18dc25b132346aeeba9ee81f (patch) | |
tree | 031c8b085950e59bbf807330704aa715f7e6b929 /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | 333489bba35d91e4ddb101f441087177c492d090 (diff) | |
download | bcm5719-llvm-afc1c1d405e91e8a18dc25b132346aeeba9ee81f.tar.gz bcm5719-llvm-afc1c1d405e91e8a18dc25b132346aeeba9ee81f.zip |
Do not emit debug information for variables while generating optimized code. The llvm optimizer and code generator are not yet ready to support optimized code debugging.
llvm-svn: 67876
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index b437f3dfbd6..7233bbf8e23 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -19,6 +19,7 @@ #include "clang/AST/RecordLayout.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/FileManager.h" +#include "clang/Frontend/CompileOptions.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Instructions.h" @@ -665,6 +666,13 @@ void CGDebugInfo::EmitDeclare(const VarDecl *Decl, unsigned Tag, llvm::Value *Storage, CGBuilderTy &Builder) { assert(!RegionStack.empty() && "Region stack mismatch, stack empty!"); + // Do not emit variable debug information while generating optimized code. + // The llvm optimizer and code generator are not yet ready to support + // optimized code debugging. + const CompileOptions &CO = M->getCompileOpts(); + if (CO.OptimizationLevel) + return; + // Get location information. SourceManager &SM = M->getContext().getSourceManager(); unsigned Line = SM.getInstantiationLineNumber(Decl->getLocation()); @@ -697,6 +705,14 @@ void CGDebugInfo::EmitDeclareOfArgVariable(const VarDecl *Decl, llvm::Value *AI, /// EmitGlobalVariable - Emit information about a global variable. void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var, const VarDecl *Decl) { + + // Do not emit variable debug information while generating optimized code. + // The llvm optimizer and code generator are not yet ready to support + // optimized code debugging. + const CompileOptions &CO = M->getCompileOpts(); + if (CO.OptimizationLevel) + return; + // Create global variable debug descriptor. llvm::DICompileUnit Unit = getOrCreateCompileUnit(Decl->getLocation()); SourceManager &SM = M->getContext().getSourceManager(); |