llvm.org GIT mirror llvm / 353149e
Remove SpecialCaseList::findCategory. It turned out that I didn't need this for DFSan. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188646 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Collingbourne 6 years ago
3 changed file(s) with 0 addition(s) and 53 deletion(s). Raw diff Collapse all Expand all
8282 /// omitted to search the empty category.
8383 bool isIn(const Module &M, const StringRef Category = StringRef()) const;
8484
85 /// Returns whether either this function or its source file are listed in any
86 /// category. Category will contain the name of an arbitrary category in
87 /// which this function is listed.
88 bool findCategory(const Function &F, StringRef &Category) const;
89
90 /// Returns whether this global, its type or its source file are listed in any
91 /// category. Category will contain the name of an arbitrary category in
92 /// which this global is listed.
93 bool findCategory(const GlobalVariable &G, StringRef &Category) const;
94
95 /// Returns whether this module is listed in any category. Category will
96 /// contain the name of an arbitrary category in which this module is listed.
97 bool findCategory(const Module &M, StringRef &Category) const;
98
9985 private:
10086 SpecialCaseList(SpecialCaseList const &) LLVM_DELETED_FUNCTION;
10187 SpecialCaseList &operator=(SpecialCaseList const &) LLVM_DELETED_FUNCTION;
10793 /// Parses just-constructed SpecialCaseList entries from a memory buffer.
10894 bool parse(const MemoryBuffer *MB, std::string &Error);
10995
110 bool findCategory(const StringRef Section, const StringRef Query,
111 StringRef &Category) const;
11296 bool inSectionCategory(const StringRef Section, const StringRef Query,
11397 const StringRef Category) const;
11498 };
168168 }
169169 }
170170
171 bool SpecialCaseList::findCategory(const Function &F,
172 StringRef &Category) const {
173 return findCategory(*F.getParent(), Category) ||
174 findCategory("fun", F.getName(), Category);
175 }
176
177171 bool SpecialCaseList::isIn(const Function& F, const StringRef Category) const {
178172 return isIn(*F.getParent(), Category) ||
179173 inSectionCategory("fun", F.getName(), Category);
190184 return "";
191185 }
192186
193 bool SpecialCaseList::findCategory(const GlobalVariable &G,
194 StringRef &Category) const {
195 return findCategory(*G.getParent(), Category) ||
196 findCategory("global", G.getName(), Category) ||
197 findCategory("type", GetGVTypeString(G), Category);
198 }
199
200187 bool SpecialCaseList::isIn(const GlobalVariable &G,
201188 const StringRef Category) const {
202189 return isIn(*G.getParent(), Category) ||
204191 inSectionCategory("type", GetGVTypeString(G), Category);
205192 }
206193
207 bool SpecialCaseList::findCategory(const Module &M, StringRef &Category) const {
208 return findCategory("src", M.getModuleIdentifier(), Category);
209 }
210
211194 bool SpecialCaseList::isIn(const Module &M, const StringRef Category) const {
212195 return inSectionCategory("src", M.getModuleIdentifier(), Category);
213 }
214
215 bool SpecialCaseList::findCategory(const StringRef Section,
216 const StringRef Query,
217 StringRef &Category) const {
218 StringMap >::const_iterator I = Entries.find(Section);
219 if (I == Entries.end()) return false;
220
221 for (StringMap::const_iterator II = I->second.begin(),
222 IE = I->second.end();
223 II != IE; ++II) {
224 if (II->getValue().match(Query)) {
225 Category = II->first();
226 return true;
227 }
228 }
229
230 return false;
231196 }
232197
233198 bool SpecialCaseList::inSectionCategory(const StringRef Section,
9393 SCL.reset(makeSpecialCaseList("fun:foo=functional\n"));
9494 EXPECT_TRUE(SCL->isIn(*Foo, "functional"));
9595 StringRef Category;
96 EXPECT_TRUE(SCL->findCategory(*Foo, Category));
97 EXPECT_EQ("functional", Category);
9896 EXPECT_FALSE(SCL->isIn(*Bar, "functional"));
9997 }
10098