[llvm-commits] [llvm] r92337 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DbgInfoPrinter.cpp lib/Analysis/DebugInfo.cpp lib/Transforms/Utils/CloneFunction.cpp

Chris Lattner sabre at nondot.org
Wed Dec 30 19:02:08 PST 2009


Author: lattner
Date: Wed Dec 30 21:02:08 2009
New Revision: 92337

URL: http://llvm.org/viewvc/llvm-project?rev=92337&view=rev
Log:
fix Analysis/DebugInfo.h to not include Metadata.h.  Do this
by moving one method out of line and eliminating redundant checks
from other methods.

Modified:
    llvm/trunk/include/llvm/Analysis/DebugInfo.h
    llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp
    llvm/trunk/lib/Analysis/DebugInfo.cpp
    llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp

Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=92337&r1=92336&r2=92337&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Wed Dec 30 21:02:08 2009
@@ -17,9 +17,9 @@
 #ifndef LLVM_ANALYSIS_DEBUGINFO_H
 #define LLVM_ANALYSIS_DEBUGINFO_H
 
-#include "llvm/Metadata.h"  // FIXME: Should not need this.
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Dwarf.h"  // FIXME: Should not need this.
 
 namespace llvm {
@@ -38,6 +38,8 @@
   class DebugLoc;
   struct DebugLocTracker;
   class Instruction;
+  class MDNode;
+  class LLVMContext;
 
   /// DIDescriptor - A thin wraper around MDNode to access encoded debug info.
   /// This should not be stored in a container, because underly MDNode may
@@ -368,20 +370,10 @@
     unsigned isLocalToUnit() const     { return getUnsignedField(9); }
     unsigned isDefinition() const      { return getUnsignedField(10); }
 
-    unsigned getVirtuality() const {
-      if (DbgNode->getNumOperands() < 14)
-        return 0;
-      return getUnsignedField(11);
-    }
-
-    unsigned getVirtualIndex() const { 
-      if (DbgNode->getNumOperands() < 14)
-        return 0;
-      return getUnsignedField(12);
-    }
+    unsigned getVirtuality() const { return getUnsignedField(11); }
+    unsigned getVirtualIndex() const { return getUnsignedField(12); }
 
     DICompositeType getContainingType() const {
-      assert (DbgNode->getNumOperands() >= 14 && "Invalid type!");
       return getFieldAs<DICompositeType>(13);
     }
 
@@ -439,8 +431,8 @@
       return getNumAddrElements() > 0;
     }
 
-    unsigned getNumAddrElements() const { return DbgNode->getNumOperands()-6; }
-
+    unsigned getNumAddrElements() const;
+    
     uint64_t getAddrElement(unsigned Idx) const {
       return getUInt64Field(Idx+6);
     }

Modified: llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp?rev=92337&r1=92336&r2=92337&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp (original)
+++ llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp Wed Dec 30 21:02:08 2009
@@ -19,6 +19,7 @@
 #include "llvm/Pass.h"
 #include "llvm/Function.h"
 #include "llvm/IntrinsicInst.h"
+#include "llvm/Metadata.h"
 #include "llvm/Assembly/Writer.h"
 #include "llvm/Analysis/DebugInfo.h"
 #include "llvm/Analysis/Passes.h"

Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=92337&r1=92336&r2=92337&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/DebugInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/DebugInfo.cpp Wed Dec 30 21:02:08 2009
@@ -120,6 +120,11 @@
   return 0;
 }
 
+unsigned DIVariable::getNumAddrElements() const {
+  return DbgNode->getNumOperands()-6;
+}
+
+
 //===----------------------------------------------------------------------===//
 // Predicates
 //===----------------------------------------------------------------------===//

Modified: llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp?rev=92337&r1=92336&r2=92337&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp Wed Dec 30 21:02:08 2009
@@ -21,6 +21,7 @@
 #include "llvm/GlobalVariable.h"
 #include "llvm/Function.h"
 #include "llvm/LLVMContext.h"
+#include "llvm/Metadata.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Transforms/Utils/ValueMapper.h"
 #include "llvm/Analysis/ConstantFolding.h"





More information about the llvm-commits mailing list