From 76818825f6ca07107e55c63b7201f0e605801636 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 15 Nov 2016 18:56:39 +0000 Subject: [PATCH] [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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@287005 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Lex/ModuleMap.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp index 2b6b78acee..c1b7b33c31 100644 --- a/lib/Lex/ModuleMap.cpp +++ b/lib/Lex/ModuleMap.cpp @@ -596,8 +596,7 @@ static void inferFrameworkLink(Module *Mod, const DirectoryEntry *FrameworkDir, // 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::parseExternModuleDecl() { /// 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; } -- 2.40.0