summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-19 07:46:45 +0000
committerChris Lattner <sabre@nondot.org>2009-01-19 07:46:45 +0000
commitcbc35ecb045a163a064d2a592515a381d01d27d2 (patch)
tree4c30786b95d5f37ef21b1a349cadface1f46315e /clang/lib
parent8c3b81214833353aac2c89e35db3be1690595cf1 (diff)
downloadbcm5719-llvm-cbc35ecb045a163a064d2a592515a381d01d27d2.tar.gz
bcm5719-llvm-cbc35ecb045a163a064d2a592515a381d01d27d2.zip
Rename SourceManager::getCanonicalFileID -> getFileID. There is
no longer such thing as a non-canonical FileID. llvm-svn: 62499
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Basic/SourceLocation.cpp4
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp2
-rw-r--r--clang/lib/Driver/HTMLDiagnostics.cpp23
-rw-r--r--clang/lib/Driver/PlistDiagnostics.cpp15
-rw-r--r--clang/lib/Driver/TextDiagnosticPrinter.cpp4
-rw-r--r--clang/lib/Lex/Lexer.cpp2
-rw-r--r--clang/lib/Rewrite/HTMLRewrite.cpp4
7 files changed, 23 insertions, 31 deletions
diff --git a/clang/lib/Basic/SourceLocation.cpp b/clang/lib/Basic/SourceLocation.cpp
index 66ad720bb3b..f0c8274de91 100644
--- a/clang/lib/Basic/SourceLocation.cpp
+++ b/clang/lib/Basic/SourceLocation.cpp
@@ -39,7 +39,7 @@ SourceRange SourceRange::ReadVal(llvm::Deserializer& D) {
FileID FullSourceLoc::getFileID() const {
assert(isValid());
- return SrcMgr->getCanonicalFileID(*this);
+ return SrcMgr->getFileID(*this);
}
@@ -106,7 +106,7 @@ const char *FullSourceLoc::getCharacterData() const {
const llvm::MemoryBuffer* FullSourceLoc::getBuffer() const {
assert(isValid());
- return SrcMgr->getBuffer(SrcMgr->getCanonicalFileID(*this));
+ return SrcMgr->getBuffer(SrcMgr->getFileID(*this));
}
void FullSourceLoc::dump() const {
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 5e4a95cc0cf..1aab4bb5d7d 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -51,7 +51,7 @@ llvm::DICompileUnit CGDebugInfo::getOrCreateCompileUnit(SourceLocation Loc) {
return llvm::DICompileUnit();
SourceManager &SM = M->getContext().getSourceManager();
- const FileEntry *FE = SM.getFileEntryForID(SM.getCanonicalFileID(Loc));
+ const FileEntry *FE = SM.getFileEntryForID(SM.getFileID(Loc));
if (FE == 0) return llvm::DICompileUnit();
// See if this compile unit has been used before.
diff --git a/clang/lib/Driver/HTMLDiagnostics.cpp b/clang/lib/Driver/HTMLDiagnostics.cpp
index 81cedba5577..2772cf34226 100644
--- a/clang/lib/Driver/HTMLDiagnostics.cpp
+++ b/clang/lib/Driver/HTMLDiagnostics.cpp
@@ -26,7 +26,6 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Path.h"
#include <fstream>
-
using namespace clang;
//===----------------------------------------------------------------------===//
@@ -132,8 +131,8 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) {
FullSourceLoc L = I->getLocation().getInstantiationLoc();
if (FID.isInvalid()) {
- FID = SMgr.getCanonicalFileID(L);
- } else if (SMgr.getCanonicalFileID(L) != FID)
+ FID = SMgr.getFileID(L);
+ } else if (SMgr.getFileID(L) != FID)
return; // FIXME: Emit a warning?
// Check the source ranges.
@@ -142,19 +141,13 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) {
SourceLocation L = SMgr.getInstantiationLoc(RI->getBegin());
- if (!L.isFileID())
- return; // FIXME: Emit a warning?
-
- if (SMgr.getCanonicalFileID(L) != FID)
+ if (!L.isFileID() || SMgr.getFileID(L) != FID)
return; // FIXME: Emit a warning?
L = SMgr.getInstantiationLoc(RI->getEnd());
- if (!L.isFileID())
+ if (!L.isFileID() || SMgr.getFileID(L) != FID)
return; // FIXME: Emit a warning?
-
- if (SMgr.getCanonicalFileID(L) != FID)
- return; // FIXME: Emit a warning?
}
}
@@ -336,10 +329,10 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID,
SourceManager &SM = R.getSourceMgr();
FullSourceLoc LPos = Pos.getInstantiationLoc();
- FileID FID = SM.getCanonicalFileID(LPos);
+ FileID FID = SM.getFileID(LPos);
assert(&LPos.getManager() == &SM && "SourceManagers are different!");
- if (SM.getCanonicalFileID(LPos) != BugFileID)
+ if (SM.getFileID(LPos) != BugFileID)
return;
const llvm::MemoryBuffer *Buf = SM.getBuffer(FID);
@@ -469,8 +462,8 @@ void HTMLDiagnostics::HighlightRange(Rewriter& R, FileID BugFileID,
if (EndLineNo < StartLineNo)
return;
- if (SM.getCanonicalFileID(InstantiationStart) != BugFileID ||
- SM.getCanonicalFileID(InstantiationEnd) != BugFileID)
+ if (SM.getFileID(InstantiationStart) != BugFileID ||
+ SM.getFileID(InstantiationEnd) != BugFileID)
return;
// Compute the column number of the end.
diff --git a/clang/lib/Driver/PlistDiagnostics.cpp b/clang/lib/Driver/PlistDiagnostics.cpp
index 0b2ca52f112..9b7da489160 100644
--- a/clang/lib/Driver/PlistDiagnostics.cpp
+++ b/clang/lib/Driver/PlistDiagnostics.cpp
@@ -51,20 +51,18 @@ clang::CreatePlistDiagnosticClient(const std::string& s,
return new PlistDiagnostics(s);
}
-static void AddFID(FIDMap &FIDs,
- llvm::SmallVectorImpl<FileID> &V,
+static void AddFID(FIDMap &FIDs, llvm::SmallVectorImpl<FileID> &V,
SourceManager& SM, SourceLocation L) {
- FileID FID = SM.getCanonicalFileID(SM.getInstantiationLoc(L));
+ FileID FID = SM.getFileID(SM.getInstantiationLoc(L));
FIDMap::iterator I = FIDs.find(FID);
if (I != FIDs.end()) return;
FIDs[FID] = V.size();
V.push_back(FID);
}
-static unsigned GetFID(const FIDMap& FIDs,
- SourceManager& SM, SourceLocation L) {
- FileID FID = SM.getCanonicalFileID(SM.getInstantiationLoc(L));
+static unsigned GetFID(const FIDMap& FIDs, SourceManager& SM, SourceLocation L){
+ FileID FID = SM.getFileID(SM.getInstantiationLoc(L));
FIDMap::const_iterator I = FIDs.find(FID);
assert(I != FIDs.end());
return I->second;
@@ -178,7 +176,7 @@ void PlistDiagnostics::HandlePathDiagnostic(const PathDiagnostic* D) {
AddFID(FM, Fids, SM, I->getLocation());
for (PathDiagnosticPiece::range_iterator RI=I->ranges_begin(),
- RE=I->ranges_end(); RI!=RE; ++RI) {
+ RE=I->ranges_end(); RI!=RE; ++RI) {
AddFID(FM, Fids, SM, RI->getBegin());
AddFID(FM, Fids, SM, RI->getEnd());
}
@@ -229,7 +227,8 @@ void PlistDiagnostics::HandlePathDiagnostic(const PathDiagnostic* D) {
o << " </array>\n";
// Output the bug type and bug category.
- o << " <key>description</key>\n <string>" << D->getDescription() << "</string>\n"
+ o << " <key>description</key>\n <string>" << D->getDescription()
+ << "</string>\n"
" <key>category</key>\n <string>" << D->getCategory() << "</string>\n";
// Finish.
diff --git a/clang/lib/Driver/TextDiagnosticPrinter.cpp b/clang/lib/Driver/TextDiagnosticPrinter.cpp
index 4080b748ad5..71a5e401075 100644
--- a/clang/lib/Driver/TextDiagnosticPrinter.cpp
+++ b/clang/lib/Driver/TextDiagnosticPrinter.cpp
@@ -48,13 +48,13 @@ void TextDiagnosticPrinter::HighlightRange(const SourceRange &R,
SourceMgr.getInstantiationLoc(R.getBegin());
unsigned StartLineNo = SourceMgr.getLineNumber(InstantiationStart);
if (StartLineNo > LineNo ||
- SourceMgr.getCanonicalFileID(InstantiationStart) != FID)
+ SourceMgr.getFileID(InstantiationStart) != FID)
return; // No intersection.
SourceLocation InstantiationEnd = SourceMgr.getInstantiationLoc(R.getEnd());
unsigned EndLineNo = SourceMgr.getLineNumber(InstantiationEnd);
if (EndLineNo < LineNo ||
- SourceMgr.getCanonicalFileID(InstantiationEnd) != FID)
+ SourceMgr.getFileID(InstantiationEnd) != FID)
return; // No intersection.
// Compute the column number of the start.
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index 9280526d22d..19b3121c644 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/lib/Lex/Lexer.cpp
@@ -156,7 +156,7 @@ Lexer *Lexer::Create_PragmaLexer(SourceLocation SpellingLoc,
SourceManager &SM = PP.getSourceManager();
// Create the lexer as if we were going to lex the file normally.
- FileID SpellingFID = SM.getCanonicalFileID(SpellingLoc);
+ FileID SpellingFID = SM.getFileID(SpellingLoc);
Lexer *L = new Lexer(SpellingFID, PP);
// Now that the lexer is created, change the start/end locations so that we
diff --git a/clang/lib/Rewrite/HTMLRewrite.cpp b/clang/lib/Rewrite/HTMLRewrite.cpp
index 68a53d364b9..040146620d2 100644
--- a/clang/lib/Rewrite/HTMLRewrite.cpp
+++ b/clang/lib/Rewrite/HTMLRewrite.cpp
@@ -33,8 +33,8 @@ void html::HighlightRange(Rewriter &R, SourceLocation B, SourceLocation E,
SourceManager &SM = R.getSourceMgr();
B = SM.getInstantiationLoc(B);
E = SM.getInstantiationLoc(E);
- FileID FID = SM.getCanonicalFileID(B);
- assert(SM.getCanonicalFileID(E) == FID && "B/E not in the same file!");
+ FileID FID = SM.getFileID(B);
+ assert(SM.getFileID(E) == FID && "B/E not in the same file!");
unsigned BOffset = SM.getFullFilePos(B);
unsigned EOffset = SM.getFullFilePos(E);
OpenPOWER on IntegriCloud