mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 14:26:06 +00:00

A significant number of our tests in C accidentally use functions without prototypes. This patch converts the function signatures to have a prototype for the situations where the test is not specific to K&R C declarations. e.g., void func(); becomes void func(void); This is the fifth batch of tests being updated (there are a significant number of other tests left to be updated). Note, the behavior of -ast-print is broken. It prints functions with a prototype (void) as if they have no prototype () in C. Some tests need to disable strict prototype checking when recompiling the results of an -ast-print invocation.
23 lines
637 B
C
23 lines
637 B
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
|
|
|
|
void foo1(void*);
|
|
void foo2(void* const);
|
|
|
|
|
|
void bar(void) {
|
|
// CHECK: FunctionDecl {{.*}} <line:{{.*}}, line:{{.*}}> line:{{.*}} bar 'void (void)'
|
|
|
|
foo1(0);
|
|
// CHECK: ImplicitCastExpr {{.*}} <col:{{.*}}> 'void *' <NullToPointer>
|
|
|
|
foo2(0);
|
|
// CHECK: ImplicitCastExpr {{.*}} <col:{{.*}}> 'void *' <NullToPointer>
|
|
}
|