Skip to content

Commit 890146b

Browse files
pmatosvitalybuka
authored andcommitted
[WebAssembly] Initial support for reference type externref in clang
This patch introduces a new type __externref_t that denotes a WebAssembly opaque reference type. It also implements builtin __builtin_wasm_ref_null_extern(), that returns a null value of __externref_t. This lays the ground work for further builtins and reference types. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D122215
1 parent e2069be commit 890146b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+522
-17
lines changed

clang/include/clang/AST/ASTContext.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,8 @@ class ASTContext : public RefCountedBase<ASTContext> {
11271127
#define RVV_TYPE(Name, Id, SingletonId) \
11281128
CanQualType SingletonId;
11291129
#include "clang/Basic/RISCVVTypes.def"
1130+
#define WASM_TYPE(Name, Id, SingletonId) CanQualType SingletonId;
1131+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
11301132

11311133
// Types for deductions in C++0x [stmt.ranged]'s desugaring. Built on demand.
11321134
mutable QualType AutoDeductTy; // Deduction against 'auto'.
@@ -1475,6 +1477,9 @@ class ASTContext : public RefCountedBase<ASTContext> {
14751477
/// \pre \p EltTy must be a built-in type.
14761478
QualType getScalableVectorType(QualType EltTy, unsigned NumElts) const;
14771479

1480+
/// Return a WebAssembly externref type.
1481+
QualType getWebAssemblyExternrefType() const;
1482+
14781483
/// Return the unique reference to a vector type of the specified
14791484
/// element type and size.
14801485
///

clang/include/clang/AST/Type.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,6 +2029,10 @@ class alignas(8) Type : public ExtQualsTypeCommonBase {
20292029
/// Returns true for SVE scalable vector types.
20302030
bool isSVESizelessBuiltinType() const;
20312031

2032+
/// Check if this is a WebAssembly Reference Type.
2033+
bool isWebAssemblyReferenceType() const;
2034+
bool isWebAssemblyExternrefType() const;
2035+
20322036
/// Determines if this is a sizeless type supported by the
20332037
/// 'arm_sve_vector_bits' type attribute, which can be applied to a single
20342038
/// SVE vector or predicate, excluding tuple types such as svint32x4_t.
@@ -2642,6 +2646,9 @@ class BuiltinType : public Type {
26422646
// RVV Types
26432647
#define RVV_TYPE(Name, Id, SingletonId) Id,
26442648
#include "clang/Basic/RISCVVTypes.def"
2649+
// WebAssembly reference types
2650+
#define WASM_TYPE(Name, Id, SingletonId) Id,
2651+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
26452652
// All other builtin types
26462653
#define BUILTIN_TYPE(Id, SingletonId) Id,
26472654
#define LAST_BUILTIN_TYPE(Id) LastKind = Id

clang/include/clang/AST/TypeProperties.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,10 @@ let Class = BuiltinType in {
813813
case BuiltinType::ID: return ctx.SINGLETON_ID;
814814
#include "clang/Basic/RISCVVTypes.def"
815815

816+
#define WASM_TYPE(NAME, ID, SINGLETON_ID) \
817+
case BuiltinType::ID: return ctx.SINGLETON_ID;
818+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
819+
816820
#define BUILTIN_TYPE(ID, SINGLETON_ID) \
817821
case BuiltinType::ID: return ctx.SINGLETON_ID;
818822
#include "clang/AST/BuiltinTypes.def"

clang/include/clang/Basic/BuiltinsWebAssembly.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,5 +190,9 @@ TARGET_BUILTIN(__builtin_wasm_relaxed_dot_i8x16_i7x16_s_i16x8, "V8sV16ScV16Sc",
190190
TARGET_BUILTIN(__builtin_wasm_relaxed_dot_i8x16_i7x16_add_s_i32x4, "V4iV16ScV16ScV4i", "nc", "relaxed-simd")
191191
TARGET_BUILTIN(__builtin_wasm_relaxed_dot_bf16x8_add_f32_f32x4, "V4fV8UsV8UsV4f", "nc", "relaxed-simd")
192192

193+
// Reference Types builtins
194+
195+
TARGET_BUILTIN(__builtin_wasm_ref_null_extern, "i", "nct", "reference-types")
196+
193197
#undef BUILTIN
194198
#undef TARGET_BUILTIN

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11800,4 +11800,10 @@ def err_loongarch_builtin_requires_la32 : Error<
1180011800
def err_builtin_pass_in_regs_non_class : Error<
1180111801
"argument %0 is not an unqualified class type">;
1180211802

11803+
11804+
// WebAssembly reference type and table diagnostics.
11805+
def err_wasm_reference_pr : Error<
11806+
"%select{pointer|reference}0 to WebAssembly reference type is not allowed">;
11807+
def err_wasm_ca_reference : Error<
11808+
"cannot %select{capture|take address of}0 WebAssembly reference">;
1180311809
} // end of sema component.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//===-- WebAssemblyReferenceTypes.def - Wasm reference types ----*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file defines externref_t. The macros are:
10+
//
11+
// WASM_TYPE(Name, Id, SingletonId)
12+
// WASM_REF_TYPE(Name, MangledName, Id, SingletonId, AS)
13+
//
14+
// where:
15+
//
16+
// - Name is the name of the builtin type.
17+
//
18+
// - MangledNameBase is the base used for name mangling.
19+
//
20+
// - BuiltinType::Id is the enumerator defining the type.
21+
//
22+
// - Context.SingletonId is the global singleton of this type.
23+
//
24+
// - AS indicates the address space for values of this type.
25+
//
26+
// To include this file, define either WASM_REF_TYPE or WASM_TYPE, depending on
27+
// how much information you want. The macros will be undefined after inclusion.
28+
//
29+
//===----------------------------------------------------------------------===//
30+
31+
32+
#ifndef WASM_REF_TYPE
33+
#define WASM_REF_TYPE(Name, MangledNameBase, Id, SingletonId, AS) \
34+
WASM_TYPE(Name, Id, SingletonId)
35+
#endif
36+
37+
WASM_REF_TYPE("__externref_t", "externref_t", WasmExternRef, WasmExternRefTy, 10)
38+
39+
#undef WASM_TYPE
40+
#undef WASM_REF_TYPE

clang/include/clang/Sema/Sema.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13496,6 +13496,9 @@ class Sema final {
1349613496
CallExpr *TheCall);
1349713497
bool CheckLoongArchBuiltinFunctionCall(const TargetInfo &TI,
1349813498
unsigned BuiltinID, CallExpr *TheCall);
13499+
bool CheckWebAssemblyBuiltinFunctionCall(const TargetInfo &TI,
13500+
unsigned BuiltinID,
13501+
CallExpr *TheCall);
1349913502

1350013503
bool SemaBuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall);
1350113504
bool SemaBuiltinVAStartARMMicrosoft(CallExpr *Call);
@@ -13561,6 +13564,9 @@ class Sema final {
1356113564
ExprResult SemaBuiltinMatrixColumnMajorStore(CallExpr *TheCall,
1356213565
ExprResult CallResult);
1356313566

13567+
// WebAssembly builtin handling.
13568+
bool BuiltinWasmRefNullExtern(CallExpr *TheCall);
13569+
1356413570
public:
1356513571
enum FormatStringType {
1356613572
FST_Scanf,

clang/include/clang/Serialization/ASTBitCodes.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,9 @@ enum PredefinedTypeIDs {
10961096
// \brief RISC-V V types with auto numeration
10971097
#define RVV_TYPE(Name, Id, SingletonId) PREDEF_TYPE_##Id##_ID,
10981098
#include "clang/Basic/RISCVVTypes.def"
1099+
// \brief WebAssembly reference types with auto numeration
1100+
#define WASM_TYPE(Name, Id, SingletonId) PREDEF_TYPE_##Id##_ID,
1101+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
10991102
};
11001103

11011104
/// The number of predefined type IDs that are reserved for

clang/include/clang/module.modulemap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ module Clang_Basic {
7474
textual header "Basic/Sanitizers.def"
7575
textual header "Basic/TargetCXXABI.def"
7676
textual header "Basic/TransformTypeTraits.def"
77+
textual header "Basic/TokenKinds.def"
78+
textual header "Basic/WebAssemblyReferenceTypes.def"
7779

7880
module * { export * }
7981
}

clang/lib/AST/ASTContext.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,6 +1507,12 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target,
15071507
#include "clang/Basic/RISCVVTypes.def"
15081508
}
15091509

1510+
if (Target.getTriple().isWasm() && Target.hasFeature("reference-types")) {
1511+
#define WASM_TYPE(Name, Id, SingletonId) \
1512+
InitBuiltinType(SingletonId, BuiltinType::Id);
1513+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
1514+
}
1515+
15101516
// Builtin type for __objc_yes and __objc_no
15111517
ObjCBuiltinBoolTy = (Target.useSignedCharForObjCBool() ?
15121518
SignedCharTy : BoolTy);
@@ -2335,6 +2341,12 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const {
23352341
Align = 8; \
23362342
break;
23372343
#include "clang/Basic/RISCVVTypes.def"
2344+
#define WASM_TYPE(Name, Id, SingletonId) \
2345+
case BuiltinType::Id: \
2346+
Width = 0; \
2347+
Align = 8; \
2348+
break;
2349+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
23382350
}
23392351
break;
23402352
case Type::ObjCObjectPointer:
@@ -4072,6 +4084,19 @@ ASTContext::getBuiltinVectorTypeInfo(const BuiltinType *Ty) const {
40724084
}
40734085
}
40744086

4087+
/// getExternrefType - Return a WebAssembly externref type, which represents an
4088+
/// opaque reference to a host value.
4089+
QualType ASTContext::getWebAssemblyExternrefType() const {
4090+
if (Target->getTriple().isWasm() && Target->hasFeature("reference-types")) {
4091+
#define WASM_REF_TYPE(Name, MangledName, Id, SingletonId, AS) \
4092+
if (BuiltinType::Id == BuiltinType::WasmExternRef) \
4093+
return SingletonId;
4094+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
4095+
}
4096+
assert(false &&
4097+
"shouldn't try to generate type externref outside WebAssembly target");
4098+
}
4099+
40754100
/// getScalableVectorType - Return the unique reference to a scalable vector
40764101
/// type of the specified element type and size. VectorType must be a built-in
40774102
/// type.
@@ -8111,6 +8136,8 @@ static char getObjCEncodingForPrimitiveType(const ASTContext *C,
81118136
#include "clang/Basic/AArch64SVEACLETypes.def"
81128137
#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
81138138
#include "clang/Basic/RISCVVTypes.def"
8139+
#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
8140+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
81148141
{
81158142
DiagnosticsEngine &Diags = C->getDiagnostics();
81168143
unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,

clang/lib/AST/ASTImporter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,10 @@ ExpectedType ASTNodeImporter::VisitBuiltinType(const BuiltinType *T) {
10941094
case BuiltinType::Id: \
10951095
return Importer.getToContext().SingletonId;
10961096
#include "clang/Basic/RISCVVTypes.def"
1097+
#define WASM_TYPE(Name, Id, SingletonId) \
1098+
case BuiltinType::Id: \
1099+
return Importer.getToContext().SingletonId;
1100+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
10971101
#define SHARED_SINGLETON_TYPE(Expansion)
10981102
#define BUILTIN_TYPE(Id, SingletonId) \
10991103
case BuiltinType::Id: return Importer.getToContext().SingletonId;

clang/lib/AST/ExprConstant.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11361,6 +11361,8 @@ EvaluateBuiltinClassifyType(QualType T, const LangOptions &LangOpts) {
1136111361
#include "clang/Basic/PPCTypes.def"
1136211362
#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
1136311363
#include "clang/Basic/RISCVVTypes.def"
11364+
#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
11365+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
1136411366
return GCCTypeClass::None;
1136511367

1136611368
case BuiltinType::Dependent:

clang/lib/AST/ItaniumMangle.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3231,6 +3231,12 @@ void CXXNameMangler::mangleType(const BuiltinType *T) {
32313231
Out << 'u' << type_name.size() << type_name; \
32323232
break;
32333233
#include "clang/Basic/RISCVVTypes.def"
3234+
#define WASM_REF_TYPE(InternalName, MangledName, Id, SingletonId, AS) \
3235+
case BuiltinType::Id: \
3236+
type_name = MangledName; \
3237+
Out << 'u' << type_name.size() << type_name; \
3238+
break;
3239+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
32343240
}
32353241
}
32363242

clang/lib/AST/MicrosoftMangle.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2481,6 +2481,13 @@ void MicrosoftCXXNameMangler::mangleType(const BuiltinType *T, Qualifiers,
24812481
mangleArtificialTagType(TTK_Struct, "__bf16", {"__clang"});
24822482
break;
24832483

2484+
#define WASM_REF_TYPE(InternalName, MangledName, Id, SingletonId, AS) \
2485+
case BuiltinType::Id: \
2486+
mangleArtificialTagType(TTK_Struct, MangledName); \
2487+
mangleArtificialTagType(TTK_Struct, MangledName, {"__clang"}); \
2488+
break;
2489+
2490+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
24842491
#define SVE_TYPE(Name, Id, SingletonId) \
24852492
case BuiltinType::Id:
24862493
#include "clang/Basic/AArch64SVEACLETypes.def"

clang/lib/AST/NSAPI.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,8 @@ NSAPI::getNSNumberFactoryMethodKind(QualType T) const {
481481
#include "clang/Basic/PPCTypes.def"
482482
#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
483483
#include "clang/Basic/RISCVVTypes.def"
484+
#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
485+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
484486
case BuiltinType::BoundMember:
485487
case BuiltinType::Dependent:
486488
case BuiltinType::Overload:

clang/lib/AST/PrintfFormatString.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,8 @@ bool PrintfSpecifier::fixType(QualType QT, const LangOptions &LangOpt,
800800
#include "clang/Basic/PPCTypes.def"
801801
#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
802802
#include "clang/Basic/RISCVVTypes.def"
803+
#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
804+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
803805
#define SIGNED_TYPE(Id, SingletonId)
804806
#define UNSIGNED_TYPE(Id, SingletonId)
805807
#define FLOATING_TYPE(Id, SingletonId)

clang/lib/AST/Type.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,13 +2335,27 @@ bool Type::isSizelessBuiltinType() const {
23352335
#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
23362336
#include "clang/Basic/RISCVVTypes.def"
23372337
return true;
2338+
// WebAssembly reference types
2339+
#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
2340+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
2341+
return true;
23382342
default:
23392343
return false;
23402344
}
23412345
}
23422346
return false;
23432347
}
23442348

2349+
bool Type::isWebAssemblyReferenceType() const {
2350+
return isWebAssemblyExternrefType();
2351+
}
2352+
2353+
bool Type::isWebAssemblyExternrefType() const {
2354+
if (const auto *BT = getAs<BuiltinType>())
2355+
return BT->getKind() == BuiltinType::WasmExternRef;
2356+
return false;
2357+
}
2358+
23452359
bool Type::isSizelessType() const { return isSizelessBuiltinType(); }
23462360

23472361
bool Type::isSVESizelessBuiltinType() const {
@@ -3148,6 +3162,10 @@ StringRef BuiltinType::getName(const PrintingPolicy &Policy) const {
31483162
case Id: \
31493163
return Name;
31503164
#include "clang/Basic/RISCVVTypes.def"
3165+
#define WASM_TYPE(Name, Id, SingletonId) \
3166+
case Id: \
3167+
return Name;
3168+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
31513169
}
31523170

31533171
llvm_unreachable("Invalid builtin type.");
@@ -4277,6 +4295,8 @@ bool Type::canHaveNullability(bool ResultIfUnknown) const {
42774295
#include "clang/Basic/PPCTypes.def"
42784296
#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
42794297
#include "clang/Basic/RISCVVTypes.def"
4298+
#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
4299+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
42804300
case BuiltinType::BuiltinFn:
42814301
case BuiltinType::NullPtr:
42824302
case BuiltinType::IncompleteMatrixIdx:

clang/lib/AST/TypeLoc.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,8 @@ TypeSpecifierType BuiltinTypeLoc::getWrittenTypeSpec() const {
424424
#include "clang/Basic/PPCTypes.def"
425425
#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
426426
#include "clang/Basic/RISCVVTypes.def"
427+
#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
428+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
427429
case BuiltinType::BuiltinFn:
428430
case BuiltinType::IncompleteMatrixIdx:
429431
case BuiltinType::OMPArraySection:

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18847,6 +18847,10 @@ Value *CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID,
1884718847
Function *Callee = CGM.getIntrinsic(IntNo, ConvertType(E->getType()));
1884818848
return Builder.CreateCall(Callee, Value);
1884918849
}
18850+
case WebAssembly::BI__builtin_wasm_ref_null_extern: {
18851+
Function *Callee = CGM.getIntrinsic(Intrinsic::wasm_ref_null_extern);
18852+
return Builder.CreateCall(Callee);
18853+
}
1885018854
case WebAssembly::BI__builtin_wasm_swizzle_i8x16: {
1885118855
Value *Src = EmitScalarExpr(E->getArg(0));
1885218856
Value *Indices = EmitScalarExpr(E->getArg(1));

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,17 @@ llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
817817
return DBuilder.createVectorType(/*Size=*/0, Align, ElemTy,
818818
SubscriptArray);
819819
}
820+
821+
#define WASM_REF_TYPE(Name, MangledName, Id, SingletonId, AS) \
822+
case BuiltinType::Id: { \
823+
if (!SingletonId) \
824+
SingletonId = \
825+
DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type, \
826+
MangledName, TheCU, TheCU->getFile(), 0); \
827+
return SingletonId; \
828+
}
829+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
830+
820831
case BuiltinType::UChar:
821832
case BuiltinType::Char_U:
822833
Encoding = llvm::dwarf::DW_ATE_unsigned_char;

clang/lib/CodeGen/CGDebugInfo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ class CGDebugInfo {
8080
#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
8181
llvm::DIType *Id##Ty = nullptr;
8282
#include "clang/Basic/OpenCLExtensionTypes.def"
83+
#define WASM_TYPE(Name, Id, SingletonId) llvm::DIType *SingletonId = nullptr;
84+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
8385

8486
/// Cache of previously constructed Types.
8587
llvm::DenseMap<const void *, llvm::TrackingMDRef> TypeCache;

clang/lib/CodeGen/CodeGenTypes.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,15 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) {
633633
Info.EC.getKnownMinValue() *
634634
Info.NumVectors);
635635
}
636-
case BuiltinType::Dependent:
636+
#define WASM_REF_TYPE(Name, MangledName, Id, SingletonId, AS) \
637+
case BuiltinType::Id: { \
638+
if (BuiltinType::Id == BuiltinType::WasmExternRef) \
639+
ResultType = CGM.getTargetCodeGenInfo().getWasmExternrefReferenceType(); \
640+
else \
641+
llvm_unreachable("Unexpected wasm reference builtin type!"); \
642+
} break;
643+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
644+
case BuiltinType::Dependent:
637645
#define BUILTIN_TYPE(Id, SingletonId)
638646
#define PLACEHOLDER_TYPE(Id, SingletonId) \
639647
case BuiltinType::Id:

clang/lib/CodeGen/ItaniumCXXABI.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3290,6 +3290,8 @@ static bool TypeInfoIsInStandardLibrary(const BuiltinType *Ty) {
32903290
#include "clang/Basic/PPCTypes.def"
32913291
#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
32923292
#include "clang/Basic/RISCVVTypes.def"
3293+
#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
3294+
#include "clang/Basic/WebAssemblyReferenceTypes.def"
32933295
case BuiltinType::ShortAccum:
32943296
case BuiltinType::Accum:
32953297
case BuiltinType::LongAccum:

0 commit comments

Comments
 (0)