Skip to content
Snippets Groups Projects
Commit 53b3cde6 authored by Eli Friedman's avatar Eli Friedman
Browse files

Add abort() as a builtin. This has two effects: one, we warn for incorrect

declarations of abort(), and two, we mark it noreturn.  Missing the latter
shows up in one of the "embarassing" tests (from the thread on llvmdev
"detailed comparison of generated code size for LLVM and other compilers").

llvm-svn: 91515
parent ce5b95c0
No related branches found
No related tags found
No related merge requests found
...@@ -475,6 +475,7 @@ BUILTIN(__sync_fetch_and_umax, "UiUi*Ui", "n") ...@@ -475,6 +475,7 @@ BUILTIN(__sync_fetch_and_umax, "UiUi*Ui", "n")
// C99 library functions // C99 library functions
// C99 stdlib.h // C99 stdlib.h
LIBBUILTIN(abort, "v", "fr", "stdlib.h")
LIBBUILTIN(calloc, "v*zz", "f", "stdlib.h") LIBBUILTIN(calloc, "v*zz", "f", "stdlib.h")
LIBBUILTIN(exit, "vi", "fr", "stdlib.h") LIBBUILTIN(exit, "vi", "fr", "stdlib.h")
LIBBUILTIN(_Exit, "vi", "fr", "stdlib.h") LIBBUILTIN(_Exit, "vi", "fr", "stdlib.h")
......
...@@ -48,6 +48,7 @@ int setuid(uid_t); ...@@ -48,6 +48,7 @@ int setuid(uid_t);
int setregid(gid_t, gid_t); int setregid(gid_t, gid_t);
int setreuid(uid_t, uid_t); int setreuid(uid_t, uid_t);
extern void check(int); extern void check(int);
void abort(void);
void test_setuid() void test_setuid()
{ {
......
// RUN: %clang_cc1 %s -verify -fsyntax-only // RUN: %clang_cc1 %s -verify -fsyntax-only
void abort(void);
@interface Subclass @interface Subclass
+ (int)magicNumber; + (int)magicNumber;
+ (void)setMagicNumber:(int)value; + (void)setMagicNumber:(int)value;
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
- (void) setOptional_getter_attr:(int)value { ivar = value; } - (void) setOptional_getter_attr:(int)value { ivar = value; }
@end @end
void abort(void);
int main () int main ()
{ {
Test *x = [[Test alloc] init]; Test *x = [[Test alloc] init];
......
...@@ -80,6 +80,7 @@ static int g_val; ...@@ -80,6 +80,7 @@ static int g_val;
} }
@end @end
void abort(void);
int main (void) { int main (void) {
Subclass *x = [[Subclass alloc] init]; Subclass *x = [[Subclass alloc] init];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment