inclyc created this revision. Herald added a project: All. inclyc added reviewers: rsmith, aaron.ballman, shafik. inclyc updated this revision to Diff 451047. inclyc added a comment. inclyc edited the summary of this revision. inclyc published this revision for review. Herald added a project: clang. Herald added a subscriber: cfe-commits.
. Fixes https://github.com/llvm/llvm-project/issues/57013 https://reviews.llvm.org/D115031 improved printing of non-type template parameter args. But checking if the end of Inits is 0 without checking if APValue is an integer, causes clang to segfault. This patch adds the code to check the type. (May not be a proper bugfix.) Repository: rG LLVM Github Monorepo 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('"');
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('"');
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits