Handle binary or in constant expressions.

llvm-svn: 46482
This commit is contained in:
Anders Carlsson 2008-01-29 01:33:32 +00:00
parent 0674a7417f
commit ce0740e1f5
2 changed files with 12 additions and 0 deletions

View File

@ -236,6 +236,14 @@ public:
return EmitLValue(E->getSubExpr());
}
// Binary operators
llvm::Constant *VisitBinOr(const BinaryOperator *E) {
llvm::Constant *LHS = Visit(E->getLHS());
llvm::Constant *RHS = Visit(E->getRHS());
return llvm::ConstantExpr::getOr(LHS, RHS);
}
// Utility methods
const llvm::Type *ConvertType(QualType T) {
return CGM.getTypes().ConvertType(T);

View File

@ -36,8 +36,12 @@ void booltest2() {
static int a = { 1 };
static int b = { 1, 2 };
// References to enums.
enum {
EnumA, EnumB
};
int c[] = { EnumA, EnumB };
// Binary operators
int d[] = { EnumA | EnumB };