[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / AST / c-casts.c
blob5eaa4aaf234526b7ce691c24214b0686c3376f61
1 // Test without serialization:
2 // RUN: %clang_cc1 -w -ast-dump %s | FileCheck %s
3 //
4 // Test with serialization:
5 // RUN: %clang_cc1 -w -emit-pch -o %t %s
6 // RUN: %clang_cc1 -w -x c -include-pch %t -ast-dump-all /dev/null \
7 // RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
8 // RUN: | FileCheck %s
10 // The cast construction code both for implicit and c-style casts is very
11 // different in C vs C++. This file is intended to test the C behavior.
13 // TODO: add tests covering the rest of the code in
14 // Sema::CheckAssignmentConstraints and Sema::PrepareScalarCast
16 // CHECK-LABEL: FunctionDecl {{.*}} cast_cvr_pointer
17 void cast_cvr_pointer(char volatile * __restrict * const * p) {
18 char*** x;
19 // CHECK: ImplicitCastExpr {{.*}} 'char ***' <NoOp>
20 x = p;
21 // CHECK: CStyleCastExpr {{.*}} 'char ***' <NoOp>
22 x = (char***)p;
25 // CHECK-LABEL: FunctionDecl {{.*}} cast_pointer_type
26 void cast_pointer_type(char *p) {
27 void *x;
28 // CHECK: ImplicitCastExpr {{.*}} 'void *' <BitCast>
29 x = p;
30 // CHECK: CStyleCastExpr {{.*}} 'void *' <BitCast>
31 x = (void*)p;