mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-11 06:38:20 +00:00
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
This commit is contained in:
@ -83,20 +83,6 @@ class SpecialCaseList {
|
|||||||
/// omitted to search the empty category.
|
/// omitted to search the empty category.
|
||||||
bool isIn(const Module &M, const StringRef Category = StringRef()) const;
|
bool isIn(const Module &M, const StringRef Category = StringRef()) const;
|
||||||
|
|
||||||
/// Returns whether either this function or its source file are listed in any
|
|
||||||
/// category. Category will contain the name of an arbitrary category in
|
|
||||||
/// which this function is listed.
|
|
||||||
bool findCategory(const Function &F, StringRef &Category) const;
|
|
||||||
|
|
||||||
/// Returns whether this global, its type or its source file are listed in any
|
|
||||||
/// category. Category will contain the name of an arbitrary category in
|
|
||||||
/// which this global is listed.
|
|
||||||
bool findCategory(const GlobalVariable &G, StringRef &Category) const;
|
|
||||||
|
|
||||||
/// Returns whether this module is listed in any category. Category will
|
|
||||||
/// contain the name of an arbitrary category in which this module is listed.
|
|
||||||
bool findCategory(const Module &M, StringRef &Category) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SpecialCaseList(SpecialCaseList const &) LLVM_DELETED_FUNCTION;
|
SpecialCaseList(SpecialCaseList const &) LLVM_DELETED_FUNCTION;
|
||||||
SpecialCaseList &operator=(SpecialCaseList const &) LLVM_DELETED_FUNCTION;
|
SpecialCaseList &operator=(SpecialCaseList const &) LLVM_DELETED_FUNCTION;
|
||||||
@ -108,8 +94,6 @@ class SpecialCaseList {
|
|||||||
/// Parses just-constructed SpecialCaseList entries from a memory buffer.
|
/// Parses just-constructed SpecialCaseList entries from a memory buffer.
|
||||||
bool parse(const MemoryBuffer *MB, std::string &Error);
|
bool parse(const MemoryBuffer *MB, std::string &Error);
|
||||||
|
|
||||||
bool findCategory(const StringRef Section, const StringRef Query,
|
|
||||||
StringRef &Category) const;
|
|
||||||
bool inSectionCategory(const StringRef Section, const StringRef Query,
|
bool inSectionCategory(const StringRef Section, const StringRef Query,
|
||||||
const StringRef Category) const;
|
const StringRef Category) const;
|
||||||
};
|
};
|
||||||
|
@ -169,12 +169,6 @@ SpecialCaseList::~SpecialCaseList() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SpecialCaseList::findCategory(const Function &F,
|
|
||||||
StringRef &Category) const {
|
|
||||||
return findCategory(*F.getParent(), Category) ||
|
|
||||||
findCategory("fun", F.getName(), Category);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SpecialCaseList::isIn(const Function& F, const StringRef Category) const {
|
bool SpecialCaseList::isIn(const Function& F, const StringRef Category) const {
|
||||||
return isIn(*F.getParent(), Category) ||
|
return isIn(*F.getParent(), Category) ||
|
||||||
inSectionCategory("fun", F.getName(), Category);
|
inSectionCategory("fun", F.getName(), Category);
|
||||||
@ -191,13 +185,6 @@ static StringRef GetGVTypeString(const GlobalVariable &G) {
|
|||||||
return "<unknown type>";
|
return "<unknown type>";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SpecialCaseList::findCategory(const GlobalVariable &G,
|
|
||||||
StringRef &Category) const {
|
|
||||||
return findCategory(*G.getParent(), Category) ||
|
|
||||||
findCategory("global", G.getName(), Category) ||
|
|
||||||
findCategory("type", GetGVTypeString(G), Category);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SpecialCaseList::isIn(const GlobalVariable &G,
|
bool SpecialCaseList::isIn(const GlobalVariable &G,
|
||||||
const StringRef Category) const {
|
const StringRef Category) const {
|
||||||
return isIn(*G.getParent(), Category) ||
|
return isIn(*G.getParent(), Category) ||
|
||||||
@ -205,32 +192,10 @@ bool SpecialCaseList::isIn(const GlobalVariable &G,
|
|||||||
inSectionCategory("type", GetGVTypeString(G), Category);
|
inSectionCategory("type", GetGVTypeString(G), Category);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SpecialCaseList::findCategory(const Module &M, StringRef &Category) const {
|
|
||||||
return findCategory("src", M.getModuleIdentifier(), Category);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SpecialCaseList::isIn(const Module &M, const StringRef Category) const {
|
bool SpecialCaseList::isIn(const Module &M, const StringRef Category) const {
|
||||||
return inSectionCategory("src", M.getModuleIdentifier(), Category);
|
return inSectionCategory("src", M.getModuleIdentifier(), Category);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SpecialCaseList::findCategory(const StringRef Section,
|
|
||||||
const StringRef Query,
|
|
||||||
StringRef &Category) const {
|
|
||||||
StringMap<StringMap<Entry> >::const_iterator I = Entries.find(Section);
|
|
||||||
if (I == Entries.end()) return false;
|
|
||||||
|
|
||||||
for (StringMap<Entry>::const_iterator II = I->second.begin(),
|
|
||||||
IE = I->second.end();
|
|
||||||
II != IE; ++II) {
|
|
||||||
if (II->getValue().match(Query)) {
|
|
||||||
Category = II->first();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SpecialCaseList::inSectionCategory(const StringRef Section,
|
bool SpecialCaseList::inSectionCategory(const StringRef Section,
|
||||||
const StringRef Query,
|
const StringRef Query,
|
||||||
const StringRef Category) const {
|
const StringRef Category) const {
|
||||||
|
@ -94,8 +94,6 @@ TEST_F(SpecialCaseListTest, FunctionIsIn) {
|
|||||||
SCL.reset(makeSpecialCaseList("fun:foo=functional\n"));
|
SCL.reset(makeSpecialCaseList("fun:foo=functional\n"));
|
||||||
EXPECT_TRUE(SCL->isIn(*Foo, "functional"));
|
EXPECT_TRUE(SCL->isIn(*Foo, "functional"));
|
||||||
StringRef Category;
|
StringRef Category;
|
||||||
EXPECT_TRUE(SCL->findCategory(*Foo, Category));
|
|
||||||
EXPECT_EQ("functional", Category);
|
|
||||||
EXPECT_FALSE(SCL->isIn(*Bar, "functional"));
|
EXPECT_FALSE(SCL->isIn(*Bar, "functional"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user