diff options
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 9 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjC.cpp | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index af55a86a590..780993ac92a 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/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,10 +2017,7 @@ 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); diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index b4fc6e0ffa4..b3460aef2d9 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -708,7 +708,7 @@ void CodeGenFunction::GenerateObjCGetter(ObjCImplementationDecl *IMP, const ObjCPropertyDecl *PD = PID->getPropertyDecl(); ObjCMethodDecl *OMD = PD->getGetterMethodDecl(); assert(OMD && "Invalid call to generate getter (empty method)"); - StartObjCMethod(OMD, IMP->getClassInterface(), PID->getLocStart()); + StartObjCMethod(OMD, IMP->getClassInterface(), OMD->getLocStart()); generateObjCGetterBody(IMP, PID, AtomicHelperFn); @@ -1216,7 +1216,7 @@ void CodeGenFunction::GenerateObjCSetter(ObjCImplementationDecl *IMP, const ObjCPropertyDecl *PD = PID->getPropertyDecl(); ObjCMethodDecl *OMD = PD->getSetterMethodDecl(); assert(OMD && "Invalid call to generate setter (empty method)"); - StartObjCMethod(OMD, IMP->getClassInterface(), PID->getLocStart()); + StartObjCMethod(OMD, IMP->getClassInterface(), OMD->getLocStart()); generateObjCSetterBody(IMP, PID, AtomicHelperFn); |