[PATCH] Move getFileNode() from DIFile to DIScope

Peter Collingbourne peter at pcc.me.uk
Sun Apr 14 21:47:44 PDT 2013


Hi dblaikie,

http://llvm-reviews.chandlerc.com/D670

Files:
  include/llvm/DebugInfo.h
  lib/IR/DebugInfo.cpp

Index: include/llvm/DebugInfo.h
===================================================================
--- include/llvm/DebugInfo.h
+++ include/llvm/DebugInfo.h
@@ -165,6 +165,7 @@
   public:
     explicit DIScope(const MDNode *N = 0) : DIDescriptor (N) {}
 
+    MDNode *getFileNode() const;
     StringRef getFilename() const;
     StringRef getDirectory() const;
   };
@@ -177,7 +178,6 @@
       if (DbgNode && !isFile())
         DbgNode = 0;
     }
-    MDNode *getFileNode() const;
     bool Verify() const;
   };
 
Index: lib/IR/DebugInfo.cpp
===================================================================
--- lib/IR/DebugInfo.cpp
+++ lib/IR/DebugInfo.cpp
@@ -541,7 +541,7 @@
 }
 
 /// \brief Retrieve the MDNode for the directory/file pair.
-MDNode *DIFile::getFileNode() const {
+MDNode *DIScope::getFileNode() const {
   return const_cast<MDNode*>(getNodeField(DbgNode, 1));
 }
 
@@ -682,15 +682,11 @@
 }
 
 StringRef DIScope::getFilename() const {
-  if (!DbgNode)
-    return StringRef();
-  return ::getStringField(getNodeField(DbgNode, 1), 0);
+  return ::getStringField(getFileNode(), 0);
 }
 
 StringRef DIScope::getDirectory() const {
-  if (!DbgNode)
-    return StringRef();
-  return ::getStringField(getNodeField(DbgNode, 1), 1);
+  return ::getStringField(getFileNode(), 1);
 }
 
 DIArray DICompileUnit::getEnumTypes() const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D670.1.patch
Type: text/x-patch
Size: 1351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130414/aafd099c/attachment.bin>


More information about the llvm-commits mailing list