From: Devang Patel Date: Thu, 7 Oct 2010 22:03:49 +0000 (+0000) Subject: Identify functions with prototype appropriately in debug info. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3951e7106c849db72301a1ef05f99511e4818ef0;p=clang Identify functions with prototype appropriately in debug info. This is tested by callfuncs.exp in gdb testsuite. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115989 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index ba5dc7c067..378be1ef49 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -746,6 +746,8 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method, if (CXXC->isExplicit()) Flags |= llvm::DIDescriptor::FlagExplicit; } + if (Method->hasPrototype()) + Flags |= llvm::DIDescriptor::FlagPrototyped; llvm::DISubprogram SP = DebugFactory.CreateSubprogram(RecordTy , MethodName, MethodName, @@ -1526,6 +1528,7 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType, FnBeginRegionCount.push_back(RegionStack.size()); const Decl *D = GD.getDecl(); + unsigned Flags = 0; if (const FunctionDecl *FD = dyn_cast(D)) { // If there is a DISubprogram for this function available then use it. llvm::DenseMap::iterator @@ -1542,13 +1545,17 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType, Name = getFunctionName(FD); // Use mangled name as linkage name for c/c++ functions. LinkageName = CGM.getMangledName(GD); + if (FD->hasPrototype()) + Flags |= llvm::DIDescriptor::FlagPrototyped; } else if (const ObjCMethodDecl *OMD = dyn_cast(D)) { Name = getObjCMethodName(OMD); LinkageName = Name; + Flags |= llvm::DIDescriptor::FlagPrototyped; } else { // Use llvm function name as linkage name. Name = Fn->getName(); LinkageName = Name; + Flags |= llvm::DIDescriptor::FlagPrototyped; } if (!Name.empty() && Name[0] == '\01') Name = Name.substr(1); @@ -1558,7 +1565,6 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType, // statement representing function body. llvm::DIFile Unit = getOrCreateFile(CurLoc); unsigned LineNo = getLineNumber(CurLoc); - unsigned Flags = 0; if (D->isImplicit()) Flags |= llvm::DIDescriptor::FlagArtificial; llvm::DISubprogram SP =