================
@@ -916,15 +916,20 @@ class SYCLWrapper {
   std::pair<Constant *, Constant *>
   initOffloadEntriesPerImage(StringRef Entries, const Twine &OffloadKindTag) {
     SmallVector<Constant *> EntriesInits;
-    std::unique_ptr<MemoryBuffer> MB = MemoryBuffer::getMemBuffer(
-        Entries, /*BufferName*/ "", /*RequiresNullTerminator*/ false);
-    for (line_iterator LI(*MB); !LI.is_at_eof(); ++LI) {
-      GlobalVariable *GV =
-          emitOffloadingEntry(M, /*Kind*/ OffloadKind::OFK_SYCL,
-                              
Constant::getNullValue(PointerType::getUnqual(C)),
-                              /*Name*/ *LI, /*Size*/ 0,
-                              /*Flags*/ 0, /*Data*/ 0);
+    const char *Current = Entries.data();
+    const char *End = Current + Entries.size();
+    while (Current < End) {
+      StringRef Name(Current);
----------------
YuriPlyakhin wrote:

The size we store is for the whole string value. But this specific string value 
is actually an array of null-terminated strings, each representing exported 
symbol.

StringData:
Key: `symbols`. Value: `symbol1\0symbol2\0symbol3\0`. Size: size of the whole 
value.
In this function we parse `symbol1`, symbol2`, symbol3`.

The change is about the following. When we did not store size, we had to 
concatenate symbols via \n, like this:
StringData:
Key: `symbols`. Value: `symbol1\nsymbol2\nsymbol3\n\0`.

https://github.com/llvm/llvm-project/pull/169425
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to