DebugInfo: Delete subclasses of DIScope

Delete subclasses of (the already defunct) `DIScope`, updating users to
use the raw pointers from the `Metadata` hierarchy directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235356 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2015-04-20 22:10:08 +00:00
parent e0d6a5c90a
commit d3c29ac587
19 changed files with 92 additions and 180 deletions

View File

@@ -194,7 +194,7 @@ bool AddDiscriminators::runOnFunction(Function &F) {
// number for it.
StringRef Filename = FirstDIL->getFilename();
auto *Scope = FirstDIL->getScope();
DIFile File = Builder.createFile(Filename, Scope->getDirectory());
auto *File = Builder.createFile(Filename, Scope->getDirectory());
// FIXME: Calculate the discriminator here, based on local information,
// and delete MDLocation::computeNewDiscriminator(). The current
@@ -202,7 +202,7 @@ bool AddDiscriminators::runOnFunction(Function &F) {
// same context. All we really need is to discriminate between
// FirstDIL and LastDIL -- a local map would suffice.
unsigned Discriminator = FirstDIL->computeNewDiscriminator();
DILexicalBlockFile NewScope =
auto *NewScope =
Builder.createLexicalBlockFile(Scope, File, Discriminator);
auto *NewDIL =
MDLocation::get(Ctx, FirstDIL->getLine(), FirstDIL->getColumn(),

View File

@@ -154,9 +154,10 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
TypeMapper, Materializer);
}
// Find the MDNode which corresponds to the DISubprogram data that described F.
static MDNode* FindSubprogram(const Function *F, DebugInfoFinder &Finder) {
for (DISubprogram Subprogram : Finder.subprograms()) {
// Find the MDNode which corresponds to the subprogram data that described F.
static MDSubprogram *FindSubprogram(const Function *F,
DebugInfoFinder &Finder) {
for (MDSubprogram *Subprogram : Finder.subprograms()) {
if (Subprogram->describes(F))
return Subprogram;
}
@@ -165,7 +166,8 @@ static MDNode* FindSubprogram(const Function *F, DebugInfoFinder &Finder) {
// Add an operand to an existing MDNode. The new operand will be added at the
// back of the operand list.
static void AddOperand(DICompileUnit CU, MDSubprogramArray SPs, Metadata *NewSP) {
static void AddOperand(MDCompileUnit *CU, MDSubprogramArray SPs,
Metadata *NewSP) {
SmallVector<Metadata *, 16> NewSPs;
NewSPs.reserve(SPs.size() + 1);
for (auto *SP : SPs)
@@ -181,16 +183,16 @@ static void CloneDebugInfoMetadata(Function *NewFunc, const Function *OldFunc,
DebugInfoFinder Finder;
Finder.processModule(*OldFunc->getParent());
const MDNode *OldSubprogramMDNode = FindSubprogram(OldFunc, Finder);
const MDSubprogram *OldSubprogramMDNode = FindSubprogram(OldFunc, Finder);
if (!OldSubprogramMDNode) return;
// Ensure that OldFunc appears in the map.
// (if it's already there it must point to NewFunc anyway)
VMap[OldFunc] = NewFunc;
DISubprogram NewSubprogram =
auto *NewSubprogram =
cast<MDSubprogram>(MapMetadata(OldSubprogramMDNode, VMap));
for (DICompileUnit CU : Finder.compile_units()) {
for (auto *CU : Finder.compile_units()) {
auto Subprograms = CU->getSubprograms();
// If the compile unit's function list contains the old function, it should
// also contain the new one.