[PATCH] D18567: Block: Fix a crash when we have type attributes or qualifiers with omitted return type.
John McCall via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 29 13:25:28 PDT 2016
rjmccall added inline comments.
================
Comment at: lib/Sema/SemaType.cpp:1569
@@ +1568,3 @@
+ // Mark them as invalid.
+ attr.setInvalid();
+ }
----------------
It's not generally a good idea to set things as invalid if you're just emitting a warning. It might be different for parsed AttributeList objects, but... I'm not sure about that.
================
Comment at: lib/Sema/SemaType.cpp:1609
@@ +1608,3 @@
+ // Warn if we see type qualifiers for omitted return type on a block literal.
+ if (TypeQuals && isOmittedBlockReturnType(declarator)) {
+ diagnoseAndRemoveTypeQualifiers(S, DS, TypeQuals, Result,
----------------
Checking TypeQuals again here is redundant.
================
Comment at: lib/Sema/SemaType.cpp:1611
@@ +1610,3 @@
+ diagnoseAndRemoveTypeQualifiers(S, DS, TypeQuals, Result,
+ DeclSpec::TQ_const | DeclSpec::TQ_volatile | DeclSpec::TQ_atomic,
+ diag::warn_block_literal_qualifiers_on_omitted_return_type);
----------------
You're missing at least TQ_restrict. But why make this an enumerated list at all?
http://reviews.llvm.org/D18567
More information about the cfe-commits
mailing list