brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 5eaa4aa Raw
33 lines · c
1// Test without serialization:2// RUN: %clang_cc1 -w -ast-dump %s | FileCheck %s3//4// Test with serialization:5// RUN: %clang_cc1 -w -emit-pch -o %t %s6// 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 %s9 10// The cast construction code both for implicit and c-style casts is very11// different in C vs C++. This file is intended to test the C behavior.12 13// TODO: add tests covering the rest of the code in14// Sema::CheckAssignmentConstraints and Sema::PrepareScalarCast15 16// CHECK-LABEL: FunctionDecl {{.*}} cast_cvr_pointer17void 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;23}24 25// CHECK-LABEL: FunctionDecl {{.*}} cast_pointer_type26void 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;32}33