[PATCH] D71920: [AST] Refactor propagation of dependency bits. NFC

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 3 06:56:49 PST 2020


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

thanks, that looks better to me



================
Comment at: clang/lib/AST/TemplateName.cpp:193
+  } else {
+    assert(!getAsOverloadedTemplate() &&
+           "overloaded templates shouldn't survive to here");
----------------
hokein wrote:
> sammccall wrote:
> > As far as I can tell, an overloaded template will always return null for getAsTemplateDecl(). So this assert can be hoisted to the top, which I think would be clearer.
> I didn't get your point here, did you mean moving the assert to the `switch (getKind())` like 
> 
> ```
> switch (getKind()) {
>   case OverloadedTemplate:
>     assert(!GetAsTemplateDecl());
> }
> ```
> ?
ITYM `assert(getAsTemplateDecl())`

Yes, but also if this is an `OverloadedTemplate`, then getAsTemplateDecl is always false. So this can just be `assert(false && "some message")` in that case statement


================
Comment at: clang/lib/AST/TemplateName.cpp:208
          "overloaded templates shouldn't survive to here");
+  D |= TemplateNameDependence::DependentInstantiation;
+  return D;
----------------
what's this line about?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71920





More information about the cfe-commits mailing list