[llvm] c8e0870 - [TableGen] emitStringLiteralDef: Pad trailing '\0' at the end of char array.

NAKAMURA Takumi via llvm-commits llvm-commits at lists.llvm.org
Mon May 23 14:25:28 PDT 2022


Author: NAKAMURA Takumi
Date: 2022-05-24T06:25:10+09:00
New Revision: c8e087082927e289bae328dc6dd07fe02b3341b1

URL: https://github.com/llvm/llvm-project/commit/c8e087082927e289bae328dc6dd07fe02b3341b1
DIFF: https://github.com/llvm/llvm-project/commit/c8e087082927e289bae328dc6dd07fe02b3341b1.diff

LOG: [TableGen] emitStringLiteralDef: Pad trailing '\0' at the end of char array.

Fixup for https://reviews.llvm.org/D73044
String literal has an implicit terminator '\0'. This commit adjusts char array
to long literal.

This causes difference of artifacts between -long-string-literals=true
and false.

Differential Revision: https://reviews.llvm.org/D126136

Added: 
    

Modified: 
    llvm/utils/TableGen/SequenceToOffsetTable.h

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/SequenceToOffsetTable.h b/llvm/utils/TableGen/SequenceToOffsetTable.h
index a3d1e185cb2c9..1b3451c24cb08 100644
--- a/llvm/utils/TableGen/SequenceToOffsetTable.h
+++ b/llvm/utils/TableGen/SequenceToOffsetTable.h
@@ -173,7 +173,7 @@ class SequenceToOffsetTable {
     if (!EmitLongStrLiterals) {
       OS << Decl << " = {\n";
       emit(OS, printChar, "0");
-      OS << "\n};\n\n";
+      OS << "  0\n};\n\n";
       return;
     }
 


        


More information about the llvm-commits mailing list