From bebb89359ac252f6a175f930d4ffebfd43d938da Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Fri, 21 Mar 2014 21:01:58 +0000 Subject: CGDebugInfo: At the end of EmitFunctionStart, Initialize PrevLoc to the location that the next call emitLocation() would default to. Otherwise setLocation() may wrongly believe that the current source file didn't change, when in fact it did. llvm-svn: 204517 --- clang/lib/CodeGen/CGDebugInfo.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'clang/lib/CodeGen') diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index cfc94430bdf..1a3089a14b2 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -2577,9 +2577,12 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType, if (HasDecl) DeclCache.insert(std::make_pair(D->getCanonicalDecl(), llvm::WeakVH(SP))); - // Push function on region stack. + // Push the function onto the lexical block stack. llvm::MDNode *SPN = SP; LexicalBlockStack.push_back(SPN); + // Initialize PrevLoc to the location of the function header. + PrevLoc = Loc; + if (HasDecl) RegionMap[D] = llvm::WeakVH(SP); } -- cgit v1.2.3