[PATCH] D70849: [AST] Traverse the class type loc inside the member pointer type loc.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 5 05:28:55 PST 2019


hokein marked an inline comment as done.
hokein added inline comments.


================
Comment at: clang/include/clang/AST/RecursiveASTVisitor.h:1168
 DEF_TRAVERSE_TYPELOC(MemberPointerType, {
-  TRY_TO(TraverseType(QualType(TL.getTypePtr()->getClass(), 0)));
+  if (auto *TSI = TL.getClassTInfo())
+    TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
----------------
hokein wrote:
> ilya-biryukov wrote:
> > Our tests probably don't catch the case where it's null, right?
> > Could we add one? (Temporarily removing the check for null should be enough to trigger a crash here)
> I tried to add one for this, but failed to figure out a case that would trigger this code path (the existing tests are all passed if we remove this if guard check.)
> 
> any thoughts?
per offline discussion, we don't find out such an example (all tests are passed),  it seems that we may never encounter this cases. Added an assertion that would allow us to catch it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70849





More information about the cfe-commits mailing list