DebugInfo: Update signature of DICompileUnit::replace*()
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 14 Apr 2015 03:51:36 +0000 (03:51 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 14 Apr 2015 03:51:36 +0000 (03:51 +0000)
Change `DICompileUnit::replaceSubprograms()` and
`DICompileUnit::replaceGlobalVariables()` to match the `MDCompileUnit`
equivalents that they're wrapping.

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

include/llvm/IR/DebugInfo.h
lib/IR/DebugInfo.cpp
lib/Transforms/IPO/StripSymbols.cpp
lib/Transforms/Utils/CloneFunction.cpp

index 8abc514a8aa656283393a0e68b93a494a383ba66..56033dfead0be5b6d462503d89e3b5b718287e3c 100644 (file)
@@ -416,8 +416,12 @@ public:
   DIArray getGlobalVariables() const { return get()->getGlobalVariables(); }
   DIArray getImportedEntities() const { return get()->getImportedEntities(); }
 
-  void replaceSubprograms(DIArray Subprograms);
-  void replaceGlobalVariables(DIArray GlobalVariables);
+  void replaceSubprograms(MDSubprogramArray Subprograms) const {
+    get()->replaceSubprograms(Subprograms);
+  }
+  void replaceGlobalVariables(MDGlobalVariableArray GlobalVariables) const {
+    get()->replaceGlobalVariables(GlobalVariables);
+  }
 
   StringRef getSplitDebugFilename() const {
     return get()->getSplitDebugFilename();
index 3ffd13064d4d4b2f487bf50e0714507184a31bca..d289f8079bde9da0104e02b8154e1f36cd546564 100644 (file)
 using namespace llvm;
 using namespace llvm::dwarf;
 
-//===----------------------------------------------------------------------===//
-// Simple Descriptor Constructors and other Methods
-//===----------------------------------------------------------------------===//
-
 DIScopeRef DIScope::getRef() const { return MDScopeRef::get(get()); }
 
-void DICompileUnit::replaceSubprograms(DIArray Subprograms) {
-  get()->replaceSubprograms(MDSubprogramArray(Subprograms));
-}
-
-void DICompileUnit::replaceGlobalVariables(DIArray GlobalVariables) {
-  get()->replaceGlobalVariables(MDGlobalVariableArray(GlobalVariables));
-}
-
 DIVariable llvm::createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
                                        LLVMContext &VMContext) {
   return cast<MDLocalVariable>(DV)
index 817f49fecd32f7205f627f2422e5ff8ad3af8764..39d8e7619de83bddd08272bde4394cc3263b6f77 100644 (file)
@@ -345,7 +345,7 @@ bool StripDeadDebugInfo::runOnModule(Module &M) {
     // subprogram list/global variable list with our new live subprogram/global
     // variable list.
     if (SubprogramChange) {
-      DIC.replaceSubprograms(DIArray(MDNode::get(C, LiveSubprograms)));
+      DIC.replaceSubprograms(MDTuple::get(C, LiveSubprograms));
       Changed = true;
     }
 
index 5cc8c6df686b5f8443e9b38f7f3208c505156f52..f5ca7ac9efd47e47e6eda41ebbfb7fd41b34fad4 100644 (file)
@@ -171,7 +171,7 @@ static void AddOperand(DICompileUnit CU, MDSubprogramArray SPs, Metadata *NewSP)
   for (auto *SP : SPs)
     NewSPs.push_back(SP);
   NewSPs.push_back(NewSP);
-  CU.replaceSubprograms(DIArray(MDNode::get(CU->getContext(), NewSPs)));
+  CU.replaceSubprograms(MDTuple::get(CU->getContext(), NewSPs));
 }
 
 // Clone the module-level debug info associated with OldFunc. The cloned data