void ClangInternalState::printMacroDefinitions(llvm::raw_ostream& Out, const clang::Preprocessor& PP) { stdstrstream contentsOS; PP.printMacros(contentsOS); Out << "Ordered Alphabetically:\n"; std::vector<std::string> elems; { // Split the string into lines. char delim = '\n'; std::stringstream ss(contentsOS.str()); std::string item; while (std::getline(ss, item, delim)) { elems.push_back(item); } // Sort them alphabetically std::sort(elems.begin(), elems.end()); } for(std::vector<std::string>::iterator I = elems.begin(), E = elems.end(); I != E; ++I) Out << *I << '\n'; Out.flush(); }
void ClangInternalState::printMacroDefinitions(llvm::raw_ostream& Out, clang::Preprocessor& PP) { PP.printMacros(Out); }