[PATCH] D131466: [clang] add APValue type check in `TryPrintAsStringLiteral`
YingChi Long via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 8 22:36:58 PDT 2022
inclyc updated this revision to Diff 451049.
inclyc edited the summary of this revision.
inclyc added a comment.
Address reviewer's comments
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131466/new/
https://reviews.llvm.org/D131466
Files:
clang/lib/AST/APValue.cpp
Index: clang/lib/AST/APValue.cpp
===================================================================
--- clang/lib/AST/APValue.cpp
+++ clang/lib/AST/APValue.cpp
@@ -637,10 +637,10 @@
return false;
// Nothing we can do about a sequence that is not null-terminated
- if (!Inits.back().getInt().isZero())
+ if (!Inits.back().isInt() || !Inits.back().getInt().isZero())
return false;
- else
- Inits = Inits.drop_back();
+
+ Inits = Inits.drop_back();
llvm::SmallString<40> Buf;
Buf.push_back('"');
@@ -655,6 +655,8 @@
}
for (auto &Val : Inits) {
+ if (!Val.isInt())
+ return false;
int64_t Char64 = Val.getInt().getExtValue();
if (!isASCII(Char64))
return false; // Bye bye, see you in integers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131466.451049.patch
Type: text/x-patch
Size: 755 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220809/11954f73/attachment-0001.bin>
More information about the cfe-commits
mailing list