Author: d0k Date: Tue Nov 15 12:56:39 2016 New Revision: 287005 URL: http://llvm.org/viewvc/llvm-project?rev=287005&view=rev Log: [Modules] Replace arrays with init lists.
Thi way the compiler can pick the optimal storage duration. It's also more readable. No functional change intended. Modified: cfe/trunk/lib/Lex/ModuleMap.cpp Modified: cfe/trunk/lib/Lex/ModuleMap.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=287005&r1=287004&r2=287005&view=diff ============================================================================== --- cfe/trunk/lib/Lex/ModuleMap.cpp (original) +++ cfe/trunk/lib/Lex/ModuleMap.cpp Tue Nov 15 12:56:39 2016 @@ -596,8 +596,7 @@ static void inferFrameworkLink(Module *M // The library name of a framework has more than one possible extension since // the introduction of the text-based dynamic library format. We need to check // for both before we give up. - static const char *frameworkExtensions[] = {"", ".tbd"}; - for (const auto *extension : frameworkExtensions) { + for (const char *extension : {"", ".tbd"}) { llvm::sys::path::replace_extension(LibName, extension); if (FileMgr.getFile(LibName)) { Mod->LinkLibraries.push_back(Module::LinkLibrary(Mod->Name, @@ -1655,15 +1654,12 @@ void ModuleMapParser::parseExternModuleD /// was never correct and causes issues now that we check it, so drop it. static bool shouldAddRequirement(Module *M, StringRef Feature, bool &IsRequiresExcludedHack) { - static const StringRef DarwinCExcluded[] = {"Darwin", "C", "excluded"}; - static const StringRef TclPrivate[] = {"Tcl", "Private"}; - static const StringRef IOKitAVC[] = {"IOKit", "avc"}; - - if (Feature == "excluded" && (M->fullModuleNameIs(DarwinCExcluded) || - M->fullModuleNameIs(TclPrivate))) { + if (Feature == "excluded" && + (M->fullModuleNameIs({"Darwin", "C", "excluded"}) || + M->fullModuleNameIs({"Tcl", "Private"}))) { IsRequiresExcludedHack = true; return false; - } else if (Feature == "cplusplus" && M->fullModuleNameIs(IOKitAVC)) { + } else if (Feature == "cplusplus" && M->fullModuleNameIs({"IOKit", "avc"})) { return false; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits