File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -1757,6 +1757,12 @@ enum class StringLiteralKind {
1757
1757
UTF16,
1758
1758
UTF32,
1759
1759
Unevaluated,
1760
+ // Binary kind of string literal is used for the data coming via #embed
1761
+ // directive. File's binary contents is transformed to a special kind of
1762
+ // string literal that in some cases may be used directly as an initializer
1763
+ // and some features of classic string literals are not applicable to this
1764
+ // kind of a string literal, for example finding a particular byte's source
1765
+ // location for better diagnosing.
1760
1766
Binary
1761
1767
};
1762
1768
@@ -1889,6 +1895,8 @@ class StringLiteral final
1889
1895
int64_t getCodeUnitS (size_t I, uint64_t BitWidth) const {
1890
1896
int64_t V = getCodeUnit (I);
1891
1897
if (isOrdinary () || isWide ()) {
1898
+ // Ordinary and wide string literals have types that can be signed.
1899
+ // It is important for checking C23 constexpr initializers.
1892
1900
unsigned Width = getCharByteWidth () * BitWidth;
1893
1901
llvm::APInt AInt (Width, (uint64_t )V);
1894
1902
V = AInt.getSExtValue ();
You can’t perform that action at this time.
0 commit comments