r235806 - [Sema] Check if a builtin is FunctionPrototype().
Davide Italiano
davide at freebsd.org
Sat Apr 25 13:20:05 PDT 2015
Author: davide
Date: Sat Apr 25 15:20:04 2015
New Revision: 235806
URL: http://llvm.org/viewvc/llvm-project?rev=235806&view=rev
Log:
[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
Added:
cfe/trunk/test/Sema/crash-invalid-builtin.c
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=235806&r1=235805&r2=235806&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat Apr 25 15:20:04 2015
@@ -1749,7 +1749,7 @@ NamedDecl *Sema::LazilyCreateBuiltin(Ide
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
Added: cfe/trunk/test/Sema/crash-invalid-builtin.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/crash-invalid-builtin.c?rev=235806&view=auto
==============================================================================
--- cfe/trunk/test/Sema/crash-invalid-builtin.c (added)
+++ cfe/trunk/test/Sema/crash-invalid-builtin.c Sat Apr 25 15:20:04 2015
@@ -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 ()'}}
More information about the cfe-commits
mailing list