diff options
author | Eric Christopher <echristo@apple.com> | 2012-04-03 00:44:15 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2012-04-03 00:44:15 +0000 |
commit | ea32047660159811a4c14d008a4b7e3807a705d6 (patch) | |
tree | d0659e6eda48db6f2d75e788f34d539393f0de85 /lib/CodeGen/CGDebugInfo.cpp | |
parent | 31b57628576a2355428fd4b57f828a3aa8423000 (diff) |
Change location information for synthesized properties to be at the
property file/line rather than the @synthesize file/line. Avoids
some nasty confusing-ness with conflating the file from the scope
and the line from the original declaration. Use the current scope
location as a separate parameter so that we can match it up
better in the line table with the beginning of the scope.
Update a couple of testcases accordingly since I had to change
that we actually use the passed in location in EmitFunctionStart
and for the new metadata parameter and add a new testcase to
make sure we've got the right line numbers for synthesized
properties.
Part of rdar://11026482
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153917 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index af55a86a59..9a33ade99b 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -1969,9 +1969,11 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType, FnBeginRegionCount.push_back(LexicalBlockStack.size()); const Decl *D = GD.getDecl(); + // Use the location of the declaration. + SourceLocation Loc = D->getLocation(); unsigned Flags = 0; - llvm::DIFile Unit = getOrCreateFile(CurLoc); + llvm::DIFile Unit = getOrCreateFile(Loc); llvm::DIDescriptor FDContext(Unit); llvm::DIArray TParamsArray; if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { @@ -2015,17 +2017,16 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType, if (!Name.empty() && Name[0] == '\01') Name = Name.substr(1); - // It is expected that CurLoc is set before using EmitFunctionStart. - // Usually, CurLoc points to the left bracket location of compound - // statement representing function body. - unsigned LineNo = getLineNumber(CurLoc); + unsigned LineNo = getLineNumber(Loc); if (D->isImplicit()) Flags |= llvm::DIDescriptor::FlagArtificial; + llvm::DISubprogram SPDecl = getFunctionDeclaration(D); llvm::DISubprogram SP = DBuilder.createFunction(FDContext, Name, LinkageName, Unit, LineNo, getOrCreateFunctionType(D, FnType, Unit), Fn->hasInternalLinkage(), true/*definition*/, + getLineNumber(CurLoc), Flags, CGM.getLangOpts().Optimize, Fn, TParamsArray, SPDecl); |