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.

llvm-svn: 196387
This commit is contained in:
Aaron Ballman 2013-12-04 15:32:26 +00:00
parent c5f420e129
commit 66037479af
2 changed files with 17 additions and 1 deletions

View File

@ -288,7 +288,8 @@ void Parser::ParseGNUAttributeArgs(IdentifierInfo *AttrName,
// If we don't know how to parse this attribute, but this is the only // 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. // 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(); const Token &Next = NextToken();
IsIdentifierArg = Next.is(tok::r_paren) || Next.is(tok::comma); IsIdentifierArg = Next.is(tok::r_paren) || Next.is(tok::comma);
} }

View File

@ -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)));