diff options
| author | Ted Kremenek <kremenek@apple.com> | 2008-05-09 17:36:24 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2008-05-09 17:36:24 +0000 |
| commit | 712c91f8a9cd5a10afba9081f3a71c281a4238e5 (patch) | |
| tree | f2efbbd21ed43a5092ec6eb36058fc21cb3eeec3 /clang | |
| parent | bbd4695a45f1d8550c0516136658d4af1f934beb (diff) | |
| download | bcm5719-llvm-712c91f8a9cd5a10afba9081f3a71c281a4238e5.tar.gz bcm5719-llvm-712c91f8a9cd5a10afba9081f3a71c281a4238e5.zip | |
Add attribute "format" support for typedefs of function pointers.
llvm-svn: 50906
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 2 | ||||
| -rw-r--r-- | clang/test/Sema/format-attribute.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 748b66fb3e1..afe877fb97e 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -2338,6 +2338,8 @@ static const FunctionTypeProto *getFunctionProto(Decl *d) { 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; diff --git a/clang/test/Sema/format-attribute.c b/clang/test/Sema/format-attribute.c index 8eefe3f0654..ecdef9dde1a 100644 --- a/clang/test/Sema/format-attribute.c +++ b/clang/test/Sema/format-attribute.c @@ -22,3 +22,5 @@ struct _mystruct { 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 |

