@@ -90,6 +90,19 @@ TEST(Attr, AnnotateType) {
9090 // Function Type Attributes
9191 __attribute__((noreturn)) int f_noreturn();
9292 __attribute__((preserve_most)) int f_cc_preserve_most();
93+
94+ #define PRESERVE_MOST __attribute__((preserve_most))
95+ PRESERVE_MOST int f_macro_attribue();
96+
97+ int (__attribute__((preserve_most)) f_paren_attribute)();
98+
99+ int (
100+ PRESERVE_MOST
101+ (
102+ __attribute__((warn_unused_result))
103+ (f_w_paren_and_attr)
104+ )
105+ ) ();
93106 )cpp" );
94107
95108 {
@@ -173,6 +186,19 @@ TEST(Attr, AnnotateType) {
173186 EXPECT_TRUE (FT->getCallConv () == CC_PreserveMost);
174187 }
175188
189+ {
190+ for (auto should_have_func_type_loc: {
191+ " f_macro_attribue" ,
192+ " f_paren_attribute" ,
193+ " f_w_paren_and_attr" ,
194+ }) {
195+ llvm::errs () << " O: " << should_have_func_type_loc << " \n " ;
196+ const FunctionDecl *Func = getFunctionNode (AST.get (), should_have_func_type_loc);
197+
198+ EXPECT_TRUE (Func->getFunctionTypeLoc ());
199+ }
200+ }
201+
176202 // The following test verifies getFunctionTypeLoc returns a type
177203 // which takes into account the attribute (instead of only the nake
178204 // type).
@@ -182,7 +208,7 @@ TEST(Attr, AnnotateType) {
182208 // with either:
183209 //
184210 // 1. It does NOT produce any AttributedType (for example it only
185- // sets one flag of the FunctionType's ExtInfo, ie NoReturn).
211+ // sets one flag of the FunctionType's ExtInfo, e.g. NoReturn).
186212 // 2. It produces an AttributedType with modified type and
187213 // equivalent type that are equal (for example, that's what
188214 // happens with Calling Convention attributes).
0 commit comments