Skip to content

Commit 4d97753

Browse files
authored
Merge pull request #82011 from slavapestov/clang-importer-assert
AST: Add assertion to BuiltinLiteralExpr::setBuiltinInitializer()
2 parents ff483fe + d7d5641 commit 4d97753

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

include/swift/AST/Expr.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -696,9 +696,7 @@ class BuiltinLiteralExpr : public LiteralExpr {
696696

697697
/// Set the builtin initializer that will be used to construct the
698698
/// literal.
699-
void setBuiltinInitializer(ConcreteDeclRef builtinInitializer) {
700-
BuiltinInitializer = builtinInitializer;
701-
}
699+
void setBuiltinInitializer(ConcreteDeclRef builtinInitializer);
702700
};
703701

704702
/// The 'nil' literal.

lib/AST/Expr.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,14 @@ StringRef LiteralExpr::getLiteralKindDescription() const {
10891089
llvm_unreachable("Unhandled literal");
10901090
}
10911091

1092-
IntegerLiteralExpr * IntegerLiteralExpr::createFromUnsigned(ASTContext &C, unsigned value, SourceLoc loc) {
1092+
void BuiltinLiteralExpr::setBuiltinInitializer(
1093+
ConcreteDeclRef builtinInitializer) {
1094+
ASSERT(builtinInitializer);
1095+
BuiltinInitializer = builtinInitializer;
1096+
}
1097+
1098+
IntegerLiteralExpr * IntegerLiteralExpr::createFromUnsigned(
1099+
ASTContext &C, unsigned value, SourceLoc loc) {
10931100
llvm::SmallString<8> Scratch;
10941101
llvm::APInt(sizeof(unsigned)*8, value).toString(Scratch, 10, /*signed*/ false);
10951102
auto Text = C.AllocateCopy(StringRef(Scratch));

0 commit comments

Comments
 (0)