aaron.ballman added inline comments.

================
Comment at: lib/Sema/SemaDecl.cpp:7464-7470
+    const Type *NonAttributedFTy = R.getTypePtr();
+    while (const auto *AttrTy = NonAttributedFTy->getAs<AttributedType>()) {
+      NonAttributedFTy = AttrTy->getModifiedType().getTypePtr();
+    }
     bool HasPrototype =
       (D.isFunctionDeclarator() && D.getFunctionTypeInfo().hasPrototype) ||
+      (!isa<FunctionType>(NonAttributedFTy) && R->isFunctionProtoType());
----------------
rsmith wrote:
> Rather than hardcoding the forms of type sugar that can appear here, can we 
> just use `R.getTypePtr()->getAs<FunctionType>()`? I expect we can also have 
> `ParenType`s wrapping the `FunctionNoProtoType` (`int (f)();`).
Good point about `ParenType`, but no, you cannot use 
`R->getAs<FunctionType>()`, because that strips off all sugar, including 
typedefs. However, I share your concern about hardcoding the forms of sugar. 
Perhaps we should add `getAsAdjusted<T>()` like you were suggesting for 
`TypeLoc` to `Type` as well?


https://reviews.llvm.org/D28166



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to