Const,
Pure,
Cleanup,
- Nodebug
+ Nodebug,
+ Noinline
};
private:
// Implement isa/cast/dyncast/etc.
static bool classof(const Attr *A) { return A->getKind() == Nodebug; }
- static bool classof(const DeprecatedAttr *A) { return true; }
+ static bool classof(const NodebugAttr *A) { return true; }
};
class WarnUnusedResultAttr : public Attr {
static bool classof(const Attr *A) { return A->getKind() == WarnUnusedResult;}
static bool classof(const WarnUnusedResultAttr *A) { return true; }
};
-
+
+class NoinlineAttr : public Attr {
+public:
+ NoinlineAttr() : Attr(Noinline) {}
+
+ // Implement isa/cast/dyncast/etc.
+
+ static bool classof(const Attr *A) { return A->getKind() == Noinline; }
+ static bool classof(const NoinlineAttr *A) { return true; }
+};
+
} // end namespace clang
#endif
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
+
+ if (!isFunctionOrMethod(d)) {
+ S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
+ << "always_inline" << 0 /*function*/;
+ return;
+ }
d->addAttr(new AlwaysInlineAttr());
}
return;
}
- if (!isa<FunctionDecl>(d)) {
+ if (!isFunctionOrMethod(d)) {
S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
<< "nodebug" << 0 /*function*/;
return;
d->addAttr(new NodebugAttr());
}
+static void HandleNoinlineAttr(Decl *d, const AttributeList &Attr, Sema &S) {
+ // check the attribute arguments.
+ if (Attr.getNumArgs() != 0) {
+ S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
+ return;
+ }
+
+ if (!isFunctionOrMethod(d)) {
+ S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
+ << "noinline" << 0 /*function*/;
+ return;
+ }
+
+ d->addAttr(new NoinlineAttr());
+}
+
//===----------------------------------------------------------------------===//
// Top Level Sema Entry Points
//===----------------------------------------------------------------------===//
case AttributeList::AT_pure: HandlePureAttr (D, Attr, S); break;
case AttributeList::AT_cleanup: HandleCleanupAttr (D, Attr, S); break;
case AttributeList::AT_nodebug: HandleNodebugAttr (D, Attr, S); break;
+ case AttributeList::AT_noinline: HandleNoinlineAttr (D, Attr, S); break;
case AttributeList::IgnoredAttribute:
// Just ignore
break;