mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Revert "Fix an invalid check for duplicate option categories."
This reverts commit r200853. It was causing clang/Analysis/checker-plugins.c to crash. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200858 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d1dc9a0af0
commit
9a7cfe5a3a
@ -149,8 +149,8 @@ private:
|
|||||||
public:
|
public:
|
||||||
OptionCategory(const char *const Name, const char *const Description = 0)
|
OptionCategory(const char *const Name, const char *const Description = 0)
|
||||||
: Name(Name), Description(Description) { registerCategory(); }
|
: Name(Name), Description(Description) { registerCategory(); }
|
||||||
const char *getName() const { return Name; }
|
const char *getName() { return Name; }
|
||||||
const char *getDescription() const { return Description; }
|
const char *getDescription() { return Description; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// The general Option Category (used as default category).
|
// The general Option Category (used as default category).
|
||||||
|
@ -125,21 +125,8 @@ static ManagedStatic<OptionCatSet> RegisteredOptionCategories;
|
|||||||
// Initialise the general option category.
|
// Initialise the general option category.
|
||||||
OptionCategory llvm::cl::GeneralCategory("General options");
|
OptionCategory llvm::cl::GeneralCategory("General options");
|
||||||
|
|
||||||
struct HasName {
|
|
||||||
HasName(StringRef Name) : Name(Name) {}
|
|
||||||
bool operator()(const OptionCategory *Category) const {
|
|
||||||
return Name == Category->getName();
|
|
||||||
}
|
|
||||||
StringRef Name;
|
|
||||||
};
|
|
||||||
|
|
||||||
void OptionCategory::registerCategory()
|
void OptionCategory::registerCategory()
|
||||||
{
|
{
|
||||||
assert(std::count_if(RegisteredOptionCategories->begin(),
|
|
||||||
RegisteredOptionCategories->end(),
|
|
||||||
HasName(getName())) == 0 &&
|
|
||||||
"Duplicate option categories");
|
|
||||||
|
|
||||||
RegisteredOptionCategories->insert(this);
|
RegisteredOptionCategories->insert(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1508,7 +1495,9 @@ public:
|
|||||||
// It shall return true if A's name should be lexographically
|
// It shall return true if A's name should be lexographically
|
||||||
// ordered before B's name. It returns false otherwise.
|
// ordered before B's name. It returns false otherwise.
|
||||||
static bool OptionCategoryCompare(OptionCategory *A, OptionCategory *B) {
|
static bool OptionCategoryCompare(OptionCategory *A, OptionCategory *B) {
|
||||||
return strcmp(A->getName(), B->getName()) < 0;
|
int Length = strcmp(A->getName(), B->getName());
|
||||||
|
assert(Length != 0 && "Duplicate option categories");
|
||||||
|
return Length < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure we inherit our base class's operator=()
|
// Make sure we inherit our base class's operator=()
|
||||||
|
Loading…
Reference in New Issue
Block a user