File tree 2 files changed +7
-1
lines changed
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -390,6 +390,11 @@ class StringExp : public Expression
390
390
assert (sz == 1 );
391
391
return {len, static_cast <const char *>(string)};
392
392
}
393
+
394
+ DArray<const unsigned char > peekData () const
395
+ {
396
+ return {len * sz, static_cast <const unsigned char *>(string)};
397
+ }
393
398
#endif
394
399
size_t numberOfCodeUnits (int tynto = 0 ) const ;
395
400
void writeTo (void * dest, bool zero, int tyto = 0 ) const ;
Original file line number Diff line number Diff line change @@ -389,7 +389,8 @@ class ToElemVisitor : public Visitor {
389
389
llvm::StringMap<llvm::GlobalVariable *> *stringLiteralCache =
390
390
stringLiteralCacheForType (cty);
391
391
392
- llvm::StringRef key (e->toChars ());
392
+ DArray<const unsigned char > keyData = e->peekData ();
393
+ llvm::StringRef key (static_cast <const char *>(keyData.ptr ), keyData.length );
393
394
llvm::GlobalVariable *gvar;
394
395
395
396
auto iter = stringLiteralCache->find (key);
You can’t perform that action at this time.
0 commit comments