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

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 4 11:07:49 PDT 2018


ahatanak added inline comments.


================
Comment at: lib/Sema/SemaInit.cpp:1827-1829
+  if (SemaRef.DiagnoseUseOfDecl(Destructor, Loc))
+    return false;
+  return true;
----------------
rsmith wrote:
> Usual Clang convention is to return `true` on error.
I also renamed the function to hasAccessibleDestructor to make it clearer what the function does.


================
Comment at: lib/Sema/SemaInit.cpp:1856
+    if (auto *CXXRD = DeclType->getAsCXXRecordDecl()) {
+      SourceLocation Loc = IList->getBeginLoc();
+      for (auto &Base : Bases)
----------------
rsmith wrote:
> 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.
The function that checks the destructor (hasAccessibleDestructor) is called in five different places now.


Repository:
  rC Clang

https://reviews.llvm.org/D45898





More information about the cfe-commits mailing list