Implement initialization of a reference (C++ [dcl.init.ref]) as part
of copy initialization. Other pieces of the puzzle:
- Try/Perform-ImplicitConversion now handles implicit conversions
that don't involve references.
- Try/Perform-CopyInitialization uses
CheckSingleAssignmentConstraints for C. PerformCopyInitialization
is now used for all argument passing and returning values from a
function.
- Diagnose errors with declaring references and const values without
an initializer. (Uses a new Action callback, ActOnUninitializedDecl).
We do not yet have implicit conversion sequences for reference
binding, which means that we don't have any overloading support for
reference parameters yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58353 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 30e06a6..44d6ca1 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -397,8 +397,7 @@
// C++ [expr.call]p10:
// A function call is an lvalue if and only if the result type
// is a reference.
- QualType CalleeType
- = cast<CallExpr>(this)->getCallee()->IgnoreParens()->getType();
+ QualType CalleeType = cast<CallExpr>(this)->getCallee()->getType();
if (const PointerType *FnTypePtr = CalleeType->getAsPointerType())
if (const FunctionType *FnType
= FnTypePtr->getPointeeType()->getAsFunctionType())
@@ -1106,6 +1105,14 @@
return isIntegerConstantExpr(Val, Ctx, 0, true) && Val == 0;
}
+/// isBitField - Return true if this expression is a bit-field.
+bool Expr::isBitField() {
+ Expr *E = this->IgnoreParenCasts();
+ if (MemberExpr *MemRef = dyn_cast<MemberExpr>(E))
+ return MemRef->getMemberDecl()->isBitField();
+ return false;
+}
+
unsigned ExtVectorElementExpr::getNumElements() const {
if (const VectorType *VT = getType()->getAsVectorType())
return VT->getNumElements();