r204471 - Fixing code that doesn't compile in MSVC 2012 (but does in MSVC 2013) from r204417 and related commits.

Aaron Ballman aaron at aaronballman.com
Fri Mar 21 08:22:56 PDT 2014


Author: aaronballman
Date: Fri Mar 21 10:22:56 2014
New Revision: 204471

URL: http://llvm.org/viewvc/llvm-project?rev=204471&view=rev
Log:
Fixing code that doesn't compile in MSVC 2012 (but does in MSVC 2013) from r204417 and related commits.

Modified:
    cfe/trunk/include/clang/Serialization/ASTReader.h
    cfe/trunk/lib/Serialization/ASTReader.cpp
    cfe/trunk/lib/Serialization/ASTWriter.cpp
    cfe/trunk/lib/Serialization/ASTWriterDecl.cpp

Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=204471&r1=204470&r2=204471&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Fri Mar 21 10:22:56 2014
@@ -770,6 +770,9 @@ private:
   struct ImportedSubmodule {
     serialization::SubmoduleID ID;
     SourceLocation ImportLoc;
+
+    ImportedSubmodule(serialization::SubmoduleID ID, SourceLocation ImportLoc)
+      : ID(ID), ImportLoc(ImportLoc) {}
   };
 
   /// \brief A list of modules that were imported by precompiled headers or

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=204471&r1=204470&r2=204471&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Fri Mar 21 10:22:56 2014
@@ -3017,7 +3017,7 @@ bool ASTReader::ReadASTBlock(ModuleFile
           unsigned GlobalID = getGlobalSubmoduleID(F, Record[I++]);
           SourceLocation Loc = ReadSourceLocation(F, Record, I);
           if (GlobalID)
-            ImportedModules.push_back({GlobalID, Loc});
+            ImportedModules.push_back(ImportedSubmodule(GlobalID, Loc));
         }
       }
       break;

Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=204471&r1=204470&r2=204471&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Fri Mar 21 10:22:56 2014
@@ -4082,7 +4082,7 @@ void ASTWriter::WriteASTCore(Sema &SemaR
   if (NamespaceDecl *NS = TU->getAnonymousNamespace()) {
     ASTWriter::UpdateRecord &Record = DeclUpdates[TU];
     if (Record.empty())
-      Record.push_back({UPD_CXX_ADDED_ANONYMOUS_NAMESPACE, NS});
+      Record.push_back(DeclUpdate(UPD_CXX_ADDED_ANONYMOUS_NAMESPACE, NS));
   }
 
   // Add update records for all mangling numbers and static local numbers.
@@ -4090,11 +4090,12 @@ void ASTWriter::WriteASTCore(Sema &SemaR
   // tagging this rare extra data onto the declarations.
   for (const auto &Number : Context.MangleNumbers)
     if (!Number.first->isFromASTFile())
-      DeclUpdates[Number.first].push_back({UPD_MANGLING_NUMBER, Number.second});
+      DeclUpdates[Number.first].push_back(DeclUpdate(UPD_MANGLING_NUMBER,
+                                                     Number.second));
   for (const auto &Number : Context.StaticLocalNumbers)
     if (!Number.first->isFromASTFile())
-      DeclUpdates[Number.first].push_back({UPD_STATIC_LOCAL_NUMBER,
-                                           Number.second});
+      DeclUpdates[Number.first].push_back(DeclUpdate(UPD_STATIC_LOCAL_NUMBER,
+                                                     Number.second));
 
   // Make sure visible decls, added to DeclContexts previously loaded from
   // an AST file, are registered for serialization.
@@ -4291,12 +4292,16 @@ void ASTWriter::WriteASTCore(Sema &SemaR
 
   if (!WritingModule) {
     // Write the submodules that were imported, if any.
-    struct ModuleInfo { uint64_t ID; Module *M; };
+    struct ModuleInfo {
+      uint64_t ID;
+      Module *M;
+      ModuleInfo(uint64_t ID, Module *M) : ID(ID), M(M) {}
+    };
     llvm::SmallVector<ModuleInfo, 64> Imports;
     for (const auto *I : Context.local_imports()) {
       assert(SubmoduleIDs.find(I->getImportedModule()) != SubmoduleIDs.end());
-      Imports.push_back({SubmoduleIDs[I->getImportedModule()],
-                         I->getImportedModule()});
+      Imports.push_back(ModuleInfo(SubmoduleIDs[I->getImportedModule()],
+                         I->getImportedModule()));
     }
 
     if (!Imports.empty()) {
@@ -5309,7 +5314,7 @@ void ASTWriter::AddedCXXImplicitMember(c
 
   // A decl coming from PCH was modified.
   assert(RD->isCompleteDefinition());
-  DeclUpdates[RD].push_back({UPD_CXX_ADDED_IMPLICIT_MEMBER, D});
+  DeclUpdates[RD].push_back(DeclUpdate(UPD_CXX_ADDED_IMPLICIT_MEMBER, D));
 }
 
 void ASTWriter::AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD,
@@ -5320,7 +5325,8 @@ void ASTWriter::AddedCXXTemplateSpeciali
   if (!(!D->isFromASTFile() && TD->isFromASTFile()))
     return; // Not a source specialization added to a template from PCH.
 
-  DeclUpdates[TD].push_back({UPD_CXX_ADDED_TEMPLATE_SPECIALIZATION, D});
+  DeclUpdates[TD].push_back(DeclUpdate(UPD_CXX_ADDED_TEMPLATE_SPECIALIZATION,
+                                       D));
 }
 
 void ASTWriter::AddedCXXTemplateSpecialization(
@@ -5331,7 +5337,8 @@ void ASTWriter::AddedCXXTemplateSpeciali
   if (!(!D->isFromASTFile() && TD->isFromASTFile()))
     return; // Not a source specialization added to a template from PCH.
 
-  DeclUpdates[TD].push_back({UPD_CXX_ADDED_TEMPLATE_SPECIALIZATION, D});
+  DeclUpdates[TD].push_back(DeclUpdate(UPD_CXX_ADDED_TEMPLATE_SPECIALIZATION,
+                                       D));
 }
 
 void ASTWriter::AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
@@ -5342,7 +5349,8 @@ void ASTWriter::AddedCXXTemplateSpeciali
   if (!(!D->isFromASTFile() && TD->isFromASTFile()))
     return; // Not a source specialization added to a template from PCH.
 
-  DeclUpdates[TD].push_back({UPD_CXX_ADDED_TEMPLATE_SPECIALIZATION, D});
+  DeclUpdates[TD].push_back(DeclUpdate(UPD_CXX_ADDED_TEMPLATE_SPECIALIZATION,
+                                       D));
 }
 
 void ASTWriter::ResolvedExceptionSpec(const FunctionDecl *FD) {
@@ -5360,7 +5368,7 @@ void ASTWriter::DeducedReturnType(const
   if (!FD->isFromASTFile())
     return; // Not a function declared in PCH and defined outside.
 
-  DeclUpdates[FD].push_back({UPD_CXX_DEDUCED_RETURN_TYPE, ReturnType});
+  DeclUpdates[FD].push_back(DeclUpdate(UPD_CXX_DEDUCED_RETURN_TYPE, ReturnType));
 }
 
 void ASTWriter::CompletedImplicitDefinition(const FunctionDecl *D) {
@@ -5381,8 +5389,8 @@ void ASTWriter::StaticDataMemberInstanti
   // Since the actual instantiation is delayed, this really means that we need
   // to update the instantiation location.
   DeclUpdates[D].push_back(
-      {UPD_CXX_INSTANTIATED_STATIC_DATA_MEMBER,
-       D->getMemberSpecializationInfo()->getPointOfInstantiation()});
+      DeclUpdate(UPD_CXX_INSTANTIATED_STATIC_DATA_MEMBER,
+       D->getMemberSpecializationInfo()->getPointOfInstantiation()));
 }
 
 void ASTWriter::AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
@@ -5416,5 +5424,5 @@ void ASTWriter::DeclarationMarkedUsed(co
   if (!D->isFromASTFile())
     return;
 
-  DeclUpdates[D].push_back({UPD_DECL_MARKED_USED});
+  DeclUpdates[D].push_back(DeclUpdate(UPD_DECL_MARKED_USED));
 }

Modified: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=204471&r1=204470&r2=204471&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Fri Mar 21 10:22:56 2014
@@ -896,7 +896,7 @@ void ASTDeclWriter::VisitNamespaceDecl(N
         D->getParent()->getRedeclContext()->getPrimaryContext());
     if (Parent->isFromASTFile() || isa<TranslationUnitDecl>(Parent)) {
       Writer.DeclUpdates[Parent].push_back(
-          {UPD_CXX_ADDED_ANONYMOUS_NAMESPACE, D});
+          ASTWriter::DeclUpdate(UPD_CXX_ADDED_ANONYMOUS_NAMESPACE, D));
     }
   }
 }





More information about the cfe-commits mailing list