diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-10-28 00:22:11 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-10-28 00:22:11 +0000 |
commit | 6b75484ba6963a748fe08ea44f11b0de89d3d0c3 (patch) | |
tree | 710bfee679d9bb468a45071ab8d3048e6291b9ea /clang/lib/Sema/SemaExprCXX.cpp | |
parent | 100f87d6554b5b187a90ce294d6d3d0f6604aee1 (diff) | |
download | bcm5719-llvm-6b75484ba6963a748fe08ea44f11b0de89d3d0c3.tar.gz bcm5719-llvm-6b75484ba6963a748fe08ea44f11b0de89d3d0c3.zip |
Improve our handling of (C++) references within Clang. Specifically:
- Do not allow expressions to ever have reference type
- Extend Expr::isLvalue to handle more cases where having written a
reference into the source implies that the expression is an lvalue
(e.g., function calls, C++ casts).
- Make GRExprEngine::VisitCall treat the call arguments as lvalues when
they are being bound to a reference parameter.
llvm-svn: 58306
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 34eff25b4c2..7a5e2dd4e91 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -79,10 +79,6 @@ Sema::CheckConstCast(SourceLocation OpLoc, Expr *&SrcExpr, QualType DestType) // C++ 5.2.11p4: An lvalue of type T1 can be [cast] to an lvalue of type T2 // [...] if a pointer to T1 can be [cast] to the type pointer to T2. DestType = Context.getPointerType(DestTypeTmp->getPointeeType()); - if (const ReferenceType *SrcTypeTmp = SrcType->getAsReferenceType()) { - // FIXME: This shouldn't actually be possible, but right now it is. - SrcType = SrcTypeTmp->getPointeeType(); - } SrcType = Context.getPointerType(SrcType); } else { // C++ 5.2.11p1: Otherwise, the result is an rvalue and the @@ -177,10 +173,6 @@ Sema::CheckReinterpretCast(SourceLocation OpLoc, Expr *&SrcExpr, // built-in & and * operators. // This code does this transformation for the checked types. DestType = Context.getPointerType(DestTypeTmp->getPointeeType()); - if (const ReferenceType *SrcTypeTmp = SrcType->getAsReferenceType()) { - // FIXME: This shouldn't actually be possible, but right now it is. - SrcType = SrcTypeTmp->getPointeeType(); - } SrcType = Context.getPointerType(SrcType); } else { // C++ 5.2.10p1: [...] the lvalue-to-rvalue, array-to-pointer, and |