mwasplund updated this revision to Diff 168607.

Repository:
  rC Clang

https://reviews.llvm.org/D52973

Files:
  include/clang/AST/ASTContext.h
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/ASTContext.cpp
  lib/Sema/Sema.cpp
  lib/Sema/SemaDecl.cpp
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTWriter.cpp

Index: lib/Serialization/ASTWriter.cpp
===================================================================
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -4682,7 +4682,9 @@
   RegisterPredefDecl(Context.CFConstantStringTagDecl,
                      PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID);
   RegisterPredefDecl(Context.TypePackElementDecl,
-                     PREDEF_DECL_TYPE_PACK_ELEMENT_ID);
+                     PREDEF_DECL_TYPE_PACK_ELEMENT_ID);
+  RegisterPredefDecl(Context.TypeInfoClassDecl,
+                     PREDEF_DECL_TYPE_INFO_CLASS_ID);
 
   // Build a record containing all of the tentative definitions in this file, in
   // TentativeDefinitions order.  Generally, this record will be empty for
Index: lib/Serialization/ASTReader.cpp
===================================================================
--- lib/Serialization/ASTReader.cpp
+++ lib/Serialization/ASTReader.cpp
@@ -7306,6 +7306,9 @@
 
   case PREDEF_DECL_TYPE_PACK_ELEMENT_ID:
     return Context.getTypePackElementDecl();
+
+  case PREDEF_DECL_TYPE_INFO_CLASS_ID:
+    return Context.getTypeInfoClassDecl();
   }
   llvm_unreachable("PredefinedDeclIDs unknown enum value");
 }
Index: lib/Sema/SemaDecl.cpp
===================================================================
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -1464,6 +1464,11 @@
   if (NewM == OldM)
     return false;
 
+  // FIXME: The Modules TS does not specify how to handle inplicit types
+  // For now we will simply ignore the implicit global types
+  if (Old->isImplicit())
+    return false;
+
   // FIXME: Check proclaimed-ownership-declarations here too.
   bool NewIsModuleInterface = NewM && NewM->Kind == Module::ModuleInterfaceUnit;
   bool OldIsModuleInterface = OldM && OldM->Kind == Module::ModuleInterfaceUnit;
Index: lib/Sema/Sema.cpp
===================================================================
--- lib/Sema/Sema.cpp
+++ lib/Sema/Sema.cpp
@@ -247,8 +247,7 @@
   if (getLangOpts().MSVCCompat) {
     if (getLangOpts().CPlusPlus &&
         IdResolver.begin(&Context.Idents.get("type_info")) == IdResolver.end())
-      PushOnScopeChains(Context.buildImplicitRecord("type_info", TTK_Class),
-                        TUScope);
+      PushOnScopeChains(Context.getTypeInfoClassDecl(), TUScope);
 
     addImplicitTypedef("size_t", Context.getSizeType());
   }
Index: lib/AST/ASTContext.cpp
===================================================================
--- lib/AST/ASTContext.cpp
+++ lib/AST/ASTContext.cpp
@@ -1080,6 +1080,12 @@
   return UInt128Decl;
 }
 
+RecordDecl *ASTContext::getTypeInfoClassDecl() const {
+  if (!TypeInfoClassDecl)
+    TypeInfoClassDecl = buildImplicitRecord("type_info", TTK_Class);
+  return TypeInfoClassDecl;
+}
+
 void ASTContext::InitBuiltinType(CanQualType &R, BuiltinType::Kind K) {
   auto *Ty = new (*this, TypeAlignment) BuiltinType(K);
   R = CanQualType::CreateUnsafe(QualType(Ty, 0));
Index: include/clang/Serialization/ASTBitCodes.h
===================================================================
--- include/clang/Serialization/ASTBitCodes.h
+++ include/clang/Serialization/ASTBitCodes.h
@@ -1264,13 +1264,16 @@
 
       /// The internal '__type_pack_element' template.
       PREDEF_DECL_TYPE_PACK_ELEMENT_ID = 16,
+
+      /// The internal 'type_info' class.
+      PREDEF_DECL_TYPE_INFO_CLASS_ID = 17,
     };
 
     /// The number of declaration IDs that are predefined.
     ///
     /// For more information about predefined declarations, see the
     /// \c PredefinedDeclIDs type and the PREDEF_DECL_*_ID constants.
-    const unsigned int NUM_PREDEF_DECL_IDS = 17;
+    const unsigned int NUM_PREDEF_DECL_IDS = 18;
 
     /// Record of updates for a declaration that was modified after
     /// being deserialized. This can occur within DECLTYPES_BLOCK_ID.
Index: include/clang/AST/ASTContext.h
===================================================================
--- include/clang/AST/ASTContext.h
+++ include/clang/AST/ASTContext.h
@@ -326,6 +326,9 @@
   /// The typedef for the predefined 'BOOL' type.
   mutable TypedefDecl *BOOLDecl = nullptr;
 
+  /// The class for the predifined 'type_info' type.
+  mutable RecordDecl *TypeInfoClassDecl = nullptr;
+
   // Typedefs which may be provided defining the structure of Objective-C
   // pseudo-builtins
   QualType ObjCIdRedefinitionType;
@@ -1123,6 +1126,9 @@
   /// Retrieve the declaration for the 128-bit unsigned integer type.
   TypedefDecl *getUInt128Decl() const;
 
+  /// Retrieve the declaration for the type_info class type.
+  RecordDecl *getTypeInfoClassDecl() const;
+
   //===--------------------------------------------------------------------===//
   //                           Type Constructors
   //===--------------------------------------------------------------------===//
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to