summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2014-12-11 22:56:26 +0000
committerFariborz Jahanian <fjahanian@apple.com>2014-12-11 22:56:26 +0000
commitc9e266b8cf4abd43167b70609df6039da3ecd9b4 (patch)
treee5c73739f10329742eff12e7290b05f9263a9c33 /clang/lib
parentb5e9b0426acff0a0c7abb16ab071d68026dd1bba (diff)
downloadbcm5719-llvm-c9e266b8cf4abd43167b70609df6039da3ecd9b4.tar.gz
bcm5719-llvm-c9e266b8cf4abd43167b70609df6039da3ecd9b4.zip
[Objective-C]. This patch extends objc_bridge attribute to support objc_bridge(id).
This means that a pointer to the struct type to which the attribute appertains is a CF type (and therefore an Objective-C object of some type), but not of any specific class. rdar://19157264 llvm-svn: 224072
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp1
-rw-r--r--clang/lib/Sema/SemaExprObjC.cpp3
2 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index b402a939c57..d9a7f39913a 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -912,6 +912,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
.Case("objc_dictionary_literals", LangOpts.ObjC2)
.Case("objc_boxed_expressions", LangOpts.ObjC2)
.Case("arc_cf_code_audited", true)
+ .Case("objc_bridge_id", LangOpts.ObjC2)
// C11 features
.Case("c_alignas", LangOpts.C11)
.Case("c_alignof", LangOpts.C11)
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index eeee352d5e7..79f7d92e98c 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -3404,6 +3404,9 @@ static bool CheckObjCBridgeNSCast(Sema &S, QualType castType, Expr *castExpr,
if (TB *ObjCBAttr = getObjCBridgeAttr<TB>(TD)) {
if (IdentifierInfo *Parm = ObjCBAttr->getBridgedType()) {
HadTheAttribute = true;
+ if (Parm->isStr("id"))
+ return true;
+
NamedDecl *Target = nullptr;
// Check for an existing type with this name.
LookupResult R(S, DeclarationName(Parm), SourceLocation(),
OpenPOWER on IntegriCloud