r220639 - ModuleMap::addHeader(): Appease msc17.

NAKAMURA Takumi geek4civic at gmail.com
Sun Oct 26 06:12:35 PDT 2014


Author: chapuni
Date: Sun Oct 26 08:12:35 2014
New Revision: 220639

URL: http://llvm.org/viewvc/llvm-project?rev=220639&view=rev
Log:
ModuleMap::addHeader(): Appease msc17.

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=220639&r1=220638&r2=220639&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Sun Oct 26 08:12:35 2014
@@ -778,10 +778,22 @@ void ModuleMap::setUmbrellaDir(Module *M
 
 void ModuleMap::addHeader(Module *Mod, const FileEntry *Header,
                           ModuleHeaderRole Role) {
-  auto HeaderLists = {&Mod->NormalHeaders, &Mod->PrivateHeaders,
-                      &Mod->TextualHeaders, &Mod->PrivateTextualHeaders};
-  assert(Role >= 0 && Role < HeaderLists.size() && "unknown header role");
-  HeaderLists.begin()[Role]->push_back(Header);
+  switch ((int)Role) {
+  default:
+    llvm_unreachable("unknown header role");
+  case NormalHeader:
+    Mod->NormalHeaders.push_back(Header);
+    break;
+  case PrivateHeader:
+    Mod->PrivateHeaders.push_back(Header);
+    break;
+  case TextualHeader:
+    Mod->TextualHeaders.push_back(Header);
+    break;
+  case PrivateHeader | TextualHeader:
+    Mod->PrivateTextualHeaders.push_back(Header);
+    break;
+  }
 
   if (!(Role & TextualHeader)) {
     bool isCompilingModuleHeader = Mod->getTopLevelModule() == CompilingModule;





More information about the cfe-commits mailing list