-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathKeyPathsAffectingVisitor.h
43 lines (34 loc) · 1.33 KB
/
KeyPathsAffectingVisitor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// KeyPathsAffectingVisitor.h
// Created by Jonathon Mah on 2014-05-11.
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
#ifndef CLANG_KPV_KEY_PATHS_AFFECTING_VISITOR_H
#define CLANG_KPV_KEY_PATHS_AFFECTING_VISITOR_H
#include "KeyPathValidationConsumer.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Frontend/CompilerInstance.h"
using namespace clang;
class KeyPathsAffectingVisitor : public RecursiveASTVisitor<KeyPathsAffectingVisitor> {
KeyPathValidationConsumer *Consumer;
const CompilerInstance &Compiler;
std::string Prefix;
llvm::SmallSet<Selector, 2> SetConstructorSelectors;
//RecursiveASTVisitor Visitor;
public:
KeyPathsAffectingVisitor(KeyPathValidationConsumer *Consumer, const CompilerInstance &Compiler)
: Consumer(Consumer)
, Compiler(Compiler)
, Prefix("keyPathsForValuesAffecting")
{
ASTContext &Ctx = Compiler.getASTContext();
SetConstructorSelectors.insert(Ctx.Selectors.getUnarySelector(&Ctx.Idents.get("setWithObject")));
SetConstructorSelectors.insert(Ctx.Selectors.getUnarySelector(&Ctx.Idents.get("setWithObjects")));
}
bool shouldVisitTemplateInstantiations() const { return false; }
bool shouldWalkTypesOfTypeLocs() const { return false; }
bool VisitObjCMethodDecl(ObjCMethodDecl *D);
};
#endif