[cfe-commits] r101226 - in /cfe/trunk: lib/Frontend/PrintPreprocessedOutput.cpp lib/Lex/PPDirectives.cpp test/Preprocessor/line-directive-output.c
Chris Lattner
sabre at nondot.org
Tue Apr 13 21:28:50 PDT 2010
Author: lattner
Date: Tue Apr 13 23:28:50 2010
New Revision: 101226
URL: http://llvm.org/viewvc/llvm-project?rev=101226&view=rev
Log:
Improve line marker directive locations, patch by Jordy Rose
Modified:
cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/test/Preprocessor/line-directive-output.c
Modified: cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp?rev=101226&r1=101225&r2=101226&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp Tue Apr 13 23:28:50 2010
@@ -219,7 +219,7 @@
SourceManager &SourceMgr = SM;
PresumedLoc UserLoc = SourceMgr.getPresumedLoc(Loc);
- unsigned NewLine = UserLoc.getLine()+1;
+ unsigned NewLine = UserLoc.getLine();
if (Reason == PPCallbacks::EnterFile) {
SourceLocation IncludeLoc = SourceMgr.getPresumedLoc(Loc).getIncludeLoc();
Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=101226&r1=101225&r2=101226&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Tue Apr 13 23:28:50 2010
@@ -716,7 +716,8 @@
SourceMgr.AddLineNote(DigitTok.getLocation(), LineNo, FilenameID);
if (Callbacks)
- Callbacks->FileChanged(DigitTok.getLocation(), PPCallbacks::RenameFile,
+ Callbacks->FileChanged(CurPPLexer->getSourceLocation(),
+ PPCallbacks::RenameFile,
SrcMgr::C_User);
}
@@ -865,7 +866,7 @@
else if (IsSystemHeader)
FileKind = SrcMgr::C_System;
- Callbacks->FileChanged(DigitTok.getLocation(), Reason, FileKind);
+ Callbacks->FileChanged(CurPPLexer->getSourceLocation(), Reason, FileKind);
}
}
Modified: cfe/trunk/test/Preprocessor/line-directive-output.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/line-directive-output.c?rev=101226&r1=101225&r2=101226&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/line-directive-output.c (original)
+++ cfe/trunk/test/Preprocessor/line-directive-output.c Tue Apr 13 23:28:50 2010
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -E %s 2>&1 | FileCheck %s -strict-whitespace
// PR6101
int a;
-// CHECK: # 2 "{{.*}}line-directive-output.c"
+// CHECK: # 1 "{{.*}}line-directive-output.c"
// CHECK: int a;
// CHECK-NEXT: # 50 "{{.*}}line-directive-output.c"
More information about the cfe-commits
mailing list