diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-27 07:57:44 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-27 07:57:44 +0000 |
commit | b9c3f966b103f7cfe8e5e60007c4c8b38f7298eb (patch) | |
tree | d10a3e7c028ae1ae13bef1b61f7da4aff02ef207 /Driver/PrintPreprocessedOutput.cpp | |
parent | 52c29081281955d3db9e11d10573b2d38f709099 (diff) |
Introduce a new PresumedLoc class to represent the concept of a location
as reported to the user and as manipulated by #line. This is what __FILE__,
__INCLUDE_LEVEL__, diagnostics and other things should follow (but not
dependency generation!).
This patch also includes several cleanups along the way:
- SourceLocation now has a dump method, and several other places
that did similar things now use it.
- I cleaned up some code in AnalysisConsumer, but it should probably be
simplified further now that NamedDecl is better.
- TextDiagnosticPrinter is now simplified and cleaned up a bit.
This patch is a prerequisite for #line, but does not actually provide
any #line functionality.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63098 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/PrintPreprocessedOutput.cpp')
-rw-r--r-- | Driver/PrintPreprocessedOutput.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Driver/PrintPreprocessedOutput.cpp b/Driver/PrintPreprocessedOutput.cpp index 32b8a8b279..5c4a140fa9 100644 --- a/Driver/PrintPreprocessedOutput.cpp +++ b/Driver/PrintPreprocessedOutput.cpp @@ -150,7 +150,7 @@ void PrintPPOutputPPCallbacks::FileChanged(SourceLocation Loc, // #include directive was at. SourceManager &SourceMgr = PP.getSourceManager(); if (Reason == PPCallbacks::EnterFile) { - MoveToLine(SourceMgr.getIncludeLoc(Loc)); + MoveToLine(SourceMgr.getPresumedLoc(Loc).getIncludeLoc()); } else if (Reason == PPCallbacks::SystemHeaderPragma) { MoveToLine(Loc); @@ -165,7 +165,7 @@ void PrintPPOutputPPCallbacks::FileChanged(SourceLocation Loc, if (DisableLineMarkers) return; CurFilename.clear(); - CurFilename += SourceMgr.getSourceName(Loc); + CurFilename += SourceMgr.getPresumedLoc(Loc).getFilename(); Lexer::Stringify(CurFilename); FileType = NewFileType; @@ -540,7 +540,8 @@ void clang::DoPrintPreprocessedInput(Preprocessor &PP, const SourceManager &SourceMgr = PP.getSourceManager(); do PP.Lex(Tok); while (Tok.isNot(tok::eof) && Tok.getLocation().isFileID() && - !strcmp(SourceMgr.getSourceName(Tok.getLocation()), "<predefines>")); + !strcmp(SourceMgr.getPresumedLoc(Tok.getLocation()).getFilename(), + "<predefines>")); while (1) { |