aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-01-20 14:18:40 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-01-20 14:18:40 +0000
commit9e013515aaeb42fb2182dbaaab787ea52ecba07b (patch)
tree127d3bad7a3b9761537d4f25b11f7cb77242f9ae
parent9ff54e1fcbdc30a13803e6ce8f4c0fe726cdae2d (diff)
downloadllvm-9e013515aaeb42fb2182dbaaab787ea52ecba07b.zip
llvm-9e013515aaeb42fb2182dbaaab787ea52ecba07b.tar.gz
llvm-9e013515aaeb42fb2182dbaaab787ea52ecba07b.tar.bz2
HasFunctionProto is a more strict version of FunctionLike. Since attribute subjects are inclusive (passing a single subject test means no subject-related diagnostic will fire), these two subjects should not be combined.
llvm-svn: 199662
-rw-r--r--clang/include/clang/Basic/Attr.td23
1 files changed, 12 insertions, 11 deletions
diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td
index 5869692..f1eb97e 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -65,6 +65,9 @@ def DeclBase : AttrSubject;
def FunctionLike : SubsetSubject<DeclBase,
[{S->getFunctionType(false) != NULL}]>;
+// HasFunctionProto is a more strict version of FunctionLike, so it should
+// never be specified in a Subjects list along with FunctionLike (due to the
+// inclusive nature of subject testing).
def HasFunctionProto : SubsetSubject<DeclBase,
[{(S->getFunctionType(true) != NULL &&
isa<FunctionProtoType>(S->getFunctionType())) ||
@@ -554,15 +557,15 @@ def Format : InheritableAttr {
let Spellings = [GNU<"format">, CXX11<"gnu", "format">];
let Args = [IdentifierArgument<"Type">, IntArgument<"FormatIdx">,
IntArgument<"FirstArg">];
- let Subjects = SubjectList<[ObjCMethod, Block, FunctionLike,
- HasFunctionProto], WarnDiag, "ExpectedFunction">;
+ let Subjects = SubjectList<[ObjCMethod, Block, HasFunctionProto], WarnDiag,
+ "ExpectedFunction">;
}
def FormatArg : InheritableAttr {
let Spellings = [GNU<"format_arg">, CXX11<"gnu", "format_arg">];
let Args = [IntArgument<"FormatIdx">];
- let Subjects = SubjectList<[ObjCMethod, FunctionLike, HasFunctionProto],
- WarnDiag, "ExpectedFunction">;
+ let Subjects = SubjectList<[ObjCMethod, HasFunctionProto], WarnDiag,
+ "ExpectedFunction">;
}
def GNUInline : InheritableAttr {
@@ -679,9 +682,8 @@ def NoMips16 : InheritableAttr, TargetSpecificAttr<TargetMips> {
def NonNull : InheritableAttr {
let Spellings = [GNU<"nonnull">, CXX11<"gnu", "nonnull">];
- let Subjects = SubjectList<[ObjCMethod, FunctionLike, HasFunctionProto,
- ParmVar],
- WarnDiag, "ExpectedFunctionMethodOrParameter">;
+ let Subjects = SubjectList<[ObjCMethod, HasFunctionProto, ParmVar], WarnDiag,
+ "ExpectedFunctionMethodOrParameter">;
let Args = [VariadicUnsignedArgument<"Args">];
let AdditionalMembers =
[{bool isNonNull(unsigned idx) const {
@@ -695,8 +697,8 @@ def NonNull : InheritableAttr {
def ReturnsNonNull : InheritableAttr {
let Spellings = [GNU<"returns_nonnull">];
- let Subjects = SubjectList<[ObjCMethod, FunctionLike, HasFunctionProto],
- WarnDiag, "ExpectedFunctionOrMethod">;
+ let Subjects = SubjectList<[ObjCMethod, HasFunctionProto], WarnDiag,
+ "ExpectedFunctionOrMethod">;
}
def NoReturn : InheritableAttr {
@@ -836,8 +838,7 @@ def Ownership : InheritableAttr {
}
}];
let Args = [IdentifierArgument<"Module">, VariadicUnsignedArgument<"Args">];
- let Subjects = SubjectList<[FunctionLike, HasFunctionProto], WarnDiag,
- "ExpectedFunction">;
+ let Subjects = SubjectList<[HasFunctionProto], WarnDiag, "ExpectedFunction">;
}
def Packed : InheritableAttr {