Patch improves lookup into dependendt bases of dependent class and adds lookup into non-dependent bases.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Looks pretty good.
lib/Sema/SemaDecl.cpp | ||
---|---|---|
132 ↗ | (On Diff #18746) | "FoundNonType" would be closer to the standardese terminology of "non-type template parameter" |
159–160 ↗ | (On Diff #18746) | You can reduce the indentation here with continue. |
test/SemaTemplate/ms-lookup-template-base-classes.cpp | ||
411 ↗ | (On Diff #18746) | Can you add a test for the case where we look through non-dependent bases? So far as I can tell, these are all dependent. |
lib/AST/Type.cpp | ||
---|---|---|
1894–1900 ↗ | (On Diff #18746) | What's the purpose of this change? We'll call the const version for a non-const object without this, which will do the same thing. |
lib/Sema/SemaDecl.cpp | ||
132 ↗ | (On Diff #18746) | This should either be an enum class or should use a prefix for its names; these identifiers seem too general to drop into global scope here. |
139 ↗ | (On Diff #18746) | The name of this function should mention something about dependent bases, since that's what's interesting about it and how it differs from normal name lookup. |
153 ↗ | (On Diff #18746) | You're going to lengths to ensure we look up into dependent bases of dependent bases, but you don't support finding names in dependent bases of non-dependent bases of dependent bases: we'll use normal name lookup here in that case. Maybe remove this whole case and do the same thing you do below: look up into the RecordDecl you get here and then recurse to its base classes. |
173–187 ↗ | (On Diff #18746) | Switch these two over: first look up in the base class itself, and then look up in its base classes if you find nothing. Otherwise you'll get the wrong result if the name is a type in one place and a non-type in the other. |
196–202 ↗ | (On Diff #18746) | If there are multiple such base classes, we should ideally search outer ones if we find nothing in the innermost one, to match normal unqualified lookup. |
Richard, Reid,
Thanks for the review!
lib/AST/Type.cpp | ||
---|---|---|
1894–1900 ↗ | (On Diff #18746) | Removed. |
lib/Sema/SemaDecl.cpp | ||
132 ↗ | (On Diff #18746) | Turned enum into enum class and renamed FoundNotType to FoundNonTypeTemplateParam |
139 ↗ | (On Diff #18746) | Renamed to lookupUnqualifiedTypeNameInDependentBase |
153 ↗ | (On Diff #18746) | Hmm, maybe I'm missing something, but is it possible at all? How non-dependent class may have dependent base? |
159–160 ↗ | (On Diff #18746) | Ok |
173–187 ↗ | (On Diff #18746) | Ok, got it. |
196–202 ↗ | (On Diff #18746) | Agree, will be fixed |
test/SemaTemplate/ms-lookup-template-base-classes.cpp | ||
411 ↗ | (On Diff #18746) | Test in 'namespace type_in_base_of_dependent_base' checks this already. But I'll add another one. |
lib/Sema/SemaDecl.cpp | ||
---|---|---|
132 ↗ | (On Diff #18746) | Well, we aren't searching for template parameters specifically, so I'd still prefer FoundNonType. :) |