forked from OSchip/llvm-project
Rewrite a cold use of std::sort to array_pod_sort.
No functionality change. llvm-svn: 191173
This commit is contained in:
parent
5626259506
commit
a92b80f8a0
|
@ -154,25 +154,29 @@ void ento::registerCallGraphDumper(CheckerManager &mgr) {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class ConfigDumper : public Checker< check::EndOfTranslationUnit > {
|
class ConfigDumper : public Checker< check::EndOfTranslationUnit > {
|
||||||
|
typedef AnalyzerOptions::ConfigTable Table;
|
||||||
|
|
||||||
|
static int compareEntry(const void *LHS, const void *RHS) {
|
||||||
|
return ((const Table::MapEntryTy *)LHS)->getKey().compare(
|
||||||
|
((const Table::MapEntryTy *)RHS)->getKey());
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void checkEndOfTranslationUnit(const TranslationUnitDecl *TU,
|
void checkEndOfTranslationUnit(const TranslationUnitDecl *TU,
|
||||||
AnalysisManager& mgr,
|
AnalysisManager& mgr,
|
||||||
BugReporter &BR) const {
|
BugReporter &BR) const {
|
||||||
|
const Table &Config = mgr.options.Config;
|
||||||
|
|
||||||
const AnalyzerOptions::ConfigTable &Config = mgr.options.Config;
|
SmallVector<const Table::MapEntryTy *, 32> Keys;
|
||||||
AnalyzerOptions::ConfigTable::const_iterator I =
|
for (Table::const_iterator I = Config.begin(), E = Config.end(); I != E;
|
||||||
Config.begin(), E = Config.end();
|
++I)
|
||||||
|
Keys.push_back(&*I);
|
||||||
|
llvm::array_pod_sort(Keys.begin(), Keys.end(), compareEntry);
|
||||||
|
|
||||||
std::vector<StringRef> Keys;
|
|
||||||
for (; I != E ; ++I) { Keys.push_back(I->getKey()); }
|
|
||||||
sort(Keys.begin(), Keys.end());
|
|
||||||
|
|
||||||
llvm::errs() << "[config]\n";
|
llvm::errs() << "[config]\n";
|
||||||
for (unsigned i = 0, n = Keys.size(); i < n ; ++i) {
|
for (unsigned I = 0, E = Keys.size(); I != E; ++I)
|
||||||
StringRef Key = Keys[i];
|
llvm::errs() << Keys[I]->getKey() << " = " << Keys[I]->second << '\n';
|
||||||
I = Config.find(Key);
|
|
||||||
llvm::errs() << Key << " = " << I->second << '\n';
|
|
||||||
}
|
|
||||||
llvm::errs() << "[stats]\n" << "num-entries = " << Keys.size() << '\n';
|
llvm::errs() << "[stats]\n" << "num-entries = " << Keys.size() << '\n';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue