Author: Timm Baeder Date: 2024-08-19T15:14:44+02:00 New Revision: 3e999bbc2ddfc8be7b2d1a250c9905c905e6ce81
URL: https://github.com/llvm/llvm-project/commit/3e999bbc2ddfc8be7b2d1a250c9905c905e6ce81 DIFF: https://github.com/llvm/llvm-project/commit/3e999bbc2ddfc8be7b2d1a250c9905c905e6ce81.diff LOG: [clang][bytecode] Use first FieldDecl instead of asserting (#104760) This assertion fails sometimes. We use the first decl for lookup later, so let's use the first decl here as well. Added: Modified: clang/lib/AST/ByteCode/Program.cpp clang/test/Modules/merge-using-decls.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/ByteCode/Program.cpp b/clang/lib/AST/ByteCode/Program.cpp index 25b99115ddd777..a4f0df8bf6462e 100644 --- a/clang/lib/AST/ByteCode/Program.cpp +++ b/clang/lib/AST/ByteCode/Program.cpp @@ -329,7 +329,7 @@ Record *Program::getOrCreateRecord(const RecordDecl *RD) { // Reserve space for fields. Record::FieldList Fields; for (const FieldDecl *FD : RD->fields()) { - assert(FD == FD->getFirstDecl()); + FD = FD->getFirstDecl(); // Note that we DO create fields and descriptors // for unnamed bitfields here, even though we later ignore // them everywhere. That's so the FieldDecl's getFieldIndex() matches. diff --git a/clang/test/Modules/merge-using-decls.cpp b/clang/test/Modules/merge-using-decls.cpp index e3bf977f054499..e9794a40837ef9 100644 --- a/clang/test/Modules/merge-using-decls.cpp +++ b/clang/test/Modules/merge-using-decls.cpp @@ -6,7 +6,8 @@ // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=2 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++98 %s -DORDER=2 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++11 %s -DORDER=2 -// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++17 %s -DORDER=2 + +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++17 %s -DORDER=2 #if ORDER == 1 #include "a.h" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits