[libcxx-commits] [clang] [libcxx] [Clang] Implement resolution for CWG1835 (PR #92957)

Matheus Izvekov via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 7 07:23:47 PDT 2024


================
@@ -390,29 +390,37 @@ bool Sema::isAcceptableNestedNameSpecifier(const NamedDecl *SD,
 /// (e.g., Base::), perform name lookup for that identifier as a
 /// nested-name-specifier within the given scope, and return the result of that
 /// name lookup.
-NamedDecl *Sema::FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS) {
-  if (!S || !NNS)
-    return nullptr;
+bool Sema::LookupFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS,
+                                       UnresolvedSetImpl &R) {
+  if (!S)
+    return false;
 
   while (NNS->getPrefix())
     NNS = NNS->getPrefix();
 
-  if (NNS->getKind() != NestedNameSpecifier::Identifier)
-    return nullptr;
-
-  LookupResult Found(*this, NNS->getAsIdentifier(), SourceLocation(),
-                     LookupNestedNameSpecifierName);
+  // FIXME: This is a rather nasty hack! Ideally we should get the results
----------------
mizvekov wrote:

I don't think this is a hack per se, I think this is just a consequence of not having a special NNS kind for this situation, and representing it with a DTST.

The alternative that I see is to implement a new NNS prefix which is composed by an identifier followed by template arguments.

It can still be represented internally with the type, if that's cheaper, but having a special accessor, and making `NNS->getAsIdentifier()` work for it, would be nicer.

https://github.com/llvm/llvm-project/pull/92957


More information about the libcxx-commits mailing list