[cfe-commits] r38577 - 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:22:52 PDT 2007
Author: sabre
Date: Wed Jul 11 11:22:52 2007
New Revision: 38577
URL: http://llvm.org/viewvc/llvm-project?rev=38577&view=rev
Log:
To not treat macro invocation locations as part of the include stack
when reporting a diagnostic.
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=38577&r1=38576&r2=38577&view=diff
==============================================================================
--- cfe/cfe/trunk/Basic/SourceManager.cpp (original)
+++ cfe/cfe/trunk/Basic/SourceManager.cpp Wed Jul 11 11:22:52 2007
@@ -129,6 +129,18 @@
return 0;
}
+/// getIncludeLoc - Return the location of the #include for the specified
+/// FileID.
+SourceLocation SourceManager::getIncludeLoc(unsigned FileID) const {
+ const SrcMgr::FileIDInfo *FIDInfo = getFIDInfo(FileID);
+
+ // For Macros, the physical loc is specified by the MacroTokenFileID.
+ if (FIDInfo->IDType == SrcMgr::FileIDInfo::MacroExpansion)
+ FIDInfo = &FileIDs[FIDInfo->u.MacroTokenFileID-1];
+
+ return FIDInfo->IncludeLoc;
+}
+
/// getColumnNumber - Return the column # for the specified include position.
/// this is significantly cheaper to compute than the line number. This returns
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=38577&r1=38576&r2=38577&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/cfe/trunk/include/clang/Basic/SourceManager.h Wed Jul 11 11:22:52 2007
@@ -189,10 +189,7 @@
/// getIncludeLoc - Return the location of the #include for the specified
/// FileID.
- SourceLocation getIncludeLoc(unsigned FileID) const {
- assert(FileID-1 < FileIDs.size() && "Invalid FileID!");
- return FileIDs[FileID-1].IncludeLoc;
- }
+ SourceLocation getIncludeLoc(unsigned FileID) const;
/// getFilePos - This (efficient) method returns the offset from the start of
/// the file that the specified SourceLocation represents. This returns the
More information about the cfe-commits
mailing list