diff options
| author | David Blaikie <dblaikie@gmail.com> | 2015-01-18 00:12:58 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2015-01-18 00:12:58 +0000 |
| commit | a81d410d4f397a35054f4056ee4c032b6b43c1d1 (patch) | |
| tree | 1accaaa6871a423bd6e4adaa6ce49b309f6375eb /clang/lib | |
| parent | e35a6e69f22cb4086f3050d3473869304b87199d (diff) | |
| download | bcm5719-llvm-a81d410d4f397a35054f4056ee4c032b6b43c1d1.tar.gz bcm5719-llvm-a81d410d4f397a35054f4056ee4c032b6b43c1d1.zip | |
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.
llvm-svn: 226382
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/DeclCXX.cpp | 6 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGClass.cpp | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index a6d9d411eef..9af8c4b242a 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/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/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 92c694a76de..d72eda95d7c 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/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); } |

