[llvm] r235055 - DebugInfo: Gut DICompileUnit and DIFile

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed Apr 15 16:19:27 PDT 2015


Author: dexonsmith
Date: Wed Apr 15 18:19:27 2015
New Revision: 235055

URL: http://llvm.org/viewvc/llvm-project?rev=235055&view=rev
Log:
DebugInfo: Gut DICompileUnit and DIFile

Continuing gutting `DIDescriptor` subclasses; this edition,
`DICompileUnit` and `DIFile`.  In the name of PR23080.

Modified:
    llvm/trunk/examples/Kaleidoscope/Chapter8/toy.cpp
    llvm/trunk/include/llvm/IR/DebugInfo.h
    llvm/trunk/lib/Analysis/ModuleDebugInfoPrinter.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
    llvm/trunk/lib/IR/DIBuilder.cpp
    llvm/trunk/lib/IR/DebugInfo.cpp
    llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
    llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp
    llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
    llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
    llvm/trunk/unittests/Transforms/Utils/Cloning.cpp

Modified: llvm/trunk/examples/Kaleidoscope/Chapter8/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter8/toy.cpp?rev=235055&r1=235054&r2=235055&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Chapter8/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/Chapter8/toy.cpp Wed Apr 15 18:19:27 2015
@@ -827,13 +827,13 @@ DIType DebugInfo::getDoubleTy() {
 void DebugInfo::emitLocation(ExprAST *AST) {
   if (!AST)
     return Builder.SetCurrentDebugLocation(DebugLoc());
-  DIScope *Scope;
+  MDScope *Scope;
   if (LexicalBlocks.empty())
-    Scope = &TheCU;
+    Scope = TheCU;
   else
-    Scope = LexicalBlocks.back();
+    Scope = *LexicalBlocks.back();
   Builder.SetCurrentDebugLocation(
-      DebugLoc::get(AST->getLine(), AST->getCol(), DIScope(*Scope)));
+      DebugLoc::get(AST->getLine(), AST->getCol(), Scope));
 }
 
 static DICompositeType CreateFunctionType(unsigned NumArgs, DIFile Unit) {
@@ -1224,9 +1224,9 @@ Function *PrototypeAST::Codegen() {
     AI->setName(Args[Idx]);
 
   // Create a subprogram DIE for this function.
-  DIFile Unit = DBuilder->createFile(KSDbgInfo.TheCU.getFilename(),
-                                     KSDbgInfo.TheCU.getDirectory());
-  DIDescriptor FContext(Unit);
+  DIFile Unit = DBuilder->createFile(KSDbgInfo.TheCU->getFilename(),
+                                     KSDbgInfo.TheCU->getDirectory());
+  DIDescriptor FContext = Unit;
   unsigned LineNo = Line;
   unsigned ScopeLine = Line;
   DISubprogram SP = DBuilder->createFunction(
@@ -1248,15 +1248,15 @@ void PrototypeAST::CreateArgumentAllocas
 
     // Create a debug descriptor for the variable.
     DIScope *Scope = KSDbgInfo.LexicalBlocks.back();
-    DIFile Unit = DBuilder->createFile(KSDbgInfo.TheCU.getFilename(),
-                                       KSDbgInfo.TheCU.getDirectory());
+    DIFile Unit = DBuilder->createFile(KSDbgInfo.TheCU->getFilename(),
+                                       KSDbgInfo.TheCU->getDirectory());
     DIVariable D = DBuilder->createLocalVariable(dwarf::DW_TAG_arg_variable,
                                                  *Scope, Args[Idx], Unit, Line,
                                                  KSDbgInfo.getDoubleTy(), Idx);
 
-    Instruction *Call = DBuilder->insertDeclare(
-        Alloca, D, DBuilder->createExpression(), Builder.GetInsertBlock());
-    Call->setDebugLoc(DebugLoc::get(Line, 0, *Scope));
+    DBuilder->insertDeclare(Alloca, D, DBuilder->createExpression(),
+                            DebugLoc::get(Line, 0, *Scope),
+                            Builder.GetInsertBlock());
 
     // Store the initial value into the alloca.
     Builder.CreateStore(AI, Alloca);

Modified: llvm/trunk/include/llvm/IR/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=235055&r1=235054&r2=235055&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfo.h Wed Apr 15 18:19:27 2015
@@ -374,59 +374,31 @@ public:
   MDTypeRefArray getTypeArray() const { return get()->getTypeArray(); }
 };
 
-/// \brief This is a wrapper for a file.
-class DIFile : public DIScope {
-public:
-  DIFile() = default;
-  DIFile(const MDFile *N) : DIScope(N) {}
+class DIFile {
+  MDFile *N;
 
-  MDFile *get() const { return cast_or_null<MDFile>(DIDescriptor::get()); }
-  operator MDFile *() const { return get(); }
-  MDFile *operator->() const { return get(); }
-  MDFile &operator*() const { return *get(); }
+public:
+  DIFile(const MDFile *N = nullptr) : N(const_cast<MDFile *>(N)) {}
 
-  /// \brief Retrieve the MDNode for the directory/file pair.
-  MDNode *getFileNode() const { return get(); }
+  operator DIDescriptor() const { return N; }
+  operator DIScope() const { return N; }
+  operator MDFile *() const { return N; }
+  MDFile *operator->() const { return N; }
+  MDFile &operator*() const { return *N; }
 };
 
-/// \brief A wrapper for a compile unit.
-class DICompileUnit : public DIScope {
+class DICompileUnit {
+  MDCompileUnit *N;
+
 public:
-  DICompileUnit() = default;
-  DICompileUnit(const MDCompileUnit *N) : DIScope(N) {}
+  DICompileUnit(const MDCompileUnit *N = nullptr)
+      : N(const_cast<MDCompileUnit *>(N)) {}
 
-  MDCompileUnit *get() const {
-    return cast_or_null<MDCompileUnit>(DIDescriptor::get());
-  }
-  operator MDCompileUnit *() const { return get(); }
-  MDCompileUnit *operator->() const { return get(); }
-  MDCompileUnit &operator*() const { return *get(); }
-
-  dwarf::SourceLanguage getLanguage() const {
-    return static_cast<dwarf::SourceLanguage>(get()->getSourceLanguage());
-  }
-  StringRef getProducer() const { return get()->getProducer(); }
-  bool isOptimized() const { return get()->isOptimized(); }
-  StringRef getFlags() const { return get()->getFlags(); }
-  unsigned getRunTimeVersion() const { return get()->getRuntimeVersion(); }
-
-  DIArray getEnumTypes() const { return get()->getEnumTypes(); }
-  DIArray getRetainedTypes() const { return get()->getRetainedTypes(); }
-  DIArray getSubprograms() const { return get()->getSubprograms(); }
-  DIArray getGlobalVariables() const { return get()->getGlobalVariables(); }
-  DIArray getImportedEntities() const { return get()->getImportedEntities(); }
-
-  void replaceSubprograms(MDSubprogramArray Subprograms) const {
-    get()->replaceSubprograms(Subprograms);
-  }
-  void replaceGlobalVariables(MDGlobalVariableArray GlobalVariables) const {
-    get()->replaceGlobalVariables(GlobalVariables);
-  }
-
-  StringRef getSplitDebugFilename() const {
-    return get()->getSplitDebugFilename();
-  }
-  unsigned getEmissionKind() const { return get()->getEmissionKind(); }
+  operator DIDescriptor() const { return N; }
+  operator DIScope() const { return N; }
+  operator MDCompileUnit *() const { return N; }
+  MDCompileUnit *operator->() const { return N; }
+  MDCompileUnit &operator*() const { return *N; }
 };
 
 class DISubprogram {

Modified: llvm/trunk/lib/Analysis/ModuleDebugInfoPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ModuleDebugInfoPrinter.cpp?rev=235055&r1=235054&r2=235055&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ModuleDebugInfoPrinter.cpp (original)
+++ llvm/trunk/lib/Analysis/ModuleDebugInfoPrinter.cpp Wed Apr 15 18:19:27 2015
@@ -72,13 +72,13 @@ void ModuleDebugInfoPrinter::print(raw_o
   // Printing the nodes directly isn't particularly helpful (since they
   // reference other nodes that won't be printed, particularly for the
   // filenames), so just print a few useful things.
-  for (DICompileUnit CU : Finder.compile_units()) {
+  for (MDCompileUnit *CU : Finder.compile_units()) {
     O << "Compile unit: ";
-    if (const char *Lang = LanguageString(CU.getLanguage()))
+    if (const char *Lang = dwarf::LanguageString(CU->getSourceLanguage()))
       O << Lang;
     else
-      O << "unknown-language(" << CU.getLanguage() << ")";
-    printFile(O, CU.getFilename(), CU.getDirectory());
+      O << "unknown-language(" << CU->getSourceLanguage() << ")";
+    printFile(O, CU->getFilename(), CU->getDirectory());
     O << '\n';
   }
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=235055&r1=235054&r2=235055&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Wed Apr 15 18:19:27 2015
@@ -819,7 +819,7 @@ bool DwarfCompileUnit::isDwoUnit() const
 }
 
 bool DwarfCompileUnit::includeMinimalInlineScopes() const {
-  return getCUNode().getEmissionKind() == DIBuilder::LineTablesOnly ||
+  return getCUNode()->getEmissionKind() == DIBuilder::LineTablesOnly ||
          (DD->useSplitDwarf() && !Skeleton);
 }
 } // end llvm namespace

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=235055&r1=235054&r2=235055&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Apr 15 18:19:27 2015
@@ -363,8 +363,8 @@ void DwarfDebug::addGnuPubAttributes(Dwa
 // Create new DwarfCompileUnit for the given metadata node with tag
 // DW_TAG_compile_unit.
 DwarfCompileUnit &DwarfDebug::constructDwarfCompileUnit(DICompileUnit DIUnit) {
-  StringRef FN = DIUnit.getFilename();
-  CompilationDir = DIUnit.getDirectory();
+  StringRef FN = DIUnit->getFilename();
+  CompilationDir = DIUnit->getDirectory();
 
   auto OwnedUnit = make_unique<DwarfCompileUnit>(
       InfoHolder.getUnits().size(), DIUnit, Asm, this, &InfoHolder);
@@ -382,9 +382,9 @@ DwarfCompileUnit &DwarfDebug::constructD
     Asm->OutStreamer.getContext().setMCLineTableCompilationDir(
         NewCU.getUniqueID(), CompilationDir);
 
-  NewCU.addString(Die, dwarf::DW_AT_producer, DIUnit.getProducer());
+  NewCU.addString(Die, dwarf::DW_AT_producer, DIUnit->getProducer());
   NewCU.addUInt(Die, dwarf::DW_AT_language, dwarf::DW_FORM_data2,
-                DIUnit.getLanguage());
+                DIUnit->getSourceLanguage());
   NewCU.addString(Die, dwarf::DW_AT_name, FN);
 
   if (!useSplitDwarf()) {
@@ -398,14 +398,14 @@ DwarfCompileUnit &DwarfDebug::constructD
     addGnuPubAttributes(NewCU, Die);
   }
 
-  if (DIUnit.isOptimized())
+  if (DIUnit->isOptimized())
     NewCU.addFlag(Die, dwarf::DW_AT_APPLE_optimized);
 
-  StringRef Flags = DIUnit.getFlags();
+  StringRef Flags = DIUnit->getFlags();
   if (!Flags.empty())
     NewCU.addString(Die, dwarf::DW_AT_APPLE_flags, Flags);
 
-  if (unsigned RVer = DIUnit.getRunTimeVersion())
+  if (unsigned RVer = DIUnit->getRuntimeVersion())
     NewCU.addUInt(Die, dwarf::DW_AT_APPLE_major_runtime_vers,
                   dwarf::DW_FORM_data1, RVer);
 
@@ -1194,7 +1194,7 @@ void DwarfDebug::endFunction(const Machi
 
   // Under -gmlt, skip building the subprogram if there are no inlined
   // subroutines inside it.
-  if (TheCU.getCUNode().getEmissionKind() == DIBuilder::LineTablesOnly &&
+  if (TheCU.getCUNode()->getEmissionKind() == DIBuilder::LineTablesOnly &&
       LScopes.getAbstractScopesList().empty() && !IsDarwin) {
     assert(InfoHolder.getScopeVariables().empty());
     assert(DbgValues.empty());
@@ -1824,7 +1824,7 @@ void DwarfDebug::emitDebugRanges() {
 void DwarfDebug::initSkeletonUnit(const DwarfUnit &U, DIE &Die,
                                   std::unique_ptr<DwarfUnit> NewU) {
   NewU->addString(Die, dwarf::DW_AT_GNU_dwo_name,
-                  U.getCUNode().getSplitDebugFilename());
+                  U.getCUNode()->getSplitDebugFilename());
 
   if (!CompilationDir.empty())
     NewU->addString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
@@ -1888,7 +1888,7 @@ MCDwarfDwoLineTable *DwarfDebug::getDwoL
   if (!useSplitDwarf())
     return nullptr;
   if (SingleCU)
-    SplitTypeUnitFileTable.setCompilationDir(CU.getCUNode().getDirectory());
+    SplitTypeUnitFileTable.setCompilationDir(CU.getCUNode()->getDirectory());
   return &SplitTypeUnitFileTable;
 }
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=235055&r1=235054&r2=235055&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Wed Apr 15 18:19:27 2015
@@ -141,7 +141,7 @@ public:
   // Accessors.
   AsmPrinter* getAsmPrinter() const { return Asm; }
   unsigned getUniqueID() const { return UniqueID; }
-  uint16_t getLanguage() const { return CUNode.getLanguage(); }
+  uint16_t getLanguage() const { return CUNode->getSourceLanguage(); }
   DICompileUnit getCUNode() const { return CUNode; }
   DIE &getUnitDie() { return UnitDie; }
 

Modified: llvm/trunk/lib/IR/DIBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DIBuilder.cpp?rev=235055&r1=235054&r2=235055&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DIBuilder.cpp (original)
+++ llvm/trunk/lib/IR/DIBuilder.cpp Wed Apr 15 18:19:27 2015
@@ -679,10 +679,9 @@ DISubprogram DIBuilder::createFunction(D
          "function types should be subroutines");
   auto *Node = MDSubprogram::get(
       VMContext, MDScopeRef::get(DIScope(getNonCompileUnitScope(Context))),
-      Name, LinkageName, File.get(), LineNo,
-      cast_or_null<MDSubroutineType>(Ty.get()), isLocalToUnit, isDefinition,
-      ScopeLine, nullptr, 0, 0, Flags, isOptimized, Fn,
-      cast_or_null<MDTuple>(TParams), cast_or_null<MDSubprogram>(Decl),
+      Name, LinkageName, File, LineNo, cast_or_null<MDSubroutineType>(Ty.get()),
+      isLocalToUnit, isDefinition, ScopeLine, nullptr, 0, 0, Flags, isOptimized,
+      Fn, cast_or_null<MDTuple>(TParams), cast_or_null<MDSubprogram>(Decl),
       MDTuple::getTemporary(VMContext, None).release());
 
   if (isDefinition)
@@ -702,11 +701,12 @@ DIBuilder::createTempFunctionFwdDecl(DID
   return MDSubprogram::getTemporary(
              VMContext,
              MDScopeRef::get(DIScope(getNonCompileUnitScope(Context))), Name,
-             LinkageName, File.get(), LineNo,
+             LinkageName, File, LineNo,
              cast_or_null<MDSubroutineType>(Ty.get()), isLocalToUnit,
              isDefinition, ScopeLine, nullptr, 0, 0, Flags, isOptimized, Fn,
              cast_or_null<MDTuple>(TParams), cast_or_null<MDSubprogram>(Decl),
-             nullptr).release();
+             nullptr)
+      .release();
 }
 
 DISubprogram DIBuilder::createMethod(DIDescriptor Context, StringRef Name,
@@ -724,8 +724,8 @@ DISubprogram DIBuilder::createMethod(DID
          "the compile unit.");
   // FIXME: Do we want to use different scope/lines?
   auto *SP = MDSubprogram::get(
-      VMContext, MDScopeRef::get(cast<MDScope>(Context)), Name, LinkageName,
-      F.get(), LineNo, cast_or_null<MDSubroutineType>(Ty.get()), isLocalToUnit,
+      VMContext, MDScopeRef::get(cast<MDScope>(Context)), Name, LinkageName, F,
+      LineNo, cast_or_null<MDSubroutineType>(Ty.get()), isLocalToUnit,
       isDefinition, LineNo, MDTypeRef::get(VTableHolder), VK, VIndex, Flags,
       isOptimized, Fn, cast_or_null<MDTuple>(TParam), nullptr, nullptr);
 
@@ -744,8 +744,7 @@ DINameSpace DIBuilder::createNameSpace(D
 DILexicalBlockFile DIBuilder::createLexicalBlockFile(DIDescriptor Scope,
                                                      DIFile File,
                                                      unsigned Discriminator) {
-  return MDLexicalBlockFile::get(VMContext, Scope, File.getFileNode(),
-                                 Discriminator);
+  return MDLexicalBlockFile::get(VMContext, Scope, File, Discriminator);
 }
 
 DILexicalBlock DIBuilder::createLexicalBlock(DIDescriptor Scope, DIFile File,
@@ -753,7 +752,7 @@ DILexicalBlock DIBuilder::createLexicalB
   // Make these distinct, to avoid merging two lexical blocks on the same
   // file/line/column.
   return MDLexicalBlock::getDistinct(VMContext, getNonCompileUnitScope(Scope),
-                                     File.getFileNode(), Line, Col);
+                                     File, Line, Col);
 }
 
 static Value *getDbgIntrinsicValueImpl(LLVMContext &VMContext, Value *V) {

Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=235055&r1=235054&r2=235055&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Wed Apr 15 18:19:27 2015
@@ -78,8 +78,8 @@ DITypeIdentifierMap
 llvm::generateDITypeIdentifierMap(const NamedMDNode *CU_Nodes) {
   DITypeIdentifierMap Map;
   for (unsigned CUi = 0, CUe = CU_Nodes->getNumOperands(); CUi != CUe; ++CUi) {
-    DICompileUnit CU = cast<MDCompileUnit>(CU_Nodes->getOperand(CUi));
-    DIArray Retain = CU.getRetainedTypes();
+    auto *CU = cast<MDCompileUnit>(CU_Nodes->getOperand(CUi));
+    DIArray Retain = CU->getRetainedTypes();
     for (unsigned Ti = 0, Te = Retain.size(); Ti != Te; ++Ti) {
       if (!isa<MDCompositeType>(Retain[Ti]))
         continue;

Modified: llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp?rev=235055&r1=235054&r2=235055&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp Wed Apr 15 18:19:27 2015
@@ -773,9 +773,9 @@ void NVPTXAsmPrinter::recordAndEmitFilen
   DbgFinder.processModule(M);
 
   unsigned i = 1;
-  for (DICompileUnit DIUnit : DbgFinder.compile_units()) {
-    StringRef Filename(DIUnit.getFilename());
-    StringRef Dirname(DIUnit.getDirectory());
+  for (const MDCompileUnit *DIUnit : DbgFinder.compile_units()) {
+    StringRef Filename = DIUnit->getFilename();
+    StringRef Dirname = DIUnit->getDirectory();
     SmallString<128> FullPathName = Dirname;
     if (!Dirname.empty() && !sys::path::is_absolute(Filename)) {
       sys::path::append(FullPathName, Filename);

Modified: llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp?rev=235055&r1=235054&r2=235055&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp Wed Apr 15 18:19:27 2015
@@ -305,7 +305,7 @@ bool StripDeadDebugInfo::runOnModule(Mod
   SmallVector<Metadata *, 64> LiveSubprograms;
   DenseSet<const MDNode *> VisitedSet;
 
-  for (DICompileUnit DIC : F.compile_units()) {
+  for (MDCompileUnit *DIC : F.compile_units()) {
     // Create our live subprogram list.
     MDSubprogramArray SPs = DIC->getSubprograms();
     bool SubprogramChange = false;
@@ -345,12 +345,12 @@ bool StripDeadDebugInfo::runOnModule(Mod
     // subprogram list/global variable list with our new live subprogram/global
     // variable list.
     if (SubprogramChange) {
-      DIC.replaceSubprograms(MDTuple::get(C, LiveSubprograms));
+      DIC->replaceSubprograms(MDTuple::get(C, LiveSubprograms));
       Changed = true;
     }
 
     if (GlobalVariableChange) {
-      DIC.replaceGlobalVariables(MDTuple::get(C, LiveGlobalVariables));
+      DIC->replaceGlobalVariables(MDTuple::get(C, LiveGlobalVariables));
       Changed = true;
     }
 

Modified: llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp?rev=235055&r1=235054&r2=235055&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp Wed Apr 15 18:19:27 2015
@@ -437,7 +437,7 @@ std::string GCOVProfiler::mangleName(DIC
     }
   }
 
-  SmallString<128> Filename = CU.getFilename();
+  SmallString<128> Filename = CU->getFilename();
   sys::path::replace_extension(Filename, NewStem);
   StringRef FName = sys::path::filename(Filename);
   SmallString<128> CurPath;

Modified: llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp?rev=235055&r1=235054&r2=235055&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp Wed Apr 15 18:19:27 2015
@@ -171,7 +171,7 @@ static void AddOperand(DICompileUnit CU,
   for (auto *SP : SPs)
     NewSPs.push_back(SP);
   NewSPs.push_back(NewSP);
-  CU.replaceSubprograms(MDTuple::get(CU->getContext(), NewSPs));
+  CU->replaceSubprograms(MDTuple::get(CU->getContext(), NewSPs));
 }
 
 // Clone the module-level debug info associated with OldFunc. The cloned data

Modified: llvm/trunk/unittests/Transforms/Utils/Cloning.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Transforms/Utils/Cloning.cpp?rev=235055&r1=235054&r2=235055&view=diff
==============================================================================
--- llvm/trunk/unittests/Transforms/Utils/Cloning.cpp (original)
+++ llvm/trunk/unittests/Transforms/Utils/Cloning.cpp Wed Apr 15 18:19:27 2015
@@ -322,8 +322,8 @@ TEST_F(CloneFunc, SubprogramInRightCU) {
   DICompileUnit CU1 = cast<MDCompileUnit>(*Iter);
   Iter++;
   DICompileUnit CU2 = cast<MDCompileUnit>(*Iter);
-  EXPECT_TRUE(CU1.getSubprograms().size() == 0 ||
-              CU2.getSubprograms().size() == 0);
+  EXPECT_TRUE(CU1->getSubprograms().size() == 0 ||
+              CU2->getSubprograms().size() == 0);
 }
 
 // Test that instructions in the old function still belong to it in the





More information about the llvm-commits mailing list