diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -206,7 +206,7 @@ Improvements to pp-trace ------------------------ -The improvements are... +- Added `HashLoc` information to `InclusionDirective` callback output. Clang-tidy Visual Studio plugin ------------------------------- diff --git a/clang-tools-extra/docs/pp-trace.rst b/clang-tools-extra/docs/pp-trace.rst --- a/clang-tools-extra/docs/pp-trace.rst +++ b/clang-tools-extra/docs/pp-trace.rst @@ -223,6 +223,7 @@ Example::: - Callback: InclusionDirective + HashLoc: "D:/Clang/llvmnewmod/clang-tools-extra/test/pp-trace/pp-trace-include.cpp:4:1" IncludeTok: include FileName: "Input/Level1B.h" IsAngled: false diff --git a/clang-tools-extra/pp-trace/PPCallbacksTracker.cpp b/clang-tools-extra/pp-trace/PPCallbacksTracker.cpp --- a/clang-tools-extra/pp-trace/PPCallbacksTracker.cpp +++ b/clang-tools-extra/pp-trace/PPCallbacksTracker.cpp @@ -137,6 +137,7 @@ llvm::StringRef SearchPath, llvm::StringRef RelativePath, const Module *Imported, SrcMgr::CharacteristicKind FileType) { beginCallback("InclusionDirective"); + appendArgument("HashLoc", HashLoc); appendArgument("IncludeTok", IncludeTok); appendFilePathArgument("FileName", FileName); appendArgument("IsAngled", IsAngled); diff --git a/clang-tools-extra/test/pp-trace/pp-trace-include.cpp b/clang-tools-extra/test/pp-trace/pp-trace-include.cpp --- a/clang-tools-extra/test/pp-trace/pp-trace-include.cpp +++ b/clang-tools-extra/test/pp-trace/pp-trace-include.cpp @@ -51,6 +51,7 @@ // CHECK-NEXT: FileType: C_User // CHECK-NEXT: PrevFID: (getFileEntryForID failed) // CHECK-NEXT: - Callback: InclusionDirective +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-include.cpp:3:1" // CHECK-NEXT: IncludeTok: include // CHECK-NEXT: FileName: "Inputs/Level1A.h" // CHECK-NEXT: IsAngled: false @@ -65,6 +66,7 @@ // CHECK-NEXT: FileType: C_User // CHECK-NEXT: PrevFID: (invalid) // CHECK-NEXT: - Callback: InclusionDirective +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}Inputs/Level1A.h:1:1" // CHECK-NEXT: IncludeTok: include // CHECK-NEXT: FileName: "Level2A.h" // CHECK-NEXT: IsAngled: false @@ -95,6 +97,7 @@ // CHECK-NEXT: FileType: C_User // CHECK-NEXT: PrevFID: "{{.*}}{{[/\\]}}Inputs/Level1A.h" // CHECK-NEXT: - Callback: InclusionDirective +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-include.cpp:4:1" // CHECK-NEXT: IncludeTok: include // CHECK-NEXT: FileName: "Inputs/Level1B.h" // CHECK-NEXT: IsAngled: false @@ -109,6 +112,7 @@ // CHECK-NEXT: FileType: C_User // CHECK-NEXT: PrevFID: (invalid) // CHECK-NEXT: - Callback: InclusionDirective +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}Inputs/Level1B.h:1:1" // CHECK-NEXT: IncludeTok: include // CHECK-NEXT: FileName: "Level2B.h" // CHECK-NEXT: IsAngled: false