[llvm-commits] [llvm] r115988 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Devang Patel dpatel at apple.com
Thu Oct 7 15:03:01 PDT 2010


Author: dpatel
Date: Thu Oct  7 17:03:01 2010
New Revision: 115988

URL: http://llvm.org/viewvc/llvm-project?rev=115988&view=rev
Log:
Provie a clearner interface so that FE can decide whether a function has prototype or not.

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

Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=115988&r1=115987&r2=115988&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Thu Oct  7 17:03:01 2010
@@ -55,7 +55,8 @@
       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 @@
         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;
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=115988&r1=115987&r2=115988&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Oct  7 17:03:01 2010
@@ -1059,8 +1059,6 @@
     // 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 @@
 
   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.





More information about the llvm-commits mailing list