forked from OSchip/llvm-project
treat bool literals as constatnt expressions.
llvm-svn: 55255
This commit is contained in:
parent
a3345a5d73
commit
4f177f803a
|
@ -720,6 +720,13 @@ bool Expr::isIntegerConstantExpr(llvm::APSInt &Result, ASTContext &Ctx,
|
|||
Result.setIsUnsigned(!getType()->isSignedIntegerType());
|
||||
break;
|
||||
}
|
||||
case CXXBoolLiteralExprClass: {
|
||||
const CXXBoolLiteralExpr *BL = cast<CXXBoolLiteralExpr>(this);
|
||||
Result.zextOrTrunc(static_cast<uint32_t>(Ctx.getTypeSize(getType())));
|
||||
Result = BL->getValue();
|
||||
Result.setIsUnsigned(!getType()->isSignedIntegerType());
|
||||
break;
|
||||
}
|
||||
case CXXZeroInitValueExprClass:
|
||||
Result.clear();
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// RUN: clang -fsyntax-only -verify %s
|
||||
|
||||
// Bool literals can be enum values.
|
||||
enum {
|
||||
ReadWrite = false,
|
||||
ReadOnly = true
|
||||
};
|
Loading…
Reference in New Issue