Skip to content

Commit 9f96706

Browse files
authored
Merge pull request #15975 from gottesmm/strliteral-upgrade
[strliteral-upgrade] Change Strings.h constants to be constexpr inste…
2 parents 38ba90b + b402696 commit 9f96706

File tree

1 file changed

+40
-34
lines changed

1 file changed

+40
-34
lines changed

include/swift/Strings.h

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,73 +16,79 @@
1616
namespace swift {
1717

1818
/// The extension for serialized modules.
19-
static const char SERIALIZED_MODULE_EXTENSION[] = "swiftmodule";
19+
constexpr static const char SERIALIZED_MODULE_EXTENSION[] = "swiftmodule";
2020
/// The extension for serialized documentation comments.
21-
static const char SERIALIZED_MODULE_DOC_EXTENSION[] = "swiftdoc";
21+
constexpr static const char SERIALIZED_MODULE_DOC_EXTENSION[] = "swiftdoc";
2222
/// The extension for PCH files.
23-
static const char PCH_EXTENSION[] = "pch";
23+
constexpr static const char PCH_EXTENSION[] = "pch";
2424
/// The extension for replacement map files.
25-
static const char REMAP_EXTENSION[] = "remap";
25+
constexpr static const char REMAP_EXTENSION[] = "remap";
2626
/// The extension for SIL files.
27-
static const char SIL_EXTENSION[] = "sil";
27+
constexpr static const char SIL_EXTENSION[] = "sil";
2828
/// The extension for SIB files.
29-
static const char SIB_EXTENSION[] = "sib";
29+
constexpr static const char SIB_EXTENSION[] = "sib";
3030
/// The extension for LLVM IR files.
31-
static const char LLVM_BC_EXTENSION[] = "bc";
32-
static const char LLVM_IR_EXTENSION[] = "ll";
31+
constexpr static const char LLVM_BC_EXTENSION[] = "bc";
32+
constexpr static const char LLVM_IR_EXTENSION[] = "ll";
3333
/// The name of the standard library, which is a reserved module name.
34-
static const char STDLIB_NAME[] = "Swift";
34+
constexpr static const char STDLIB_NAME[] = "Swift";
3535
/// The name of the Onone support library, which is a reserved module name.
36-
static const char SWIFT_ONONE_SUPPORT[] = "SwiftOnoneSupport";
36+
constexpr static const char SWIFT_ONONE_SUPPORT[] = "SwiftOnoneSupport";
3737
/// The name of the SwiftShims module, which contains private stdlib decls.
38-
static const char SWIFT_SHIMS_NAME[] = "SwiftShims";
38+
constexpr static const char SWIFT_SHIMS_NAME[] = "SwiftShims";
3939
/// The name of the Builtin module, which contains Builtin functions.
40-
static const char BUILTIN_NAME[] = "Builtin";
40+
constexpr static const char BUILTIN_NAME[] = "Builtin";
4141
/// The prefix of module names used by LLDB to capture Swift expressions
42-
static const char LLDB_EXPRESSIONS_MODULE_NAME_PREFIX[] = "__lldb_expr_";
42+
constexpr static const char LLDB_EXPRESSIONS_MODULE_NAME_PREFIX[] =
43+
"__lldb_expr_";
4344

4445
/// The name of the fake module used to hold imported Objective-C things.
45-
static const char MANGLING_MODULE_OBJC[] = "__C";
46+
constexpr static const char MANGLING_MODULE_OBJC[] = "__C";
4647
/// The name of the fake module used to hold synthesized ClangImporter things.
47-
static const char MANGLING_MODULE_CLANG_IMPORTER[] = "__C_Synthesized";
48+
constexpr static const char MANGLING_MODULE_CLANG_IMPORTER[] =
49+
"__C_Synthesized";
4850

4951
/// The name of the Builtin type prefix
50-
static const char BUILTIN_TYPE_NAME_PREFIX[] = "Builtin.";
52+
constexpr static const char BUILTIN_TYPE_NAME_PREFIX[] = "Builtin.";
5153
/// The name of the Builtin type for Int
52-
static const char BUILTIN_TYPE_NAME_INT[] = "Builtin.Int";
54+
constexpr static const char BUILTIN_TYPE_NAME_INT[] = "Builtin.Int";
5355
/// The name of the Builtin type for Int8
54-
static const char BUILTIN_TYPE_NAME_INT8[] = "Builtin.Int8";
56+
constexpr static const char BUILTIN_TYPE_NAME_INT8[] = "Builtin.Int8";
5557
/// The name of the Builtin type for Int16
56-
static const char BUILTIN_TYPE_NAME_INT16[] = "Builtin.Int16";
58+
constexpr static const char BUILTIN_TYPE_NAME_INT16[] = "Builtin.Int16";
5759
/// The name of the Builtin type for Int32
58-
static const char BUILTIN_TYPE_NAME_INT32[] = "Builtin.Int32";
60+
constexpr static const char BUILTIN_TYPE_NAME_INT32[] = "Builtin.Int32";
5961
/// The name of the Builtin type for Int64
60-
static const char BUILTIN_TYPE_NAME_INT64[] = "Builtin.Int64";
62+
constexpr static const char BUILTIN_TYPE_NAME_INT64[] = "Builtin.Int64";
6163
/// The name of the Builtin type for Int128
62-
static const char BUILTIN_TYPE_NAME_INT128[] = "Builtin.Int128";
64+
constexpr static const char BUILTIN_TYPE_NAME_INT128[] = "Builtin.Int128";
6365
/// The name of the Builtin type for Int256
64-
static const char BUILTIN_TYPE_NAME_INT256[] = "Builtin.Int256";
66+
constexpr static const char BUILTIN_TYPE_NAME_INT256[] = "Builtin.Int256";
6567
/// The name of the Builtin type for Int512
66-
static const char BUILTIN_TYPE_NAME_INT512[] = "Builtin.Int512";
68+
constexpr static const char BUILTIN_TYPE_NAME_INT512[] = "Builtin.Int512";
6769
/// The name of the Builtin type for Float
68-
static const char BUILTIN_TYPE_NAME_FLOAT[] = "Builtin.Float";
70+
constexpr static const char BUILTIN_TYPE_NAME_FLOAT[] = "Builtin.Float";
6971
/// The name of the Builtin type for NativeObject
70-
static const char BUILTIN_TYPE_NAME_NATIVEOBJECT[] = "Builtin.NativeObject";
72+
constexpr static const char BUILTIN_TYPE_NAME_NATIVEOBJECT[] =
73+
"Builtin.NativeObject";
7174
/// The name of the Builtin type for BridgeObject
72-
static const char BUILTIN_TYPE_NAME_BRIDGEOBJECT[] = "Builtin.BridgeObject";
75+
constexpr static const char BUILTIN_TYPE_NAME_BRIDGEOBJECT[] =
76+
"Builtin.BridgeObject";
7377
/// The name of the Builtin type for RawPointer
74-
static const char BUILTIN_TYPE_NAME_RAWPOINTER[] = "Builtin.RawPointer";
78+
constexpr static const char BUILTIN_TYPE_NAME_RAWPOINTER[] =
79+
"Builtin.RawPointer";
7580
/// The name of the Builtin type for UnsafeValueBuffer
76-
static const char BUILTIN_TYPE_NAME_UNSAFEVALUEBUFFER[] = "Builtin.UnsafeValueBuffer";
81+
constexpr static const char BUILTIN_TYPE_NAME_UNSAFEVALUEBUFFER[] =
82+
"Builtin.UnsafeValueBuffer";
7783
/// The name of the Builtin type for UnknownObject
78-
static const char BUILTIN_TYPE_NAME_UNKNOWNOBJECT[] = "Builtin.UnknownObject";
84+
constexpr static const char BUILTIN_TYPE_NAME_UNKNOWNOBJECT[] =
85+
"Builtin.UnknownObject";
7986
/// The name of the Builtin type for Vector
80-
static const char BUILTIN_TYPE_NAME_VEC[] = "Builtin.Vec";
87+
constexpr static const char BUILTIN_TYPE_NAME_VEC[] = "Builtin.Vec";
8188
/// The name of the Builtin type for SILToken
82-
static const char BUILTIN_TYPE_NAME_SILTOKEN[] = "Builtin.SILToken";
89+
constexpr static const char BUILTIN_TYPE_NAME_SILTOKEN[] = "Builtin.SILToken";
8390
/// The name of the Builtin type for Word
84-
static const char BUILTIN_TYPE_NAME_WORD[] = "Builtin.Word";
85-
91+
constexpr static const char BUILTIN_TYPE_NAME_WORD[] = "Builtin.Word";
8692
} // end namespace swift
8793

8894
#endif // SWIFT_STRINGS_H

0 commit comments

Comments
 (0)