From e65982c8c88c1a591ca87083f5cb572c0da8b042 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Mon, 7 Mar 2011 18:29:53 +0000 Subject: [PATCH] Do not emit stop point for CXXDefaultArgExpr. It results in suboptimial user experience. 21 int main() { 22 A a; For example, here user would expect to stop at line 22, even if A's constructor leads to a call through CXXDefaultArgExpr. This fixes ostream-defined.exp regression from gdb testsuite. llvm-svn: 127164 --- clang/lib/CodeGen/CGExpr.cpp | 2 +- clang/lib/CodeGen/CGExprScalar.cpp | 7 ++++++- clang/lib/CodeGen/CodeGenModule.cpp | 2 +- clang/lib/CodeGen/CodeGenModule.h | 10 +++++++++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index e23d6107c0be..add163da1d2e 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -1937,7 +1937,7 @@ LValue CodeGenFunction::EmitOpaqueValueLValue(const OpaqueValueExpr *e) { RValue CodeGenFunction::EmitCallExpr(const CallExpr *E, ReturnValueSlot ReturnValue) { - if (CGDebugInfo *DI = getDebugInfo()) { + if (CGDebugInfo *DI = CGM.getDebugInfo()) { DI->setLocation(E->getLocStart()); DI->UpdateLineDirectiveRegion(Builder); DI->EmitStopPoint(Builder); diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 6f52a539cf60..911a0ea418d0 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -2567,8 +2567,13 @@ Value *CodeGenFunction::EmitScalarExpr(const Expr *E, bool IgnoreResultAssign) { assert(E && !hasAggregateLLVMType(E->getType()) && "Invalid scalar expression to emit"); - return ScalarExprEmitter(*this, IgnoreResultAssign) + if (isa(E)) + CGM.disableDebugInfo(); + Value *V = ScalarExprEmitter(*this, IgnoreResultAssign) .Visit(const_cast(E)); + if (isa(E)) + CGM.enableDebugInfo(); + return V; } /// EmitScalarConversion - Emit a conversion from the specified type to the diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 00956b2793fb..439cc7d35776 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -64,7 +64,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO, ABI(createCXXABI(*this)), Types(C, M, TD, getTargetCodeGenInfo().getABIInfo(), ABI), TBAA(0), - VTables(*this), Runtime(0), + VTables(*this), Runtime(0), DisableDebugInfo(false), CFConstantStringClassRef(0), ConstantStringClassRef(0), VMContext(M.getContext()), NSConcreteGlobalBlockDecl(0), NSConcreteStackBlockDecl(0), diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 4a1575a23fe7..550a4dcc8b55 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -152,6 +152,7 @@ class CodeGenModule : public CodeGenTypeCache { CGObjCRuntime* Runtime; CGDebugInfo* DebugInfo; + bool DisableDebugInfo; // WeakRefReferences - A set of references that have only been seen via // a weakref so far. This is used to remove the weak of the reference if we ever @@ -281,7 +282,14 @@ public: StaticLocalDeclMap[D] = GV; } - CGDebugInfo *getDebugInfo() { return DebugInfo; } + CGDebugInfo *getDebugInfo() { + if (DisableDebugInfo) + return NULL; + return DebugInfo; + } + void disableDebugInfo() { DisableDebugInfo = true; } + void enableDebugInfo() { DisableDebugInfo = false; } + ASTContext &getContext() const { return Context; } const CodeGenOptions &getCodeGenOpts() const { return CodeGenOpts; } const LangOptions &getLangOptions() const { return Features; }