[PATCH] D37308: Interface class with uuid base record

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 13 13:43:50 PDT 2017


erichkeane added a comment.

Tighten up the 'IUnknown' check, and do the check I mentioned above, and I think this logic is correct.  Searching would be required in the positive case, but this is the negative case.



================
Comment at: lib/Sema/SemaDeclCXX.cpp:2483
+            !IsDeclPublicInterface(RD, KnownBase->getAccessSpecifier()) &&
+            !IsOrInheritsFromIUnknown(RD)) {
           Diag(KnownBase->getLocStart(), diag::err_invalid_base_in_interface)
----------------
So, I just realized... this call here is useless, we got sidetracked because of the inversion of logic here.  You ACTUALLY just care that this base is either a public interface, OR if it is IUnknown.  This logic can be:

   if (Class->isInterface() && !IsDeclPublicInterface(...) && !IsIUnknownType(...)) {...}

The search doesn't actually need to take place, since the current base COULD NOT be a valid 'interface' unless it inherited only from interfaces/IUnknown anyway.  Unless I'm missing something, you can delete the function "IsOrInheritsFromIUnknown" as well.


https://reviews.llvm.org/D37308





More information about the cfe-commits mailing list