[PATCH] D60892: Modules: Search for a visible definition of the decl context when computing visibility of a default template parameter

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 19 15:21:33 PDT 2019


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

LGTM, with a possible optimization. Thank you! I know this bug was incredibly hard to track down. =)



================
Comment at: lib/Sema/SemaLookup.cpp:1551
+          TemplateParameterList *TPL = TD->getTemplateParameters();
+          SearchDefinitions = llvm::find(*TPL, D) == TPL->end();
+        }
----------------
You can avoid the linear search with:

```
SearchDefinitions = D->getIndex() >= TPL->size() || TPL->getParam(D->getIndex()) != D;
```


Repository:
  rC Clang

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

https://reviews.llvm.org/D60892





More information about the cfe-commits mailing list