Move replaceAllUsesWith() from DIType to DIDescriptor.
authorFrederic Riss <friss@apple.com>
Mon, 15 Sep 2014 07:50:36 +0000 (07:50 +0000)
committerFrederic Riss <friss@apple.com>
Mon, 15 Sep 2014 07:50:36 +0000 (07:50 +0000)
RAUW was only used on DIType to merge declarations and full definitions
of types. In order to support the same functionality for functions and
global variables, move the function up type DI type hierarchy to the
common parent of DIType, DISubprogram and DIVariable which is
DIDescriptor.

This functionality will be exercized when we add the code to emit
imported declarations for forward declared function/variables.

Reviewers: echristo, dblaikie, aprantl

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D5325

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

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

index 7c58e33e96461fb339641bae9e61915181e6aa8c..f87095ba475681a76ca987611619972697d449b1 100644 (file)
@@ -156,6 +156,11 @@ public:
 
   /// dump - print descriptor to dbgs() with a newline.
   void dump() const;
+
+  /// replaceAllUsesWith - Replace all uses of debug info referenced by
+  /// this descriptor.
+  void replaceAllUsesWith(LLVMContext &VMContext, DIDescriptor D);
+  void replaceAllUsesWith(MDNode *D);
 };
 
 /// DISubrange - This is used to represent ranges, for array bounds.
@@ -352,11 +357,6 @@ public:
     return (getFlags() & FlagRValueReference) != 0;
   }
   bool isValid() const { return DbgNode && isType(); }
-
-  /// replaceAllUsesWith - Replace all uses of debug info referenced by
-  /// this descriptor.
-  void replaceAllUsesWith(LLVMContext &VMContext, DIDescriptor D);
-  void replaceAllUsesWith(MDNode *D);
 };
 
 /// DIBasicType - A basic type, like 'int' or 'float'.
index b6f9b51b3d1c68252a245968c3dd527984bb4a60..71c32fc969d329b3ba0eb19800f4b8bf53cebb36 100644 (file)
@@ -363,7 +363,7 @@ bool DIDescriptor::isImportedEntity() const {
 
 /// replaceAllUsesWith - Replace all uses of the MDNode used by this
 /// type with the one in the passed descriptor.
-void DIType::replaceAllUsesWith(LLVMContext &VMContext, DIDescriptor D) {
+void DIDescriptor::replaceAllUsesWith(LLVMContext &VMContext, DIDescriptor D) {
 
   assert(DbgNode && "Trying to replace an unverified type!");
 
@@ -389,7 +389,7 @@ void DIType::replaceAllUsesWith(LLVMContext &VMContext, DIDescriptor D) {
 
 /// replaceAllUsesWith - Replace all uses of the MDNode used by this
 /// type with the one in D.
-void DIType::replaceAllUsesWith(MDNode *D) {
+void DIDescriptor::replaceAllUsesWith(MDNode *D) {
 
   assert(DbgNode && "Trying to replace an unverified type!");
   assert(DbgNode != D && "This replacement should always happen");