diff options
| author | Davide Italiano <davide@freebsd.org> | 2015-04-25 20:20:04 +0000 |
|---|---|---|
| committer | Davide Italiano <davide@freebsd.org> | 2015-04-25 20:20:04 +0000 |
| commit | 3c613d608da68fe34ab45c093f7765a7f83cbdba (patch) | |
| tree | e8e0365deebd6a4919354f73e9371f6453a9b39d /clang | |
| parent | 81bd06d787f9934f4ee8bd491b7ea389c9b05019 (diff) | |
| download | bcm5719-llvm-3c613d608da68fe34ab45c093f7765a7f83cbdba.tar.gz bcm5719-llvm-3c613d608da68fe34ab45c093f7765a7f83cbdba.zip | |
[Sema] Check if a builtin is FunctionPrototype().
Don't assume it's always is. This prevents a crash in Sema while
trying to merge return type for a builtin w/out function prototype.
PR: 23086
Differential Revision: http://reviews.llvm.org/D9235
Reviewed by: rsmith
llvm-svn: 235806
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 2 | ||||
| -rw-r--r-- | clang/test/Sema/crash-invalid-builtin.c | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 6916710036c..339280614ff 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1749,7 +1749,7 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID, Loc, Loc, II, R, /*TInfo=*/nullptr, SC_Extern, false, - /*hasPrototype=*/true); + R->isFunctionProtoType()); New->setImplicit(); // Create Decl objects for each parameter, adding them to the diff --git a/clang/test/Sema/crash-invalid-builtin.c b/clang/test/Sema/crash-invalid-builtin.c new file mode 100644 index 00000000000..1c5221fa40d --- /dev/null +++ b/clang/test/Sema/crash-invalid-builtin.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -triple=x86_64-apple-darwin -fsyntax-only -verify %s +// PR23086 + +__builtin_isinf(...); // expected-warning {{type specifier missing, defaults to 'int'}} expected-error {{ISO C requires a named parameter before '...'}} // expected-error {{conflicting types for '__builtin_isinf'}} // expected-note {{'__builtin_isinf' is a builtin with type 'int ()'}} |

