fix Analysis/DebugInfo.h to not include Metadata.h. Do this
authorChris Lattner <sabre@nondot.org>
Thu, 31 Dec 2009 03:02:08 +0000 (03:02 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 31 Dec 2009 03:02:08 +0000 (03:02 +0000)
by moving one method out of line and eliminating redundant checks
from other methods.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92337 91177308-0d34-0410-b5e6-96231b3b80d8

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

index f3d1b595ab86bf08cc750845fc733699dcb7c69b..291610de987bb6203c70bf02aa90ad95539a20a1 100644 (file)
@@ -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 @@ namespace llvm {
   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 @@ namespace llvm {
     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 @@ namespace llvm {
       return getNumAddrElements() > 0;
     }
 
-    unsigned getNumAddrElements() const { return DbgNode->getNumOperands()-6; }
-
+    unsigned getNumAddrElements() const;
+    
     uint64_t getAddrElement(unsigned Idx) const {
       return getUInt64Field(Idx+6);
     }
index b90a996d820c9b5d984093473073611a45175833..7d72b383a5e009a7b1c42924735dbdaaac81331b 100644 (file)
@@ -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"
index aa1f78ebc9422860b513ceb79b26d6b84dfcffb3..de2d839f6d61e672fdaf44072d021606d471e2e8 100644 (file)
@@ -120,6 +120,11 @@ GlobalVariable *DIDescriptor::getGlobalVariableField(unsigned Elt) const {
   return 0;
 }
 
+unsigned DIVariable::getNumAddrElements() const {
+  return DbgNode->getNumOperands()-6;
+}
+
+
 //===----------------------------------------------------------------------===//
 // Predicates
 //===----------------------------------------------------------------------===//
index 032a9e3a546f65ad3a50e226abbf648d0d5a6087..c287747b91d36c48211b00a5ea07c455ca6a7b22 100644 (file)
@@ -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"