[cfe-commits] r107595 - in /cfe/trunk: include/clang/AST/ASTContext.h include/clang/Frontend/PCHBitCodes.h lib/AST/ASTContext.cpp lib/Frontend/PCHReader.cpp lib/Frontend/PCHWriter.cpp lib/Sema/Sema.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Sun Jul 4 14:44:19 PDT 2010


Author: akirtzidis
Date: Sun Jul  4 16:44:19 2010
New Revision: 107595

URL: http://llvm.org/viewvc/llvm-project?rev=107595&view=rev
Log:
Don't try to install the __[u]int128_t identifier if it is already installed by PCHReader.

Currently, adding it to visible decls of a PCH'ed translation unit has no effect because
adding visible decls before deserialization has no effect (the decls won't be visible).
This will be fixed in a future commit; then it will force deserialization of visible decls, so avoid pointlessly installing it.

Modified:
    cfe/trunk/include/clang/AST/ASTContext.h
    cfe/trunk/include/clang/Frontend/PCHBitCodes.h
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/lib/Frontend/PCHReader.cpp
    cfe/trunk/lib/Frontend/PCHWriter.cpp
    cfe/trunk/lib/Sema/Sema.cpp

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=107595&r1=107594&r2=107595&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Sun Jul  4 16:44:19 2010
@@ -148,7 +148,10 @@
   
   TemplateTemplateParmDecl *getCanonicalTemplateTemplateParmDecl(
                                                TemplateTemplateParmDecl *TTP);
-  
+
+  /// \brief Whether __[u]int128_t identifier is installed.
+  bool IsInt128Installed;
+
   /// BuiltinVaListType - built-in va list type.
   /// This is initially null and set by Sema::LazilyCreateBuiltin when
   /// a builtin that takes a valist is encountered.
@@ -818,6 +821,10 @@
   /// purpose in characters.
   CharUnits getObjCEncodingTypeSize(QualType t);
 
+  /// \brief Whether __[u]int128_t identifier is installed.
+  bool isInt128Installed() const { return IsInt128Installed; }
+  void setInt128Installed() { IsInt128Installed = true; }
+
   /// This setter/getter represents the ObjC 'id' type. It is setup lazily, by
   /// Sema.  id is always a (typedef for a) pointer type, a pointer to a struct.
   QualType getObjCIdType() const { return ObjCIdTypedefType; }

Modified: cfe/trunk/include/clang/Frontend/PCHBitCodes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/PCHBitCodes.h?rev=107595&r1=107594&r2=107595&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/PCHBitCodes.h (original)
+++ cfe/trunk/include/clang/Frontend/PCHBitCodes.h Sun Jul  4 16:44:19 2010
@@ -467,7 +467,9 @@
       /// \brief Objective-C "SEL" redefinition type
       SPECIAL_TYPE_OBJC_SEL_REDEFINITION       = 14,
       /// \brief NSConstantString type
-      SPECIAL_TYPE_NS_CONSTANT_STRING          = 15
+      SPECIAL_TYPE_NS_CONSTANT_STRING          = 15,
+      /// \brief Whether __[u]int128_t identifier is installed.
+      SPECIAL_TYPE_INT128_INSTALLED            = 16
     };
 
     /// \brief Record codes for each kind of declaration.

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=107595&r1=107594&r2=107595&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Sun Jul  4 16:44:19 2010
@@ -141,8 +141,8 @@
                        bool FreeMem, unsigned size_reserve) :
   TemplateSpecializationTypes(this_()),
   DependentTemplateSpecializationTypes(this_()),
-  GlobalNestedNameSpecifier(0), CFConstantStringTypeDecl(0),
-  NSConstantStringTypeDecl(0),
+  GlobalNestedNameSpecifier(0), IsInt128Installed(false),
+  CFConstantStringTypeDecl(0), NSConstantStringTypeDecl(0),
   ObjCFastEnumerationStateTypeDecl(0), FILEDecl(0), jmp_bufDecl(0),
   sigjmp_bufDecl(0), BlockDescriptorType(0), BlockDescriptorExtendedType(0),
   NullTypeSourceInfo(QualType()),

Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=107595&r1=107594&r2=107595&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReader.cpp Sun Jul  4 16:44:19 2010
@@ -1769,6 +1769,9 @@
     Context->ObjCSelRedefinitionType = GetType(ObjCSelRedef);
   if (unsigned String = SpecialTypes[pch::SPECIAL_TYPE_NS_CONSTANT_STRING])
     Context->setNSConstantStringType(GetType(String));
+
+  if (SpecialTypes[pch::SPECIAL_TYPE_INT128_INSTALLED])
+    Context->setInt128Installed();
 }
 
 /// \brief Retrieve the name of the original source file name

Modified: cfe/trunk/lib/Frontend/PCHWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriter.cpp?rev=107595&r1=107594&r2=107595&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHWriter.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHWriter.cpp Sun Jul  4 16:44:19 2010
@@ -2159,6 +2159,7 @@
   AddTypeRef(Context.getRawBlockdescriptorExtendedType(), Record);
   AddTypeRef(Context.ObjCSelRedefinitionType, Record);
   AddTypeRef(Context.getRawNSConstantStringType(), Record);
+  Record.push_back(Context.isInt128Installed());
   Stream.EmitRecord(pch::SPECIAL_TYPES, Record);
 
   // Keep writing types and declarations until all types and

Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=107595&r1=107594&r2=107595&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Sun Jul  4 16:44:19 2010
@@ -46,7 +46,8 @@
 
   VAListTagName = PP.getIdentifierInfo("__va_list_tag");
 
-  if (PP.getTargetInfo().getPointerWidth(0) >= 64) {
+  if (!Context.isInt128Installed() && // May be set by PCHReader.
+      PP.getTargetInfo().getPointerWidth(0) >= 64) {
     TypeSourceInfo *TInfo;
 
     // Install [u]int128_t for 64-bit targets.
@@ -61,6 +62,7 @@
                                           SourceLocation(),
                                           &Context.Idents.get("__uint128_t"),
                                           TInfo), TUScope);
+    Context.setInt128Installed();
   }
 
 





More information about the cfe-commits mailing list