forked from OSchip/llvm-project
Tighten up the determination of whether a function declaration has a
prototype. Thanks Eli! llvm-svn: 67533
This commit is contained in:
parent
6ad3bc2e7f
commit
d6b05f705b
|
@ -1895,7 +1895,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
|
||||||
bool HasPrototype =
|
bool HasPrototype =
|
||||||
getLangOptions().CPlusPlus ||
|
getLangOptions().CPlusPlus ||
|
||||||
(D.getNumTypeObjects() && D.getTypeObject(0).Fun.hasPrototype) ||
|
(D.getNumTypeObjects() && D.getTypeObject(0).Fun.hasPrototype) ||
|
||||||
!isa<FunctionType>(R.getTypePtr());
|
(!isa<FunctionType>(R.getTypePtr()) && R->isFunctionProtoType());
|
||||||
|
|
||||||
NewFD = FunctionDecl::Create(Context, DC,
|
NewFD = FunctionDecl::Create(Context, DC,
|
||||||
D.getIdentifierLoc(),
|
D.getIdentifierLoc(),
|
||||||
|
|
|
@ -116,3 +116,12 @@ extern __typeof (h1) h1 __attribute__((__sentinel__));
|
||||||
void i0 (unsigned short a0);
|
void i0 (unsigned short a0);
|
||||||
extern __typeof (i0) i1;
|
extern __typeof (i0) i1;
|
||||||
extern __typeof (i1) i1;
|
extern __typeof (i1) i1;
|
||||||
|
|
||||||
|
typedef int a();
|
||||||
|
typedef int a2(int*);
|
||||||
|
a x;
|
||||||
|
a2 x2;
|
||||||
|
void test_x() {
|
||||||
|
x(5);
|
||||||
|
x2(5); // expected-warning{{incompatible integer to pointer conversion passing 'int', expected 'int *'}}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue