Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Dec 2011 22:30:21 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r229041 - in stable/9/contrib/llvm/tools/clang: include/clang/AST include/clang/Basic include/clang/Serialization lib/AST lib/Sema lib/Serialization
Message-ID:  <201112302230.pBUMULC6033851@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Fri Dec 30 22:30:21 2011
New Revision: 229041
URL: http://svn.freebsd.org/changeset/base/229041

Log:
  MFC r227737:
  
  Pull in r144505 from upstream clang trunk:
  
  Fix the signature of the getcontext builtin, eliminating incorrect
  warnings about its prototype.
  
  This also adds a -W(no-)builtin-requires-header option, which can be
  used to enable or disable warnings of this kind.

Modified:
  stable/9/contrib/llvm/tools/clang/include/clang/AST/ASTContext.h
  stable/9/contrib/llvm/tools/clang/include/clang/Basic/Builtins.def
  stable/9/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td
  stable/9/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
  stable/9/contrib/llvm/tools/clang/include/clang/Serialization/ASTBitCodes.h
  stable/9/contrib/llvm/tools/clang/lib/AST/ASTContext.cpp
  stable/9/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp
  stable/9/contrib/llvm/tools/clang/lib/Serialization/ASTReader.cpp
  stable/9/contrib/llvm/tools/clang/lib/Serialization/ASTWriter.cpp
Directory Properties:
  stable/9/contrib/llvm/   (props changed)
  stable/9/contrib/llvm/tools/clang/   (props changed)

Modified: stable/9/contrib/llvm/tools/clang/include/clang/AST/ASTContext.h
==============================================================================
--- stable/9/contrib/llvm/tools/clang/include/clang/AST/ASTContext.h	Fri Dec 30 22:27:26 2011	(r229040)
+++ stable/9/contrib/llvm/tools/clang/include/clang/AST/ASTContext.h	Fri Dec 30 22:30:21 2011	(r229041)
@@ -229,6 +229,9 @@ class ASTContext : public llvm::RefCount
   /// \brief The type for the C sigjmp_buf type.
   TypeDecl *sigjmp_bufDecl;
 
+  /// \brief The type for the C ucontext_t type.
+  TypeDecl *ucontext_tDecl;
+
   /// \brief Type for the Block descriptor for Blocks CodeGen.
   ///
   /// Since this is only used for generation of debug info, it is not
@@ -955,6 +958,18 @@ public:
     return QualType();
   }
 
+  /// \brief Set the type for the C ucontext_t type.
+  void setucontext_tDecl(TypeDecl *ucontext_tDecl) {
+    this->ucontext_tDecl = ucontext_tDecl;
+  }
+
+  /// \brief Retrieve the C ucontext_t type.
+  QualType getucontext_tType() const {
+    if (ucontext_tDecl)
+      return getTypeDeclType(ucontext_tDecl);
+    return QualType();
+  }
+
   /// \brief The result type of logical operations, '<', '>', '!=', etc.
   QualType getLogicalOperationType() const {
     return getLangOptions().CPlusPlus ? BoolTy : IntTy;
@@ -1099,7 +1114,8 @@ public:
   enum GetBuiltinTypeError {
     GE_None,              //< No error
     GE_Missing_stdio,     //< Missing a type from <stdio.h>
-    GE_Missing_setjmp     //< Missing a type from <setjmp.h>
+    GE_Missing_setjmp,    //< Missing a type from <setjmp.h>
+    GE_Missing_ucontext   //< Missing a type from <ucontext.h>
   };
 
   /// GetBuiltinType - Return the type for the specified builtin.  If 

Modified: stable/9/contrib/llvm/tools/clang/include/clang/Basic/Builtins.def
==============================================================================
--- stable/9/contrib/llvm/tools/clang/include/clang/Basic/Builtins.def	Fri Dec 30 22:27:26 2011	(r229040)
+++ stable/9/contrib/llvm/tools/clang/include/clang/Basic/Builtins.def	Fri Dec 30 22:30:21 2011	(r229041)
@@ -39,6 +39,7 @@
 //  P -> FILE
 //  J -> jmp_buf
 //  SJ -> sigjmp_buf
+//  K -> ucontext_t
 //  . -> "...".  This may only occur at the end of the function list.
 //
 // Types may be prefixed with the following modifiers:
@@ -685,7 +686,7 @@ LIBBUILTIN(sigsetjmp, "iSJi",     "fj", 
 LIBBUILTIN(setjmp_syscall, "iJ",  "fj",   "setjmp.h", ALL_LANGUAGES)
 LIBBUILTIN(savectx, "iJ",         "fj",   "setjmp.h", ALL_LANGUAGES)
 LIBBUILTIN(qsetjmp, "iJ",         "fj",   "setjmp.h", ALL_LANGUAGES)
-LIBBUILTIN(getcontext, "iJ",      "fj",   "setjmp.h", ALL_LANGUAGES)
+LIBBUILTIN(getcontext, "iK*",     "fj",   "setjmp.h", ALL_LANGUAGES)
 
 LIBBUILTIN(_longjmp, "vJi",       "fr",    "setjmp.h", ALL_LANGUAGES)
 LIBBUILTIN(siglongjmp, "vSJi",    "fr",    "setjmp.h", ALL_LANGUAGES)

Modified: stable/9/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td
==============================================================================
--- stable/9/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td	Fri Dec 30 22:27:26 2011	(r229040)
+++ stable/9/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td	Fri Dec 30 22:30:21 2011	(r229041)
@@ -26,6 +26,7 @@ def : DiagGroup<"attributes">;
 def : DiagGroup<"bad-function-cast">;
 def Availability : DiagGroup<"availability">;
 def BoolConversions : DiagGroup<"bool-conversions">;
+def BuiltinRequiresHeader : DiagGroup<"builtin-requires-header">;
 def CXXCompat: DiagGroup<"c++-compat">;
 def CastAlign : DiagGroup<"cast-align">;
 def : DiagGroup<"cast-qual">;

Modified: stable/9/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
==============================================================================
--- stable/9/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td	Fri Dec 30 22:27:26 2011	(r229040)
+++ stable/9/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td	Fri Dec 30 22:30:21 2011	(r229041)
@@ -254,10 +254,16 @@ def note_please_include_header : Note<
 def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
 def warn_implicit_decl_requires_stdio : Warning<
   "declaration of built-in function '%0' requires inclusion of the header "
-  "<stdio.h>">;
+  "<stdio.h>">,
+  InGroup<BuiltinRequiresHeader>;
 def warn_implicit_decl_requires_setjmp : Warning<
   "declaration of built-in function '%0' requires inclusion of the header "
-  "<setjmp.h>">;
+  "<setjmp.h>">,
+  InGroup<BuiltinRequiresHeader>;
+def warn_implicit_decl_requires_ucontext : Warning<
+  "declaration of built-in function '%0' requires inclusion of the header "
+  "<ucontext.h>">,
+  InGroup<BuiltinRequiresHeader>;
 def warn_redecl_library_builtin : Warning<
   "incompatible redeclaration of library function %0">;
 def err_builtin_definition : Error<"definition of builtin function %0">;

Modified: stable/9/contrib/llvm/tools/clang/include/clang/Serialization/ASTBitCodes.h
==============================================================================
--- stable/9/contrib/llvm/tools/clang/include/clang/Serialization/ASTBitCodes.h	Fri Dec 30 22:27:26 2011	(r229040)
+++ stable/9/contrib/llvm/tools/clang/include/clang/Serialization/ASTBitCodes.h	Fri Dec 30 22:30:21 2011	(r229041)
@@ -677,7 +677,9 @@ namespace clang {
       /// \brief Objective-C "Class" redefinition type
       SPECIAL_TYPE_OBJC_CLASS_REDEFINITION     = 7,
       /// \brief Objective-C "SEL" redefinition type
-      SPECIAL_TYPE_OBJC_SEL_REDEFINITION       = 8
+      SPECIAL_TYPE_OBJC_SEL_REDEFINITION       = 8,
+      /// \brief C ucontext_t typedef type
+      SPECIAL_TYPE_UCONTEXT_T                  = 9
     };
     
     /// \brief The number of special type IDs.

Modified: stable/9/contrib/llvm/tools/clang/lib/AST/ASTContext.cpp
==============================================================================
--- stable/9/contrib/llvm/tools/clang/lib/AST/ASTContext.cpp	Fri Dec 30 22:27:26 2011	(r229040)
+++ stable/9/contrib/llvm/tools/clang/lib/AST/ASTContext.cpp	Fri Dec 30 22:30:21 2011	(r229041)
@@ -227,8 +227,9 @@ ASTContext::ASTContext(LangOptions& LOpt
     ObjCIdDecl(0), ObjCSelDecl(0), ObjCClassDecl(0),
     CFConstantStringTypeDecl(0), ObjCInstanceTypeDecl(0),
     FILEDecl(0), 
-    jmp_bufDecl(0), sigjmp_bufDecl(0), BlockDescriptorType(0), 
-    BlockDescriptorExtendedType(0), cudaConfigureCallDecl(0),
+    jmp_bufDecl(0), sigjmp_bufDecl(0), ucontext_tDecl(0),
+    BlockDescriptorType(0), BlockDescriptorExtendedType(0),
+    cudaConfigureCallDecl(0),
     NullTypeSourceInfo(QualType()),
     SourceMgr(SM), LangOpts(LOpts), 
     AddrSpaceMap(0), Target(t), PrintingPolicy(LOpts),
@@ -6293,6 +6294,15 @@ static QualType DecodeTypeFromStr(const 
       return QualType();
     }
     break;
+  case 'K':
+    assert(HowLong == 0 && !Signed && !Unsigned && "Bad modifiers for 'K'!");
+    Type = Context.getucontext_tType();
+
+    if (Type.isNull()) {
+      Error = ASTContext::GE_Missing_ucontext;
+      return QualType();
+    }
+    break;
   }
 
   // If there are modifiers and if we're allowed to parse them, go for it.

Modified: stable/9/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp
==============================================================================
--- stable/9/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp	Fri Dec 30 22:27:26 2011	(r229040)
+++ stable/9/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp	Fri Dec 30 22:30:21 2011	(r229041)
@@ -1305,6 +1305,12 @@ NamedDecl *Sema::LazilyCreateBuiltin(Ide
       Diag(Loc, diag::warn_implicit_decl_requires_setjmp)
         << Context.BuiltinInfo.GetName(BID);
     return 0;
+
+  case ASTContext::GE_Missing_ucontext:
+    if (ForRedeclaration)
+      Diag(Loc, diag::warn_implicit_decl_requires_ucontext)
+        << Context.BuiltinInfo.GetName(BID);
+    return 0;
   }
 
   if (!ForRedeclaration && Context.BuiltinInfo.isPredefinedLibFunction(BID)) {
@@ -3635,6 +3641,8 @@ Sema::ActOnTypedefNameDecl(Scope *S, Dec
         Context.setjmp_bufDecl(NewTD);
       else if (II->isStr("sigjmp_buf"))
         Context.setsigjmp_bufDecl(NewTD);
+      else if (II->isStr("ucontext_t"))
+        Context.setucontext_tDecl(NewTD);
       else if (II->isStr("__builtin_va_list"))
         Context.setBuiltinVaListType(Context.getTypedefType(NewTD));
     }

Modified: stable/9/contrib/llvm/tools/clang/lib/Serialization/ASTReader.cpp
==============================================================================
--- stable/9/contrib/llvm/tools/clang/lib/Serialization/ASTReader.cpp	Fri Dec 30 22:27:26 2011	(r229040)
+++ stable/9/contrib/llvm/tools/clang/lib/Serialization/ASTReader.cpp	Fri Dec 30 22:30:21 2011	(r229041)
@@ -2659,6 +2659,24 @@ void ASTReader::InitializeContext() {  
       if (Context.ObjCSelRedefinitionType.isNull())
         Context.ObjCSelRedefinitionType = GetType(ObjCSelRedef);
     }
+
+    if (unsigned Ucontext_t = SpecialTypes[SPECIAL_TYPE_UCONTEXT_T]) {
+      QualType Ucontext_tType = GetType(Ucontext_t);
+      if (Ucontext_tType.isNull()) {
+        Error("ucontext_t type is NULL");
+        return;
+      }
+
+      if (!Context.ucontext_tDecl) {
+        if (const TypedefType *Typedef = Ucontext_tType->getAs<TypedefType>())
+          Context.setucontext_tDecl(Typedef->getDecl());
+        else {
+          const TagType *Tag = Ucontext_tType->getAs<TagType>();
+          assert(Tag && "Invalid ucontext_t type in AST file");
+          Context.setucontext_tDecl(Tag->getDecl());
+        }
+      }
+    }
   }
   
   ReadPragmaDiagnosticMappings(Context.getDiagnostics());

Modified: stable/9/contrib/llvm/tools/clang/lib/Serialization/ASTWriter.cpp
==============================================================================
--- stable/9/contrib/llvm/tools/clang/lib/Serialization/ASTWriter.cpp	Fri Dec 30 22:27:26 2011	(r229040)
+++ stable/9/contrib/llvm/tools/clang/lib/Serialization/ASTWriter.cpp	Fri Dec 30 22:30:21 2011	(r229041)
@@ -2994,6 +2994,7 @@ void ASTWriter::WriteASTCore(Sema &SemaR
   AddTypeRef(Context.ObjCIdRedefinitionType, SpecialTypes);
   AddTypeRef(Context.ObjCClassRedefinitionType, SpecialTypes);
   AddTypeRef(Context.ObjCSelRedefinitionType, SpecialTypes);
+  AddTypeRef(Context.getucontext_tType(), SpecialTypes);
   
   // Keep writing types and declarations until all types and
   // declarations have been written.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112302230.pBUMULC6033851>