[PATCH] D73638: [AST] Move dependence computations into a separate file

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 16 09:48:10 PDT 2020


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

(I do think there are ways we could write the dependency computations more clearly, but don't want to diverge further from the existing code)



================
Comment at: clang/include/clang/AST/TemplateBase.h:672
                       TemplateArgumentLoc *OutArgArray);
+  // FIXME: cleanup the unsued Deps.
   void initializeFrom(SourceLocation TemplateKWLoc,
----------------
hokein wrote:
> sammccall wrote:
> > I don't understand this comment, can you expand it?
> The parameter `Deps` is the result populated by this method, the caller doesn't need it since we have the `computeDependencies`.
Thanks, but I meant can you expand the comment :-)
(The explanation you just gave is fine)


================
Comment at: clang/lib/AST/ComputeDependence.cpp:171
+      E->getSubExpr()->getDependence();
+  if (E->getType()->isDependentType())
+    D |= ExprDependence::Type;
----------------
the old code for type-dependence is `E->getType()->isDependentType()`.
The new one is the typedependence of `E->getType() | E->getSubExpr() | E->getWrittenTypeInfo()->getType()`.

E->getType() is always the getNonLValueExprType of the E->getWrittenTypeInfo()->getType(), and that function doesn't change the dependence of a type, so I think you can drop the E->getType() here.

You still have E->getSubExpr() as a driver for type-dependence, whith I think is incorrect. va_arg(list, t) returns type t regardless of the type of list.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73638





More information about the cfe-commits mailing list