[clang] 2c88a48 - [clang] Make libcxx test suite pass again after memcmp changes
David Zarzycki via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 5 04:17:27 PDT 2020
Author: David Zarzycki
Date: 2020-04-05T07:16:47-04:00
New Revision: 2c88a485c71155c19e512f22c54e63ee337282a3
URL: https://github.com/llvm/llvm-project/commit/2c88a485c71155c19e512f22c54e63ee337282a3
DIFF: https://github.com/llvm/llvm-project/commit/2c88a485c71155c19e512f22c54e63ee337282a3.diff
LOG: [clang] Make libcxx test suite pass again after memcmp changes
Added:
Modified:
clang/lib/AST/ExprConstant.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index a83b2e24e17f..7508bcbc365d 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -11154,9 +11154,11 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
CharTy1, E->getArg(0)->getType()->getPointeeType()) &&
Info.Ctx.hasSameUnqualifiedType(CharTy1, CharTy2)));
- // For memcmp, allow comparing any arrays of '[[un]signed] char',
- // but no other types.
- if (IsRawByte && !(CharTy1->isCharType() && CharTy2->isCharType())) {
+ // For memcmp, allow comparing any arrays of '[[un]signed] char' or
+ // 'char8_t', but no other types.
+ bool IsChar = CharTy1->isCharType() && CharTy2->isCharType();
+ bool IsChar8 = CharTy1->isChar8Type() && CharTy2->isChar8Type();
+ if (IsRawByte && !IsChar && !IsChar8) {
// FIXME: Consider using our bit_cast implementation to support this.
Info.FFDiag(E, diag::note_constexpr_memcmp_unsupported)
<< (std::string("'") + Info.Ctx.BuiltinInfo.getName(BuiltinOp) + "'")
More information about the cfe-commits
mailing list