summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2015-02-02 21:02:01 +0000
committerHans Wennborg <hans@hanshq.net>2015-02-02 21:02:01 +0000
commit384d518d9a6fc04cebc4e03d0cb0d352c3bebb9b (patch)
treea9e43a50e5068dc97c9760251bc19dc19ba8e294
parent7c554b353eb4b7c99213b73db52b1d35d8213041 (diff)
Merging r226382:
------------------------------------------------------------------------ r226382 | dblaikie | 2015-01-17 16:12:58 -0800 (Sat, 17 Jan 2015) | 7 lines DebugInfo: Correct the debug location of non-static data member initializers This was causing some trouble for otherwise dead code removed in r225085 (reverted in r225361). The location being set for function arguments was leaking out to the call which wasn't setting its own location (so a quality bug turned into a crasher with r225085). Fix this so r225085 can be recommitted. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@227859 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/DeclCXX.cpp6
-rw-r--r--lib/CodeGen/CGClass.cpp3
-rw-r--r--test/CodeGenCXX/debug-info-line.cpp17
3 files changed, 21 insertions, 5 deletions
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index a6d9d411ee..9af8c4b242 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/lib/AST/DeclCXX.cpp
@@ -1693,12 +1693,12 @@ const Type *CXXCtorInitializer::getBaseClass() const {
}
SourceLocation CXXCtorInitializer::getSourceLocation() const {
- if (isAnyMemberInitializer())
- return getMemberLocation();
-
if (isInClassMemberInitializer())
return getAnyMember()->getLocation();
+ if (isAnyMemberInitializer())
+ return getMemberLocation();
+
if (TypeSourceInfo *TSInfo = Initializee.get<TypeSourceInfo*>())
return TSInfo->getTypeLoc().getLocalSourceRange().getBegin();
diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp
index 92c694a76d..d72eda95d7 100644
--- a/lib/CodeGen/CGClass.cpp
+++ b/lib/CodeGen/CGClass.cpp
@@ -544,7 +544,7 @@ static void EmitMemberInitializer(CodeGenFunction &CGF,
CXXCtorInitializer *MemberInit,
const CXXConstructorDecl *Constructor,
FunctionArgList &Args) {
- ApplyDebugLocation Loc(CGF, MemberInit->getMemberLocation());
+ ApplyDebugLocation Loc(CGF, MemberInit->getSourceLocation());
assert(MemberInit->isAnyMemberInitializer() &&
"Must have member initializer!");
assert(MemberInit->getInit() && "Must have initializer!");
@@ -598,7 +598,6 @@ static void EmitMemberInitializer(CodeGenFunction &CGF,
ArrayRef<VarDecl *> ArrayIndexes;
if (MemberInit->getNumArrayIndices())
ArrayIndexes = MemberInit->getArrayIndexes();
- ApplyDebugLocation DL(CGF, MemberInit->getMemberLocation());
CGF.EmitInitializerForField(Field, LHS, MemberInit->getInit(), ArrayIndexes);
}
diff --git a/test/CodeGenCXX/debug-info-line.cpp b/test/CodeGenCXX/debug-info-line.cpp
index a5cc6392b4..cce4a98861 100644
--- a/test/CodeGenCXX/debug-info-line.cpp
+++ b/test/CodeGenCXX/debug-info-line.cpp
@@ -166,6 +166,23 @@ void f13() {
F13_IMPL;
}
+struct f14 {
+ f14(int);
+};
+
+// CHECK-LABEL: define
+// CHECK-LABEL: define
+// CHECK-LABEL: define
+struct {
+// CHECK: call {{.*}}, !dbg [[DBG_F14_CTOR_CALL:![0-9]*]]
+#line 1600
+ f14 v
+ =
+ 1;
+} f14_inst;
+
+// CHECK-LABEL: define
+
// CHECK: [[DBG_F1]] = !MDLocation(line: 100,
// CHECK: [[DBG_FOO_VALUE]] = !MDLocation(line: 200,
// CHECK: [[DBG_FOO_REF]] = !MDLocation(line: 202,