[PATCH] D84781: [SyntaxTree] Use PointerUnion instead of inheritance for alternative clauses in NNS

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 10 01:19:29 PDT 2020


gribozavr2 added a comment.

Seeing the API, I like the inheritance-based approach better. It seems more uniform.



================
Comment at: clang/lib/Tooling/Syntax/Nodes.cpp:219
+      syntax::EmptyNode *, syntax::Leaf *, syntax::DecltypeSpecifier *,
+      syntax::SimpleTemplateSpecifier *>::getFromOpaqueValue(firstChild());
+}
----------------
getFromOpaqueValue will not select the right alternative in the PointerUnion. You need to do case analysis through if-else-if based on the type of node returned by firstChild.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84781



More information about the cfe-commits mailing list