[llvm-commits] [llvm-gcc-4.2] r115990 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
Devang Patel
dpatel at apple.com
Thu Oct 7 15:04:22 PDT 2010
Author: dpatel
Date: Thu Oct 7 17:04:22 2010
New Revision: 115990
URL: http://llvm.org/viewvc/llvm-project?rev=115990&view=rev
Log:
Identify functions with prototypes in debug info.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=115990&r1=115989&r2=115990&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Thu Oct 7 17:04:22 2010
@@ -290,6 +290,13 @@
setCurrentLexicalBlock(desired);
}
+/// functionPrototyped - Return true if function is prototyped.
+static bool functionPrototyped(tree FnDecl, unsigned Lang) {
+ if ((Lang == DW_LANG_C89 || Lang == DW_LANG_ObjC)
+ || TYPE_ARG_TYPES (TREE_TYPE (FnDecl)) != NULL)
+ return true;
+ return false;
+}
/// CreateSubprogramFromFnDecl - Constructs the debug code for
/// entering a function - "llvm.dbg.func.start."
DISubprogram DebugInfo::CreateSubprogramFromFnDecl(tree FnDecl) {
@@ -373,6 +380,12 @@
if (Fn)
hasInternalLinkage = Fn->hasInternalLinkage();
}
+ unsigned Flags = 0;
+ if (DECL_ARTIFICIAL (FnDecl))
+ Flags |= llvm::DIDescriptor::FlagArtificial;
+ else if (functionPrototyped(FnDecl, TheCU.getLanguage()))
+ Flags |= llvm::DIDescriptor::FlagPrototyped;
+
DISubprogram SP =
DebugFactory.CreateSubprogram(SPContext,
FnName, FnName,
@@ -382,8 +395,7 @@
hasInternalLinkage,
definition,
Virtuality, VIndex, ContainingType,
- DECL_ARTIFICIAL (FnDecl), optimize,
- Fn);
+ Flags, optimize, Fn);
SPCache[FnDecl] = WeakVH(SP);
RegionMap[FnDecl] = WeakVH(SP);
@@ -1149,10 +1161,12 @@
if (DECL_ARTIFICIAL (Member))
Flags |= llvm::DIDescriptor::FlagArtificial;
if (TREE_PROTECTED(Member))
- Flags = llvm::DIDescriptor::FlagProtected;
+ Flags |= llvm::DIDescriptor::FlagProtected;
else if (TREE_PRIVATE(Member))
- Flags = llvm::DIDescriptor::FlagPrivate;
-
+ Flags |= llvm::DIDescriptor::FlagPrivate;
+ else if (functionPrototyped(Member, TheCU.getLanguage()))
+ Flags |= llvm::DIDescriptor::FlagPrototyped;
+
DISubprogram SP =
DebugFactory.CreateSubprogram(findRegion(DECL_CONTEXT(Member)),
MemberName, MemberName,
More information about the llvm-commits
mailing list