From owner-svn-src-all@FreeBSD.ORG Sun Aug 19 10:33:06 2012
Return-Path:
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
by hub.freebsd.org (Postfix) with ESMTP id 13B04106564A;
Sun, 19 Aug 2012 10:33:06 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
by mx1.freebsd.org (Postfix) with ESMTP id EE3208FC21;
Sun, 19 Aug 2012 10:33:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7JAX5kj070389;
Sun, 19 Aug 2012 10:33:05 GMT (envelope-from dim@svn.freebsd.org)
Received: (from dim@localhost)
by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7JAX5KX070368;
Sun, 19 Aug 2012 10:33:05 GMT (envelope-from dim@svn.freebsd.org)
Message-Id: <201208191033.q7JAX5KX070368@svn.freebsd.org>
From: Dimitry Andric
Date: Sun, 19 Aug 2012 10:33:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
svn-src-vendor@freebsd.org
X-SVN-Group: vendor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc:
Subject: svn commit: r239392 - in vendor/clang/dist: docs docs/analyzer
include/clang/AST include/clang/ASTMatchers
include/clang/Basic include/clang/Lex include/clang/Parse
include/clang/Sema include/clang...
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
user" and " projects" \)"
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
X-List-Received-Date: Sun, 19 Aug 2012 10:33:06 -0000
Author: dim
Date: Sun Aug 19 10:33:04 2012
New Revision: 239392
URL: http://svn.freebsd.org/changeset/base/239392
Log:
Vendor import of clang trunk r162107:
http://llvm.org/svn/llvm-project/cfe/trunk@162107
Added:
vendor/clang/dist/docs/analyzer/
vendor/clang/dist/docs/analyzer/IPA.txt
vendor/clang/dist/test/Analysis/inlining/dyn-dispatch-bifurcate.cpp
vendor/clang/dist/test/Analysis/reinterpret-cast.cpp
vendor/clang/dist/test/CodeGen/align-global-large.c
vendor/clang/dist/test/CodeGen/arm-neon-misc.c
vendor/clang/dist/test/CodeGen/complex-builtints.c
vendor/clang/dist/test/CodeGenOpenCL/vectorLoadStore.cl
vendor/clang/dist/test/Index/complete-preamble.cpp
vendor/clang/dist/test/Index/complete-preamble.h
vendor/clang/dist/test/Sema/arm-asm.c
vendor/clang/dist/test/Sema/warn-type-safety-mpi-hdf5.c
vendor/clang/dist/test/Sema/warn-type-safety.c
vendor/clang/dist/test/Sema/warn-type-safety.cpp
vendor/clang/dist/test/SemaObjC/warn-cast-of-sel-expr.m
vendor/clang/dist/test/SemaObjCXX/abstract-class-type-ivar.mm
Modified:
vendor/clang/dist/docs/LanguageExtensions.html
vendor/clang/dist/docs/ReleaseNotes.html
vendor/clang/dist/include/clang/AST/ASTContext.h
vendor/clang/dist/include/clang/AST/Attr.h
vendor/clang/dist/include/clang/AST/CommentCommandTraits.h
vendor/clang/dist/include/clang/AST/DeclBase.h
vendor/clang/dist/include/clang/AST/DeclCXX.h
vendor/clang/dist/include/clang/AST/DeclGroup.h
vendor/clang/dist/include/clang/AST/DeclLookups.h
vendor/clang/dist/include/clang/AST/PrettyPrinter.h
vendor/clang/dist/include/clang/AST/RawCommentList.h
vendor/clang/dist/include/clang/AST/Stmt.h
vendor/clang/dist/include/clang/AST/TemplateBase.h
vendor/clang/dist/include/clang/AST/TypeLoc.h
vendor/clang/dist/include/clang/ASTMatchers/ASTMatchers.h
vendor/clang/dist/include/clang/Basic/Attr.td
vendor/clang/dist/include/clang/Basic/Builtins.def
vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td
vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td
vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td
vendor/clang/dist/include/clang/Lex/PTHManager.h
vendor/clang/dist/include/clang/Parse/Parser.h
vendor/clang/dist/include/clang/Sema/AttributeList.h
vendor/clang/dist/include/clang/Sema/Sema.h
vendor/clang/dist/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
vendor/clang/dist/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h
vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
vendor/clang/dist/lib/AST/APValue.cpp
vendor/clang/dist/lib/AST/ASTContext.cpp
vendor/clang/dist/lib/AST/ASTDiagnostic.cpp
vendor/clang/dist/lib/AST/CommentCommandTraits.cpp
vendor/clang/dist/lib/AST/DeclCXX.cpp
vendor/clang/dist/lib/AST/DeclPrinter.cpp
vendor/clang/dist/lib/AST/DeclTemplate.cpp
vendor/clang/dist/lib/AST/DumpXML.cpp
vendor/clang/dist/lib/AST/NestedNameSpecifier.cpp
vendor/clang/dist/lib/AST/RawCommentList.cpp
vendor/clang/dist/lib/AST/Stmt.cpp
vendor/clang/dist/lib/AST/StmtPrinter.cpp
vendor/clang/dist/lib/AST/TemplateBase.cpp
vendor/clang/dist/lib/Basic/Diagnostic.cpp
vendor/clang/dist/lib/Basic/Targets.cpp
vendor/clang/dist/lib/CodeGen/CGBuiltin.cpp
vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp
vendor/clang/dist/lib/CodeGen/CGExpr.cpp
vendor/clang/dist/lib/CodeGen/CGExprCXX.cpp
vendor/clang/dist/lib/CodeGen/CGStmt.cpp
vendor/clang/dist/lib/CodeGen/CGValue.h
vendor/clang/dist/lib/Driver/Tools.cpp
vendor/clang/dist/lib/Frontend/ASTConsumers.cpp
vendor/clang/dist/lib/Frontend/CacheTokens.cpp
vendor/clang/dist/lib/Lex/PTHLexer.cpp
vendor/clang/dist/lib/Parse/ParseDecl.cpp
vendor/clang/dist/lib/Parse/ParseStmt.cpp
vendor/clang/dist/lib/Rewrite/RewriteModernObjC.cpp
vendor/clang/dist/lib/Rewrite/RewriteObjC.cpp
vendor/clang/dist/lib/Sema/AttributeList.cpp
vendor/clang/dist/lib/Sema/SemaCast.cpp
vendor/clang/dist/lib/Sema/SemaChecking.cpp
vendor/clang/dist/lib/Sema/SemaCodeComplete.cpp
vendor/clang/dist/lib/Sema/SemaDecl.cpp
vendor/clang/dist/lib/Sema/SemaDeclAttr.cpp
vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp
vendor/clang/dist/lib/Sema/SemaExceptionSpec.cpp
vendor/clang/dist/lib/Sema/SemaExpr.cpp
vendor/clang/dist/lib/Sema/SemaExprMember.cpp
vendor/clang/dist/lib/Sema/SemaOverload.cpp
vendor/clang/dist/lib/Sema/SemaStmt.cpp
vendor/clang/dist/lib/Sema/SemaTemplate.cpp
vendor/clang/dist/lib/Sema/SemaTemplateInstantiate.cpp
vendor/clang/dist/lib/Sema/SemaType.cpp
vendor/clang/dist/lib/Sema/TreeTransform.h
vendor/clang/dist/lib/Serialization/ASTReader.cpp
vendor/clang/dist/lib/Serialization/ASTWriter.cpp
vendor/clang/dist/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
vendor/clang/dist/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
vendor/clang/dist/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
vendor/clang/dist/lib/StaticAnalyzer/Core/AnalysisManager.cpp
vendor/clang/dist/lib/StaticAnalyzer/Core/BugReporter.cpp
vendor/clang/dist/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
vendor/clang/dist/lib/StaticAnalyzer/Core/CallEvent.cpp
vendor/clang/dist/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
vendor/clang/dist/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
vendor/clang/dist/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
vendor/clang/dist/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
vendor/clang/dist/lib/StaticAnalyzer/Core/ProgramState.cpp
vendor/clang/dist/lib/StaticAnalyzer/Core/TextPathDiagnostics.cpp
vendor/clang/dist/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
vendor/clang/dist/test/Analysis/CFNumber.c
vendor/clang/dist/test/Analysis/CheckNSError.m
vendor/clang/dist/test/Analysis/array-struct.c
vendor/clang/dist/test/Analysis/ctor-inlining.mm
vendor/clang/dist/test/Analysis/dtor.cpp
vendor/clang/dist/test/Analysis/func.c
vendor/clang/dist/test/Analysis/html-diags.c
vendor/clang/dist/test/Analysis/inline.cpp
vendor/clang/dist/test/Analysis/inlining/DynDispatchBifurcate.m
vendor/clang/dist/test/Analysis/inlining/InlineObjCClassMethod.m
vendor/clang/dist/test/Analysis/keychainAPI.m
vendor/clang/dist/test/Analysis/malloc-annotations.c
vendor/clang/dist/test/Analysis/malloc.c
vendor/clang/dist/test/Analysis/method-call-path-notes.cpp
vendor/clang/dist/test/Analysis/method-call.cpp
vendor/clang/dist/test/Analysis/misc-ps-region-store.m
vendor/clang/dist/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
vendor/clang/dist/test/Analysis/ptr-arith.c
vendor/clang/dist/test/Analysis/security-syntax-checks.m
vendor/clang/dist/test/Analysis/sizeofpointer.c
vendor/clang/dist/test/Analysis/stack-addr-ps.cpp
vendor/clang/dist/test/Analysis/stream.c
vendor/clang/dist/test/Analysis/variadic-method-types.m
vendor/clang/dist/test/CodeCompletion/objc-expr.m
vendor/clang/dist/test/CodeGen/alignment.c
vendor/clang/dist/test/CodeGen/ms-inline-asm.c
vendor/clang/dist/test/CodeGenCXX/devirtualize-virtual-function-calls.cpp
vendor/clang/dist/test/CodeGenObjC/instance-method-metadata.m
vendor/clang/dist/test/CodeGenObjC/ns_consume_null_check.m
vendor/clang/dist/test/Driver/Xlinker-args.c
vendor/clang/dist/test/Index/complete-enums.cpp
vendor/clang/dist/test/Index/complete-exprs.m
vendor/clang/dist/test/Parser/ms-inline-asm.c
vendor/clang/dist/test/Sema/128bitint.c
vendor/clang/dist/test/Sema/builtins-decl.c
vendor/clang/dist/test/Sema/callingconv.c
vendor/clang/dist/test/Sema/static-array.c
vendor/clang/dist/test/Sema/tentative-decls.c
vendor/clang/dist/test/Sema/warn-documentation.cpp
vendor/clang/dist/test/SemaCXX/convert-to-bool.cpp
vendor/clang/dist/test/SemaCXX/pragma-pack.cpp
vendor/clang/dist/test/SemaCXX/references.cpp
vendor/clang/dist/test/SemaCXX/uninitialized.cpp
vendor/clang/dist/test/SemaCXX/warn-thread-safety-parsing.cpp
vendor/clang/dist/test/Tooling/clang-check-ast-dump.cpp
vendor/clang/dist/unittests/ASTMatchers/ASTMatchersTest.cpp
vendor/clang/dist/unittests/Tooling/RecursiveASTVisitorTest.cpp
vendor/clang/dist/utils/TableGen/ClangAttrEmitter.cpp
vendor/clang/dist/utils/analyzer/CmpRuns.py
vendor/clang/dist/www/comparison.html
Modified: vendor/clang/dist/docs/LanguageExtensions.html
==============================================================================
--- vendor/clang/dist/docs/LanguageExtensions.html Sun Aug 19 10:32:32 2012 (r239391)
+++ vendor/clang/dist/docs/LanguageExtensions.html Sun Aug 19 10:33:04 2012 (r239392)
@@ -142,6 +142,13 @@
shared_locks_required(...)
+Type Safety Checking
+
+
@@ -1913,6 +1920,161 @@ declaration to specify that the function
shared locks. Arguments must be lockable type, and there must be at
least one argument.
+
+Type Safety Checking
+
+
+Clang supports additional attributes to enable checking type safety
+properties that can't be enforced by C type system. Usecases include:
+
+- MPI library implementations, where these attributes enable checking that
+ buffer type matches the passed MPI_Datatype;
+- for HDF5 library there is a similar usecase as MPI;
+- checking types of variadic functions' arguments for functions like
+ fcntl() and ioctl().
+
+
+You can detect support for these attributes with __has_attribute(). For
+example:
+
+
+
+#if defined(__has_attribute)
+# if __has_attribute(argument_with_type_tag) && \
+ __has_attribute(pointer_with_type_tag) && \
+ __has_attribute(type_tag_for_datatype)
+# define ATTR_MPI_PWT(buffer_idx, type_idx) __attribute__((pointer_with_type_tag(mpi,buffer_idx,type_idx)))
+/* ... other macros ... */
+# endif
+#endif
+
+#if !defined(ATTR_MPI_PWT)
+#define ATTR_MPI_PWT(buffer_idx, type_idx)
+#endif
+
+int MPI_Send(void *buf, int count, MPI_Datatype datatype /*, other args omitted */)
+ ATTR_MPI_PWT(1,3);
+
+
+
+argument_with_type_tag(...)
+
+Use __attribute__((argument_with_type_tag(arg_kind, arg_idx,
+type_tag_idx))) on a function declaration to specify that the function
+accepts a type tag that determines the type of some other argument.
+arg_kind is an identifier that should be used when annotating all
+applicable type tags.
+
+This attribute is primarily useful for checking arguments of variadic
+functions (pointer_with_type_tag can be used in most of non-variadic
+cases).
+
+For example:
+
+
+int fcntl(int fd, int cmd, ...)
+ __attribute__(( argument_with_type_tag(fcntl,3,2) ));
+
+
+
+pointer_with_type_tag(...)
+
+Use __attribute__((pointer_with_type_tag(ptr_kind, ptr_idx,
+type_tag_idx))) on a function declaration to specify that the
+function a type tag that determines the pointee type of some other pointer
+argument.
+
+For example:
+
+
+int MPI_Send(void *buf, int count, MPI_Datatype datatype /*, other args omitted */)
+ __attribute__(( pointer_with_type_tag(mpi,1,3) ));
+
+
+
+type_tag_for_datatype(...)
+
+Clang supports annotating type tags of two forms.
+
+
+- Type tag that is an expression containing a reference to some declared
+identifier. Use __attribute__((type_tag_for_datatype(kind, type)))
+on a declaration with that identifier:
+
+
+
+extern struct mpi_datatype mpi_datatype_int
+ __attribute__(( type_tag_for_datatype(mpi,int) ));
+#define MPI_INT ((MPI_Datatype) &mpi_datatype_int)
+
+
+
+- Type tag that is an integral literal. Introduce a static
+const variable with a corresponding initializer value and attach
+__attribute__((type_tag_for_datatype(kind, type))) on that
+declaration, for example:
+
+
+
+#define MPI_INT ((MPI_Datatype) 42)
+static const MPI_Datatype mpi_datatype_int
+ __attribute__(( type_tag_for_datatype(mpi,int) )) = 42
+
+
+
+
+The attribute also accepts an optional third argument that determines how
+the expression is compared to the type tag. There are two supported flags:
+
+- layout_compatible will cause types to be compared according to
+layout-compatibility rules (C++11 [class.mem] p 17, 18). This is
+implemented to support annotating types like MPI_DOUBLE_INT.
+
+
For example:
+
+
+/* In mpi.h */
+struct internal_mpi_double_int { double d; int i; };
+extern struct mpi_datatype mpi_datatype_double_int
+ __attribute__(( type_tag_for_datatype(mpi, struct internal_mpi_double_int,
+ layout_compatible) ));
+
+#define MPI_DOUBLE_INT ((MPI_Datatype) &mpi_datatype_double_int)
+
+/* In user code */
+struct my_pair { double a; int b; };
+struct my_pair *buffer;
+MPI_Send(buffer, 1, MPI_DOUBLE_INT /*, ... */); // no warning
+
+struct my_int_pair { int a; int b; }
+struct my_int_pair *buffer2;
+MPI_Send(buffer2, 1, MPI_DOUBLE_INT /*, ... */); // warning: actual buffer element
+ // type 'struct my_int_pair'
+ // doesn't match specified MPI_Datatype
+
+
+
+
+- must_be_null specifies that the expression should be a null
+pointer constant, for example:
+
+
+
+/* In mpi.h */
+extern struct mpi_datatype mpi_datatype_null
+ __attribute__(( type_tag_for_datatype(mpi, void, must_be_null) ));
+
+#define MPI_DATATYPE_NULL ((MPI_Datatype) &mpi_datatype_null)
+
+/* In user code */
+MPI_Send(buffer, 1, MPI_DATATYPE_NULL /*, ... */); // warning: MPI_DATATYPE_NULL
+ // was specified but buffer
+ // is not a null pointer
+
+
+
+
+