[PATCH] D62116: [Sema] raise nullptr check to cover additional uses

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 19 23:25:32 PDT 2019


rsmith requested changes to this revision.
rsmith added inline comments.
This revision now requires changes to proceed.


================
Comment at: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:557-558
+            dyn_cast_or_null<CXXRecordDecl>(ND->getDeclContext());
+        CXXThisScopeRAII ThisScope(*this, ThisContext, Qualifiers(),
+                                   ND->isCXXInstanceMember());
+      }
----------------
The purpose of creating this is to change the type of `this` in the scope of the instantiation below, so this change is incorrect. The right fix would be to change the initializer of `ThisContext` to handle `ND` being null. (I suspect that actually can't happen at the moment because we happen to only attach late-parsed attributes to `NamedDecl`s, but I don't think there's any fundamental reason why that should be the case so it makes some sense to retain the check here.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62116/new/

https://reviews.llvm.org/D62116





More information about the cfe-commits mailing list