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

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 19 06:43:40 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 93831c73ea51dcf4dc1832a4ea5616b819d36f31 babdee51c4a40a5053ed47846ff57bae2858a21b --extensions 'h,,cpp,c' -- clang/test/CXX/basic/basic.lookup/basic.lookup.qual/basic.lookup.qual.general/p3-example3.cpp clang/test/CXX/basic/basic.lookup/basic.lookup.qual/basic.lookup.qual.general/p3.cpp clang/test/CXX/temp/temp.names/p3-23.cpp clang/include/clang/AST/ExprCXX.h clang/include/clang/AST/Stmt.h clang/include/clang/AST/UnresolvedSet.h clang/include/clang/Parse/Parser.h clang/include/clang/Sema/DeclSpec.h clang/include/clang/Sema/Lookup.h clang/include/clang/Sema/Sema.h clang/lib/AST/ASTImporter.cpp clang/lib/AST/ExprCXX.cpp clang/lib/AST/ItaniumMangle.cpp clang/lib/Parse/ParseExprCXX.cpp clang/lib/Sema/SemaCXXScopeSpec.cpp clang/lib/Sema/SemaCoroutine.cpp clang/lib/Sema/SemaDeclCXX.cpp clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaExprMember.cpp clang/lib/Sema/SemaOverload.cpp clang/lib/Sema/SemaStmtAsm.cpp clang/lib/Sema/SemaTemplate.cpp clang/lib/Sema/SemaTemplateInstantiate.cpp clang/lib/Sema/TreeTransform.h clang/lib/Serialization/ASTReaderStmt.cpp clang/lib/Serialization/ASTWriterStmt.cpp clang/test/CXX/basic/basic.lookup/basic.lookup.classref/p1-cxx11.cpp clang/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp clang/test/CXX/class.derived/class.member.lookup/p8.cpp clang/test/CXX/drs/cwg1xx.cpp clang/test/CXX/drs/cwg3xx.cpp clang/test/CXX/drs/cwg4xx.cpp clang/test/CXX/temp/temp.res/p3.cpp clang/test/FixIt/fixit.cpp clang/test/Misc/warning-flags.c clang/test/Parser/cxx2a-concepts-requires-expr.cpp clang/test/SemaCXX/pseudo-destructors.cpp clang/test/SemaCXX/static-assert-cxx17.cpp clang/test/SemaTemplate/dependent-base-classes.cpp clang/test/SemaTemplate/dependent-template-recover.cpp clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp clang/test/SemaTemplate/template-id-expr.cpp clang/test/SemaTemplate/typename-specifier-3.cpp libcxx/include/regex
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Sema/SemaCXXScopeSpec.cpp b/clang/lib/Sema/SemaCXXScopeSpec.cpp
index ae20849193..84d0baf80e 100644
--- a/clang/lib/Sema/SemaCXXScopeSpec.cpp
+++ b/clang/lib/Sema/SemaCXXScopeSpec.cpp
@@ -483,7 +483,7 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo,
                                        bool ErrorRecoveryLookup,
                                        bool *IsCorrectedToColon,
                                        bool OnlyNamespace) {
- #if 0
+#if 0
   if (IdInfo.Identifier->isEditorPlaceholder())
     return true;
   LookupResult Found(*this, IdInfo.Identifier, IdInfo.IdentifierLoc,
@@ -579,7 +579,6 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo,
 #endif
 #endif
 
-
   if (IdInfo.Identifier->isEditorPlaceholder())
     return true;
   if (IsCorrectedToColon)
@@ -609,8 +608,7 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo,
   }
 
   bool ObjectTypeSearchedInScope = false;
-  bool LookupFirstQualifierInScope =
-      Found.empty() && !ObjectType.isNull();
+  bool LookupFirstQualifierInScope = Found.empty() && !ObjectType.isNull();
 
   if (LookupFirstQualifierInScope) {
     if (S) {
@@ -658,9 +656,10 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo,
     }
   }
 
-  DeclContext *LookupCtx = SS.isSet()
-      ? computeDeclContext(SS, EnteringContext)
-      : (!ObjectType.isNull() ? computeDeclContext(ObjectType) : nullptr);
+  DeclContext *LookupCtx =
+      SS.isSet()
+          ? computeDeclContext(SS, EnteringContext)
+          : (!ObjectType.isNull() ? computeDeclContext(ObjectType) : nullptr);
 
   if (Found.empty() && !ErrorRecoveryLookup && !getLangOpts().MSVCCompat) {
     // We haven't found anything, and we're not recovering from a
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 1349ee2ea2..5caa8eff30 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -400,8 +400,8 @@ bool Sema::LookupTemplateName(LookupResult &Found, Scope *S, CXXScopeSpec &SS,
   // vector component name, and look up a template name if not. And similarly
   // for lookups into Objective-C class and object types, where the same
   // problem can arise.
-  if (!ObjectType.isNull() &&
-      (ObjectType->isVectorType() || ObjectType->isObjCObjectOrInterfaceType())) {
+  if (!ObjectType.isNull() && (ObjectType->isVectorType() ||
+                               ObjectType->isObjCObjectOrInterfaceType())) {
     Found.clear();
     return false;
   }
@@ -412,7 +412,7 @@ bool Sema::LookupTemplateName(LookupResult &Found, Scope *S, CXXScopeSpec &SS,
   if (Found.wasNotFoundInCurrentInstantiation())
     return false;
 
-  #if 0
+#if 0
   // Determine where to perform name lookup
   DeclContext *LookupCtx = nullptr;
   bool IsDependent = false;
@@ -475,10 +475,9 @@ bool Sema::LookupTemplateName(LookupResult &Found, Scope *S, CXXScopeSpec &SS,
     // unknown specialization when we come to instantiate the template.
     IsDependent |= Found.wasNotFoundInCurrentInstantiation();
   }
-  #endif
+#endif
 
-
-  #if 0
+#if 0
   bool ObjectTypeSearchedInScope = false;
   bool LookupFirstQualifierInScope =
       MayBeNNS && Found.empty() && !ObjectType.isNull() && !IsDependent;
@@ -508,7 +507,7 @@ bool Sema::LookupTemplateName(LookupResult &Found, Scope *S, CXXScopeSpec &SS,
 
     IsDependent |= Found.wasNotFoundInCurrentInstantiation();
   }
-  #endif
+#endif
 
   bool ObjectTypeSearchedInScope = false;
   bool LookupFirstQualifierInScope =
@@ -558,9 +557,10 @@ bool Sema::LookupTemplateName(LookupResult &Found, Scope *S, CXXScopeSpec &SS,
     // to correct any typos.
     DeclarationName Name = Found.getLookupName();
     Found.clear();
-    DeclContext *LookupCtx = SS.isSet()
-        ? computeDeclContext(SS, EnteringContext)
-        : (!ObjectType.isNull() ? computeDeclContext(ObjectType) : nullptr);
+    DeclContext *LookupCtx =
+        SS.isSet()
+            ? computeDeclContext(SS, EnteringContext)
+            : (!ObjectType.isNull() ? computeDeclContext(ObjectType) : nullptr);
     // Simple filter callback that, for keywords, only accepts the C++ *_cast
     DefaultFilterCCC FilterCCC{};
     FilterCCC.WantTypeSpecifiers = false;

``````````

</details>


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


More information about the libcxx-commits mailing list