aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-03 22:13:05 +0000
committerChris Lattner <sabre@nondot.org>2009-02-03 22:13:05 +0000
commitac50e3427cb9eb3dc9f13f29a78f00ef3122433d (patch)
treeb30e351cf2c346b0348791ac0f8d0eb61239ff1b /lib/Basic
parent0d7b091ffd100ca2cf51c686635a5d2bfbbad639 (diff)
more plumbing for #line propagation. Use happy bit #3
out of FileInfo :) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63672 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic')
-rw-r--r--lib/Basic/SourceManager.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp
index ce9efb034a..02568d373f 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/lib/Basic/SourceManager.cpp
@@ -84,7 +84,8 @@ public:
~LineTableInfo() {}
unsigned getLineTableFilenameID(const char *Ptr, unsigned Len);
-
+ void AddLineNote(FileID FID, unsigned Offset,
+ unsigned LineNo, int FilenameID);
};
} // namespace clang
@@ -105,6 +106,16 @@ unsigned LineTableInfo::getLineTableFilenameID(const char *Ptr, unsigned Len) {
return FilenamesByID.size()-1;
}
+/// AddLineNote - Add a line note to the line table that indicates that there
+/// is a #line at the specified FID/Offset location which changes the presumed
+/// location to LineNo/FilenameID.
+void LineTableInfo::AddLineNote(FileID FID, unsigned Offset,
+ unsigned LineNo, int FilenameID) {
+
+}
+
+
+
/// getLineTableFilenameID - Return the uniqued ID for the specified filename.
///
unsigned SourceManager::getLineTableFilenameID(const char *Ptr, unsigned Len) {
@@ -119,7 +130,16 @@ unsigned SourceManager::getLineTableFilenameID(const char *Ptr, unsigned Len) {
/// unspecified.
void SourceManager::AddLineNote(SourceLocation Loc, unsigned LineNo,
int FilenameID) {
+ std::pair<FileID, unsigned> LocInfo = getDecomposedInstantiationLoc(Loc);
+
+ const SrcMgr::FileInfo &FileInfo = getSLocEntry(LocInfo.first).getFile();
+
+ // Remember that this file has #line directives now if it doesn't already.
+ const_cast<SrcMgr::FileInfo&>(FileInfo).setHasLineDirectives();
+ if (LineTable == 0)
+ LineTable = new LineTableInfo();
+ LineTable->AddLineNote(LocInfo.first, LocInfo.second, LineNo, FilenameID);
}