steven_wu added a comment.

Thanks for reviewing Erik!



================
Comment at: lib/Sema/SemaDecl.cpp:9134-9151
+  // Diagnose availability attributes. Availability cannot be used on functions
+  // that are run during load/unload.
+  for (const auto& attr: NewFD->attrs()) {
+    if (!isa<AvailabilityAttr>(attr))
+      continue;
+
+    if (NewFD->hasAttr<ConstructorAttr>()) {
----------------
erik.pilkington wrote:
> Shouldn't this be in ProcessDeclAttributeList in SemaDeclAttr.cpp?
This has to happen after mergeDeclAttributes, otherwise, you won't catch the 
case which the availability attributes and constructor attributes are on 
different decl that gets merged. It can't be in mergeDeclAttributes as well, 
then it won't catch the case they are on a single decl.


================
Comment at: lib/Sema/SemaDecl.cpp:9136
+  // that are run during load/unload.
+  for (const auto& attr: NewFD->attrs()) {
+    if (!isa<AvailabilityAttr>(attr))
----------------
erik.pilkington wrote:
> Can't this just be: `if (NewFD->hasAttr<AvailabilityAttr>())`?
The location of the diagnostics need to be on attributes and that is why it is 
a for loop.


Repository:
  rC Clang

https://reviews.llvm.org/D45699



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

Reply via email to