diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-12-08 21:48:57 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-12-08 21:48:57 +0000 |
commit | 0b7fad656bc574e681b46c992e1a11828b9d2bc2 (patch) | |
tree | 49e8794aa27ddca3a13d4cc670ce1cf599980437 | |
parent | 270e99ab0ae98413b2194b220a8253ec7754b0db (diff) | |
download | bcm5719-llvm-0b7fad656bc574e681b46c992e1a11828b9d2bc2.tar.gz bcm5719-llvm-0b7fad656bc574e681b46c992e1a11828b9d2bc2.zip |
DebugInfo: Ensure the store for an assignment is attributed to the beginning of the assignment expression
llvm-svn: 223699
-rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 2 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/debug-info-line.cpp | 26 |
2 files changed, 28 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 1a3a61a76dd..6ced6e18f94 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -3133,6 +3133,8 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const BinaryOperator *E) { RValue RV = EmitAnyExpr(E->getRHS()); LValue LV = EmitCheckedLValue(E->getLHS(), TCK_Store); + if (CGDebugInfo *DI = getDebugInfo()) + DI->EmitLocation(Builder, E->getLocStart()); EmitStoreThroughLValue(RV, LV); return LV; } diff --git a/clang/test/CodeGenCXX/debug-info-line.cpp b/clang/test/CodeGenCXX/debug-info-line.cpp new file mode 100644 index 00000000000..0434de5e102 --- /dev/null +++ b/clang/test/CodeGenCXX/debug-info-line.cpp @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -g -std=c++11 -S -emit-llvm %s -o - | FileCheck %s + +int src(); int* sink(); + +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 + ( + ) + + + 3 + ) + = + src + ( + ) + + + 42 + ; + // CHECK: store {{.*}}, !dbg [[DBG1:!.*]] +} + +// CHECK: [[DBG1]] = metadata !{i32 100, {{.*}} |