-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Change all CHECK lines in test to include DAG to work when the compiler emits debug info in a different order. #67503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…er emits debug info in a different order.
|
@llvm/pr-subscribers-clang ChangesWhen the changes in f8aab28 were merged into our downstream compiler, it started failing because the compiler with our downstream patches applied was emitting the debug information in a different order than originally expected. The debug info was still correct, just in a different order. This changes the test to be more flexible in the search so that it works more generally. Sample debug output generated by our downstream compiler for this test: The match of the CHECK line on line 47 capturing a value for Full diff: https://github.com/llvm/llvm-project/pull/67503.diff 1 Files Affected:
diff --git a/clang/test/CodeGenCXX/debug-info-codeview-unnamed.cpp b/clang/test/CodeGenCXX/debug-info-codeview-unnamed.cpp
index 9602ac1b0249730..ed33a1934ee9e8f 100644
--- a/clang/test/CodeGenCXX/debug-info-codeview-unnamed.cpp
+++ b/clang/test/CodeGenCXX/debug-info-codeview-unnamed.cpp
@@ -3,58 +3,58 @@
int main(int argc, char* argv[], char* arge[]) {
//
- // LINUX: [[TYPE_OF_ONE:![0-9]+]] = distinct !DICompositeType(
- // LINUX-SAME: tag: DW_TAG_structure_type
- // LINUX-NOT: name:
- // LINUX-NOT: identifier:
- // LINUX-SAME: )
- //
- // MSVC: [[TYPE_OF_ONE:![0-9]+]] = distinct !DICompositeType
- // MSVC-SAME: tag: DW_TAG_structure_type
- // MSVC-SAME: name: "<unnamed-type-one>"
- // MSVC-SAME: identifier: ".?AU<unnamed-type-one>@?1??main@@9@"
- // MSVC-SAME: )
+ // LINUX-DAG: [[TYPE_OF_ONE:![0-9]+]] = distinct !DICompositeType(
+ // LINUX-DAG-SAME: tag: DW_TAG_structure_type
+ // LINUX-DAG-SAME-NOT: name:
+ // LINUX-DAG-SAME-NOT: identifier:
+ // LINUX-DAG-SAME: )
+ //
+ // MSVC-DAG: [[TYPE_OF_ONE:![0-9]+]] = distinct !DICompositeType
+ // MSVC-DAG-SAME: tag: DW_TAG_structure_type
+ // MSVC-DAG-SAME: name: "<unnamed-type-one>"
+ // MSVC-DAG-SAME: identifier: ".?AU<unnamed-type-one>@?1??main@@9@"
+ // MSVC-DAG-SAME: )
//
- // LINUX: [[TYPE_OF_TWO:![0-9]+]] = distinct !DICompositeType(
- // LINUX-SAME: tag: DW_TAG_structure_type
- // LINUX-NOT: name:
- // LINUX-NOT: identifier:
- // LINUX-SAME: )
- //
- // MSVC: [[TYPE_OF_TWO:![0-9]+]] = distinct !DICompositeType
- // MSVC-SAME: tag: DW_TAG_structure_type
- // MSVC-SAME: name: "<unnamed-type-two>"
- // MSVC-SAME: identifier: ".?AU<unnamed-type-two>@?2??main@@9@"
- // MSVC-SAME: )
+ // LINUX-DAG: [[TYPE_OF_TWO:![0-9]+]] = distinct !DICompositeType(
+ // LINUX-DAG-SAME: tag: DW_TAG_structure_type
+ // LINUX-DAG-SAME-NOT: name:
+ // LINUX-DAG-SAME-NOT: identifier:
+ // LINUX-DAG-SAME: )
+ //
+ // MSVC-DAG: [[TYPE_OF_TWO:![0-9]+]] = distinct !DICompositeType
+ // MSVC-DAG-SAME: tag: DW_TAG_structure_type
+ // MSVC-DAG-SAME: name: "<unnamed-type-two>"
+ // MSVC-DAG-SAME: identifier: ".?AU<unnamed-type-two>@?2??main@@9@"
+ // MSVC-DAG-SAME: )
//
- // LINUX: [[TYPE_OF_THREE:![0-9]+]] = distinct !DICompositeType(
- // LINUX-SAME: tag: DW_TAG_structure_type
- // LINUX-SAME: name: "named"
- // LINUX-NOT: identifier:
- // LINUX-SAME: )
- //
- // MSVC: [[TYPE_OF_THREE:![0-9]+]] = distinct !DICompositeType
- // MSVC-SAME: tag: DW_TAG_structure_type
- // MSVC-SAME: name: "named"
- // MSVC-SAME: identifier: ".?AUnamed@?1??main@@9@"
- // MSVC-SAME: )
+ // LINUX-DAG: [[TYPE_OF_THREE:![0-9]+]] = distinct !DICompositeType(
+ // LINUX-DAG-SAME: tag: DW_TAG_structure_type
+ // LINUX-DAG-SAME: name: "named"
+ // LINUX-DAG-SAME-NOT: identifier:
+ // LINUX-DAG-SAME: )
+ //
+ // MSVC-DAG: [[TYPE_OF_THREE:![0-9]+]] = distinct !DICompositeType
+ // MSVC-DAG-SAME: tag: DW_TAG_structure_type
+ // MSVC-DAG-SAME: name: "named"
+ // MSVC-DAG-SAME: identifier: ".?AUnamed@?1??main@@9@"
+ // MSVC-DAG-SAME: )
//
- // LINUX: [[TYPE_OF_FOUR:![0-9]+]] = distinct !DICompositeType(
- // LINUX-SAME: tag: DW_TAG_class_type
- // LINUX-NOT: name:
- // LINUX-NOT: identifier:
- // LINUX-SAME: )
- //
- // MSVC: [[TYPE_OF_FOUR:![0-9]+]] = distinct !DICompositeType
- // MSVC-SAME: tag: DW_TAG_class_type
- // MSVC-SAME: name: "<lambda_0>"
- // MSVC-SAME: identifier: ".?AV<lambda_0>@?0??main@@9@"
- // MSVC-SAME: )
+ // LINUX-DAG: [[TYPE_OF_FOUR:![0-9]+]] = distinct !DICompositeType(
+ // LINUX-DAG-SAME: tag: DW_TAG_class_type
+ // LINUX-DAG-SAME-NOT: name:
+ // LINUX-DAG-SAME-NOT: identifier:
+ // LINUX-DAG-SAME: )
+ //
+ // MSVC-DAG: [[TYPE_OF_FOUR:![0-9]+]] = distinct !DICompositeType
+ // MSVC-DAG-SAME: tag: DW_TAG_class_type
+ // MSVC-DAG-SAME: name: "<lambda_0>"
+ // MSVC-DAG-SAME: identifier: ".?AV<lambda_0>@?0??main@@9@"
+ // MSVC-DAG-SAME: )
// In CodeView, the LF_MFUNCTION entry for "bar()" refers to the forward
@@ -63,13 +63,13 @@ int main(int argc, char* argv[], char* arge[]) {
//
struct { void bar() {} } one;
//
- // LINUX: !{{[0-9]+}} = !DILocalVariable(name: "one"
- // LINUX-SAME: type: [[TYPE_OF_ONE]]
- // LINUX-SAME: )
+ // LINUX-DAG: !{{[0-9]+}} = !DILocalVariable(name: "one"
+ // LINUX-DAG-SAME: type: [[TYPE_OF_ONE]]
+ // LINUX-DAG-SAME: )
//
- // MSVC: !{{[0-9]+}} = !DILocalVariable(name: "one"
- // MSVC-SAME: type: [[TYPE_OF_ONE]]
- // MSVC-SAME: )
+ // MSVC-DAG: !{{[0-9]+}} = !DILocalVariable(name: "one"
+ // MSVC-DAG-SAME: type: [[TYPE_OF_ONE]]
+ // MSVC-DAG-SAME: )
// In CodeView, the LF_POINTER entry for "ptr2unnamed" refers to the forward
@@ -79,13 +79,13 @@ int main(int argc, char* argv[], char* arge[]) {
struct { int bar; } two = { 42 };
int decltype(two)::*ptr2unnamed = &decltype(two)::bar;
//
- // LINUX: !{{[0-9]+}} = !DILocalVariable(name: "two"
- // LINUX-SAME: type: [[TYPE_OF_TWO]]
- // LINUX-SAME: )
+ // LINUX-DAG: !{{[0-9]+}} = !DILocalVariable(name: "two"
+ // LINUX-DAG-SAME: type: [[TYPE_OF_TWO]]
+ // LINUX-DAG-SAME: )
//
- // MSVC: !{{[0-9]+}} = !DILocalVariable(name: "two"
- // MSVC-SAME: type: [[TYPE_OF_TWO]]
- // MSVC-SAME: )
+ // MSVC-DAG: !{{[0-9]+}} = !DILocalVariable(name: "two"
+ // MSVC-DAG-SAME: type: [[TYPE_OF_TWO]]
+ // MSVC-DAG-SAME: )
// In DWARF, named structures which are not externally visibile do not
@@ -94,13 +94,13 @@ int main(int argc, char* argv[], char* arge[]) {
//
struct named { int bar; int named::* p2mem; } three = { 42, &named::bar };
//
- // LINUX: !{{[0-9]+}} = !DILocalVariable(name: "three"
- // LINUX-SAME: type: [[TYPE_OF_THREE]]
- // LINUX-SAME: )
+ // LINUX-DAG: !{{[0-9]+}} = !DILocalVariable(name: "three"
+ // LINUX-DAG-SAME: type: [[TYPE_OF_THREE]]
+ // LINUX-DAG-SAME: )
//
- // MSVC: !{{[0-9]+}} = !DILocalVariable(name: "three"
- // MSVC-SAME: type: [[TYPE_OF_THREE]]
- // MSVC-SAME: )
+ // MSVC-DAG: !{{[0-9]+}} = !DILocalVariable(name: "three"
+ // MSVC-DAG-SAME: type: [[TYPE_OF_THREE]]
+ // MSVC-DAG-SAME: )
// In CodeView, the LF_MFUNCTION entry for the lambda "operator()" routine
@@ -110,13 +110,13 @@ int main(int argc, char* argv[], char* arge[]) {
//
auto four = [argc](int i) -> int { return argc == i ? 1 : 0; };
//
- // LINUX: !{{[0-9]+}} = !DILocalVariable(name: "four"
- // LINUX-SAME: type: [[TYPE_OF_FOUR]]
- // LINUX-SAME: )
+ // LINUX-DAG: !{{[0-9]+}} = !DILocalVariable(name: "four"
+ // LINUX-DAG-SAME: type: [[TYPE_OF_FOUR]]
+ // LINUX-DAG-SAME: )
//
- // MSVC: !{{[0-9]+}} = !DILocalVariable(name: "four"
- // MSVC-SAME: type: [[TYPE_OF_FOUR]]
- // MSVC-SAME: )
+ // MSVC-DAG: !{{[0-9]+}} = !DILocalVariable(name: "four"
+ // MSVC-DAG-SAME: type: [[TYPE_OF_FOUR]]
+ // MSVC-DAG-SAME: )
return 0;
}
|
|
In general, you cannot combine suffixes in the same directive. FileCheck will detect and complain about some combinations, but it doesn't detect all of them. I believe |
When the changes in f8aab28 were merged into our downstream compiler, it started failing because the compiler with our downstream patches applied was emitting the debug information in a different order than originally expected. The debug info was still correct, just in a different order. This changes the test to be more flexible in the search so that it works more generally.
Sample debug output generated by our downstream compiler for this test:
The match of the CHECK line on line 47 capturing a value for
TYPE_OF_FOURwas matched on line!36of the debug output. When it next tried to find the variable definition for "one" the check failed because it had already passed it (it was previously emitted as!23).