[cfe-commits] r50906 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/format-attribute.c
Ted Kremenek
kremenek at apple.com
Fri May 9 10:36:25 PDT 2008
Author: kremenek
Date: Fri May 9 12:36:24 2008
New Revision: 50906
URL: http://llvm.org/viewvc/llvm-project?rev=50906&view=rev
Log:
Add attribute "format" support for typedefs of function pointers.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/format-attribute.c
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=50906&r1=50905&r2=50906&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri May 9 12:36:24 2008
@@ -2338,6 +2338,8 @@
Ty = decl->getType();
else if (FieldDecl *decl = dyn_cast<FieldDecl>(d))
Ty = decl->getType();
+ else if (TypedefDecl* decl = dyn_cast<TypedefDecl>(d))
+ Ty = decl->getUnderlyingType();
else
return 0;
Modified: cfe/trunk/test/Sema/format-attribute.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/format-attribute.c?rev=50906&r1=50905&r2=50906&view=diff
==============================================================================
--- cfe/trunk/test/Sema/format-attribute.c (original)
+++ cfe/trunk/test/Sema/format-attribute.c Fri May 9 12:36:24 2008
@@ -22,3 +22,5 @@
int (*printf)(const char *format, ...) __attribute__((__format__(printf, 1, 2))); // no-error
int (*printf2)(double format, ...) __attribute__((__format__(printf, 1, 2))); // expected-error {{format argument not a string type}}
};
+
+typedef int (*f3_ptr)(char*,...) __attribute__((format(printf,1,0))); // no-error
More information about the cfe-commits
mailing list