diff options
Diffstat (limited to 'clang/lib/Frontend/PrintPreprocessedOutput.cpp')
-rw-r--r-- | clang/lib/Frontend/PrintPreprocessedOutput.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp index 20d7cd3a8c0..88e3b2212ab 100644 --- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -678,11 +678,6 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok, } } -typedef std::pair<const IdentifierInfo *, MacroInfo *> id_macro_pair; -static int MacroIDCompare(const id_macro_pair *LHS, const id_macro_pair *RHS) { - return LHS->first->getName().compare(RHS->first->getName()); -} - static void DoPrintMacros(Preprocessor &PP, raw_ostream *OS) { // Ignore unknown pragmas. PP.AddPragmaHandler(new EmptyPragmaHandler()); @@ -695,13 +690,17 @@ static void DoPrintMacros(Preprocessor &PP, raw_ostream *OS) { do PP.Lex(Tok); while (Tok.isNot(tok::eof)); + typedef std::pair<const IdentifierInfo *, MacroInfo *> id_macro_pair; SmallVector<id_macro_pair, 128> MacrosByID; for (Preprocessor::macro_iterator I = PP.macro_begin(), E = PP.macro_end(); I != E; ++I) { if (I->first->hasMacroDefinition()) MacrosByID.push_back(id_macro_pair(I->first, I->second->getMacroInfo())); } - llvm::array_pod_sort(MacrosByID.begin(), MacrosByID.end(), MacroIDCompare); + llvm::array_pod_sort(MacrosByID.begin(), MacrosByID.end(), + [](const id_macro_pair *LHS, const id_macro_pair *RHS) { + return LHS->first->getName().compare(RHS->first->getName()); + }); for (unsigned i = 0, e = MacrosByID.size(); i != e; ++i) { MacroInfo &MI = *MacrosByID[i].second; |