aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-03-27 23:16:32 +0000
committerDevang Patel <dpatel@apple.com>2009-03-27 23:16:32 +0000
commit0773903975631a4baa41e495e8654e2f88a6f3dd (patch)
tree1c054698f65f2152a5e7648ac612be9275a60537 /lib/CodeGen/CGDebugInfo.cpp
parentd57959af02b4af695276f4204443afe6e5d86bd8 (diff)
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67876 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index b437f3dfbd..7233bbf8e2 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/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();