[PATCH] D28451: [AVR] Add support for the 'interrupt' and 'naked' attributes

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 5 08:24:21 PST 2017

aaron.ballman added a comment.

Just one more issue due to the nature of needing a custom parsed attribute.

Comment at: lib/Sema/SemaDeclAttr.cpp:5130
+static void handleAVRInterruptAttr(Sema &S, Decl *D, const AttributeList &Attr) {
+  if (!isFunctionOrMethod(D)) {
+    S.Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type)
Because you have to do custom parsing, you also need to manually check that the attribute was not given any arguments and diagnose if they are present.

Comment at: test/Sema/avr-interrupt-attr.c:5
+struct a test __attribute__((interrupt)); // expected-warning {{'interrupt' attribute only applies to functions and methods}}
+__attribute__((interrupt)) void food() {}
Please add a test for `__attribute__((interrupt(12)))`, and a test with an Objective-C method. Similar for `signal`. You should add an ObjC method to the codegen tests as well.


More information about the cfe-commits mailing list