Str += 2;
Len -= 4;
}
-
+
switch (Len) {
case 6:
if (!memcmp(Str, "packed", 6)) return AT_packed;
break;
case 8:
if (!memcmp(Str, "annotate", 8)) return AT_annotate;
+ if (!memcmp(Str, "noreturn", 8)) return AT_noreturn;
break;
case 11:
if (!memcmp(Str, "vector_size", 11)) return AT_vector_size;
void HandleAlignedAttribute(Decl *d, AttributeList *rawAttr);
void HandlePackedAttribute(Decl *d, AttributeList *rawAttr);
void HandleAnnotateAttribute(Decl *d, AttributeList *rawAttr);
+ void HandleNoReturnAttribute(Decl *d, AttributeList *rawAttr);
void WarnUndefinedMethod(SourceLocation ImpLoc, ObjCMethodDecl *method,
bool &IncompleteImpl);
case AttributeList::AT_annotate:
HandleAnnotateAttribute(New, Attr);
break;
+ case AttributeList::AT_noreturn:
+ HandleNoReturnAttribute(New, Attr);
+ break;
default:
// FIXME: add other attributes...
break;
rawAttr->getName()->getName());
}
+void Sema::HandleNoReturnAttribute(Decl *d, AttributeList *rawAttr) {
+ // check the attribute arguments.
+ if (rawAttr->getNumArgs() != 0) {
+ Diag(rawAttr->getLoc(), diag::err_attribute_wrong_number_arguments,
+ std::string("0"));
+ return;
+ }
+
+ d->addAttr(new NoReturnAttr());
+}
+
void Sema::HandleAnnotateAttribute(Decl *d, AttributeList *rawAttr) {
// check the attribute arguments.
if (rawAttr->getNumArgs() != 1) {
enum Kind {
Aligned,
Packed,
- Annotate
+ Annotate,
+ NoReturn
};
private:
}
static bool classof(const AnnotateAttr *A) { return true; }
};
+
+class NoReturnAttr : public Attr {
+public:
+ NoReturnAttr() : Attr(NoReturn) {}
+
+ // Implement isa/cast/dyncast/etc.
+
+ static bool classof(const Attr *A) { return A->getKind() == NoReturn; }
+ static bool classof(const NoReturnAttr *A) { return true; }
+};
} // end namespace clang
AT_address_space,
AT_aligned,
AT_packed,
- AT_annotate
+ AT_annotate,
+ AT_noreturn
};
IdentifierInfo *getName() const { return AttrName; }