[cfe-commits] r38599 - in /cfe/cfe/trunk: Basic/SourceManager.cpp include/clang/Basic/SourceManager.h
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:23:04 PDT 2007
Author: sabre
Date: Wed Jul 11 11:23:04 2007
New Revision: 38599
URL: http://llvm.org/viewvc/llvm-project?rev=38599&view=rev
Log:
Eliminate SourceManager::createFileIDForMacroExp, inlining it into its single use.
Modified:
cfe/cfe/trunk/Basic/SourceManager.cpp
cfe/cfe/trunk/include/clang/Basic/SourceManager.h
Modified: cfe/cfe/trunk/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Basic/SourceManager.cpp?rev=38599&r1=38598&r2=38599&view=diff
==============================================================================
--- cfe/cfe/trunk/Basic/SourceManager.cpp (original)
+++ cfe/cfe/trunk/Basic/SourceManager.cpp Wed Jul 11 11:23:04 2007
@@ -110,27 +110,19 @@
return Result;
}
-/// createFileIDForMacroExp - Return a new FileID for a macro expansion at
-/// SourcePos, where the macro token character came from PhysicalFileID.
-///
-unsigned SourceManager::createFileIDForMacroExp(SourceLocation SourcePos,
- unsigned PhysicalFileID) {
- SourcePos = getLogicalLoc(SourcePos);
- FileIDs.push_back(FileIDInfo::getMacroExpansion(SourcePos, PhysicalFileID));
- return FileIDs.size();
-}
-
/// getInstantiationLoc - Return a new SourceLocation that encodes the fact
/// that a token from physloc PhysLoc should actually be referenced from
/// InstantiationLoc.
SourceLocation SourceManager::getInstantiationLoc(SourceLocation PhysLoc,
SourceLocation InstantLoc) {
- unsigned CharFilePos = PhysLoc.getRawFilePos();
- unsigned CharFileID = PhysLoc.getFileID();
-
- unsigned InstantiationFileID =
- createFileIDForMacroExp(InstantLoc, CharFileID);
- return SourceLocation(InstantiationFileID, CharFilePos);
+ // Resolve InstantLoc down to a real logical location.
+ InstantLoc = getLogicalLoc(InstantLoc);
+
+ // Add a FileID for this. FIXME: should cache these!
+ FileIDs.push_back(FileIDInfo::getMacroExpansion(InstantLoc,
+ PhysLoc.getFileID()));
+ unsigned InstantiationFileID = FileIDs.size();
+ return SourceLocation(InstantiationFileID, PhysLoc.getRawFilePos());
}
Modified: cfe/cfe/trunk/include/clang/Basic/SourceManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Basic/SourceManager.h?rev=38599&r1=38598&r2=38599&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/cfe/trunk/include/clang/Basic/SourceManager.h Wed Jul 11 11:23:04 2007
@@ -190,12 +190,6 @@
SourceLocation getInstantiationLoc(SourceLocation PhysLoc,
SourceLocation InstantiationLoc);
- /// createFileIDForMacroExp - Return a new FileID for a macro expansion at
- /// SourcePos, where the macro token character came from PhysicalFileID.
- ///
- unsigned createFileIDForMacroExp(SourceLocation SourcePos,
- unsigned PhysicalFileID);
-
/// getBuffer - Return the buffer for the specified FileID.
///
const SourceBuffer *getBuffer(unsigned FileID) const {
More information about the cfe-commits
mailing list