[cfe-commits] r70013 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/function.c
Chris Lattner
sabre at nondot.org
Fri Apr 24 22:51:56 PDT 2009
Author: lattner
Date: Sat Apr 25 00:51:56 2009
New Revision: 70013
URL: http://llvm.org/viewvc/llvm-project?rev=70013&view=rev
Log:
in:
typedef void foo(void);
We get a typedef for a functiontypeproto with no arguments, not
one with one argument and type void. This means the code being
removed in SemaDecl is dead.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/function.c
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=70013&r1=70012&r2=70013&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat Apr 25 00:51:56 2009
@@ -2153,7 +2153,7 @@
}
NewFD->setParams(Context, &Params[0], Params.size());
- } else if (R->getAsTypedefType()) {
+ } else if (isa<TypedefType>(R)) {
// When we're declaring a function with a typedef, as in the
// following example, we'll need to synthesize (unnamed)
// parameters for use in the declaration.
@@ -2162,15 +2162,7 @@
// typedef void fn(int);
// fn f;
// @endcode
- const FunctionProtoType *FT = R->getAsFunctionProtoType();
- if (!FT) {
- // This is a typedef of a function with no prototype, so we
- // don't need to do anything.
- } else if ((FT->getNumArgs() == 0) ||
- (FT->getNumArgs() == 1 && !FT->isVariadic() &&
- FT->getArgType(0)->isVoidType())) {
- // This is a zero-argument function. We don't need to do anything.
- } else {
+ if (const FunctionProtoType *FT = R->getAsFunctionProtoType()) {
// Synthesize a parameter for each argument type.
llvm::SmallVector<ParmVarDecl*, 16> Params;
for (FunctionProtoType::arg_type_iterator ArgType = FT->arg_type_begin();
Modified: cfe/trunk/test/Sema/function.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/function.c?rev=70013&r1=70012&r2=70013&view=diff
==============================================================================
--- cfe/trunk/test/Sema/function.c (original)
+++ cfe/trunk/test/Sema/function.c Sat Apr 25 00:51:56 2009
@@ -76,4 +76,7 @@
inline foo_t invalid_type() { // expected-error {{unknown type name 'foo_t'}}
}
+typedef void fn_t(void);
+fn_t t17;
+
More information about the cfe-commits
mailing list