From 59ddeabc4c0aa2fdeef5a9183e8af69db07b5e74 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 16 Jan 2009 23:06:35 +0000 Subject: [PATCH] eliminate FullSourceLoc::getLocation() now that FullSourceLoc *is* the location. This eliminates some weird X.getLocation().getLocation()'s. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62376 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/SourceLocation.h | 2 -- lib/Driver/HTMLDiagnostics.cpp | 9 ++++----- lib/Driver/PlistDiagnostics.cpp | 4 ++-- lib/Driver/TextDiagnosticBuffer.cpp | 6 +++--- lib/Driver/TextDiagnosticPrinter.cpp | 2 +- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h index b3cb787544..da7ea25a54 100644 --- a/include/clang/Basic/SourceLocation.h +++ b/include/clang/Basic/SourceLocation.h @@ -218,8 +218,6 @@ public: explicit FullSourceLoc(SourceLocation Loc, SourceManager &SM) : SourceLocation(Loc), SrcMgr(&SM) {} - SourceLocation getLocation() const { return *this; } - SourceManager& getManager() { assert (SrcMgr && "SourceManager is NULL."); return *SrcMgr; diff --git a/lib/Driver/HTMLDiagnostics.cpp b/lib/Driver/HTMLDiagnostics.cpp index 7f20e1ac44..f335396ec4 100644 --- a/lib/Driver/HTMLDiagnostics.cpp +++ b/lib/Driver/HTMLDiagnostics.cpp @@ -133,9 +133,9 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) { FullSourceLoc L = I->getLocation().getInstantiationLoc(); if (!FileIDInitialized) { - FileID = SMgr.getCanonicalFileID(L.getLocation()); + FileID = SMgr.getCanonicalFileID(L); FileIDInitialized = true; - } else if (SMgr.getCanonicalFileID(L.getLocation()) != FileID) + } else if (SMgr.getCanonicalFileID(L) != FileID) return; // FIXME: Emit a warning? // Check the source ranges. @@ -339,11 +339,11 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, unsigned BugFileID, SourceManager& SM = R.getSourceMgr(); FullSourceLoc LPos = Pos.getInstantiationLoc(); - unsigned FileID = SM.getCanonicalFileID(LPos.getLocation()); + unsigned FileID = SM.getCanonicalFileID(LPos); assert (&LPos.getManager() == &SM && "SourceManagers are different!"); - if (SM.getCanonicalFileID(LPos.getLocation()) != BugFileID) + if (SM.getCanonicalFileID(LPos) != BugFileID) return; const llvm::MemoryBuffer *Buf = SM.getBuffer(FileID); @@ -351,7 +351,6 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, unsigned BugFileID, // Compute the column number. Rewind from the current position to the start // of the line. - unsigned ColNo = LPos.getColumnNumber(); const char *TokInstantiationPtr = LPos.getCharacterData(); const char *LineStart = TokInstantiationPtr-ColNo; diff --git a/lib/Driver/PlistDiagnostics.cpp b/lib/Driver/PlistDiagnostics.cpp index 7719930125..14280288cd 100644 --- a/lib/Driver/PlistDiagnostics.cpp +++ b/lib/Driver/PlistDiagnostics.cpp @@ -109,7 +109,7 @@ static void ReportDiag(llvm::raw_ostream& o, const PathDiagnosticPiece& P, FullSourceLoc L = P.getLocation(); Indent(o, indent) << "location\n"; - EmitLocation(o, SM, L.getLocation(), FM, indent); + EmitLocation(o, SM, L, FM, indent); // Output the ranges (if any). PathDiagnosticPiece::range_iterator RI = P.ranges_begin(), @@ -174,7 +174,7 @@ void PlistDiagnostics::HandlePathDiagnostic(const PathDiagnostic* D) { llvm::SmallVector Fids; for (PathDiagnostic::const_iterator I=D->begin(), E=D->end(); I != E; ++I) { - AddFID(FM, Fids, SM, I->getLocation().getLocation()); + AddFID(FM, Fids, SM, I->getLocation()); for (PathDiagnosticPiece::range_iterator RI=I->ranges_begin(), RE=I->ranges_end(); RI!=RE; ++RI) { diff --git a/lib/Driver/TextDiagnosticBuffer.cpp b/lib/Driver/TextDiagnosticBuffer.cpp index 5032cdb0b5..279a6b9a38 100644 --- a/lib/Driver/TextDiagnosticBuffer.cpp +++ b/lib/Driver/TextDiagnosticBuffer.cpp @@ -26,13 +26,13 @@ void TextDiagnosticBuffer::HandleDiagnostic(Diagnostic::Level Level, switch (Level) { default: assert(0 && "Diagnostic not handled during diagnostic buffering!"); case Diagnostic::Note: - Notes.push_back(std::make_pair(Info.getLocation().getLocation(), Str)); + Notes.push_back(std::make_pair(Info.getLocation(), Str)); break; case Diagnostic::Warning: - Warnings.push_back(std::make_pair(Info.getLocation().getLocation(), Str)); + Warnings.push_back(std::make_pair(Info.getLocation(), Str)); break; case Diagnostic::Error: - Errors.push_back(std::make_pair(Info.getLocation().getLocation(), Str)); + Errors.push_back(std::make_pair(Info.getLocation(), Str)); break; } } diff --git a/lib/Driver/TextDiagnosticPrinter.cpp b/lib/Driver/TextDiagnosticPrinter.cpp index 1f98ef9190..8523723278 100644 --- a/lib/Driver/TextDiagnosticPrinter.cpp +++ b/lib/Driver/TextDiagnosticPrinter.cpp @@ -105,7 +105,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, if (Pos.isValid()) { FullSourceLoc LPos = Pos.getInstantiationLoc(); LineNo = LPos.getLineNumber(); - FileID = LPos.getLocation().getFileID(); + FileID = LPos.getFileID(); // First, if this diagnostic is not in the main file, print out the // "included from" lines. -- 2.40.0