Based on post-commit review discussion on2bd8493847with Richard Smith. Other uses of forcing HasEmptyPlaceHolder to false seem OK to me - they're all around pointer/reference types where the pointer/reference token will appear at the rightmost side of the left side of the type name, so they make nested types (eg: the "int" in "int *") behave as though there is a non-empty placeholder (because the "*" is essentially the placeholder as far as the "int" is concerned). This was originally committed in277623f4d5Reverted inf9ad1d1c77due to breakages outside of clang - lldb seems to have some strange/strong dependence on "char [N]" versus "char[N]" when printing strings (not due to that name appearing in DWARF, but probably due to using clang to stringify type names) that'll need to be addressed, plus a few other odds and ends in other subprojects (clang-tools-extra, compiler-rt, etc).
68 lines
2.9 KiB
C++
68 lines
2.9 KiB
C++
// Test without serialization:
|
|
// RUN: %clang_cc1 -ast-dump %s | FileCheck %s
|
|
//
|
|
// Test with serialization:
|
|
// RUN: %clang_cc1 -emit-pch -o %t %s
|
|
// RUN: %clang_cc1 -x c++ -include-pch %t -ast-dump-all /dev/null \
|
|
// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
|
|
// RUN: | FileCheck %s
|
|
|
|
template<int N = 0>
|
|
void pr43370() {
|
|
int arr[2];
|
|
__atomic_store_n(arr, 0, 5);
|
|
}
|
|
|
|
template<int N = 0>
|
|
void foo() {
|
|
int arr[2];
|
|
(void)__atomic_compare_exchange_n(arr, arr, 1, 0, 3, 4);
|
|
}
|
|
|
|
void useage(){
|
|
pr43370();
|
|
foo();
|
|
}
|
|
|
|
// CHECK:FunctionTemplateDecl 0x{{[0-9a-f]+}} <{{[^,]+}}, line:{{.*}}:1> line:{{.*}}:6 pr43370
|
|
// CHECK: AtomicExpr
|
|
// CHECK-NEXT: ImplicitCastExpr
|
|
// CHECK-SAME: <ArrayToPointerDecay>
|
|
// CHECK-NEXT: DeclRefExpr 0x{{[0-9a-f]+}} <{{[^:]+}}:20> 'int[2]' lvalue Var 0x{{[0-9a-f]+}} 'arr' 'int[2]'
|
|
// CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:28> 'int' 5
|
|
// CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:25> 'int' 0
|
|
// CHECK:FunctionDecl 0x{{[0-9a-f]+}} <line:{{.*}}:1, line:{{.*}}:1> line:{{.*}}:6 used pr43370
|
|
// CHECK: AtomicExpr
|
|
// CHECK-NEXT: ImplicitCastExpr
|
|
// CHECK-SAME: <ArrayToPointerDecay>
|
|
// CHECK-NEXT: DeclRefExpr 0x{{[0-9a-f]+}} <{{[^:]+}}:20> 'int[2]' lvalue Var 0x{{[0-9a-f]+}} 'arr' 'int[2]'
|
|
// CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:28> 'int' 5
|
|
// CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:25> 'int' 0
|
|
|
|
// CHECK:FunctionTemplateDecl 0x{{[0-9a-f]+}} <line:{{.*}}:1, line:{{.*}}:1> line:{{.*}}:6 foo
|
|
// CHECK: AtomicExpr
|
|
// CHECK-NEXT: ImplicitCastExpr
|
|
// CHECK-SAME: <ArrayToPointerDecay>
|
|
// CHECK-NEXT: DeclRefExpr 0x{{[0-9a-f]+}} <{{[^:]+}}:37> 'int[2]' lvalue Var 0x{{[0-9a-f]+}} 'arr' 'int[2]'
|
|
// CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:53> 'int' 3
|
|
// CHECK-NEXT: ImplicitCastExpr
|
|
// CHECK-SAME: <ArrayToPointerDecay>
|
|
// CHECK-NEXT: DeclRefExpr 0x{{[0-9a-f]+}} <{{[^:]+}}:42> 'int[2]' lvalue Var 0x{{[0-9a-f]+}} 'arr' 'int[2]'
|
|
// CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:56> 'int' 4
|
|
// CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:47> 'int' 1
|
|
// CHECK-NEXT: ImplicitCastExpr
|
|
// CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:50> 'int' 0
|
|
// CHECK:FunctionDecl 0x{{[0-9a-f]+}} <line:{{.*}}:1, line:{{.*}}:1> line:{{.*}}:6 used foo
|
|
// CHECK: AtomicExpr
|
|
// CHECK-NEXT: ImplicitCastExpr
|
|
// CHECK-SAME: <ArrayToPointerDecay>
|
|
// CHECK-NEXT: DeclRefExpr 0x{{[0-9a-f]+}} <{{[^:]+}}:37> 'int[2]' lvalue Var 0x{{[0-9a-f]+}} 'arr' 'int[2]'
|
|
// CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:53> 'int' 3
|
|
// CHECK-NEXT: ImplicitCastExpr
|
|
// CHECK-SAME: <ArrayToPointerDecay>
|
|
// CHECK-NEXT: DeclRefExpr 0x{{[0-9a-f]+}} <{{[^:]+}}:42> 'int[2]' lvalue Var 0x{{[0-9a-f]+}} 'arr' 'int[2]'
|
|
// CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:56> 'int' 4
|
|
// CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:47> 'int' 1
|
|
// CHECK-NEXT: ImplicitCastExpr
|
|
// CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:50> 'int' 0
|