diff options
| author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-02-07 20:10:22 +0000 |
|---|---|---|
| committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-02-07 20:10:22 +0000 |
| commit | 5822f08cd6df25a715c9b3e5c5bcc84458078f71 (patch) | |
| tree | 50de3a8a641cf9dfff5c6b24fb976bcadf8e4507 /clang/lib/Sema/SemaExpr.cpp | |
| parent | 6d8a61747483e7736564e5defe46363313de9737 (diff) | |
| download | bcm5719-llvm-5822f08cd6df25a715c9b3e5c5bcc84458078f71.tar.gz bcm5719-llvm-5822f08cd6df25a715c9b3e5c5bcc84458078f71.zip | |
Move CheckPointerToMemberOperands to SemaExprCXX.cpp
llvm-svn: 64029
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 8ce8bfdd8ba..c12440322d0 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -11,7 +11,6 @@ // //===----------------------------------------------------------------------===// -#include "SemaInherit.h" #include "Sema.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclObjC.h" @@ -2703,72 +2702,6 @@ inline QualType Sema::CheckVectorOperands(SourceLocation Loc, Expr *&lex, return QualType(); } -inline QualType Sema::CheckPointerToMemberOperands( - Expr *&lex, Expr *&rex, SourceLocation Loc, bool isIndirect) -{ - const char *OpSpelling = isIndirect ? "->*" : ".*"; - // C++ 5.5p2 - // The binary operator .* [p3: ->*] binds its second operand, which shall - // be of type "pointer to member of T" (where T is a completely-defined - // class type) [...] - QualType RType = rex->getType(); - const MemberPointerType *MemPtr = RType->getAsMemberPointerType(); - if (!MemPtr || MemPtr->getClass()->isIncompleteType()) { - Diag(Loc, diag::err_bad_memptr_rhs) - << OpSpelling << RType << rex->getSourceRange(); - return QualType(); - } - QualType Class(MemPtr->getClass(), 0); - - // C++ 5.5p2 - // [...] to its first operand, which shall be of class T or of a class of - // which T is an unambiguous and accessible base class. [p3: a pointer to - // such a class] - QualType LType = lex->getType(); - if (isIndirect) { - if (const PointerType *Ptr = LType->getAsPointerType()) - LType = Ptr->getPointeeType().getNonReferenceType(); - else { - Diag(Loc, diag::err_bad_memptr_lhs) - << OpSpelling << 1 << LType << lex->getSourceRange(); - return QualType(); - } - } - - if (Context.getCanonicalType(Class).getUnqualifiedType() != - Context.getCanonicalType(LType).getUnqualifiedType()) { - BasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/false, - /*DetectVirtual=*/false); - // FIXME: Would it be useful to print full ambiguity paths, - // or is that overkill? - if (!IsDerivedFrom(LType, Class, Paths) || - Paths.isAmbiguous(Context.getCanonicalType(Class))) { - Diag(Loc, diag::err_bad_memptr_lhs) << OpSpelling - << (int)isIndirect << lex->getType() << lex->getSourceRange(); - return QualType(); - } - } - - // C++ 5.5p2 - // The result is an object or a function of the type specified by the - // second operand. - // The cv qualifiers are the union of those in the pointer and the left side, - // in accordance with 5.5p5 and 5.2.5. - // FIXME: This returns a dereferenced member function pointer as a normal - // function type. However, the only operation valid on such functions is - // calling them. There's also a GCC extension to get a function pointer to - // the thing, which is another complication, because this type - unlike the - // type that is the result of this expression - takes the class as the first - // argument. - // We probably need a "MemberFunctionClosureType" or something like that. - QualType Result = MemPtr->getPointeeType(); - if (LType.isConstQualified()) - Result.addConst(); - if (LType.isVolatileQualified()) - Result.addVolatile(); - return Result; -} - inline QualType Sema::CheckMultiplyDivideOperands( Expr *&lex, Expr *&rex, SourceLocation Loc, bool isCompAssign) { |

