r228591 - DebugInfo: Refactor default arg handling into a common place (instead of handling in repeatedly for aggregate, complex, and scalar types)
David Blaikie
dblaikie at gmail.com
Mon Feb 9 11:13:52 PST 2015
Author: dblaikie
Date: Mon Feb 9 13:13:51 2015
New Revision: 228591
URL: http://llvm.org/viewvc/llvm-project?rev=228591&view=rev
Log:
DebugInfo: Refactor default arg handling into a common place (instead of handling in repeatedly for aggregate, complex, and scalar types)
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
cfe/trunk/lib/CodeGen/CGExprComplex.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=228591&r1=228590&r2=228591&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Mon Feb 9 13:13:51 2015
@@ -2734,8 +2734,22 @@ struct DestroyUnpassedArg : EHScopeStack
}
+struct DisableDebugLocationUpdates {
+ CodeGenFunction &CGF;
+ bool disabledDebugInfo;
+ DisableDebugLocationUpdates(CodeGenFunction &CGF, const Expr *E) : CGF(CGF) {
+ if ((disabledDebugInfo = isa<CXXDefaultArgExpr>(E) && CGF.getDebugInfo()))
+ CGF.disableDebugInfo();
+ }
+ ~DisableDebugLocationUpdates() {
+ if (disabledDebugInfo)
+ CGF.enableDebugInfo();
+ }
+};
+
void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E,
QualType type) {
+ DisableDebugLocationUpdates Dis(*this, E);
if (const ObjCIndirectCopyRestoreExpr *CRE
= dyn_cast<ObjCIndirectCopyRestoreExpr>(E)) {
assert(getLangOpts().ObjCAutoRefCount);
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=228591&r1=228590&r2=228591&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Mon Feb 9 13:13:51 2015
@@ -1387,12 +1387,7 @@ void CodeGenFunction::EmitAggExpr(const
// Optimize the slot if possible.
CheckAggExprForMemSetUse(Slot, E, *this);
- bool hasDebugInfo = getDebugInfo();
- if (isa<CXXDefaultArgExpr>(E))
- disableDebugInfo();
AggExprEmitter(*this, Slot).Visit(const_cast<Expr*>(E));
- if (isa<CXXDefaultArgExpr>(E) && hasDebugInfo)
- enableDebugInfo();
}
LValue CodeGenFunction::EmitAggExprToLValue(const Expr *E) {
Modified: cfe/trunk/lib/CodeGen/CGExprComplex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprComplex.cpp?rev=228591&r1=228590&r2=228591&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprComplex.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprComplex.cpp Mon Feb 9 13:13:51 2015
@@ -1033,14 +1033,8 @@ ComplexPairTy CodeGenFunction::EmitCompl
assert(E && getComplexType(E->getType()) &&
"Invalid complex expression to emit");
- bool hasDebugInfo = getDebugInfo();
- if (isa<CXXDefaultArgExpr>(E))
- disableDebugInfo();
- auto R = ComplexExprEmitter(*this, IgnoreReal, IgnoreImag)
- .Visit(const_cast<Expr *>(E));
- if (isa<CXXDefaultArgExpr>(E) && hasDebugInfo)
- enableDebugInfo();
- return R;
+ return ComplexExprEmitter(*this, IgnoreReal, IgnoreImag)
+ .Visit(const_cast<Expr *>(E));
}
void CodeGenFunction::EmitComplexExprIntoLValue(const Expr *E, LValue dest,
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=228591&r1=228590&r2=228591&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Mon Feb 9 13:13:51 2015
@@ -3393,14 +3393,8 @@ Value *CodeGenFunction::EmitScalarExpr(c
assert(E && hasScalarEvaluationKind(E->getType()) &&
"Invalid scalar expression to emit");
- bool hasDebugInfo = getDebugInfo();
- if (isa<CXXDefaultArgExpr>(E))
- disableDebugInfo();
- Value *V = ScalarExprEmitter(*this, IgnoreResultAssign)
- .Visit(const_cast<Expr*>(E));
- if (isa<CXXDefaultArgExpr>(E) && hasDebugInfo)
- enableDebugInfo();
- return V;
+ return ScalarExprEmitter(*this, IgnoreResultAssign)
+ .Visit(const_cast<Expr *>(E));
}
/// EmitScalarConversion - Emit a conversion from the specified type to the
More information about the cfe-commits
mailing list