This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGeec6931d7787: [clang][Interp] Fix ignoring String- and
CharacterLiterals (authored by tbaeder).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149960/new/
https://reviews.llvm.org/D149960
Files:
clang/lib/AST/Interp/ByteCodeExprGen.cpp
clang/test/AST/Interp/literals.cpp
Index: clang/test/AST/Interp/literals.cpp
===================================================================
--- clang/test/AST/Interp/literals.cpp
+++ clang/test/AST/Interp/literals.cpp
@@ -901,6 +901,8 @@
(int[]){1,2,3};
int arr[] = {1,2,3};
arr[0];
+ "a";
+ 'b';
return 0;
}
Index: clang/lib/AST/Interp/ByteCodeExprGen.cpp
===================================================================
--- clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -616,6 +616,8 @@
template <class Emitter>
bool ByteCodeExprGen<Emitter>::VisitStringLiteral(const StringLiteral *E) {
+ if (DiscardResult)
+ return true;
unsigned StringIndex = P.createGlobalString(E);
return this->emitGetPtrGlobal(StringIndex, E);
}
@@ -623,6 +625,8 @@
template <class Emitter>
bool ByteCodeExprGen<Emitter>::VisitCharacterLiteral(
const CharacterLiteral *E) {
+ if (DiscardResult)
+ return true;
return this->emitConst(E->getValue(), E);
}
Index: clang/test/AST/Interp/literals.cpp
===================================================================
--- clang/test/AST/Interp/literals.cpp
+++ clang/test/AST/Interp/literals.cpp
@@ -901,6 +901,8 @@
(int[]){1,2,3};
int arr[] = {1,2,3};
arr[0];
+ "a";
+ 'b';
return 0;
}
Index: clang/lib/AST/Interp/ByteCodeExprGen.cpp
===================================================================
--- clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -616,6 +616,8 @@
template <class Emitter>
bool ByteCodeExprGen<Emitter>::VisitStringLiteral(const StringLiteral *E) {
+ if (DiscardResult)
+ return true;
unsigned StringIndex = P.createGlobalString(E);
return this->emitGetPtrGlobal(StringIndex, E);
}
@@ -623,6 +625,8 @@
template <class Emitter>
bool ByteCodeExprGen<Emitter>::VisitCharacterLiteral(
const CharacterLiteral *E) {
+ if (DiscardResult)
+ return true;
return this->emitConst(E->getValue(), E);
}
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits