[PATCH] D45898: [SemaCXX] Mark destructor as referenced

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 31 18:37:53 PDT 2018


rsmith accepted this revision.
rsmith added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/Sema/SemaInit.cpp:1827-1829
+  if (SemaRef.DiagnoseUseOfDecl(Destructor, Loc))
+    return false;
+  return true;
----------------
Usual Clang convention is to return `true` on error.


================
Comment at: lib/Sema/SemaInit.cpp:1856
+    if (auto *CXXRD = DeclType->getAsCXXRecordDecl()) {
+      SourceLocation Loc = IList->getBeginLoc();
+      for (auto &Base : Bases)
----------------
It's a minor thing, but I think it'd be preferable to point the diagnostic at the relevant init list element, or at the close brace if the initializer was omitted.


================
Comment at: lib/Sema/SemaInit.cpp:1875
+
   if (DeclType->isUnionType() && IList->getNumInits() == 0) {
     RecordDecl *RD = DeclType->getAs<RecordType>()->getDecl();
----------------
Hmm, I don't think we considered this case when working on the relevant DR. It doesn't make much sense to check the destructors of the inactive union members. I'll take this back to WG21, but let's go with the wording as-is for now.


Repository:
  rC Clang

https://reviews.llvm.org/D45898





More information about the cfe-commits mailing list