summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-05-12 23:29:11 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-05-12 23:29:11 +0000
commitcac49a8f8a11d4f1ccb36b02e07553c9d4c13961 (patch)
tree85501374bfa8fd9a2372c1060b777956921e1341 /clang/lib/Sema/SemaOverload.cpp
parentbf5c83745aef6e79a0cd6cee1aa9400cd1544172 (diff)
downloadbcm5719-llvm-cac49a8f8a11d4f1ccb36b02e07553c9d4c13961.tar.gz
bcm5719-llvm-cac49a8f8a11d4f1ccb36b02e07553c9d4c13961.zip
Objective-C++ Sema. Support for conversion of a C++
class object used as a receiver to an objective-c pointer via a converwsion function. wip. llvm-svn: 103672
Diffstat (limited to 'clang/lib/Sema/SemaOverload.cpp')
-rw-r--r--clang/lib/Sema/SemaOverload.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index a45ad154787..04495e5ca4c 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -2931,6 +2931,27 @@ bool Sema::PerformContextuallyConvertToBool(Expr *&From) {
<< From->getType() << From->getSourceRange();
return true;
}
+
+/// TryContextuallyConvertToObjCId - Attempt to contextually convert the
+/// expression From to 'id'.
+ImplicitConversionSequence Sema::TryContextuallyConvertToObjCId(Expr *From) {
+ QualType Ty = Context.getObjCObjectPointerType(Context.ObjCBuiltinIdTy);
+ return TryImplicitConversion(From, Ty,
+ // FIXME: Are these flags correct?
+ /*SuppressUserConversions=*/false,
+ /*AllowExplicit=*/true,
+ /*InOverloadResolution=*/false);
+}
+
+/// PerformContextuallyConvertToObjCId - Perform a contextual conversion
+/// of the expression From to 'id'.
+bool Sema::PerformContextuallyConvertToObjCId(Expr *&From) {
+ QualType Ty = Context.getObjCObjectPointerType(Context.ObjCBuiltinIdTy);
+ ImplicitConversionSequence ICS = TryContextuallyConvertToObjCId(From);
+ if (!ICS.isBad())
+ return PerformImplicitConversion(From, Ty, ICS, AA_Converting);
+ return true;
+}
/// AddOverloadCandidate - Adds the given function to the set of
/// candidate functions, using the given function call arguments. If
OpenPOWER on IntegriCloud