Protocol related tweaks
- Implement type conversion of ObjCQualifiedIdType
- Wire @protocol(...) to GenerateProtocolRef in ScalarExprEmitter
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54666 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index decf539..2949654 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -14,6 +14,7 @@
#include "CodeGenFunction.h"
#include "CodeGenModule.h"
#include "clang/AST/ASTContext.h"
+#include "clang/AST/DeclObjC.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Basic/TargetInfo.h"
#include "llvm/Constants.h"
@@ -135,6 +136,7 @@
}
Value *VisitObjCMessageExpr(ObjCMessageExpr *E);
Value *VisitObjCSelectorExpr(ObjCSelectorExpr *E);
+ Value *VisitObjCProtocolExpr(ObjCProtocolExpr *E);
Value *VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) { return EmitLoadOfLValue(E);}
Value *VisitArraySubscriptExpr(ArraySubscriptExpr *E);
Value *VisitShuffleVectorExpr(ShuffleVectorExpr *E);
@@ -506,6 +508,11 @@
return Runtime->GetSelector(Builder, E->getSelector());
}
+Value *ScalarExprEmitter::VisitObjCProtocolExpr(ObjCProtocolExpr *E) {
+ // FIXME: This should pass the Decl not the name.
+ return Runtime->GenerateProtocolRef(Builder, E->getProtocol()->getName());
+}
+
Value *ScalarExprEmitter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
// Emit subscript expressions in rvalue context's. For most cases, this just
// loads the lvalue formed by the subscript expr. However, we have to be