ApplyDebugLocation::ApplyDebugLocation(CodeGenFunction &CGF,
SourceLocation TemporaryLocation)
: CGF(CGF) {
+ init(TemporaryLocation);
+}
+
+void ApplyDebugLocation::init(SourceLocation TemporaryLocation) {
if (auto *DI = CGF.getDebugInfo()) {
OriginalLocation = CGF.Builder.getCurrentDebugLocation();
if (TemporaryLocation.isInvalid())
}
}
+ApplyDebugLocation::ApplyDebugLocation(CodeGenFunction &CGF, const Expr *E)
+ : CGF(CGF) {
+ init(E->getExprLoc());
+}
+
ApplyDebugLocation::ApplyDebugLocation(CodeGenFunction &CGF, llvm::DebugLoc Loc)
: CGF(CGF) {
if (CGF.getDebugInfo()) {
};
class ApplyDebugLocation {
+private:
+ void init(SourceLocation TemporaryLocation);
+
protected:
llvm::DebugLoc OriginalLocation;
CodeGenFunction &CGF;
public:
ApplyDebugLocation(CodeGenFunction &CGF,
SourceLocation TemporaryLocation = SourceLocation());
+ ApplyDebugLocation(CodeGenFunction &CGF, const Expr *E);
ApplyDebugLocation(CodeGenFunction &CGF, llvm::DebugLoc Loc);
~ApplyDebugLocation();
};
/// length type, this is not possible.
///
LValue CodeGenFunction::EmitLValue(const Expr *E) {
- ApplyDebugLocation DL(*this, E->getLocStart());
+ ApplyDebugLocation DL(*this, E);
switch (E->getStmtClass()) {
default: return EmitUnsupportedLValue(E, "l-value expression");
RValue CodeGenFunction::EmitCallExpr(const CallExpr *E,
ReturnValueSlot ReturnValue) {
- ApplyDebugLocation DL(*this, E->getLocStart());
+ ApplyDebugLocation DL(*this, E);
// Builtins never have block type.
if (E->getCallee()->getType()->isBlockPointerType())
//===--------------------------------------------------------------------===//
void Visit(Expr *E) {
- ApplyDebugLocation DL(CGF, E->getLocStart());
+ ApplyDebugLocation DL(CGF, E);
StmtVisitor<AggExprEmitter>::Visit(E);
}
llvm::Value *NewPtr,
llvm::Value *NumElements,
llvm::Value *AllocSizeWithoutCookie) {
- ApplyDebugLocation DL(CGF, E->getStartLoc());
+ ApplyDebugLocation DL(CGF, E);
if (E->isArray())
CGF.EmitNewArrayInitializer(E, ElementType, NewPtr, NumElements,
AllocSizeWithoutCookie);
//===--------------------------------------------------------------------===//
ComplexPairTy Visit(Expr *E) {
- ApplyDebugLocation DL(CGF, E->getLocStart());
+ ApplyDebugLocation DL(CGF, E);
return StmtVisitor<ComplexExprEmitter, ComplexPairTy>::Visit(E);
}
//===--------------------------------------------------------------------===//
Value *Visit(Expr *E) {
- ApplyDebugLocation DL(CGF, E->getLocStart());
+ ApplyDebugLocation DL(CGF, E);
return StmtVisitor<ScalarExprEmitter, Value*>::Visit(E);
}
// CHECK-LABEL: define
void f1() {
-#line 100
- * // The store for the assignment should be attributed to the start of the
- // assignment expression here, regardless of the location of subexpressions.
- sink() = src();
+ *sink()
// CHECK: store {{.*}}, !dbg [[DBG_F1:!.*]]
+#line 100
+ = //
+ src();
}
struct foo {
// CHECK-LABEL: define {{.*}}f2{{.*}}
void f2() {
+ // CHECK: store float {{.*}} !dbg [[DBG_F2:!.*]]
+ *complex_sink()
#line 300
- * // CHECK: store float {{.*}} !dbg [[DBG_F2:!.*]]
- complex_sink() = complex_src();
+ = //
+ complex_src();
}
// CHECK-LABEL: define
void f3() {
+ // CHECK: store float {{.*}} !dbg [[DBG_F3:!.*]]
+ *complex_sink()
#line 400
- * // CHECK: store float {{.*}} !dbg [[DBG_F3:!.*]]
- complex_sink() += complex_src();
+ += //
+ complex_src();
}
// CHECK-LABEL: define