diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-12-05 18:35:37 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-12-05 18:35:37 +0000 |
commit | 307c92ecb82e59a8fa82912906e1b168a157cb82 (patch) | |
tree | 22d316fac029123027ee046882ce6b5a5bb4605c | |
parent | 2434dcfb022778b06cfd257d830d0249680b87cf (diff) | |
download | clang-307c92ecb82e59a8fa82912906e1b168a157cb82.tar.gz clang-307c92ecb82e59a8fa82912906e1b168a157cb82.tar.bz2 clang-307c92ecb82e59a8fa82912906e1b168a157cb82.tar.xz |
Merging r196387:
------------------------------------------------------------------------
r196387 | aaronballman | 2013-12-04 07:32:26 -0800 (Wed, 04 Dec 2013) | 1 line
When parsing ignored attribute arguments, presuming the first argument is an unresolved identifier the same way that we do for unknown arguments. This resolves PR18075, where we regressed the handling of OpenBSD's bounded attribute.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@196522 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 3 | ||||
-rw-r--r-- | test/Sema/attr-bounded.c | 15 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index a1c4ccdb6d..61b57a1d90 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -288,7 +288,8 @@ void Parser::ParseGNUAttributeArgs(IdentifierInfo *AttrName, // If we don't know how to parse this attribute, but this is the only // token in this argument, assume it's meant to be an identifier. - if (AttrKind == AttributeList::UnknownAttribute) { + if (AttrKind == AttributeList::UnknownAttribute || + AttrKind == AttributeList::IgnoredAttribute) { const Token &Next = NextToken(); IsIdentifierArg = Next.is(tok::r_paren) || Next.is(tok::comma); } diff --git a/test/Sema/attr-bounded.c b/test/Sema/attr-bounded.c new file mode 100644 index 0000000000..bf71fedf2d --- /dev/null +++ b/test/Sema/attr-bounded.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only %s
+// Make sure OpenBSD's bounded extension is accepted.
+
+typedef long ssize_t;
+typedef unsigned long size_t;
+typedef struct FILE FILE;
+
+ssize_t read(int, void *, size_t)
+ __attribute__((__bounded__(__buffer__,2,3)));
+int readlink(const char *, char *, size_t)
+ __attribute__((__bounded__(__string__,2,3)));
+size_t fread(void *, size_t, size_t, FILE *)
+ __attribute__((__bounded__(__size__,1,3,2)));
+char *getwd(char *)
+ __attribute__((__bounded__(__minbytes__,1,1024)));
\ No newline at end of file |