]> granicus.if.org Git - clang/commitdiff
[Modules] Replace arrays with init lists.
authorBenjamin Kramer <benny.kra@googlemail.com>
Tue, 15 Nov 2016 18:56:39 +0000 (18:56 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 15 Nov 2016 18:56:39 +0000 (18:56 +0000)
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

index 2b6b78aceec52c55fcf639489038cd0433eb0243..c1b7b33c31e3ad867a95729b900a5133324ba4b7 100644 (file)
@@ -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;
   }