DebugInfo: Gut DILocation

This is along the same lines as r234832, but for `DILocation`.  Clean
out all accessors from `DILocation`.  Any callers should be using
`MDLocation` directly (e.g., via `operator->()`).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234835 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2015-04-14 01:35:55 +00:00
parent 1624f35f2b
commit d59e30dfb7
6 changed files with 23 additions and 37 deletions

View File

@ -192,8 +192,8 @@ bool AddDiscriminators::runOnFunction(Function &F) {
if (!FirstDIL->canDiscriminate(*LastDIL)) {
// Create a new lexical scope and compute a new discriminator
// number for it.
StringRef Filename = FirstDIL.getFilename();
DIScope Scope = FirstDIL.getScope();
StringRef Filename = FirstDIL->getFilename();
DIScope Scope = FirstDIL->getScope();
DIFile File = Builder.createFile(Filename, Scope.getDirectory());
// FIXME: Calculate the discriminator here, based on local information,
@ -204,10 +204,10 @@ bool AddDiscriminators::runOnFunction(Function &F) {
unsigned Discriminator = FirstDIL->computeNewDiscriminator();
DILexicalBlockFile NewScope =
Builder.createLexicalBlockFile(Scope, File, Discriminator);
DILocation NewDIL =
auto *NewDIL =
MDLocation::get(Ctx, FirstDIL->getLine(), FirstDIL->getColumn(),
NewScope, FirstDIL->getInlinedAt());
DebugLoc newDebugLoc = NewDIL.get();
DebugLoc newDebugLoc = NewDIL;
// Attach this new debug location to First and every
// instruction following First that shares the same location.
@ -216,9 +216,9 @@ bool AddDiscriminators::runOnFunction(Function &F) {
if (I1->getDebugLoc().get() != FirstDIL)
break;
I1->setDebugLoc(newDebugLoc);
DEBUG(dbgs() << NewDIL.getFilename() << ":" << NewDIL.getLineNumber()
<< ":" << NewDIL.getColumnNumber() << ":"
<< NewDIL.getDiscriminator() << *I1 << "\n");
DEBUG(dbgs() << NewDIL->getFilename() << ":" << NewDIL->getLine()
<< ":" << NewDIL->getColumn() << ":"
<< NewDIL->getDiscriminator() << *I1 << "\n");
}
DEBUG(dbgs() << "\n");
Changed = true;