1 // RUN: pp-trace -callbacks '*,-FileChanged' %s -- -undef -target x86_64 -std=c++11 | FileCheck --strict-whitespace %s 2 3 #define MACRO 1 4 int i = MACRO; 5 #if defined(MACRO) 6 #endif 7 #undef MACRO 8 #if defined(MACRO) 9 #endif 10 #define FUNCMACRO(ARG1) ARG1 11 int j = FUNCMACRO(1); 12 #define X X_IMPL(a+y,b) X_IMPL2(c) 13 #define X_IMPL(p1,p2) 14 #define X_IMPL2(p1) 15 X 16 17 // CHECK: --- 18 // CHECK-NEXT: - Callback: MacroDefined 19 // CHECK: MacroNameTok: __STDC__ 20 // CHECK-NEXT: MacroDirective: MD_Define 21 // CHECK-NEXT: - Callback: MacroDefined 22 // CHECK: MacroNameTok: __STDC_HOSTED__ 23 // CHECK-NEXT: MacroDirective: MD_Define 24 // CHECK-NEXT: - Callback: MacroDefined 25 // CHECK: MacroNameTok: __cplusplus 26 // CHECK-NEXT: MacroDirective: MD_Define 27 // CHECK-NEXT: - Callback: MacroDefined 28 // CHECK: MacroNameTok: __STDC_UTF_16__ 29 // CHECK-NEXT: MacroDirective: MD_Define 30 // CHECK-NEXT: - Callback: MacroDefined 31 // CHECK: MacroNameTok: __STDC_UTF_32__ 32 // CHECK-NEXT: MacroDirective: MD_Define 33 // CHECK: - Callback: MacroDefined 34 // CHECK-NEXT: MacroNameTok: MACRO 35 // CHECK-NEXT: MacroDirective: MD_Define 36 // CHECK-NEXT: - Callback: MacroExpands 37 // CHECK-NEXT: MacroNameTok: MACRO 38 // CHECK-NEXT: MacroDefinition: [(local)] 39 // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:4:9", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:4:9"] 40 // CHECK-NEXT: Args: (null) 41 // CHECK-NEXT: - Callback: Defined 42 // CHECK-NEXT: MacroNameTok: MACRO 43 // CHECK-NEXT: MacroDefinition: [(local)] 44 // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:5", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:19"] 45 // CHECK-NEXT: - Callback: If 46 // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:2" 47 // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:5", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:19"] 48 // CHECK-NEXT: ConditionValue: CVK_True 49 // CHECK-NEXT: - Callback: Endif 50 // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:6:2" 51 // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:2" 52 // CHECK-NEXT: - Callback: MacroUndefined 53 // CHECK-NEXT: MacroNameTok: MACRO 54 // CHECK-NEXT: MacroDefinition: [(local)] 55 // CHECK-NEXT: - Callback: Defined 56 // CHECK-NEXT: MacroNameTok: MACRO 57 // CHECK-NEXT: MacroDefinition: [] 58 // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:5", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:19"] 59 // CHECK-NEXT: - Callback: If 60 // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:2" 61 // CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:5", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:19"] 62 // CHECK-NEXT: ConditionValue: CVK_False 63 // CHECK-NEXT: - Callback: Endif 64 // CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:9:2" 65 // CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:2" 66 // CHECK-NEXT: - Callback: SourceRangeSkipped 67 // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:1", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:9:2"] 68 // CHECK-NEXT: - Callback: MacroDefined 69 // CHECK-NEXT: MacroNameTok: FUNCMACRO 70 // CHECK-NEXT: MacroDirective: MD_Define 71 // CHECK-NEXT: - Callback: MacroExpands 72 // CHECK-NEXT: MacroNameTok: FUNCMACRO 73 // CHECK-NEXT: MacroDefinition: [(local)] 74 // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:11:9", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:11:20"] 75 // CHECK-NEXT: Args: [1] 76 // CHECK-NEXT: - Callback: MacroDefined 77 // CHECK-NEXT: MacroNameTok: X 78 // CHECK-NEXT: MacroDirective: MD_Define 79 // CHECK-NEXT: - Callback: MacroDefined 80 // CHECK-NEXT: MacroNameTok: X_IMPL 81 // CHECK-NEXT: MacroDirective: MD_Define 82 // CHECK-NEXT: - Callback: MacroDefined 83 // CHECK-NEXT: MacroNameTok: X_IMPL2 84 // CHECK-NEXT: MacroDirective: MD_Define 85 // CHECK-NEXT: - Callback: MacroExpands 86 // CHECK-NEXT: MacroNameTok: X 87 // CHECK-NEXT: MacroDefinition: [(local)] 88 // CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:15:1", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:15:1"] 89 // CHECK-NEXT: Args: (null) 90 // CHECK-NEXT: - Callback: MacroExpands 91 // CHECK-NEXT: MacroNameTok: X_IMPL 92 // CHECK-NEXT: MacroDefinition: [(local)] 93 // CHECK-NEXT: Range: [(nonfile), (nonfile)] 94 // CHECK-NEXT: Args: [a <plus> y, b] 95 // CHECK-NEXT: - Callback: MacroExpands 96 // CHECK-NEXT: MacroNameTok: X_IMPL2 97 // CHECK-NEXT: MacroDefinition: [(local)] 98 // CHECK-NEXT: Range: [(nonfile), (nonfile)] 99 // CHECK-NEXT: Args: [c] 100 // CHECK-NEXT: - Callback: EndOfMainFile 101 // CHECK-NEXT: ... 102