From: Devang Patel Date: Fri, 8 Oct 2010 17:02:40 +0000 (+0000) Subject: Do not repeat debug info for file variable constants. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=67c32268c0891b539fe9da26d10579e2ebfc9b38;p=clang Do not repeat debug info for file variable constants. This is tested by file-statics.exp in gdb testsuite. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116060 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 62433a1781..8e01b7c212 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -165,7 +165,11 @@ public: assert(!Result.HasSideEffects && "Constant declref with side-effect?!"); llvm::ConstantInt *CI = llvm::ConstantInt::get(VMContext, Result.Val.getInt()); - CGF.EmitDeclRefExprDbgValue(E, CI); + if (VarDecl *VD = dyn_cast((E->getDecl()))) { + if (!VD->isFileVarDecl()) { + CGF.EmitDeclRefExprDbgValue(E, CI); + } + } return CI; } return EmitLoadOfLValue(E);