[clang] [Clang]fix dependent qualified base member lookup crash (PR #199403)

via cfe-commits cfe-commits at lists.llvm.org
Sun May 24 22:06:12 PDT 2026


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 origin/main HEAD --extensions h,cpp -- clang/include/clang/AST/DeclCXX.h clang/lib/AST/DeclCXX.cpp clang/lib/AST/ODRDiagsEmitter.cpp clang/lib/Sema/SemaExprMember.cpp clang/lib/Serialization/ASTWriter.cpp clang/test/SemaTemplate/current-instantiation.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h
index 50caba9b0..d3c3bee60 100644
--- a/clang/include/clang/AST/DeclCXX.h
+++ b/clang/include/clang/AST/DeclCXX.h
@@ -363,7 +363,7 @@ private:
       if (!VBases.isOffset())
         return VBases.get(nullptr);
       return getVBasesSlowCase(Context);
-    }    
+    }
     ArrayRef<CXXBaseSpecifier> bases(const ASTContext &Context) const {
       return {getBases(Context), NumBases};
     }
@@ -372,10 +372,10 @@ private:
       return {getVBases(Context), NumVBases};
     }
 
- private:
+  private:
     CXXBaseSpecifier *getBasesSlowCase(const ASTContext &Context) const;
     CXXBaseSpecifier *getVBasesSlowCase(const ASTContext &Context) const;
-};
+  };
 
   struct DefinitionData *DefinitionData;
 
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 1b11824f0..70dc44672 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -113,14 +113,12 @@ CXXRecordDecl::DefinitionData::DefinitionData(CXXRecordDecl *D)
       IsLambda(false), IsParsingBaseSpecifiers(false),
       ComputedVisibleConversions(false), HasODRHash(false), Definition(D) {}
 
-CXXBaseSpecifier *
-CXXRecordDecl::DefinitionData::getBasesSlowCase(
+CXXBaseSpecifier *CXXRecordDecl::DefinitionData::getBasesSlowCase(
     const ASTContext &Context) const {
   return Bases.get(Context.getExternalSource());
 }
 
-CXXBaseSpecifier *
-CXXRecordDecl::DefinitionData::getVBasesSlowCase(
+CXXBaseSpecifier *CXXRecordDecl::DefinitionData::getVBasesSlowCase(
     const ASTContext &Context) const {
   return VBases.get(Context.getExternalSource());
 }
diff --git a/clang/lib/AST/ODRDiagsEmitter.cpp b/clang/lib/AST/ODRDiagsEmitter.cpp
index e8f25c110..37222c034 100644
--- a/clang/lib/AST/ODRDiagsEmitter.cpp
+++ b/clang/lib/AST/ODRDiagsEmitter.cpp
@@ -755,24 +755,20 @@ bool ODRDiagsEmitter::diagnoseMismatch(
     unsigned SecondNumVBases = SecondDD->NumVBases;
     if (FirstNumBases != SecondNumBases) {
       DiagBaseError(FirstRecord->getLocation(),
-                    GetSourceRange(FirstRecord, FirstDD),
-                    NumBases)
+                    GetSourceRange(FirstRecord, FirstDD), NumBases)
           << FirstNumBases;
       DiagBaseNote(SecondRecord->getLocation(),
-                   GetSourceRange(SecondRecord, SecondDD),
-                   NumBases)
+                   GetSourceRange(SecondRecord, SecondDD), NumBases)
           << SecondNumBases;
       return true;
     }
 
     if (FirstNumVBases != SecondNumVBases) {
       DiagBaseError(FirstRecord->getLocation(),
-                    GetSourceRange(FirstRecord, FirstDD),
-                    NumVBases)
+                    GetSourceRange(FirstRecord, FirstDD), NumVBases)
           << FirstNumVBases;
       DiagBaseNote(SecondRecord->getLocation(),
-                   GetSourceRange(SecondRecord, SecondDD),
-                   NumVBases)
+                   GetSourceRange(SecondRecord, SecondDD), NumVBases)
           << SecondNumVBases;
       return true;
     }

``````````

</details>


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


More information about the cfe-commits mailing list