mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-05 23:52:45 +00:00
Improve line marker directive locations, patch by Jordy Rose
llvm-svn: 101226
This commit is contained in:
parent
851002d42e
commit
c745cec17c
@ -219,7 +219,7 @@ void PrintPPOutputPPCallbacks::FileChanged(SourceLocation Loc,
|
||||
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();
|
||||
|
@ -716,7 +716,8 @@ void Preprocessor::HandleLineDirective(Token &Tok) {
|
||||
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 @@ void Preprocessor::HandleDigitDirective(Token &DigitTok) {
|
||||
else if (IsSystemHeader)
|
||||
FileKind = SrcMgr::C_System;
|
||||
|
||||
Callbacks->FileChanged(DigitTok.getLocation(), Reason, FileKind);
|
||||
Callbacks->FileChanged(CurPPLexer->getSourceLocation(), Reason, FileKind);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user