Index: clang-tools-extra/docs/pp-trace.rst =================================================================== --- clang-tools-extra/docs/pp-trace.rst +++ clang-tools-extra/docs/pp-trace.rst @@ -582,6 +582,7 @@ ============== ================================================== ============================== ============================================================== Argument Name Argument Value Syntax Clang C++ Type Description ============== ================================================== ============================== ============================================================== +HashLoc "(file):(line):(col)" SourceLocation The location of the '#' that starts the directive. MacroNameTok (token) const Token The macro name token. MacroDirective (MD_Define|MD_Undefine|MD_Visibility) const MacroDirective The kind of macro directive from the MacroDirective structure. ============== ================================================== ============================== ============================================================== @@ -602,6 +603,7 @@ ============== ================================================== ============================== ============================================================== Argument Name Argument Value Syntax Clang C++ Type Description ============== ================================================== ============================== ============================================================== +HashLoc "(file):(line):(col)" SourceLocation The location of the '#' that starts the directive. MacroNameTok (token) const Token The macro name token. MacroDirective (MD_Define|MD_Undefine|MD_Visibility) const MacroDirective The kind of macro directive from the MacroDirective structure. ============== ================================================== ============================== ============================================================== @@ -659,13 +661,14 @@ Argument descriptions: -============== ================================================== ============================== =================================== +============== ================================================== ============================== ================================================== Argument Name Argument Value Syntax Clang C++ Type Description -============== ================================================== ============================== =================================== +============== ================================================== ============================== ================================================== +HashLoc "(file):(line):(col)" SourceLocation The location of the '#' that starts the directive. Loc "(file):(line):(col)" SourceLocation The location of the directive. ConditionRange ["(file):(line):(col)", "(file):(line):(col)"] SourceRange The source range for the condition. ConditionValue (true|false) bool The condition value. -============== ================================================== ============================== =================================== +============== ================================================== ============================== ================================================== Example::: @@ -681,14 +684,15 @@ Argument descriptions: -============== ================================================== ============================== =================================== +============== ================================================== ============================== ================================================== Argument Name Argument Value Syntax Clang C++ Type Description -============== ================================================== ============================== =================================== +============== ================================================== ============================== ================================================== +HashLoc "(file):(line):(col)" SourceLocation The location of the '#' that starts the directive. Loc "(file):(line):(col)" SourceLocation The location of the directive. ConditionRange ["(file):(line):(col)", "(file):(line):(col)"] SourceRange The source range for the condition. ConditionValue (true|false) bool The condition value. IfLoc "(file):(line):(col)" SourceLocation The location of the directive. -============== ================================================== ============================== =================================== +============== ================================================== ============================== ================================================== Example::: @@ -708,6 +712,7 @@ ============== ================================================== ============================== ============================================================== Argument Name Argument Value Syntax Clang C++ Type Description ============== ================================================== ============================== ============================================================== +HashLoc "(file):(line):(col)" SourceLocation The location of the '#' that starts the directive. Loc "(file):(line):(col)" SourceLocation The location of the directive. MacroNameTok (token) const Token The macro name token. MacroDirective (MD_Define|MD_Undefine|MD_Visibility) const MacroDirective The kind of macro directive from the MacroDirective structure. @@ -730,6 +735,7 @@ ============== ================================================== ============================== ============================================================== Argument Name Argument Value Syntax Clang C++ Type Description ============== ================================================== ============================== ============================================================== +HashLoc "(file):(line):(col)" SourceLocation The location of the '#' that starts the directive. Loc "(file):(line):(col)" SourceLocation The location of the directive. MacroNameTok (token) const Token The macro name token. MacroDirective (MD_Define|MD_Undefine|MD_Visibility) const MacroDirective The kind of macro directive from the MacroDirective structure. @@ -749,12 +755,13 @@ Argument descriptions: -============== ================================================== ============================== =================================== +============== ================================================== ============================== ================================================== Argument Name Argument Value Syntax Clang C++ Type Description -============== ================================================== ============================== =================================== +============== ================================================== ============================== ================================================== +HashLoc "(file):(line):(col)" SourceLocation The location of the '#' that starts the directive. Loc "(file):(line):(col)" SourceLocation The location of the else directive. IfLoc "(file):(line):(col)" SourceLocation The location of the if directive. -============== ================================================== ============================== =================================== +============== ================================================== ============================== ================================================== Example::: @@ -769,12 +776,13 @@ Argument descriptions: -============== ================================================== ============================== ==================================== +============== ================================================== ============================== ================================================== Argument Name Argument Value Syntax Clang C++ Type Description -============== ================================================== ============================== ==================================== +============== ================================================== ============================== ================================================== +HashLoc "(file):(line):(col)" SourceLocation The location of the '#' that starts the directive. Loc "(file):(line):(col)" SourceLocation The location of the endif directive. IfLoc "(file):(line):(col)" SourceLocation The location of the if directive. -============== ================================================== ============================== ==================================== +============== ================================================== ============================== ================================================== Example::: Index: clang-tools-extra/pp-trace/PPCallbacksTracker.cpp =================================================================== --- clang-tools-extra/pp-trace/PPCallbacksTracker.cpp +++ clang-tools-extra/pp-trace/PPCallbacksTracker.cpp @@ -329,6 +329,7 @@ const Token &MacroNameTok, const MacroDirective *MacroDirective) { beginCallback("MacroDefined"); + appendArgument("HashLoc", HashLoc); appendArgument("MacroNameTok", MacroNameTok); appendArgument("MacroDirective", MacroDirective); } @@ -339,6 +340,7 @@ const MacroDefinition &MacroDefinition, const MacroDirective *Undef) { beginCallback("MacroUndefined"); + appendArgument("HashLoc", HashLoc); appendArgument("MacroNameTok", MacroNameTok); appendArgument("MacroDefinition", MacroDefinition); } @@ -365,6 +367,7 @@ SourceRange ConditionRange, ConditionValueKind ConditionValue) { beginCallback("If"); + appendArgument("HashLoc", HashLoc); appendArgument("Loc", Loc); appendArgument("ConditionRange", ConditionRange); appendArgument("ConditionValue", ConditionValue, ConditionValueKindStrings); @@ -376,6 +379,7 @@ ConditionValueKind ConditionValue, SourceLocation IfLoc) { beginCallback("Elif"); + appendArgument("HashLoc", HashLoc); appendArgument("Loc", Loc); appendArgument("ConditionRange", ConditionRange); appendArgument("ConditionValue", ConditionValue, ConditionValueKindStrings); @@ -387,6 +391,7 @@ const Token &MacroNameTok, const MacroDefinition &MacroDefinition) { beginCallback("Ifdef"); + appendArgument("HashLoc", HashLoc); appendArgument("Loc", Loc); appendArgument("MacroNameTok", MacroNameTok); appendArgument("MacroDefinition", MacroDefinition); @@ -397,6 +402,7 @@ const Token &MacroNameTok, const MacroDefinition &MacroDefinition) { beginCallback("Ifndef"); + appendArgument("HashLoc", HashLoc); appendArgument("Loc", Loc); appendArgument("MacroNameTok", MacroNameTok); appendArgument("MacroDefinition", MacroDefinition); @@ -406,6 +412,7 @@ void PPCallbacksTracker::Else(SourceLocation HashLoc, SourceLocation Loc, SourceLocation IfLoc) { beginCallback("Else"); + appendArgument("HashLoc", HashLoc); appendArgument("Loc", Loc); appendArgument("IfLoc", IfLoc); } @@ -414,6 +421,7 @@ void PPCallbacksTracker::Endif(SourceLocation HashLoc, SourceLocation Loc, SourceLocation IfLoc) { beginCallback("Endif"); + appendArgument("HashLoc", HashLoc); appendArgument("Loc", Loc); appendArgument("IfLoc", IfLoc); } Index: clang-tools-extra/test/pp-trace/pp-trace-conditional.cpp =================================================================== --- clang-tools-extra/test/pp-trace/pp-trace-conditional.cpp +++ clang-tools-extra/test/pp-trace/pp-trace-conditional.cpp @@ -78,78 +78,96 @@ // CHECK: MacroNameTok: __STDC_UTF_32__ // CHECK-NEXT: MacroDirective: MD_Define // CHECK: - Callback: If +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:3:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:3:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:3:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:3:5"] // CHECK-NEXT: ConditionValue: CVK_True // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:4:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:4:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:3:2" // CHECK-NEXT: - Callback: If +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:6:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:6:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:6:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:6:5"] // CHECK-NEXT: ConditionValue: CVK_False // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:7:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:7:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:6:2" // CHECK-NEXT: - Callback: SourceRangeSkipped // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:6:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:7:2"] // CHECK-NEXT: - Callback: If +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:9:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:9:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:9:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:9:5"] // CHECK-NEXT: ConditionValue: CVK_True // CHECK-NEXT: - Callback: Else +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:10:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:10:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:9:2" // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:11:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:11:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:9:2" // CHECK-NEXT: - Callback: SourceRangeSkipped // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:10:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:11:2"] // CHECK-NEXT: - Callback: If +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:13:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:13:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:13:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:13:5"] // CHECK-NEXT: ConditionValue: CVK_False // CHECK-NEXT: - Callback: Else +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:14:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:14:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:13:2" // CHECK-NEXT: - Callback: SourceRangeSkipped // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:13:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:14:2"] // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:15:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:15:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:13:2" // CHECK-NEXT: - Callback: If +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:17:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:17:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:17:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:17:5"] // CHECK-NEXT: ConditionValue: CVK_True // CHECK-NEXT: - Callback: Elif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:18:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:18:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:18:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:18:8"] // CHECK-NEXT: ConditionValue: CVK_NotEvaluated // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:17:2" // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:19:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:19:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:17:2" // CHECK-NEXT: - Callback: SourceRangeSkipped // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:18:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:19:2"] // CHECK-NEXT: - Callback: If +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:20:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:20:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:20:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:20:5"] // CHECK-NEXT: ConditionValue: CVK_True // CHECK-NEXT: - Callback: Elif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:21:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:21:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:21:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:21:8"] // CHECK-NEXT: ConditionValue: CVK_NotEvaluated // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:20:2" // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:22:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:22:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:20:2" // CHECK-NEXT: - Callback: SourceRangeSkipped // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:21:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:22:2"] // CHECK-NEXT: - Callback: If +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:24:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:24:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:24:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:24:5"] // CHECK-NEXT: ConditionValue: CVK_False // CHECK-NEXT: - Callback: Elif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:25:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:25:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:25:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:25:7"] // CHECK-NEXT: ConditionValue: CVK_True @@ -157,55 +175,67 @@ // CHECK-NEXT: - Callback: SourceRangeSkipped // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:24:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:25:2"] // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:26:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:26:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:24:2" // CHECK-NEXT: - Callback: If +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:27:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:27:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:27:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:27:5"] // CHECK-NEXT: ConditionValue: CVK_False // CHECK-NEXT: - Callback: Elif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:28:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:28:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:28:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:28:7"] // CHECK-NEXT: ConditionValue: CVK_False // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:27:2" // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:29:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:29:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:27:2" // CHECK-NEXT: - Callback: SourceRangeSkipped // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:27:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:29:2"] // CHECK-NEXT: - Callback: If +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:30:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:30:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:30:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:30:5"] // CHECK-NEXT: ConditionValue: CVK_True // CHECK-NEXT: - Callback: Elif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:31:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:31:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:31:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:31:8"] // CHECK-NEXT: ConditionValue: CVK_NotEvaluated // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:30:2" // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:32:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:32:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:30:2" // CHECK-NEXT: - Callback: SourceRangeSkipped // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:31:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:32:2"] // CHECK-NEXT: - Callback: If +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:33:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:33:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:33:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:33:5"] // CHECK-NEXT: ConditionValue: CVK_True // CHECK-NEXT: - Callback: Elif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:34:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:34:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:34:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:34:8"] // CHECK-NEXT: ConditionValue: CVK_NotEvaluated // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:33:2" // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:35:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:35:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:33:2" // CHECK-NEXT: - Callback: SourceRangeSkipped // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:34:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:35:2"] // CHECK-NEXT: - Callback: If +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:37:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:37:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:37:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:37:5"] // CHECK-NEXT: ConditionValue: CVK_False // CHECK-NEXT: - Callback: Elif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:38:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:38:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:38:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:38:7"] // CHECK-NEXT: ConditionValue: CVK_True @@ -213,91 +243,112 @@ // CHECK-NEXT: - Callback: SourceRangeSkipped // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:37:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:38:2"] // CHECK-NEXT: - Callback: Else +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:39:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:39:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:37:2" // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:40:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:40:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:37:2" // CHECK-NEXT: - Callback: SourceRangeSkipped // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:39:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:40:2"] // CHECK-NEXT: - Callback: If +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:41:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:41:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:41:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:41:5"] // CHECK-NEXT: ConditionValue: CVK_False // CHECK-NEXT: - Callback: Elif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:42:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:42:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:42:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:42:7"] // CHECK-NEXT: ConditionValue: CVK_False // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:41:2" // CHECK-NEXT: - Callback: Else +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:43:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:43:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:41:2" // CHECK-NEXT: - Callback: SourceRangeSkipped // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:41:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:43:2"] // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:44:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:44:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:41:2" // CHECK-NEXT: - Callback: If +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:45:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:45:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:45:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:45:5"] // CHECK-NEXT: ConditionValue: CVK_True // CHECK-NEXT: - Callback: Elif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:46:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:46:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:46:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:46:8"] // CHECK-NEXT: ConditionValue: CVK_NotEvaluated // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:45:2" // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:48:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:48:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:45:2" // CHECK-NEXT: - Callback: SourceRangeSkipped // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:46:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:48:2"] // CHECK-NEXT: - Callback: If +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:49:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:49:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:49:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:49:5"] // CHECK-NEXT: ConditionValue: CVK_True // CHECK-NEXT: - Callback: Elif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:50:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:50:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:50:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:50:8"] // CHECK-NEXT: ConditionValue: CVK_NotEvaluated // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:49:2" // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:52:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:52:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:49:2" // CHECK-NEXT: - Callback: SourceRangeSkipped // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:50:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:52:2"] // CHECK-NEXT: - Callback: MacroDefined +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:54:1" // CHECK-NEXT: MacroNameTok: MACRO // CHECK-NEXT: MacroDirective: MD_Define // CHECK-NEXT: - Callback: Ifdef +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:55:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:55:2" // CHECK-NEXT: MacroNameTok: MACRO // CHECK-NEXT: MacroDefinition: [(local)] // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:56:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:56:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:55:2" // CHECK-NEXT: - Callback: Ifdef +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:57:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:57:2" // CHECK-NEXT: MacroNameTok: NO_MACRO // CHECK-NEXT: MacroDefinition: [] // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:58:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:58:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:57:2" // CHECK-NEXT: - Callback: SourceRangeSkipped // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:57:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:58:2"] // CHECK-NEXT: - Callback: Ifndef +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:59:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:59:2" // CHECK-NEXT: MacroNameTok: MACRO // CHECK-NEXT: MacroDefinition: [(local)] // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:60:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:60:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:59:2" // CHECK-NEXT: - Callback: SourceRangeSkipped // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:59:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:60:2"] // CHECK-NEXT: - Callback: Ifndef +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:61:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:61:2" // CHECK-NEXT: MacroNameTok: NO_MACRO // CHECK-NEXT: MacroDefinition: [] // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:62:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:62:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:61:2" // CHECK-NEXT: - Callback: EndOfMainFile Index: clang-tools-extra/test/pp-trace/pp-trace-include.cpp =================================================================== --- clang-tools-extra/test/pp-trace/pp-trace-include.cpp +++ clang-tools-extra/test/pp-trace/pp-trace-include.cpp @@ -81,6 +81,7 @@ // CHECK-NEXT: FileType: C_User // CHECK-NEXT: PrevFID: "{{.*}}{{[/\\]}}Inputs/Level1A.h" // CHECK-NEXT: - Callback: MacroDefined +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}Inputs/Level2A.h:1:1" // CHECK-NEXT: MacroNameTok: MACRO_2A // CHECK-NEXT: MacroDirective: MD_Define // CHECK-NEXT: - Callback: FileChanged @@ -89,6 +90,7 @@ // CHECK-NEXT: FileType: C_User // CHECK-NEXT: PrevFID: "{{.*}}{{[/\\]}}Inputs/Level2A.h" // CHECK-NEXT: - Callback: MacroDefined +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}Inputs/Level1A.h:2:1" // CHECK-NEXT: MacroNameTok: MACRO_1A // CHECK-NEXT: MacroDirective: MD_Define // CHECK-NEXT: - Callback: FileChanged @@ -127,6 +129,7 @@ // CHECK-NEXT: FileType: C_User // CHECK-NEXT: PrevFID: "{{.*}}{{[/\\]}}Inputs/Level1B.h" // CHECK-NEXT: - Callback: MacroDefined +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}Inputs/Level2B.h:1:1" // CHECK-NEXT: MacroNameTok: MACRO_2B // CHECK-NEXT: MacroDirective: MD_Define // CHECK-NEXT: - Callback: FileChanged @@ -135,6 +138,7 @@ // CHECK-NEXT: FileType: C_User // CHECK-NEXT: PrevFID: "{{.*}}{{[/\\]}}Inputs/Level2B.h" // CHECK-NEXT: - Callback: MacroDefined +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}Inputs/Level1B.h:2:1" // CHECK-NEXT: MacroNameTok: MACRO_1B // CHECK-NEXT: MacroDirective: MD_Define // CHECK-NEXT: - Callback: FileChanged Index: clang-tools-extra/test/pp-trace/pp-trace-macro.cpp =================================================================== --- clang-tools-extra/test/pp-trace/pp-trace-macro.cpp +++ clang-tools-extra/test/pp-trace/pp-trace-macro.cpp @@ -32,6 +32,7 @@ // CHECK-NEXT: MacroDirective: MD_Define // CHECK: - Callback: MacroDefined // CHECK: - Callback: MacroDefined +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:3:1" // CHECK-NEXT: MacroNameTok: MACRO // CHECK-NEXT: MacroDirective: MD_Define // CHECK-NEXT: - Callback: MacroExpands @@ -44,13 +45,16 @@ // CHECK-NEXT: MacroDefinition: [(local)] // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:5", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:19"] // CHECK-NEXT: - Callback: If +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:5", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:19"] // CHECK-NEXT: ConditionValue: CVK_True // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:6:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:6:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:2" // CHECK-NEXT: - Callback: MacroUndefined +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:7:1" // CHECK-NEXT: MacroNameTok: MACRO // CHECK-NEXT: MacroDefinition: [(local)] // CHECK-NEXT: - Callback: Defined @@ -58,15 +62,18 @@ // CHECK-NEXT: MacroDefinition: [] // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:5", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:19"] // CHECK-NEXT: - Callback: If +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:2" // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:5", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:19"] // CHECK-NEXT: ConditionValue: CVK_False // CHECK-NEXT: - Callback: Endif +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:9:1" // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:9:2" // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:2" // CHECK-NEXT: - Callback: SourceRangeSkipped // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:1", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:9:2"] // CHECK-NEXT: - Callback: MacroDefined +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:10:1" // CHECK-NEXT: MacroNameTok: FUNCMACRO // CHECK-NEXT: MacroDirective: MD_Define // CHECK-NEXT: - Callback: MacroExpands @@ -75,12 +82,15 @@ // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:11:9", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:11:20"] // CHECK-NEXT: Args: [1] // CHECK-NEXT: - Callback: MacroDefined +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:12:1" // CHECK-NEXT: MacroNameTok: X // CHECK-NEXT: MacroDirective: MD_Define // CHECK-NEXT: - Callback: MacroDefined +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:13:1" // CHECK-NEXT: MacroNameTok: X_IMPL // CHECK-NEXT: MacroDirective: MD_Define // CHECK-NEXT: - Callback: MacroDefined +// CHECK-NEXT: HashLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:14:1" // CHECK-NEXT: MacroNameTok: X_IMPL2 // CHECK-NEXT: MacroDirective: MD_Define // CHECK-NEXT: - Callback: MacroExpands