SE-0022: Implement parsing, AST, and semantic analysis for #selector.

This commit is contained in:
Doug Gregor
2016-01-26 13:35:21 -08:00
parent b2290992fa
commit dccf3155f1
20 changed files with 421 additions and 11 deletions

View File

@@ -2738,6 +2738,26 @@ namespace {
// case we return the null type.
return E->getType();
}
Type visitObjCSelectorExpr(ObjCSelectorExpr *E) {
// #selector only makes sense when we have the Objective-C
// #runtime.
auto &tc = CS.getTypeChecker();
if (!tc.Context.LangOpts.EnableObjCInterop) {
tc.diagnose(E->getLoc(), diag::expr_selector_no_objc_runtime);
return nullptr;
}
// Make sure we can reference ObjectiveC.Selector.
// FIXME: Fix-It to add the import?
auto type = CS.getTypeChecker().getObjCSelectorType(CS.DC);
if (!type) {
tc.diagnose(E->getLoc(), diag::expr_selector_module_missing);
return nullptr;
}
return type;
}
};
/// \brief AST walker that "sanitizes" an expression for the