ExpectedObjectiveCInterface
};
-/// These constants match the enumerated choices of
-/// err_attribute_argument_n_type.
-enum AttributeArgumentNType {
- ArgumentIntOrBool,
- ArgumentIntegerConstant,
- ArgumentString,
- ArgumentIdentifier
-};
-
//===----------------------------------------------------------------------===//
// Helper functions
//===----------------------------------------------------------------------===//
!IdxExpr->isIntegerConstantExpr(IdxInt, S.Context)) {
std::string Name = std::string("'") + AttrName.str() + std::string("'");
S.Diag(AttrLoc, diag::err_attribute_argument_n_type) << Name.c_str()
- << AttrArgNum << ArgumentIntegerConstant << IdxExpr->getSourceRange();
+ << AttrArgNum << AANT_ArgumentIntegerConstant << IdxExpr->getSourceRange();
return false;
}
if (!isIntOrBool(Attr.getArg(0))) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << 1 << ArgumentIntOrBool;
+ << Attr.getName() << 1 << AANT_ArgumentIntOrBool;
return false;
}
if (!AL.getParameterName()) {
S.Diag(AL.getLoc(), diag::err_attribute_argument_n_type)
- << AL.getName()->getName() << 1 << ArgumentString;
+ << AL.getName()->getName() << 1 << AANT_ArgumentString;
return;
}
// Figure out our Kind, and check arguments while we're at it.
if (!Str || !Str->isAscii()) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << 1 << ArgumentString;
+ << Attr.getName() << 1 << AANT_ArgumentString;
return;
}
// GCC will accept anything as the argument of weakref. Should we
StringLiteral *Str = dyn_cast<StringLiteral>(Arg);
if (!Str || !Str->isAscii()) {
- S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << 1 << ArgumentString;
+ S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
+ << Attr.getName() << AANT_ArgumentString;
return;
}
// Check that it is a string.
if (!Str) {
- S.Diag(Attr.getLoc(), diag::err_attribute_not_string) << "tls_model";
+ S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
+ << Attr.getName() << AANT_ArgumentString;
return;
}
if (E->isTypeDependent() || E->isValueDependent() ||
!E->isIntegerConstantExpr(Idx, S.Context)) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << 1 << ArgumentIntegerConstant
+ << Attr.getName() << 1 << AANT_ArgumentIntegerConstant
<< E->getSourceRange();
return;
}
if (E->isTypeDependent() || E->isValueDependent() ||
!E->isIntegerConstantExpr(Idx, S.Context)) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << 1 << ArgumentIntegerConstant
+ << Attr.getName() << 1 << AANT_ArgumentIntegerConstant
<< E->getSourceRange();
return;
}
if (NumArgs == 1) {
StringLiteral *SE = dyn_cast<StringLiteral>(Attr.getArg(0));
if (!SE) {
- S.Diag(Attr.getArg(0)->getLocStart(), diag::err_attribute_not_string)
- << Attr.getName();
+ S.Diag(Attr.getArg(0)->getLocStart(), diag::err_attribute_argument_type)
+ << Attr.getName() << AANT_ArgumentString;
return;
}
Str = SE->getString();
StringLiteral *Str = dyn_cast<StringLiteral>(Arg);
if (!Str || !Str->isAscii()) {
- S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << 1 << ArgumentString;
+ S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
+ << Attr.getName() << AANT_ArgumentString;
return;
}
if (Attr.getNumArgs() != 0 || !Attr.getParameterName()) {
if (!Attr.getParameterName() && Attr.getNumArgs() == 1) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << 1 << ArgumentString;
+ << Attr.getName() << 1 << AANT_ArgumentString;
} else {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
<< Attr.getName() << 0;
static void handleBlocksAttr(Sema &S, Decl *D, const AttributeList &Attr) {
if (!Attr.getParameterName()) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << 1 << ArgumentString;
+ << Attr.getName() << 1 << AANT_ArgumentString;
return;
}
if (E->isTypeDependent() || E->isValueDependent() ||
!E->isIntegerConstantExpr(Idx, S.Context)) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << 1 << ArgumentIntegerConstant
+ << Attr.getName() << 1 << AANT_ArgumentIntegerConstant
<< E->getSourceRange();
return;
}
if (E->isTypeDependent() || E->isValueDependent() ||
!E->isIntegerConstantExpr(Idx, S.Context)) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << 2 << ArgumentIntegerConstant
+ << Attr.getName() << 2 << AANT_ArgumentIntegerConstant
<< E->getSourceRange();
return;
}
Expr *ArgExpr = Attr.getArg(0);
StringLiteral *SE = dyn_cast<StringLiteral>(ArgExpr);
if (!SE) {
- S.Diag(ArgExpr->getLocStart(), diag::err_attribute_not_string) << "section";
+ S.Diag(ArgExpr->getLocStart(), diag::err_attribute_argument_type)
+ << Attr.getName() << AANT_ArgumentString;
return;
}
if (!Attr.getParameterName()) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << 1 << ArgumentString;
+ << Attr.getName() << 1 << AANT_ArgumentString;
return;
}
if (IdxExpr->isTypeDependent() || IdxExpr->isValueDependent() ||
!IdxExpr->isIntegerConstantExpr(Idx, S.Context)) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << 2 << ArgumentIntegerConstant
+ << Attr.getName() << 2 << AANT_ArgumentIntegerConstant
<< IdxExpr->getSourceRange();
return;
}
if (FirstArgExpr->isTypeDependent() || FirstArgExpr->isValueDependent() ||
!FirstArgExpr->isIntegerConstantExpr(FirstArg, S.Context)) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << 3 << ArgumentIntegerConstant
+ << Attr.getName() << 3 << AANT_ArgumentIntegerConstant
<< FirstArgExpr->getSourceRange();
return;
}
// Make sure that there is a string literal as the annotation's single
// argument.
if (!SE) {
- S.Diag(ArgExpr->getLocStart(), diag::err_attribute_not_string) <<"annotate";
+ S.Diag(ArgExpr->getLocStart(), diag::err_attribute_argument_type)
+ << Attr.getName() << AANT_ArgumentString;
return;
}
Expr *Arg = attr.getArg(0);
StringLiteral *Str = dyn_cast<StringLiteral>(Arg);
if (!Str || !Str->isAscii()) {
- Diag(attr.getLoc(), diag::err_attribute_argument_n_type)
- << attr.getName() << 1 << ArgumentString;
+ Diag(attr.getLoc(), diag::err_attribute_argument_type) << attr.getName()
+ << AANT_ArgumentString;
attr.setInvalid();
return true;
}
MaxThreadsExpr->isValueDependent() ||
!MaxThreadsExpr->isIntegerConstantExpr(MaxThreads, S.Context)) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << 1 << ArgumentIntegerConstant
+ << Attr.getName() << 1 << AANT_ArgumentIntegerConstant
<< MaxThreadsExpr->getSourceRange();
return;
}
MinBlocksExpr->isValueDependent() ||
!MinBlocksExpr->isIntegerConstantExpr(MinBlocks, S.Context)) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << 2 << ArgumentIntegerConstant
+ << Attr.getName() << 2 << AANT_ArgumentIntegerConstant
<< MinBlocksExpr->getSourceRange();
return;
}
StringRef AttrName = Attr.getName()->getName();
if (!Attr.getParameterName()) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << /* arg num = */ 1 << ArgumentIdentifier;
+ << Attr.getName() << /* arg num = */ 1 << AANT_ArgumentIdentifier;
return;
}
IdentifierInfo *PointerKind = Attr.getParameterName();
if (!PointerKind) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << 1 << ArgumentIdentifier;
+ << Attr.getName() << 1 << AANT_ArgumentIdentifier;
return;
}
Expr *Arg = Attr.getArg(0);
StringLiteral *Str = dyn_cast<StringLiteral>(Arg);
if (!Str || !Str->isAscii()) {
- S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << Attr.getName() << 1 << ArgumentString;
+ S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
+ << Attr.getName() << AANT_ArgumentString;
return;
}
[repeatable][source_annotation_attribute( Parameter|ReturnValue )]
struct SA_Post{ SA_Post(); int attr; };
-[returnvalue:SA_Post( attr=1)]
+[returnvalue:SA_Post( attr=1)]
int foo1([SA_Post(attr=1)] void *param);
namespace {
- [returnvalue:SA_Post(attr=1)]
+ [returnvalue:SA_Post(attr=1)]
int foo2([SA_Post(attr=1)] void *param);
}
class T {
- [returnvalue:SA_Post(attr=1)]
+ [returnvalue:SA_Post(attr=1)]
int foo3([SA_Post(attr=1)] void *param);
};
extern "C" {
- [returnvalue:SA_Post(attr=1)]
+ [returnvalue:SA_Post(attr=1)]
int foo5([SA_Post(attr=1)] void *param);
}
void uuidof_test1()
-{
+{
__uuidof(0); // expected-error {{you need to include <guiddef.h> before using the '__uuidof' operator}}
}
unsigned char Data4[8];
} GUID;
-struct __declspec(uuid(L"00000000-0000-0000-1234-000000000047")) uuid_attr_bad1 { };// expected-error {{'uuid' attribute requires parameter 1 to be a string}}
-struct __declspec(uuid(3)) uuid_attr_bad2 { };// expected-error {{'uuid' attribute requires parameter 1 to be a string}}
+struct __declspec(uuid(L"00000000-0000-0000-1234-000000000047")) uuid_attr_bad1 { };// expected-error {{'uuid' attribute requires a string}}
+struct __declspec(uuid(3)) uuid_attr_bad2 { };// expected-error {{'uuid' attribute requires a string}}
struct __declspec(uuid("0000000-0000-0000-1234-0000500000047")) uuid_attr_bad3 { };// expected-error {{uuid attribute contains a malformed GUID}}
struct __declspec(uuid("0000000-0000-0000-Z234-000000000047")) uuid_attr_bad4 { };// expected-error {{uuid attribute contains a malformed GUID}}
struct __declspec(uuid("000000000000-0000-1234-000000000047")) uuid_attr_bad5 { };// expected-error {{uuid attribute contains a malformed GUID}}
struct __declspec(uuid("000000A0-0000-0000-C000-000000000049"))
struct_with_uuid2;
-struct
+struct
struct_with_uuid2 {} ;
int uuid_sema_test()
void template_uuid()
{
T expr;
-
+
__uuidof(T);
__uuidof(expr);
}
struct __declspec(uuid("000000A0-0000-0000-C000-000000000049")) late_defined_uuid;
-class CtorCall {
+class CtorCall {
public:
CtorCall& operator=(const CtorCall& that);
class Iterator {
};
};
-
+
template<class T>
class C2 {
typename C1<T>:: /*template*/ Iterator<0> Mypos; // expected-warning {{use 'template' keyword to treat 'Iterator' as a dependent template name}}
typename AAAA a;// expected-warning {{expected a qualified name after 'typename'}}
t = 3;
-
+
typedef typename T* pointerT;// expected-warning {{expected a qualified name after 'typename'}}
typedef typename SimpleTemplate<int> templateT;// expected-warning {{expected a qualified name after 'typename'}}
int __if_exists_init_list() {
int array1[] = {
- 0,
+ 0,
__if_exists(IF_EXISTS::Type) {2, }
3
};
int array2[] = {
- 0,
+ 0,
__if_exists(IF_EXISTS::Type_not) { this wont compile }
3
};
int array3[] = {
- 0,
+ 0,
__if_not_exists(IF_EXISTS::Type_not) {2, }
3
};
int array4[] = {
- 0,
+ 0,
__if_not_exists(IF_EXISTS::Type) { this wont compile }
3
};
int main () {
// Necessary to force instantiation in -fdelayed-template-parsing mode.
- test_late_defined_uuid<int>();
+ test_late_defined_uuid<int>();
redundant_typename<int>();
missing_template_keyword<int>();
}