Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 1 | DEF_ADD_DATA(AddrLabelExpr, { |
2 | |||
3 | addData(S->getLabel()->getName()); |
||
4 | } |
||
5 | ) |
||
6 | DEF_ADD_DATA(ArrayTypeTraitExpr, { |
||
7 | |||
8 | addData(S->getTrait()); |
||
9 | } |
||
10 | ) |
||
11 | DEF_ADD_DATA(AsmStmt, { |
||
12 | |||
13 | addData(S->isSimple()); |
||
14 | addData(S->isVolatile()); |
||
15 | addData(S->generateAsmString(Context)); |
||
16 | for (unsigned i = 0; i < S->getNumInputs(); ++i) { |
||
17 | addData(S->getInputConstraint(i)); |
||
18 | } |
||
19 | for (unsigned i = 0; i < S->getNumOutputs(); ++i) { |
||
20 | addData(S->getOutputConstraint(i)); |
||
21 | } |
||
22 | for (unsigned i = 0; i < S->getNumClobbers(); ++i) { |
||
23 | addData(S->getClobber(i)); |
||
24 | } |
||
25 | } |
||
26 | ) |
||
27 | DEF_ADD_DATA(AttributedStmt, { |
||
28 | |||
29 | for (const Attr *A : S->getAttrs()) { |
||
30 | addData(std::string(A->getSpelling())); |
||
31 | } |
||
32 | } |
||
33 | ) |
||
34 | DEF_ADD_DATA(BinaryOperator, { |
||
35 | |||
36 | addData(S->getOpcode()); |
||
37 | } |
||
38 | ) |
||
39 | DEF_ADD_DATA(CXXBoolLiteralExpr, { |
||
40 | |||
41 | addData(S->getValue()); |
||
42 | } |
||
43 | ) |
||
44 | DEF_ADD_DATA(CXXCatchStmt, { |
||
45 | |||
46 | addData(S->getCaughtType()); |
||
47 | } |
||
48 | ) |
||
49 | DEF_ADD_DATA(CXXDeleteExpr, { |
||
50 | |||
51 | addData(S->isArrayFormAsWritten()); addData(S->isGlobalDelete()); |
||
52 | } |
||
53 | ) |
||
54 | DEF_ADD_DATA(CXXFoldExpr, { |
||
55 | |||
56 | addData(S->isRightFold()); addData(S->getOperator()); |
||
57 | } |
||
58 | ) |
||
59 | DEF_ADD_DATA(CallExpr, { |
||
60 | |||
61 | // Function pointers don't have a callee and we just skip hashing it. |
||
62 | if (const FunctionDecl *D = S->getDirectCallee()) { |
||
63 | // If the function is a template specialization, we also need to handle |
||
64 | // the template arguments as they are not included in the qualified name. |
||
65 | if (auto Args = D->getTemplateSpecializationArgs()) { |
||
66 | std::string ArgString; |
||
67 | |||
68 | // Print all template arguments into ArgString |
||
69 | llvm::raw_string_ostream OS(ArgString); |
||
70 | for (unsigned i = 0; i < Args->size(); ++i) { |
||
71 | Args->get(i).print(Context.getLangOpts(), OS, /*IncludeType*/ true); |
||
72 | // Add a padding character so that 'foo<X, XX>()' != 'foo<XX, X>()'. |
||
73 | OS << '\n'; |
||
74 | } |
||
75 | OS.flush(); |
||
76 | |||
77 | addData(ArgString); |
||
78 | } |
||
79 | addData(D->getQualifiedNameAsString()); |
||
80 | } |
||
81 | } |
||
82 | ) |
||
83 | DEF_ADD_DATA(CharacterLiteral, { |
||
84 | |||
85 | addData(S->getValue()); |
||
86 | } |
||
87 | ) |
||
88 | DEF_ADD_DATA(DeclRefExpr, { |
||
89 | |||
90 | addData(S->getDecl()->getQualifiedNameAsString()); |
||
91 | } |
||
92 | ) |
||
93 | DEF_ADD_DATA(DeclStmt, { |
||
94 | |||
95 | auto numDecls = std::distance(S->decl_begin(), S->decl_end()); |
||
96 | addData(static_cast<unsigned>(numDecls)); |
||
97 | for (const Decl *D : S->decls()) { |
||
98 | if (const VarDecl *VD = dyn_cast<VarDecl>(D)) { |
||
99 | addData(VD->getType()); |
||
100 | } |
||
101 | } |
||
102 | } |
||
103 | ) |
||
104 | DEF_ADD_DATA(Expr, { |
||
105 | |||
106 | addData(S->getType()); |
||
107 | } |
||
108 | ) |
||
109 | DEF_ADD_DATA(ExpressionTraitExpr, { |
||
110 | |||
111 | addData(S->getTrait()); |
||
112 | } |
||
113 | ) |
||
114 | DEF_ADD_DATA(FloatingLiteral, { |
||
115 | |||
116 | addData(llvm::hash_value(S->getValue())); |
||
117 | } |
||
118 | ) |
||
119 | DEF_ADD_DATA(GenericSelectionExpr, { |
||
120 | |||
121 | for (const GenericSelectionExpr::ConstAssociation Assoc : S->associations()) { |
||
122 | addData(Assoc.getType()); |
||
123 | } |
||
124 | } |
||
125 | ) |
||
126 | DEF_ADD_DATA(GotoStmt, { |
||
127 | |||
128 | addData(S->getLabel()->getName()); |
||
129 | } |
||
130 | ) |
||
131 | DEF_ADD_DATA(IndirectGotoStmt, { |
||
132 | |||
133 | if (S->getConstantTarget()) |
||
134 | addData(S->getConstantTarget()->getName()); |
||
135 | } |
||
136 | ) |
||
137 | DEF_ADD_DATA(IntegerLiteral, { |
||
138 | |||
139 | addData(llvm::hash_value(S->getValue())); |
||
140 | } |
||
141 | ) |
||
142 | DEF_ADD_DATA(LabelStmt, { |
||
143 | |||
144 | addData(S->getDecl()->getName()); |
||
145 | } |
||
146 | ) |
||
147 | DEF_ADD_DATA(LambdaExpr, { |
||
148 | |||
149 | for (const LambdaCapture &C : S->captures()) { |
||
150 | addData(C.isPackExpansion()); |
||
151 | addData(C.getCaptureKind()); |
||
152 | if (C.capturesVariable()) |
||
153 | addData(C.getCapturedVar()->getType()); |
||
154 | } |
||
155 | addData(S->isGenericLambda()); |
||
156 | addData(S->isMutable()); |
||
157 | } |
||
158 | ) |
||
159 | DEF_ADD_DATA(MSDependentExistsStmt, { |
||
160 | |||
161 | addData(S->isIfExists()); |
||
162 | } |
||
163 | ) |
||
164 | DEF_ADD_DATA(MemberExpr, { |
||
165 | |||
166 | addData(S->getMemberDecl()->getName()); |
||
167 | } |
||
168 | ) |
||
169 | DEF_ADD_DATA(ObjCAtCatchStmt, { |
||
170 | |||
171 | addData(S->hasEllipsis()); |
||
172 | } |
||
173 | ) |
||
174 | DEF_ADD_DATA(ObjCBridgedCastExpr, { |
||
175 | |||
176 | addData(S->getBridgeKind()); |
||
177 | } |
||
178 | ) |
||
179 | DEF_ADD_DATA(ObjCIndirectCopyRestoreExpr, { |
||
180 | |||
181 | addData(S->shouldCopy()); |
||
182 | } |
||
183 | ) |
||
184 | DEF_ADD_DATA(ObjCPropertyRefExpr, { |
||
185 | |||
186 | addData(S->isSuperReceiver()); addData(S->isImplicitProperty()); |
||
187 | } |
||
188 | ) |
||
189 | DEF_ADD_DATA(PredefinedExpr, { |
||
190 | |||
191 | addData(S->getIdentKind()); |
||
192 | } |
||
193 | ) |
||
194 | DEF_ADD_DATA(Stmt, { |
||
195 | |||
196 | addData(S->getStmtClass()); |
||
197 | // This ensures that non-macro-generated code isn't identical to |
||
198 | // macro-generated code. |
||
199 | addData(data_collection::getMacroStack(S->getBeginLoc(), Context)); |
||
200 | addData(data_collection::getMacroStack(S->getEndLoc(), Context)); |
||
201 | } |
||
202 | ) |
||
203 | DEF_ADD_DATA(StringLiteral, { |
||
204 | |||
205 | addData(S->getString()); |
||
206 | } |
||
207 | ) |
||
208 | DEF_ADD_DATA(TypeTraitExpr, { |
||
209 | |||
210 | addData(S->getTrait()); |
||
211 | for (unsigned i = 0; i < S->getNumArgs(); ++i) |
||
212 | addData(S->getArg(i)->getType()); |
||
213 | } |
||
214 | ) |
||
215 | DEF_ADD_DATA(UnaryOperator, { |
||
216 | |||
217 | addData(S->getOpcode()); |
||
218 | } |
||
219 | ) |
||
220 | #undef DEF_ADD_DATA |