Provie a clearner interface so that FE can decide whether a function has prototype...
authorDevang Patel <dpatel@apple.com>
Thu, 7 Oct 2010 22:03:01 +0000 (22:03 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 7 Oct 2010 22:03:01 +0000 (22:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115988 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/DebugInfo.h
lib/CodeGen/AsmPrinter/DwarfDebug.cpp

index 8b4a4c184e8f8ddebb5c6b8fea0074e17cefffb1..26118c26bc88e70fd0b1fb0dc773ba2604391fdf 100644 (file)
@@ -55,7 +55,8 @@ namespace llvm {
       FlagBlockByrefStruct = 1 << 4,
       FlagVirtual          = 1 << 5,
       FlagArtificial       = 1 << 6,
-      FlagExplicit         = 1 << 7
+      FlagExplicit         = 1 << 7,
+      FlagPrototyped       = 1 << 8
     };
   protected:
     const MDNode *DbgNode;
@@ -422,6 +423,12 @@ namespace llvm {
         return false;
       return (getUnsignedField(14) & FlagExplicit) != 0;
     }
+    /// isPrototyped - Return true if this subprogram is prototyped.
+    bool isPrototyped() const    { 
+      if (getVersion() <= llvm::LLVMDebugVersion8)
+        return false;
+      return (getUnsignedField(14) & FlagPrototyped) != 0;
+    }
 
     unsigned isOptimized() const;
 
index b2ae1a24c1174d1ac86a30549c53e070c5b8726e..74fe8643ab371fe2edd6fb4162e21e68f047ca47 100644 (file)
@@ -1059,8 +1059,6 @@ void DwarfDebug::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
     // Add prototype flag.
     if (isPrototyped)
       addUInt(&Buffer, dwarf::DW_AT_prototyped, dwarf::DW_FORM_flag, 1);
-
-
   }
     break;
   case dwarf::DW_TAG_structure_type:
@@ -1318,10 +1316,7 @@ DIE *DwarfDebug::createSubprogramDIE(DISubprogram SP) {
 
   addSourceLine(SPDie, SP);
 
-  // Add prototyped tag, if C or ObjC.
-  unsigned Lang = SP.getCompileUnit().getLanguage();
-  if (Lang == dwarf::DW_LANG_C99 || Lang == dwarf::DW_LANG_C89 ||
-      Lang == dwarf::DW_LANG_ObjC)
+  if (SP.isPrototyped()) 
     addUInt(SPDie, dwarf::DW_AT_prototyped, dwarf::DW_FORM_flag, 1);
 
   // Add Return Type.