[Clang] [NFC] Fix unintended -Wreturn-type warnings everywhere in the test suite (#123464)

In preparation of making `-Wreturn-type` default to an error (as there
is virtually no situation where you’d *want* to fall off the end of a
function that is supposed to return a value), this patch fixes tests
that have relied on this being only a warning, of which there seem 
to be 3 kinds:

1. Tests which for no apparent reason have a function that triggers the
warning.

I suspect that a lot of these were on accident (or from before the
warning was introduced), since a lot of people will open issues w/ their
problematic code in the `main` function (which is the one case where you
don’t need to return from a non-void function, after all...), which
someone will then copy, possibly into a namespace, possibly renaming it,
the end result of that being that you end up w/ something that
definitely is not `main` anymore, but which still is declared as
returning `int`, and which still has no return statement (another reason
why I think this might apply to a lot of these is because usually the
actual return type of such problematic functions is quite literally
`int`).
  
A lot of these are really old tests that don’t use `-verify`, which is
why no-one noticed or had to care about the extra warning that was
already being emitted by them until now.

2. Tests which test either `-Wreturn-type`, `[[noreturn]]`, or what
codegen and sanitisers do whenever you do fall off the end of a
function.

3. Tests where I struggle to figure out what is even being tested
(usually because they’re Objective-C tests, and I don’t know
Objective-C), whether falling off the end of a function matters in the
first place, and tests where actually spelling out an expression to
return would be rather cumbersome (e.g. matrix types currently don’t
support list initialisation, so I can’t write e.g. `return {}`).

For tests that fall into categories 2 and 3, I just added
`-Wno-error=return-type` to the `RUN` lines and called it a day. This
was especially necessary for the former since `-Wreturn-type` is an
analysis-based warning, meaning that it is currently impossible to test
for more than one occurrence of it in the same compilation if it
defaults to an error since the analysis pass is skipped for subsequent
functions as soon as an error is emitted.

I’ve also added `-Werror=return-type` to a few tests that I had already
updated as this patch was previously already making the warning an error
by default, but we’ve decided to split that into two patches instead.
This commit is contained in:
Sirraide
2025-01-18 19:16:33 +01:00
committed by GitHub
parent a5fb2bbb2a
commit 12f78e740c
147 changed files with 271 additions and 211 deletions

View File

@@ -69,7 +69,7 @@ id test2(A* val) {
return val;
}
id test3(void) {
void test3(void) {
id a = [[A alloc] init];
[a autorelease];
}

View File

@@ -64,6 +64,6 @@ id test2(A* val) {
return val;
}
id test3(void) {
void test3(void) {
id a = [[A alloc] init];
}

View File

@@ -21,7 +21,7 @@ id IhaveSideEffect(void);
@synthesize bar;
-(id)something {}
-(id)something { return (id)0; }
-(id)test:(id)obj {
id x = self.bar;

View File

@@ -21,7 +21,7 @@ id IhaveSideEffect(void);
@synthesize bar;
-(id)something {}
-(id)something { return (id)0; }
-(id)test:(id)obj {
id x = self.bar;

View File

@@ -5,7 +5,7 @@ struct S {
int f(this S&);
};
int main() {
void main() {
S s;
int x = s.f();
// CHECK: CallExpr 0x{{[^ ]*}} <col:11, col:15> 'int

View File

@@ -253,25 +253,25 @@ struct TrivialCopyAssignment {
struct NontrivialCopyAssignment {
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialCopyAssignment definition
// CHECK: CopyAssignment {{.*}}non_trivial{{.*}}
NontrivialCopyAssignment& operator=(const NontrivialCopyAssignment&) {}
NontrivialCopyAssignment& operator=(const NontrivialCopyAssignment&) { return *this; }
};
struct CopyAssignmentHasConstParam {
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentHasConstParam definition
// CHECK: CopyAssignment {{.*}}has_const_param{{.*}}
CopyAssignmentHasConstParam& operator=(const CopyAssignmentHasConstParam&) {}
CopyAssignmentHasConstParam& operator=(const CopyAssignmentHasConstParam&) { return *this; }
};
struct CopyAssignmentDoesNotHaveConstParam {
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentDoesNotHaveConstParam definition
// CHECK-NOT: CopyAssignment {{.*}} has_const_param{{.*}}
CopyAssignmentDoesNotHaveConstParam& operator=(CopyAssignmentDoesNotHaveConstParam&) {}
CopyAssignmentDoesNotHaveConstParam& operator=(CopyAssignmentDoesNotHaveConstParam&) { return *this; }
};
struct UserDeclaredCopyAssignment {
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredCopyAssignment definition
// CHECK: CopyAssignment {{.*}}user_declared{{.*}}
UserDeclaredCopyAssignment& operator=(const UserDeclaredCopyAssignment&) {}
UserDeclaredCopyAssignment& operator=(const UserDeclaredCopyAssignment&) { return *this; }
};
struct NonUserDeclaredCopyAssignment {
@@ -288,7 +288,7 @@ struct NeedsImplicitCopyAssignment {
struct DoesNotNeedImplicitCopyAssignment {
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitCopyAssignment definition
// CHECK-NOT: CopyAssignment {{.*}}needs_implicit{{.*}}
DoesNotNeedImplicitCopyAssignment& operator=(const DoesNotNeedImplicitCopyAssignment&) {}
DoesNotNeedImplicitCopyAssignment& operator=(const DoesNotNeedImplicitCopyAssignment&) { return *this; }
};
struct DeclaresCopyAssignment {
@@ -352,13 +352,13 @@ struct TrivialMoveAssignment {
struct NontrivialMoveAssignment {
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialMoveAssignment definition
// CHECK: MoveAssignment {{.*}}non_trivial{{.*}}
NontrivialMoveAssignment& operator=(NontrivialMoveAssignment&&) {}
NontrivialMoveAssignment& operator=(NontrivialMoveAssignment&&) { return *this; }
};
struct UserDeclaredMoveAssignment {
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredMoveAssignment definition
// CHECK: MoveAssignment {{.*}}user_declared{{.*}}
UserDeclaredMoveAssignment& operator=(UserDeclaredMoveAssignment&&) {}
UserDeclaredMoveAssignment& operator=(UserDeclaredMoveAssignment&&) { return *this; }
};
struct NonUserDeclaredMoveAssignment {
@@ -375,7 +375,7 @@ struct NeedsImplicitMoveAssignment {
struct DoesNotNeedImplicitMoveAssignment {
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitMoveAssignment definition
// CHECK-NOT: MoveAssignment {{.*}}needs_implicit{{.*}}
DoesNotNeedImplicitMoveAssignment& operator=(DoesNotNeedImplicitMoveAssignment&&) {}
DoesNotNeedImplicitMoveAssignment& operator=(DoesNotNeedImplicitMoveAssignment&&) { return *this; }
};
struct MoveAssignmentNeedsOverloadResolution : virtual DeletedDestructor {

View File

@@ -6151,7 +6151,7 @@
<key>type</key><string>Argument with &apos;nonnull&apos; attribute passed null</string>
<key>check_name</key><string>core.NonNullParamChecker</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>c0b359a043c633f1b8d1581f68743361</string>
<key>issue_hash_content_of_line_in_context</key><string>4c580a2a9cf15947fa485a0a9e625306</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>RDar13295437</string>
<key>issue_hash_function_offset</key><string>3</string>

View File

@@ -1,4 +1,4 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
// RUN: %clang_analyze_cc1 -Wno-error=return-type -analyzer-checker=core,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
void clang_analyzer_eval(bool);

View File

@@ -1,4 +1,4 @@
// RUN: %clang_analyze_cc1 %s -analyzer-checker=core.NullDereference -analyzer-output=plist -Wno-error=implicit-int -o %t > /dev/null 2>&1
// RUN: %clang_analyze_cc1 %s -analyzer-checker=core.NullDereference -analyzer-output=plist -Wno-error=implicit-int -Wno-error=return-type -o %t > /dev/null 2>&1
// RUN: %normalize_plist <%t | diff -ub %S/Inputs/expected-plists/inline-unique-reports.c.plist -
static inline bug(int *p) {

View File

@@ -1914,8 +1914,8 @@ variable 'buf', which is not memory allocated by 'malloc()' [unix.Malloc]}}
(*crash_a)(); // expected-warning{{type specifier missing}}
// A CallEvent without a corresponding FunctionDecl.
crash_b() { crash_a(); } // no-crash
// expected-warning@-1{{type specifier missing}} expected-warning@-1{{non-void}}
crash_b() { crash_a(); return 0; } // no-crash
// expected-warning@-1{{type specifier missing}}
long *global_a;
void realloc_crash(void) {

View File

@@ -1,8 +1,8 @@
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin8 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.1 2>&1
// RUN: %clang_analyze_cc1 -Wno-error=return-type -triple i386-apple-darwin8 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.1 2>&1
// RUN: FileCheck -input-file=%t.1 -check-prefix=CHECK-darwin8 %s
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin9 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.2 2>&1
// RUN: %clang_analyze_cc1 -Wno-error=return-type -triple i386-apple-darwin9 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.2 2>&1
// RUN: FileCheck -input-file=%t.2 -check-prefix=CHECK-darwin9 %s
// RUN: %clang_analyze_cc1 -triple thumbv6-apple-ios4.0 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.3 2>&1
// RUN: %clang_analyze_cc1 -Wno-error=return-type -triple thumbv6-apple-ios4.0 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.3 2>&1
// RUN: FileCheck -input-file=%t.3 -check-prefix=CHECK-darwin9 %s
@interface MyClass {}

View File

@@ -1,4 +1,4 @@
// RUN: %clang_analyze_cc1 -std=c89 -Wno-int-conversion -analyzer-checker=core %s
// RUN: %clang_analyze_cc1 -Wno-error=return-type -std=c89 -Wno-int-conversion -analyzer-checker=core %s
x;
y(void **z) { // no-crash
*z = x;

View File

@@ -177,7 +177,7 @@ void RDar13295437_f(void *i) __attribute__((__nonnull__));
struct RDar13295437_S { int *i; };
int RDar13295437(void) {
void RDar13295437(void) {
struct RDar13295437_S s = {0};
struct RDar13295437_S *sp = &s;
RDar13295437_f(sp->i);

View File

@@ -2,7 +2,7 @@
// REQUIRES: asserts
// RUN: FileCheck --input-file=%t.plist %s
int foo(void) {}
void foo(void) {}
// CHECK: <key>diagnostics</key>

View File

@@ -1074,7 +1074,7 @@ void test_switch_with_compound_with_default() {
// CHECK-NEXT: Succs (1): B4
// CHECK: [B0 (EXIT)]
// CHECK-NEXT: Preds (1): B1
int test_switch_with_compound_without_default() {
void test_switch_with_compound_without_default() {
char c = '1';
switch (int i = getX()) {
case 0:

View File

@@ -3,10 +3,10 @@
void clang_analyzer_eval(bool);
struct s { int a; };
int foo() {
void foo() {
auto [a] = s{1};
clang_analyzer_eval(a == 1); // expected-warning{{TRUE}}
} // expected-warning{{non-void function does not return a value}}
}
struct s2 {
int &x;

View File

@@ -12,7 +12,7 @@ template <class T>
static T f(T t) {}
template <>
int f(int t) {}
int f(int t) { return 0; }
void g(int a) {
f(a);

View File

@@ -1,9 +1,9 @@
// RUN: %clang_cc1 -std=c++11 %s -Winvalid-noreturn -verify
// RUN: %clang_cc1 -Werror=return-type -std=c++11 %s -Winvalid-noreturn -verify
// An attribute-specifier-seq in a lambda-declarator appertains to the
// type of the corresponding function call operator.
void test_attributes() {
auto nrl = [](int x) -> int { if (x > 0) return x; }; // expected-warning{{on-void lambda does not return a value in all control paths}}
auto nrl = [](int x) -> int { if (x > 0) return x; }; // expected-error{{non-void lambda does not return a value in all control paths}}
// FIXME: GCC accepts the [[gnu::noreturn]] attribute here.
auto nrl2 = []() [[gnu::noreturn]] { return; }; // expected-warning{{attribute 'noreturn' ignored}}

View File

@@ -1,8 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
// RUN: %clang_cc1 -Werror=return-type -fsyntax-only -std=c++11 %s -verify
// Check that analysis-based warnings work in lambda bodies.
void analysis_based_warnings() {
(void)[]() -> int { }; // expected-warning{{non-void lambda does not return a value}}
(void)[]() -> int { }; // expected-error{{non-void lambda does not return a value}}
}
// Check that we get the right types of captured variables (the

View File

@@ -13,7 +13,7 @@ typedef struct Globals {
extern Uz_Globs G;
int extract_or_test_files(void) {
void extract_or_test_files(void) {
G.pInfo = G.info;
}

View File

@@ -5,7 +5,7 @@ typedef int sigjmp_buf[_JBLEN + 1];
int sigsetjmp(sigjmp_buf env, int savemask);
void bar(void);
sigjmp_buf B;
int foo(void) {
void foo(void) {
sigsetjmp(B, 1);
bar();
}

View File

@@ -4,7 +4,7 @@
union foo { int X; };
int test(union foo* F) {
void test(union foo* F) {
{
union foo { float X; } A;
}

View File

@@ -16,7 +16,7 @@ int Func64(struct bar* B) {
}
int test(void) {
void test(void) {
Func(0); /* should be renamed to call Func64 */
Func64(0);
}

View File

@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
int test(void) {
void test(void) {
__complex__ double C;
double D;
C / D;

View File

@@ -3,7 +3,7 @@
struct S { };
int xxxx(int a) {
void xxxx(int a) {
struct S comps[a];
comps[0];
}

View File

@@ -14,4 +14,4 @@ void bar(void) {
int func(void);
foo(func);
}
static int func(char** A, char ** B) {}
static int func(char** A, char ** B) { return 0; }

View File

@@ -2,7 +2,7 @@
// PR481
// RUN: %clang_cc1 %s -Wno-implicit-function-declaration -emit-llvm -o /dev/null
int flags(int a, int b, ...) {
void flags(int a, int b, ...) {
__builtin_va_list args;
__builtin_va_start(args,a); // not the last named arg
foo(args);

View File

@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c99 %s -emit-llvm -o - | \
// RUN: %clang_cc1 -Wno-error=return-type -std=c99 %s -emit-llvm -o - | \
// RUN: opt -O3 -disable-output
// PR580

View File

@@ -6,5 +6,6 @@ int svc_register (void (*dispatch) (int));
int svc_register (dispatch)
void (*dispatch) ();
{
return 0;
}

View File

@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -emit-llvm -O2 %s -o /dev/null
// RUN: %clang_cc1 -Wno-error=return-type -emit-llvm -O2 %s -o /dev/null
// PR2292.
__inline__ __attribute__ ((__pure__)) int g (void) {}
void f (int k) { k = g (); }

View File

@@ -22,6 +22,6 @@ static void bar(void *db) {
char s[5] = "hi";
int foo(void) {
void foo(void) {
bar(0);
}

View File

@@ -1,7 +1,7 @@
// RUN: %clang_cc1 %s -std=c89 -emit-llvm -o -
// PR2797
unsigned int
void
func_48 (signed char p_49)
{
signed char l_340;

View File

@@ -63,6 +63,7 @@ frame_hdr_cache[8];
_Unwind_Ptr
base_from_cb_data (struct unw_eh_callback_data *data)
{
return 0;
}
void

View File

@@ -14,4 +14,4 @@ enum kobject_action {
struct kobject;
// CHECK: i32 inreg %action
int kobject_uevent(struct kobject *kobj, enum kobject_action action) {}
void kobject_uevent(struct kobject *kobj, enum kobject_action action) {}

View File

@@ -14,4 +14,5 @@ typedef __WCHAR_TYPE__ wchar_t;
signed short _iodbcdm_sqlerror(void)
{
wchar_t _sqlState[6] = { L"\0" };
return 0;
}

View File

@@ -11,7 +11,7 @@ typedef __attribute__((vector_size(16))) int v4i32;
v4i32 (*bar)(int);
static int foo() {
(*bar)(0)[0];
return (*bar)(0)[0];
}
int fun() { return foo(); }

View File

@@ -206,6 +206,8 @@ struct fsd {
struct fsd pr52011(void) {
// CHECK: define{{.*}} { float, double } @
struct fsd x;
return x;
}
struct hsd {
@@ -216,6 +218,8 @@ struct hsd {
struct hsd pr52011_2(void) {
// CHECK: define{{.*}} { half, double } @
struct hsd x;
return x;
}
struct hsf {
@@ -226,6 +230,8 @@ struct hsf {
struct hsf pr52011_3(void) {
// CHECK: define{{.*}} <4 x half> @
struct hsf x;
return x;
}
struct fds {
@@ -237,4 +243,6 @@ struct fds {
struct fds pr52011_4(void) {
// CHECK-C: define{{.*}} { float, double } @pr52011_4
// CHECK-CPP: define{{.*}} void @_Z9pr52011_4v({{.*}} sret
struct fds x;
return x;
}

View File

@@ -26,4 +26,5 @@ __int128 test_expression(_Atomic __int128 *addr) {
// CHECK-LABEL: @test_expression
// CHECK: atomicrmw and ptr {{.*}} seq_cst, align 16
*addr &= 1;
return 0;
}

View File

@@ -4,7 +4,7 @@ typedef struct __attribute((aligned(16))) {int x[4];} ff;
// CHECK: alloca %struct.ff, align 16
// CHECK: alloca %struct.anon, align 16
int a(void) {
void a(void) {
ff a;
struct {int x[4];} b __attribute((aligned(16)));
}

View File

@@ -41,8 +41,8 @@ typedef struct {
int x, y, z;
} Point;
void *test_pointed_object(void *p) {
// CHECK: define {{.*}} ptr @test_pointed_object
void test_pointed_object(void *p) {
// CHECK: define {{.*}} void @test_pointed_object
Point *pt = (Point *)p;
cmse_check_pointed_object(pt, CMSE_MPU_READ);
// CHECK: call i32 @llvm.arm.cmse.tt

View File

@@ -53,8 +53,8 @@ typedef struct {
int x, y, z;
} Point;
void *test_pointed_object(void *p) {
// CHECK: define {{.*}} ptr @test_pointed_object
void test_pointed_object(void *p) {
// CHECK: define {{.*}} void @test_pointed_object
Point *pt = (Point *)p;
cmse_check_pointed_object(pt, CMSE_NONSECURE
| CMSE_MPU_READ

View File

@@ -8,7 +8,7 @@ static int baz(int x) {
return x * 10;
}
[[clang::noinline]] bool noi() { }
[[clang::noinline]] bool noi() { return true; }
[[msvc::noinline]] bool ms_noi() { return true; }
void foo(int i) {

View File

@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -emit-llvm -std=c2x %s -o - | FileCheck %s
// RUN: %clang_cc1 -triple %itanium_abi_triple -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-CXX
// RUN: %clang_cc1 -Wno-error=return-type -emit-llvm -std=c2x %s -o - | FileCheck %s
// RUN: %clang_cc1 -Wno-error=return-type -triple %itanium_abi_triple -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-CXX
typedef void (*fptrs_t[4])(void);
fptrs_t p __attribute__((noreturn));

View File

@@ -6,7 +6,7 @@
void foo(float *);
float bar(void) {
void bar(void) {
float lookupTable[] = {-1,-1,-1,0, -1,-1,0,-1, -1,-1,0,1, -1,-1,1,0,
-1,0,-1,-1, -1,0,-1,1, -1,0,1,-1, -1,0,1,1,
-1,1,-1,0, -1,1,0,-1, -1,1,0,1, -1,1,1,0,

View File

@@ -56,7 +56,7 @@ int test6(char *X) {
// CHECK: @test7
// PR12094
int test7(int *p) {
void test7(int *p) {
struct snd_pcm_hw_params_t* hwparams; // incomplete type.
// CHECK: call void @llvm.memset{{.*}} align 4 {{.*}}256, i1 false)

View File

@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsanitize=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-UBSAN
// RUN: %clang_cc1 -fsanitize-trap=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-TRAP
// RUN: %clang_cc1 -fsanitize=signed-integer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-OVERFLOW
// RUN: %clang_cc1 -Wno-error=return-type -fsanitize=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-UBSAN
// RUN: %clang_cc1 -Wno-error=return-type -fsanitize-trap=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-TRAP
// RUN: %clang_cc1 -Wno-error=return-type -fsanitize=signed-integer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-OVERFLOW
// CHECK-UBSAN: @[[INT:.*]] = private unnamed_addr constant { i16, i16, [6 x i8] } { i16 0, i16 11, [6 x i8] c"'int'\00" }

View File

@@ -29,7 +29,7 @@ class C1 {
virtual void f() {}
};
C1 *f1() {
void f1() {
myalloc<C1> allocator;
(void)allocator.allocate(16);
(void)allocator.allocate(16, 0);

View File

@@ -2,7 +2,7 @@
// REQUIRES: asserts
// CHECK: @a.a = internal global ptr blockaddress(@a, %A)
int a(void) {
void a(void) {
A:;static void* a = &&A;
}

View File

@@ -6,7 +6,7 @@ __attribute__((visibility("default")))
extern struct dispatch_queue_s _dispatch_main_q;
typedef struct dispatch_item_s *dispatch_item_t;
typedef void (^dispatch_legacy_block_t)(dispatch_item_t);
dispatch_item_t LEGACY_dispatch_call(dispatch_queue_t dq,
void LEGACY_dispatch_call(dispatch_queue_t dq,
dispatch_legacy_block_t dispatch_block,
dispatch_legacy_block_t callback_block) {
dispatch_queue_t lq = _dispatch_queue_get_current() ?: (&_dispatch_main_q);

View File

@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s
// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s
// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-unk-unk -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s
// RUN: %clang_cc1 -Wno-error=return-type -triple powerpc64-ibm-aix-xcoff -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s
// PR3023
void convert(void) {

View File

@@ -8,6 +8,7 @@ struct Mem {
struct Mem *columnMem(void){
static const struct Mem nullMem = { {} };
return 0;
}

View File

@@ -276,6 +276,7 @@ int exception_code_in_except(void) {
} __except(1) {
return _exception_code();
}
return 0;
}
// CHECK-LABEL: define dso_local i32 @exception_code_in_except()

View File

@@ -7,7 +7,7 @@ int x=sizeof(zxcv);
int y=__alignof__(zxcv);
void *test(int *i) {
void test(int *i) {
short a = 1;
i += a;
i + a;
@@ -18,7 +18,7 @@ _Bool test2b;
int test2(void) { if (test2b); return 0; }
// PR1921
int test3(void) {
void test3(void) {
const unsigned char *bp;
bp -= (short)1;
}

View File

@@ -162,7 +162,7 @@ void ParamPassing4(_BitInt(129) a) {}
// LA32-NOT: define{{.*}} void @ParamPassing4(ptr %{{.+}})
#endif
_BitInt(63) ReturnPassing(void){}
_BitInt(63) ReturnPassing(void) { return 0; }
// LIN64: define{{.*}} i64 @ReturnPassing(
// WIN64: define dso_local i63 @ReturnPassing(
// LIN32: define{{.*}} i63 @ReturnPassing(
@@ -193,7 +193,7 @@ _BitInt(63) ReturnPassing(void){}
// LA64: define{{.*}} signext i63 @ReturnPassing(
// LA32: define{{.*}} i63 @ReturnPassing(
_BitInt(64) ReturnPassing2(void){}
_BitInt(64) ReturnPassing2(void) { return 0; }
// LIN64: define{{.*}} i64 @ReturnPassing2(
// WIN64: define dso_local i64 @ReturnPassing2(
// LIN32: define{{.*}} i64 @ReturnPassing2(
@@ -224,7 +224,7 @@ _BitInt(64) ReturnPassing2(void){}
// LA64: define{{.*}} i64 @ReturnPassing2(
// LA32: define{{.*}} i64 @ReturnPassing2(
_BitInt(127) ReturnPassing3(void){}
_BitInt(127) ReturnPassing3(void) { return 0; }
// LIN64: define{{.*}} { i64, i64 } @ReturnPassing3(
// WIN64: define dso_local void @ReturnPassing3(ptr dead_on_unwind noalias writable sret
// LIN32: define{{.*}} void @ReturnPassing3(ptr dead_on_unwind noalias writable sret
@@ -257,7 +257,7 @@ _BitInt(127) ReturnPassing3(void){}
// LA64: define{{.*}} i127 @ReturnPassing3(
// LA32: define{{.*}} void @ReturnPassing3(ptr dead_on_unwind noalias writable sret
_BitInt(128) ReturnPassing4(void){}
_BitInt(128) ReturnPassing4(void) { return 0; }
// LIN64: define{{.*}} { i64, i64 } @ReturnPassing4(
// WIN64: define dso_local void @ReturnPassing4(ptr dead_on_unwind noalias writable sret
// LIN32: define{{.*}} void @ReturnPassing4(ptr dead_on_unwind noalias writable sret
@@ -289,7 +289,7 @@ _BitInt(128) ReturnPassing4(void){}
// LA32: define{{.*}} void @ReturnPassing4(ptr dead_on_unwind noalias writable sret
#if __BITINT_MAXWIDTH__ > 128
_BitInt(129) ReturnPassing5(void){}
_BitInt(129) ReturnPassing5(void) { return 0; }
// LIN64: define{{.*}} void @ReturnPassing5(ptr dead_on_unwind noalias writable sret
// WIN64: define dso_local void @ReturnPassing5(ptr dead_on_unwind noalias writable sret
// LIN32: define{{.*}} void @ReturnPassing5(ptr dead_on_unwind noalias writable sret
@@ -322,8 +322,8 @@ _BitInt(129) ReturnPassing5(void){}
// SparcV9 is odd in that it has a return-size limit of 256, not 128 or 64
// like other platforms, so test to make sure this behavior will still work.
_BitInt(256) ReturnPassing6(void) {}
_BitInt(256) ReturnPassing6(void) { return 0; }
// SPARCV9-NOT: define{{.*}} i256 @ReturnPassing6(
_BitInt(257) ReturnPassing7(void) {}
_BitInt(257) ReturnPassing7(void) { return 0; }
// SPARCV9-NOT: define{{.*}} void @ReturnPassing7(ptr dead_on_unwind noalias writable sret
#endif

View File

@@ -1,5 +1,5 @@
// RUN: %clang_cc1 %s -emit-llvm -o -
// RUN: %clang_cc1 %s -emit-llvm -O1 -o -
// RUN: %clang_cc1 %s -Wno-error=return-type -emit-llvm -o -
// RUN: %clang_cc1 %s -Wno-error=return-type -emit-llvm -O1 -o -
static int bar();
void foo() {

View File

@@ -1,12 +1,12 @@
// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -o - %s | \
// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -o - %s | \
// RUN: FileCheck %s --check-prefixes=CLEAN,CHECK
// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -fno-sanitize-memory-param-retval -o - %s | \
// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -fno-sanitize-memory-param-retval -o - %s | \
// RUN: FileCheck %s --check-prefixes=NOUNDEF,NOUNDEF_ONLY,CHECK
// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -mllvm -msan-eager-checks -o - %s | \
// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -mllvm -msan-eager-checks -o - %s | \
// RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER,CHECK
// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \
// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \
// RUN: FileCheck %s --check-prefixes=CLEAN,CHECK
// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -o - %s | \
// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -o - %s | \
// RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER,CHECK
void bar(int x) {

View File

@@ -1,12 +1,12 @@
// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -o - %s | \
// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -o - %s | \
// RUN: FileCheck %s --check-prefixes=CLEAN,CHECK
// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -fno-sanitize-memory-param-retval -o - %s | \
// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -fno-sanitize-memory-param-retval -o - %s | \
// RUN: FileCheck %s --check-prefixes=NOUNDEF,NOUNDEF_ONLY,CHECK
// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -mllvm -msan-eager-checks -o - %s | \
// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -mllvm -msan-eager-checks -o - %s | \
// RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER,CHECK
// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \
// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \
// RUN: FileCheck %s --check-prefixes=CLEAN,CHECK
// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -o - %s | \
// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -o - %s | \
// RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER,CHECK
void bar(int x) {

View File

@@ -592,7 +592,7 @@ void PR30346(void) {
extern char incomplete_char_array[];
// CHECK-LABEL: @incomplete_and_function_types
int incomplete_and_function_types(void) {
void incomplete_and_function_types(void) {
// CHECK: call i64 @llvm.objectsize.i64.p0
gi = OBJECT_SIZE_BUILTIN(incomplete_char_array, 0);
// CHECK: call i64 @llvm.objectsize.i64.p0

View File

@@ -4,16 +4,19 @@
float __complex__
p (float __complex__ a, float __complex__ b)
{
return 0;
}
// CHECK-LABEL: define{{.*}} { double, double } @q(ptr noundef byval({ double, double }) align 8 %a, ptr noundef byval({ double, double }) align 8 %b) #0 {
double __complex__
q (double __complex__ a, double __complex__ b)
{
return 0;
}
// CHECK-LABEL: define{{.*}} { i64, i64 } @r(ptr noundef byval({ i64, i64 }) align 8 %a, ptr noundef byval({ i64, i64 }) align 8 %b) #0 {
long long __complex__
r (long long __complex__ a, long long __complex__ b)
{
return 0;
}

View File

@@ -12,7 +12,7 @@ struct abc foo1(void);
// CHECK-DAG: declare {{.*}} @foo1(ptr dead_on_unwind writable sret(%struct.abc)
struct abc foo2();
// CHECK-DAG: declare {{.*}} @foo2(ptr dead_on_unwind writable sret(%struct.abc)
struct abc foo3(void){}
struct abc foo3(void) { return (struct abc){0}; }
// CHECK-DAG: define {{.*}} @foo3(ptr dead_on_unwind noalias writable sret(%struct.abc)
void bar(void) {

View File

@@ -19,4 +19,5 @@ void *f(void)
{
if (a.a)
return v;
return 0;
}

View File

@@ -27,7 +27,7 @@ void foo(void) {
}
// CHECK: @f1.l0 = internal global i32 ptrtoint (ptr @f1 to i32)
int f1(void) { static int l0 = (unsigned) f1; }
void f1(void) { static int l0 = (unsigned) f1; }
// PR7044
char *f2(char key) {

View File

@@ -136,7 +136,7 @@ struct a14 { short a; int b; } x = {1, 1};
/* flexible array members */
struct a15 {char a; int b[];} c15;
int a16(void) {c15.a = 1;}
void a16(void) {c15.a = 1;}
/* compound literals */
void f13(void) {

View File

@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -x c -debug-info-kind=line-tables-only -emit-llvm -fsanitize=returns-nonnull-attribute -o - %s | FileCheck %s
// RUN: %clang_cc1 -Wno-error=return-type -x c -debug-info-kind=line-tables-only -emit-llvm -fsanitize=returns-nonnull-attribute -o - %s | FileCheck %s
// The UBSAN function call in the epilogue needs to have a debug location.
__attribute__((returns_nonnull)) void *allocate(void) {}

View File

@@ -34,7 +34,7 @@ void fS65(void) { enum E9 e = s65.a; }
typedef union{
unsigned char x[65536];
} q;
int qfunc(void) {q buf; unsigned char* x = buf.x;}
void qfunc(void) {q buf; unsigned char* x = buf.x;}
union RR {_Bool a : 1;} RRU;
int RRF(void) {return RRU.a;}

View File

@@ -52,6 +52,7 @@ unsigned long fun_zi64(unsigned long a, unsigned long b) {
// CHECK-LABEL: define{{.*}} i128 @fun_si128(i128 noundef %a, i128 noundef %b) #0 {
__int128 fun_si128(__int128 a, __int128 b) {
return a;
}
// CHECK-LABEL: define{{.*}} i128 @fun_zi128(i128 noundef %a, i128 noundef %b) #0 {

View File

@@ -20,6 +20,8 @@ extern "C++"
{
static const nsIID & GetIID ()
{
static const nsIID i = {};
return i;
}
};
}
@@ -31,6 +33,8 @@ class nsIDOMEventListener:public nsISupports
{
public:static const nsIID & GetIID ()
{
static const nsIID i = {};
return i;
}
virtual nsresult
__attribute__ ((regparm (0), cdecl)) HandleEvent (nsIDOMEvent * event) =
@@ -42,6 +46,7 @@ public:static const nsIID & GetIID ()
{
static const nsIID iid = {
};
return iid;
}
virtual nsresult
__attribute__ ((regparm (0),

View File

@@ -55,6 +55,7 @@ namespace Manta
vector < _Tp, _Alloc > > iterator;
iterator end ()
{
return {};
}
};
class MantaInterface

View File

@@ -7,7 +7,7 @@ struct Bork {
unsigned int f2 : 30;
};
int Foo(Bork *hdr) {
void Foo(Bork *hdr) {
hdr->f1 = 7;
hdr->f2 = 927;
}

View File

@@ -1,7 +1,7 @@
// RUN: %clang_cc1 %s -emit-llvm -o /dev/null
typedef void (*Func) ();
typedef long long m64 __attribute__((__vector_size__(8), __may_alias__));
static inline m64 __attribute__((__always_inline__, __nodebug__)) _mm_set1_pi16() {}
static inline m64 __attribute__((__always_inline__, __nodebug__)) _mm_set1_pi16() { return {}; }
template <class MM>
static void Bork() {
const m64 mmx_0x00ff = _mm_set1_pi16();

View File

@@ -16,7 +16,7 @@ namespace std {
public:
typedef _Tp element_type;
auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { }
element_type& operator*() const throw() { }
element_type& operator*() const throw() { return *_M_ptr; }
};
}
class Pointer32 {
@@ -69,17 +69,17 @@ template <typename SIZE_AND_ENDIANNESS> void extract_dwarf_data_from_header(TExt
TRawSymbolOwnerData<typename SIZE_AND_ENDIANNESS::SIZE>& symbol_owner_data,
TAddressRelocator<typename SIZE_AND_ENDIANNESS::SIZE>* address_relocator) {}
struct CSCppSymbolOwnerHashFunctor {
size_t operator()(const CSCppSymbolOwner& symbol_owner) const {
void operator()(const CSCppSymbolOwner& symbol_owner) const {
# 97 "wrong_place_for_decl.cpp"
}
};
template <typename SIZE_AND_ENDIANNESS> CSCppSymbolOwnerData* create_symbol_owner_data_arch_specific(CSCppSymbolOwner* symbol_owner, const char* dsym_path) {
template <typename SIZE_AND_ENDIANNESS> void create_symbol_owner_data_arch_specific(CSCppSymbolOwner* symbol_owner, const char* dsym_path) {
typedef typename SIZE_AND_ENDIANNESS::SIZE SIZE;
std::auto_ptr< TRawSymbolOwnerData<SIZE> > data(new TRawSymbolOwnerData<SIZE>());
std::auto_ptr< TExtendedMachOHeader<SIZE_AND_ENDIANNESS> > header;
extract_dwarf_data_from_header(*header, *data, (TAddressRelocator<typename SIZE_AND_ENDIANNESS::SIZE>*)__null);
}
CSCppSymbolOwnerData* create_symbol_owner_data2(CSCppSymbolOwner* symbol_owner, const char* dsym_path) {
void create_symbol_owner_data2(CSCppSymbolOwner* symbol_owner, const char* dsym_path) {
create_symbol_owner_data_arch_specific< ISA32Little >(symbol_owner, dsym_path);
create_symbol_owner_data_arch_specific< ISA32Big >(symbol_owner, dsym_path);
create_symbol_owner_data_arch_specific< ISA64Little >(symbol_owner, dsym_path);

View File

@@ -41,7 +41,7 @@ template<typename T, unsigned int n>
using char1 = my_vector_type<char, 1>;
int mane() {
void mane() {
char1 f1{1};
char1 f2{1};

View File

@@ -22,7 +22,7 @@ struct Foo {
S sbar_[5];
};
int test1(void) {
void test1(void) {
Foo a;
}

View File

@@ -4,7 +4,7 @@
// CHECK: define{{.*}} i32 @_Z3foov() [[NUW:#[0-9]+]] align 1024
int foo() __attribute__((aligned(1024)));
int foo() { }
int foo() { return 0; }
class C {
virtual void bar1() __attribute__((aligned(1)));

View File

@@ -29,5 +29,6 @@ extern "C" {
struct test3_s {
};
bool operator==(const int& a, const test3_s& b) {
return false;
}
}

View File

@@ -1,8 +1,8 @@
// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift-base,shift-exponent,unreachable,return,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -fsanitize-recover=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift-base,shift-exponent,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECK-FUNCSAN
// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=vptr,address -fsanitize-recover=vptr,address -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-ASAN
// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=vptr -fsanitize-recover=vptr -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=DOWNCAST-NULL
// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=function -emit-llvm %s -o - -triple x86_64-linux-gnux32 | FileCheck %s --check-prefix=CHECK-FUNCSAN
// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=function -emit-llvm %s -o - -triple i386-linux-gnu | FileCheck %s --check-prefix=CHECK-FUNCSAN
// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -Wno-error=return-type -fsanitize=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift-base,shift-exponent,unreachable,return,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -fsanitize-recover=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift-base,shift-exponent,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECK-FUNCSAN
// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -Wno-error=return-type -fsanitize=vptr,address -fsanitize-recover=vptr,address -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-ASAN
// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -Wno-error=return-type -fsanitize=vptr -fsanitize-recover=vptr -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=DOWNCAST-NULL
// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -Wno-error=return-type -fsanitize=function -emit-llvm %s -o - -triple x86_64-linux-gnux32 | FileCheck %s --check-prefix=CHECK-FUNCSAN
// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -Wno-error=return-type -fsanitize=function -emit-llvm %s -o - -triple i386-linux-gnu | FileCheck %s --check-prefix=CHECK-FUNCSAN
struct S {
double d;

View File

@@ -11,7 +11,7 @@ void test0() {
namespace radar8446940 {
extern "C" void abort();
int main () {
void main () {
char x[1];
char *y = x ? : 0;

View File

@@ -55,6 +55,9 @@ static const int &foo() {
// CHECK-DAG: @_Z1tIKiE
return t<const int>;
}
static int x;
return x;
}

View File

@@ -12,7 +12,7 @@ namespace PR13570 {
template<typename T, typename U> struct P {};
template<typename T> struct A {
template<typename U> static P<T,U> isa(U);
decltype(isa(int())) f() {}
decltype(isa(int())) f() { return {}; }
};
template struct A<int>;
}

View File

@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -std=c++11 \
// RUN: %clang_cc1 -Wno-error=return-type -emit-llvm -debug-info-kind=standalone -std=c++11 \
// RUN: -triple thumbv7-apple-ios %s -o - | FileCheck %s
// This forward-declared scoped enum will be created while building its own

View File

@@ -4,9 +4,9 @@ struct D {
D();
D(const D&);
int x;
int d(int x);
void d(int x);
};
int D::d(int x) {
void D::d(int x) {
[=] {
return this->x;
}();

View File

@@ -24,7 +24,7 @@ int test3g = test3(__PRETTY_FUNCTION__);
struct test4A {
int j : 2;
};
int test4() {
void test4() {
test4A a;
(a.j = 2) = 3;
}

View File

@@ -56,6 +56,7 @@ inline int foo() {
};
};
L(3)('a');
return 0;
}
int use = foo();
}

View File

@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++11 -fclang-abi-compat=latest -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
// RUN: %clang_cc1 -Wno-error=return-type -std=c++11 -fclang-abi-compat=latest -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
namespace std {
typedef decltype(sizeof(int)) size_t;
@@ -327,7 +327,7 @@ namespace test7 {
template<class T> decltype(T{{1,2}}) fTB(T t) {}
template<class T> decltype(T({1,2})) fTC(T t) {}
int main() {
void main() {
fA1(1); // CHECK-LABEL: define {{.*}} @_ZN5test73fA1IiEEDTcmtlNS_1AELi1ELi2EEcvT__EES2_
fA2(1); // CHECK-LABEL: define {{.*}} @_ZN5test73fA2IiEEDTcmcvNS_1AEilLi1ELi2EEcvT__EES2_
fB1(1); // CHECK-LABEL: define {{.*}} @_ZN5test73fB1IiEEDTcmtlNS_1BELi1ELi2EEcvT__EES2_

View File

@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++11 -emit-llvm -triple=x86_64-apple-darwin9 -o - %s | FileCheck %s
// RUN: %clang_cc1 -Wno-error=return-type -std=c++11 -emit-llvm -triple=x86_64-apple-darwin9 -o - %s | FileCheck %s
template<unsigned I, typename ...Types>
struct X { };
@@ -47,7 +47,7 @@ template void f3<int>(const int*);
template void f3<int, float>(const int*, const float*);
// Mangling of type pack expansions in a template argument
template<typename ...Types> tuple<Types...> f4() {}
template<typename ...Types> tuple<Types...> f4() { return {}; }
// CHECK-LABEL: define weak_odr void @_Z2f4IJifdEE5tupleIJDpT_EEv
template tuple<int, float, double> f4();

View File

@@ -645,7 +645,7 @@ namespace test24 {
foo();
}
static char bar() {}
static char bar() { return 0; }
void test1() {
// CHECK: call noundef signext i8 @_ZN6test24L3barEv()
bar();
@@ -839,7 +839,7 @@ namespace test36 {
template<unsigned> struct A { };
template<typename ...Types>
auto f1(Types... values) -> A<sizeof...(values)> { }
auto f1(Types... values) -> A<sizeof...(values)> { return {}; }
// CHECK: define weak_odr {{.*}} @_ZN6test362f1IJifEEENS_1AIXsZfp_EEEDpT_
template A<2> f1(int, float);

View File

@@ -300,7 +300,11 @@ int test_extract_template(MyMatrix<int, 2, 2> Mat1) {
using double4x4 = double __attribute__((matrix_type(4, 4)));
template <class R, class C>
auto matrix_subscript(double4x4 m, R r, C c) -> decltype(m[r][c]) {}
auto matrix_subscript(double4x4 m, R r, C c) -> decltype(m[r][c]) {
// FIXME: We can't actually do 'return m[r][c]' here currently.
static double d;
return d;
}
double test_matrix_subscript(double4x4 m) {
// CHECK-LABEL: @_Z21test_matrix_subscriptu11matrix_typeILm4ELm4EdE(

View File

@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -no-enable-noundef-analysis -fenable-matrix -fclang-abi-compat=latest -triple x86_64-apple-darwin %s -emit-llvm -disable-llvm-passes -o - -std=c++17 | FileCheck %s
// RUN: %clang_cc1 -Wno-error=return-type -no-enable-noundef-analysis -fenable-matrix -fclang-abi-compat=latest -triple x86_64-apple-darwin %s -emit-llvm -disable-llvm-passes -o - -std=c++17 | FileCheck %s
typedef double dx5x5_t __attribute__((matrix_type(5, 5)));
typedef float fx3x4_t __attribute__((matrix_type(3, 4)));

View File

@@ -194,6 +194,7 @@ inline int switch_test(int x) {
return b + c++;
}
};
return 0;
}
int f();

View File

@@ -3,11 +3,12 @@
using size_t = decltype(sizeof(0));
extern "C" char *something(long long x) {
return nullptr;
}
// CHECK: @_Znwm ={{.*}} alias ptr (i64), ptr @something
void *operator new(size_t) __attribute__((alias("something")));
// PR16715: don't assert here.
// CHECK: call noalias noundef nonnull ptr @_Znwm(i64 noundef 4) #3{{$}}
// CHECK: call noalias noundef nonnull ptr @_Znwm(i64 noundef 4)
int *pr16715 = new int;

View File

@@ -1,7 +1,7 @@
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -fcxx-exceptions -fexceptions -disable-llvm-passes -std=c++03 -o - %s | FileCheck --check-prefixes=CHECK-EH-03 %s
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -fcxx-exceptions -fexceptions -disable-llvm-passes -std=c++11 -DCXX11 -o - %s | FileCheck --check-prefixes=CHECK-EH-11 %s
// RUN: %clang_cc1 -triple i386-unknown-unknown -Wno-error=return-type -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple i386-unknown-unknown -Wno-error=return-type -emit-llvm -fcxx-exceptions -fexceptions -disable-llvm-passes -std=c++03 -o - %s | FileCheck --check-prefixes=CHECK-EH-03 %s
// RUN: %clang_cc1 -triple i386-unknown-unknown -Wno-error=return-type -emit-llvm -fcxx-exceptions -fexceptions -disable-llvm-passes -std=c++11 -DCXX11 -o - %s | FileCheck --check-prefixes=CHECK-EH-11 %s
// Test code generation for the named return value optimization.
class X {

View File

@@ -3,6 +3,6 @@
// Make sure the call to b() doesn't get optimized out.
extern struct x {char& x,y;}y;
int b();
int a() { if (!&y.x) b(); }
void a() { if (!&y.x) b(); }
// CHECK: @_Z1bv

View File

@@ -1,8 +1,8 @@
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -o - %s | FileCheck --check-prefixes=CHECK,CHECK-COMMON %s
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -O -o - %s | FileCheck %s --check-prefixes=CHECK-OPT,CHECK-COMMON
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -fno-strict-return -o - %s | FileCheck %s --check-prefixes=CHECK-NOSTRICT,CHECK-COMMON
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -Wno-error=return-type -o - %s | FileCheck --check-prefixes=CHECK,CHECK-COMMON %s
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -Wno-error=return-type -O -o - %s | FileCheck %s --check-prefixes=CHECK-OPT,CHECK-COMMON
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -fno-strict-return -Wno-error=return-type -o - %s | FileCheck %s --check-prefixes=CHECK-NOSTRICT,CHECK-COMMON
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -fno-strict-return -Wno-return-type -o - %s | FileCheck %s --check-prefixes=CHECK-NOSTRICT,CHECK-COMMON
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -fno-strict-return -O -o - %s | FileCheck %s --check-prefixes=CHECK-NOSTRICT-OPT,CHECK-COMMON
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -fno-strict-return -Wno-error=return-type -O -o - %s | FileCheck %s --check-prefixes=CHECK-NOSTRICT-OPT,CHECK-COMMON
// CHECK-COMMON-LABEL: @_Z9no_return
int no_return() {

View File

@@ -140,7 +140,7 @@ namespace test4 {
B b;
}
unsigned test() {
void test() {
A<int>::foo();
}
}

View File

@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -O0 -emit-llvm -ftrapv -ftrap-function=mytrap %s -o - | FileCheck %s -check-prefix=TRAPFUNC
// RUN: %clang_cc1 -O0 -emit-llvm -ftrapv %s -o - | FileCheck %s -check-prefix=NOOPTION
// RUN: %clang_cc1 -O0 -emit-llvm -Wno-error=return-type -ftrapv -ftrap-function=mytrap %s -o - | FileCheck %s -check-prefix=TRAPFUNC
// RUN: %clang_cc1 -O0 -emit-llvm -Wno-error=return-type -ftrapv %s -o - | FileCheck %s -check-prefix=NOOPTION
// TRAPFUNC-LABEL: define {{(dso_local )?}}void @{{_Z12test_builtinv|\"\?test_builtin@@YAXXZ\"}}
// TRAPFUNC: call void @llvm.trap() [[ATTR0:#[0-9]+]]

View File

@@ -8,7 +8,7 @@
// CHECK-SAME: !dbg
struct SourceLocation {
SourceLocation acquire() {};
SourceLocation acquire() { return {}; };
};
extern "C" void __ubsan_handle_type_mismatch_v1(SourceLocation *Loc);
static void handleTypeMismatchImpl(SourceLocation *Loc) { Loc->acquire(); }

View File

@@ -14,5 +14,6 @@ struct A {
@end
@implementation AGy
- (unsigned) ver {
return 0;
}
@end

View File

@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fblocks -emit-llvm %s -o /dev/null
// RUN: %clang_cc1 -Wno-error=return-type -fblocks -emit-llvm %s -o /dev/null
@interface bork
- (id)B:(void (^)(void))blk;

View File

@@ -36,5 +36,6 @@
}
+ (NSAttributedString *)attributedStringWithString:(id)string image:(NSImage *)image {
NSMutableAttributedString *attrStr;
return 0;
}
@end

View File

@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple i686-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o %t %s
// RUN: %clang_cc1 -Wno-error=return-type -triple i686-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o %t %s
// RUN: FileCheck < %t %s
//
// CHECK: @OBJC_METH_VAR_TYPE_{{.*}} = private unnamed_addr constant [16 x i8] c"v12@0:4[3[4@]]8\00"

Some files were not shown because too many files have changed in this diff Show More