Skip to content

Commit 4c5284f

Browse files
authored
Merge pull request #74851 from bnbarham/rebranch-build-after-branch
[rebranch] Various changes to get rebranch compiling after taking new clang branch
2 parents 75bb91e + aa7a3a8 commit 4c5284f

23 files changed

+122
-226
lines changed

include/swift/AST/PluginRegistry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class CompilerPlugin {
8888

8989
/// Remove "on reconnect" callback.
9090
void removeOnReconnect(std::function<void(void)> *fn) {
91-
llvm::erase_value(onReconnect, fn);
91+
llvm::erase(onReconnect, fn);
9292
}
9393

9494
ArrayRef<std::function<void(void)> *> getOnReconnectCallbacks() {

include/swift/ClangImporter/ClangModule.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "swift/Basic/Version.h"
2121
#include "swift/ClangImporter/ClangImporter.h"
2222
#include "clang/AST/ExternalASTSource.h"
23+
#include "clang/Basic/ASTSourceDescriptor.h"
2324
#include "clang/Basic/Module.h"
2425

2526
namespace clang {

include/swift/ClangImporter/SwiftAbstractBasicReader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class DataStreamBasicReader
7272
return clang::Selector();
7373

7474
unsigned numArgs = unsigned(numArgsPlusOne - 1);
75-
SmallVector<clang::IdentifierInfo *, 4> chunks;
75+
SmallVector<const clang::IdentifierInfo *, 4> chunks;
7676
for (unsigned i = 0, e = std::max(numArgs, 1U); i != e; ++i)
7777
chunks.push_back(asImpl().readIdentifier());
7878

include/swift/SIL/SILInstruction.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ namespace ilist_detail {
5858
///
5959
/// We need a custom base class to not clear the prev/next pointers when
6060
/// removing an instruction from the list.
61-
class SILInstructionListBase : public ilist_base<false> {
61+
class SILInstructionListBase : public ilist_base<false, void> {
6262
public:
6363
/// Remove an instruction from the list.
6464
///
@@ -96,7 +96,8 @@ template <> struct compute_node_options<::swift::SILInstruction> {
9696
static const bool is_sentinel_tracking_explicit = false;
9797
static const bool has_iterator_bits = false;
9898
typedef void tag;
99-
typedef ilist_node_base<enable_sentinel_tracking> node_base_type;
99+
typedef void parent_ty;
100+
typedef ilist_node_base<enable_sentinel_tracking, void> node_base_type;
100101
typedef SILInstructionListBase list_base_type;
101102
};
102103
};

lib/AST/ClangTypeConverter.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,14 @@ getClangBuiltinTypeFromKind(const clang::ASTContext &context,
7575
case clang::BuiltinType::Id: \
7676
return context.Id##Ty;
7777
#include "clang/Basic/RISCVVTypes.def"
78-
#define WASM_REF_TYPE(Name, MangedNameBase, Id, SingletonId, AS) \
78+
#define WASM_REF_TYPE(Name, MangledNameBase, Id, SingletonId, AS) \
7979
case clang::BuiltinType::Id: \
8080
return context.SingletonId;
8181
#include "clang/Basic/WebAssemblyReferenceTypes.def"
82+
#define AMDGPU_TYPE(Name, Id, SingletonId) \
83+
case clang::BuiltinType::Id: \
84+
return context.SingletonId;
85+
#include "clang/Basic/AMDGPUTypes.def"
8286
}
8387

8488
// Not a valid BuiltinType.
@@ -891,8 +895,8 @@ ClangTypeConverter::getClangTemplateArguments(
891895
auto templateParam = cast<clang::TemplateTypeParmDecl>(param);
892896
// We must have found a defaulted parameter at the end of the list.
893897
if (templateParam->getIndex() >= genericArgs.size()) {
894-
templateArgs.push_back(
895-
clang::TemplateArgument(templateParam->getDefaultArgument()));
898+
templateArgs.push_back(clang::TemplateArgument(
899+
templateParam->getDefaultArgument().getArgument()));
896900
continue;
897901
}
898902

lib/AST/NameLookup.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
#include "llvm/Support/Debug.h"
5050
#include "llvm/Support/raw_ostream.h"
5151

52+
#include <deque>
53+
5254
#define DEBUG_TYPE "namelookup"
5355

5456
using namespace swift;

lib/AST/RequirementMachine/KnuthBendix.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include "llvm/Support/Debug.h"
3535
#include "llvm/Support/raw_ostream.h"
3636
#include <algorithm>
37-
#include <deque>
3837
#include <vector>
3938

4039
#include "RewriteContext.h"

lib/ClangImporter/ClangAdapter.cpp

Lines changed: 23 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ OmissionTypeName importer::getClangTypeNameForOmission(clang::ASTContext &ctx,
364364
case clang::BuiltinType::Overload:
365365
case clang::BuiltinType::PseudoObject:
366366
case clang::BuiltinType::UnknownAny:
367+
case clang::BuiltinType::UnresolvedTemplate:
367368
return OmissionTypeName();
368369

369370
// FIXME: Types that can be mapped, but aren't yet.
@@ -407,87 +408,48 @@ OmissionTypeName importer::getClangTypeNameForOmission(clang::ASTContext &ctx,
407408
case clang::BuiltinType::ObjCSel:
408409
return OmissionTypeName();
409410

410-
// OpenCL types that don't have Swift equivalents.
411-
case clang::BuiltinType::OCLImage1dRO:
412-
case clang::BuiltinType::OCLImage1dRW:
413-
case clang::BuiltinType::OCLImage1dWO:
414-
case clang::BuiltinType::OCLImage1dArrayRO:
415-
case clang::BuiltinType::OCLImage1dArrayRW:
416-
case clang::BuiltinType::OCLImage1dArrayWO:
417-
case clang::BuiltinType::OCLImage1dBufferRO:
418-
case clang::BuiltinType::OCLImage1dBufferRW:
419-
case clang::BuiltinType::OCLImage1dBufferWO:
420-
case clang::BuiltinType::OCLImage2dRO:
421-
case clang::BuiltinType::OCLImage2dRW:
422-
case clang::BuiltinType::OCLImage2dWO:
423-
case clang::BuiltinType::OCLImage2dArrayRO:
424-
case clang::BuiltinType::OCLImage2dArrayRW:
425-
case clang::BuiltinType::OCLImage2dArrayWO:
426-
case clang::BuiltinType::OCLImage2dDepthRO:
427-
case clang::BuiltinType::OCLImage2dDepthRW:
428-
case clang::BuiltinType::OCLImage2dDepthWO:
429-
case clang::BuiltinType::OCLImage2dArrayDepthRO:
430-
case clang::BuiltinType::OCLImage2dArrayDepthRW:
431-
case clang::BuiltinType::OCLImage2dArrayDepthWO:
432-
case clang::BuiltinType::OCLImage2dMSAARO:
433-
case clang::BuiltinType::OCLImage2dMSAARW:
434-
case clang::BuiltinType::OCLImage2dMSAAWO:
435-
case clang::BuiltinType::OCLImage2dArrayMSAARO:
436-
case clang::BuiltinType::OCLImage2dArrayMSAARW:
437-
case clang::BuiltinType::OCLImage2dArrayMSAAWO:
438-
case clang::BuiltinType::OCLImage2dMSAADepthRO:
439-
case clang::BuiltinType::OCLImage2dMSAADepthRW:
440-
case clang::BuiltinType::OCLImage2dMSAADepthWO:
441-
case clang::BuiltinType::OCLImage2dArrayMSAADepthRO:
442-
case clang::BuiltinType::OCLImage2dArrayMSAADepthRW:
443-
case clang::BuiltinType::OCLImage2dArrayMSAADepthWO:
444-
case clang::BuiltinType::OCLImage3dRO:
445-
case clang::BuiltinType::OCLImage3dRW:
446-
case clang::BuiltinType::OCLImage3dWO:
447-
case clang::BuiltinType::OCLSampler:
448-
case clang::BuiltinType::OCLEvent:
449-
case clang::BuiltinType::OCLClkEvent:
450-
case clang::BuiltinType::OCLQueue:
451-
case clang::BuiltinType::OCLReserveID:
452-
case clang::BuiltinType::OCLIntelSubgroupAVCMcePayload:
453-
case clang::BuiltinType::OCLIntelSubgroupAVCImePayload:
454-
case clang::BuiltinType::OCLIntelSubgroupAVCRefPayload:
455-
case clang::BuiltinType::OCLIntelSubgroupAVCSicPayload:
456-
case clang::BuiltinType::OCLIntelSubgroupAVCMceResult:
457-
case clang::BuiltinType::OCLIntelSubgroupAVCImeResult:
458-
case clang::BuiltinType::OCLIntelSubgroupAVCRefResult:
459-
case clang::BuiltinType::OCLIntelSubgroupAVCSicResult:
460-
case clang::BuiltinType::OCLIntelSubgroupAVCImeResultSingleReferenceStreamout:
461-
case clang::BuiltinType::OCLIntelSubgroupAVCImeResultDualReferenceStreamout:
462-
case clang::BuiltinType::OCLIntelSubgroupAVCImeSingleReferenceStreamin:
463-
case clang::BuiltinType::OCLIntelSubgroupAVCImeDualReferenceStreamin:
464-
return OmissionTypeName();
465-
466411
// OpenMP types that don't have Swift equivalents.
467-
case clang::BuiltinType::OMPArraySection:
412+
case clang::BuiltinType::ArraySection:
468413
case clang::BuiltinType::OMPArrayShaping:
469414
case clang::BuiltinType::OMPIterator:
470415
return OmissionTypeName();
471416

417+
// OpenCL builtin types that don't have Swift equivalents.
418+
case clang::BuiltinType::OCLClkEvent:
419+
case clang::BuiltinType::OCLEvent:
420+
case clang::BuiltinType::OCLSampler:
421+
case clang::BuiltinType::OCLQueue:
422+
case clang::BuiltinType::OCLReserveID:
423+
#define IMAGE_TYPE(Name, Id, ...) case clang::BuiltinType::Id:
424+
#include "clang/Basic/OpenCLImageTypes.def"
425+
#define EXT_OPAQUE_TYPE(Name, Id, ...) case clang::BuiltinType::Id:
426+
#include "clang/Basic/OpenCLExtensionTypes.def"
427+
return OmissionTypeName();
428+
472429
// ARM SVE builtin types that don't have Swift equivalents.
473430
#define SVE_TYPE(Name, Id, ...) case clang::BuiltinType::Id:
474431
#include "clang/Basic/AArch64SVEACLETypes.def"
475432
return OmissionTypeName();
476433

477434
// PPC MMA builtin types that don't have Swift equivalents.
478-
#define PPC_VECTOR_TYPE(Name, Id, Size) case clang::BuiltinType::Id:
435+
#define PPC_VECTOR_TYPE(Name, Id, ...) case clang::BuiltinType::Id:
479436
#include "clang/Basic/PPCTypes.def"
480437
return OmissionTypeName();
481438

482439
// RISC-V V builtin types that don't have Swift equivalents.
483-
#define RVV_TYPE(Name, Id, Size) case clang::BuiltinType::Id:
440+
#define RVV_TYPE(Name, Id, ...) case clang::BuiltinType::Id:
484441
#include "clang/Basic/RISCVVTypes.def"
485442
return OmissionTypeName();
486443

487-
// WAM builtin types that don't have Swift equivalents.
488-
#define WASM_TYPE(Name, Id, Size) case clang::BuiltinType::Id:
444+
// WASM builtin types that don't have Swift equivalents.
445+
#define WASM_TYPE(Name, Id, ...) case clang::BuiltinType::Id:
489446
#include "clang/Basic/WebAssemblyReferenceTypes.def"
490447
return OmissionTypeName();
448+
449+
// AMDGPU builtins that don't have Swift equivalents.
450+
#define AMDGPU_TYPE(Name, Id, ...) case clang::BuiltinType::Id:
451+
#include "clang/Basic/AMDGPUTypes.def"
452+
return OmissionTypeName();
491453
}
492454
}
493455

lib/ClangImporter/ClangImporter.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,18 +1508,18 @@ ClangImporter::create(ASTContext &ctx,
15081508
importer->Impl.objectAtIndexedSubscript
15091509
= clangContext.Selectors.getUnarySelector(
15101510
&clangContext.Idents.get("objectAtIndexedSubscript"));
1511-
clang::IdentifierInfo *setObjectAtIndexedSubscriptIdents[2] = {
1512-
&clangContext.Idents.get("setObject"),
1513-
&clangContext.Idents.get("atIndexedSubscript")
1511+
const clang::IdentifierInfo *setObjectAtIndexedSubscriptIdents[2] = {
1512+
&clangContext.Idents.get("setObject"),
1513+
&clangContext.Idents.get("atIndexedSubscript"),
15141514
};
15151515
importer->Impl.setObjectAtIndexedSubscript
15161516
= clangContext.Selectors.getSelector(2, setObjectAtIndexedSubscriptIdents);
15171517
importer->Impl.objectForKeyedSubscript
15181518
= clangContext.Selectors.getUnarySelector(
15191519
&clangContext.Idents.get("objectForKeyedSubscript"));
1520-
clang::IdentifierInfo *setObjectForKeyedSubscriptIdents[2] = {
1521-
&clangContext.Idents.get("setObject"),
1522-
&clangContext.Idents.get("forKeyedSubscript")
1520+
const clang::IdentifierInfo *setObjectForKeyedSubscriptIdents[2] = {
1521+
&clangContext.Idents.get("setObject"),
1522+
&clangContext.Idents.get("forKeyedSubscript"),
15231523
};
15241524
importer->Impl.setObjectForKeyedSubscript
15251525
= clangContext.Selectors.getSelector(2, setObjectForKeyedSubscriptIdents);
@@ -2880,7 +2880,7 @@ ClangImporter::Implementation::exportSelector(DeclName name,
28802880

28812881
clang::ASTContext &ctx = getClangASTContext();
28822882

2883-
SmallVector<clang::IdentifierInfo *, 8> pieces;
2883+
SmallVector<const clang::IdentifierInfo *, 8> pieces;
28842884
pieces.push_back(exportName(name.getBaseIdentifier()).getAsIdentifierInfo());
28852885

28862886
auto argNames = name.getArgumentNames();
@@ -2899,7 +2899,7 @@ ClangImporter::Implementation::exportSelector(DeclName name,
28992899

29002900
clang::Selector
29012901
ClangImporter::Implementation::exportSelector(ObjCSelector selector) {
2902-
SmallVector<clang::IdentifierInfo *, 4> pieces;
2902+
SmallVector<const clang::IdentifierInfo *, 4> pieces;
29032903
for (auto piece : selector.getSelectorPieces())
29042904
pieces.push_back(exportName(piece).getAsIdentifierInfo());
29052905
return getClangASTContext().Selectors.getSelector(selector.getNumArgs(),
@@ -2915,7 +2915,7 @@ isPotentiallyConflictingSetter(const clang::ObjCProtocolDecl *proto,
29152915
if (sel.getNumArgs() != 1)
29162916
return false;
29172917

2918-
clang::IdentifierInfo *setterID = sel.getIdentifierInfoForSlot(0);
2918+
const clang::IdentifierInfo *setterID = sel.getIdentifierInfoForSlot(0);
29192919
if (!setterID || !setterID->getName().starts_with("set"))
29202920
return false;
29212921

@@ -3949,11 +3949,12 @@ void ClangModuleUnit::lookupObjCMethods(
39493949
// Collect all of the Objective-C methods with this selector.
39503950
SmallVector<clang::ObjCMethodDecl *, 8> objcMethods;
39513951
auto &clangSema = owner.getClangSema();
3952-
clangSema.CollectMultipleMethodsInGlobalPool(clangSelector,
3952+
auto &clangObjc = clangSema.ObjC();
3953+
clangObjc.CollectMultipleMethodsInGlobalPool(clangSelector,
39533954
objcMethods,
39543955
/*InstanceFirst=*/true,
39553956
/*CheckTheOther=*/false);
3956-
clangSema.CollectMultipleMethodsInGlobalPool(clangSelector,
3957+
clangObjc.CollectMultipleMethodsInGlobalPool(clangSelector,
39573958
objcMethods,
39583959
/*InstanceFirst=*/false,
39593960
/*CheckTheOther=*/false);
@@ -7891,7 +7892,7 @@ bool importer::requiresCPlusPlus(const clang::Module *module) {
78917892
}
78927893

78937894
return llvm::any_of(module->Requirements, [](clang::Module::Requirement req) {
7894-
return req.first == "cplusplus";
7895+
return req.FeatureName == "cplusplus";
78957896
});
78967897
}
78977898

lib/ClangImporter/ImportDecl.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,7 +2237,7 @@ namespace {
22372237

22382238
// Unnamed bitfields are just for padding and should not
22392239
// inhibit creation of a memberwise initializer.
2240-
if (field->isUnnamedBitfield()) {
2240+
if (field->isUnnamedBitField()) {
22412241
hasUnreferenceableStorage = true;
22422242
continue;
22432243
}
@@ -3457,8 +3457,9 @@ namespace {
34573457
// parameters when the function template is instantiated, so do not
34583458
// import the function template if the template parameter has
34593459
// dependent default value.
3460-
auto defaultArgumentType = templateTypeParam->getDefaultArgument();
3461-
if (defaultArgumentType->isDependentType())
3460+
auto &defaultArgument =
3461+
templateTypeParam->getDefaultArgument().getArgument();
3462+
if (defaultArgument.isDependent())
34623463
return nullptr;
34633464
continue;
34643465
}
@@ -9200,7 +9201,7 @@ void ClangImporter::Implementation::loadAllMembersOfRecordDecl(
92009201

92019202
// Currently, we don't import unnamed bitfields.
92029203
if (isa<clang::FieldDecl>(m) &&
9203-
cast<clang::FieldDecl>(m)->isUnnamedBitfield())
9204+
cast<clang::FieldDecl>(m)->isUnnamedBitField())
92049205
continue;
92059206

92069207
// Make sure we always pull in record fields. Everything else had better

lib/ClangImporter/ImportName.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ bool NameImporter::hasErrorMethodNameCollision(
14311431
unsigned numArgs = selector.getNumArgs();
14321432
assert(numArgs > 0);
14331433

1434-
SmallVector<clang::IdentifierInfo *, 4> chunks;
1434+
SmallVector<const clang::IdentifierInfo *, 4> chunks;
14351435
for (unsigned i = 0, e = selector.getNumArgs(); i != e; ++i) {
14361436
chunks.push_back(selector.getIdentifierInfoForSlot(i));
14371437
}

0 commit comments

Comments
 (0)