Date: Sat, 14 Jan 2017 15:38:35 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312175 - in vendor/clang/dist: . bindings/python/clang bindings/python/tests/cindex docs include/clang-c include/clang/AST include/clang/Basic include/clang/Driver include/clang/Index ... Message-ID: <201701141538.v0EFcZ3X026728@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Sat Jan 14 15:38:35 2017 New Revision: 312175 URL: https://svnweb.freebsd.org/changeset/base/312175 Log: Vendor import of clang release_40 branch r292009: https://llvm.org/svn/llvm-project/cfe/branches/release_40@292009 Added: vendor/clang/dist/test/CXX/basic/basic.start/basic.start.init/p2.cpp (contents, props changed) vendor/clang/dist/test/CodeGenCXX/pr31054.cpp (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_42.2_aarch64_tree/ vendor/clang/dist/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/ vendor/clang/dist/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/ vendor/clang/dist/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/crt1.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/crti.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/crtn.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/ vendor/clang/dist/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/ vendor/clang/dist/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/4.8/ vendor/clang/dist/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/4.8/crtbegin.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/4.8/crtend.o (contents, props changed) vendor/clang/dist/test/Driver/disable-llvm.c (contents, props changed) vendor/clang/dist/test/Modules/Inputs/FooFramework.framework/ vendor/clang/dist/test/Modules/Inputs/FooFramework.framework/Modules/ vendor/clang/dist/test/Modules/Inputs/FooFramework.framework/Modules/module.modulemap vendor/clang/dist/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/ vendor/clang/dist/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Bar.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Baz_Private.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/Foo.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/FooFramework.framework/PrivateHeaders/FooUmbrella.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/PR31469/ vendor/clang/dist/test/Modules/Inputs/PR31469/empty.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/PR31469/module.modulemap vendor/clang/dist/test/Modules/Inputs/PR31469/textual.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/PR31469/textual_file_shadow.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/import-textual/ vendor/clang/dist/test/Modules/Inputs/import-textual/M/ vendor/clang/dist/test/Modules/Inputs/import-textual/M/A/ vendor/clang/dist/test/Modules/Inputs/import-textual/M/A/A.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/import-textual/M/B/ vendor/clang/dist/test/Modules/Inputs/import-textual/M/B/B.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/import-textual/M/module.modulemap vendor/clang/dist/test/Modules/Inputs/import-textual/M/someheader.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/import-textual/M2/ vendor/clang/dist/test/Modules/Inputs/import-textual/M2/A/ vendor/clang/dist/test/Modules/Inputs/import-textual/M2/A/A.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/import-textual/M2/B/ vendor/clang/dist/test/Modules/Inputs/import-textual/M2/B/B.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/import-textual/M2/module.modulemap vendor/clang/dist/test/Modules/Inputs/import-textual/M2/someheader.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/cstddef vendor/clang/dist/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/type_traits vendor/clang/dist/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/ vendor/clang/dist/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/ vendor/clang/dist/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_ptrdiff_t.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_types.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/module-impl-with-link/ vendor/clang/dist/test/Modules/Inputs/module-impl-with-link/foo.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/module-impl-with-link/module.modulemap vendor/clang/dist/test/Modules/builtin-import.mm vendor/clang/dist/test/Modules/import-textual-noguard.mm vendor/clang/dist/test/Modules/import-textual.mm vendor/clang/dist/test/Modules/module-impl-with-link.c (contents, props changed) vendor/clang/dist/test/Modules/pr31469.cpp (contents, props changed) vendor/clang/dist/test/Modules/textual-hdr-in-umbrella-hdr.m vendor/clang/dist/test/OpenMP/nvptx_parallel_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_parallel_for_is_device_ptr_ast_print.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_parallel_for_is_device_ptr_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_parallel_for_simd_is_device_ptr_ast_print.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_parallel_for_simd_is_device_ptr_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_aligned_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_ast_print.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_collapse_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_defaultmap_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_depend_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_device_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_dist_schedule_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_firstprivate_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_if_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_is_device_ptr_ast_print.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_is_device_ptr_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_lastprivate_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_linear_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_loop_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_map_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_misc_messages.c (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_nowait_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_num_teams_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_private_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_reduction_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_safelen_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_shared_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_simdlen_messages.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_thread_limit_messages.cpp (contents, props changed) vendor/clang/dist/test/PCH/uses-seh.cpp (contents, props changed) vendor/clang/dist/test/SemaCXX/diagnose_if-ext.cpp (contents, props changed) Modified: vendor/clang/dist/CMakeLists.txt vendor/clang/dist/bindings/python/clang/cindex.py vendor/clang/dist/bindings/python/tests/cindex/test_translation_unit.py vendor/clang/dist/docs/AttributeReference.rst vendor/clang/dist/docs/ReleaseNotes.rst vendor/clang/dist/docs/UsersManual.rst vendor/clang/dist/include/clang-c/Index.h vendor/clang/dist/include/clang/AST/Decl.h vendor/clang/dist/include/clang/AST/DeclTemplate.h vendor/clang/dist/include/clang/AST/RecursiveASTVisitor.h vendor/clang/dist/include/clang/AST/StmtOpenMP.h vendor/clang/dist/include/clang/AST/TypeLoc.h vendor/clang/dist/include/clang/Basic/AttrDocs.td vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td vendor/clang/dist/include/clang/Basic/OpenMPKinds.def vendor/clang/dist/include/clang/Basic/StmtNodes.td vendor/clang/dist/include/clang/Driver/CLCompatOptions.td vendor/clang/dist/include/clang/Driver/Options.td vendor/clang/dist/include/clang/Index/IndexSymbol.h vendor/clang/dist/include/clang/Lex/HeaderSearch.h vendor/clang/dist/include/clang/Lex/ModuleMap.h vendor/clang/dist/include/clang/Parse/Parser.h vendor/clang/dist/include/clang/Sema/Sema.h vendor/clang/dist/include/clang/Serialization/ASTBitCodes.h vendor/clang/dist/lib/AST/ASTImporter.cpp vendor/clang/dist/lib/AST/Decl.cpp vendor/clang/dist/lib/AST/DeclTemplate.cpp vendor/clang/dist/lib/AST/Expr.cpp vendor/clang/dist/lib/AST/ExprConstant.cpp vendor/clang/dist/lib/AST/StmtOpenMP.cpp vendor/clang/dist/lib/AST/StmtPrinter.cpp vendor/clang/dist/lib/AST/StmtProfile.cpp vendor/clang/dist/lib/Analysis/BodyFarm.cpp vendor/clang/dist/lib/Analysis/CFG.cpp vendor/clang/dist/lib/Analysis/ReachableCode.cpp vendor/clang/dist/lib/Basic/OpenMPKinds.cpp vendor/clang/dist/lib/Basic/Targets.cpp vendor/clang/dist/lib/Basic/Version.cpp vendor/clang/dist/lib/CodeGen/CGBuiltin.cpp vendor/clang/dist/lib/CodeGen/CGDecl.cpp vendor/clang/dist/lib/CodeGen/CGDeclCXX.cpp vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h vendor/clang/dist/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp vendor/clang/dist/lib/CodeGen/CGOpenMPRuntimeNVPTX.h vendor/clang/dist/lib/CodeGen/CGStmt.cpp vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp vendor/clang/dist/lib/CodeGen/CodeGenFunction.h vendor/clang/dist/lib/CodeGen/CodeGenModule.cpp vendor/clang/dist/lib/CodeGen/ItaniumCXXABI.cpp vendor/clang/dist/lib/Driver/ToolChains.cpp vendor/clang/dist/lib/Driver/Tools.cpp vendor/clang/dist/lib/Format/ContinuationIndenter.cpp vendor/clang/dist/lib/Frontend/InitPreprocessor.cpp vendor/clang/dist/lib/Headers/altivec.h vendor/clang/dist/lib/Index/IndexDecl.cpp vendor/clang/dist/lib/Index/IndexSymbol.cpp vendor/clang/dist/lib/Index/IndexTypeSourceInfo.cpp vendor/clang/dist/lib/Index/IndexingContext.cpp vendor/clang/dist/lib/Index/IndexingContext.h vendor/clang/dist/lib/Lex/HeaderSearch.cpp vendor/clang/dist/lib/Lex/ModuleMap.cpp vendor/clang/dist/lib/Lex/PPDirectives.cpp vendor/clang/dist/lib/Parse/ParseDecl.cpp vendor/clang/dist/lib/Parse/ParseDeclCXX.cpp vendor/clang/dist/lib/Parse/ParseExpr.cpp vendor/clang/dist/lib/Parse/ParseExprCXX.cpp vendor/clang/dist/lib/Parse/ParseOpenMP.cpp vendor/clang/dist/lib/Parse/Parser.cpp vendor/clang/dist/lib/Sema/AnalysisBasedWarnings.cpp vendor/clang/dist/lib/Sema/SemaCoroutine.cpp vendor/clang/dist/lib/Sema/SemaDecl.cpp vendor/clang/dist/lib/Sema/SemaDeclObjC.cpp vendor/clang/dist/lib/Sema/SemaExprCXX.cpp vendor/clang/dist/lib/Sema/SemaOpenMP.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/SemaTemplateInstantiateDecl.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/ASTReaderDecl.cpp vendor/clang/dist/lib/Serialization/ASTReaderStmt.cpp vendor/clang/dist/lib/Serialization/ASTWriter.cpp vendor/clang/dist/lib/Serialization/ASTWriterDecl.cpp vendor/clang/dist/lib/Serialization/ASTWriterStmt.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/ExprEngine.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/SValBuilder.cpp vendor/clang/dist/test/Analysis/initializer.cpp vendor/clang/dist/test/Analysis/pointer-to-member.cpp vendor/clang/dist/test/Analysis/properties.m vendor/clang/dist/test/CXX/drs/dr0xx.cpp vendor/clang/dist/test/CXX/drs/dr12xx.cpp vendor/clang/dist/test/CXX/drs/dr13xx.cpp vendor/clang/dist/test/CXX/drs/dr14xx.cpp vendor/clang/dist/test/CXX/drs/dr15xx.cpp vendor/clang/dist/test/CXX/drs/dr16xx.cpp vendor/clang/dist/test/CXX/drs/dr18xx.cpp vendor/clang/dist/test/CXX/drs/dr2xx.cpp vendor/clang/dist/test/CXX/drs/dr5xx.cpp vendor/clang/dist/test/CXX/drs/dr6xx.cpp vendor/clang/dist/test/CodeGen/always_inline.c vendor/clang/dist/test/CodeGen/arm_acle.c vendor/clang/dist/test/CodeGen/builtins-arm.c vendor/clang/dist/test/CodeGen/builtins-arm64.c vendor/clang/dist/test/CodeGen/builtins-ppc-p9vector.c vendor/clang/dist/test/CodeGen/integer-overflow.c vendor/clang/dist/test/CodeGenCXX/cxx11-thread-local.cpp vendor/clang/dist/test/CodeGenCXX/dllexport.cpp vendor/clang/dist/test/CodeGenCXX/funcsig.cpp vendor/clang/dist/test/CodeGenCXX/global-array-destruction.cpp vendor/clang/dist/test/Driver/cl-options.c vendor/clang/dist/test/Driver/linux-ld.c vendor/clang/dist/test/Driver/x86-march.c vendor/clang/dist/test/Frontend/x86-target-cpu.c vendor/clang/dist/test/Index/Core/designated-inits.c vendor/clang/dist/test/Index/Core/index-source.cpp vendor/clang/dist/test/Index/Core/index-source.m vendor/clang/dist/test/Index/Core/index-subkinds.m vendor/clang/dist/test/Index/Core/index-with-module.m vendor/clang/dist/test/Index/index-templates.cpp vendor/clang/dist/test/Misc/ast-dump-decl.cpp vendor/clang/dist/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/math.h vendor/clang/dist/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/module.modulemap vendor/clang/dist/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stddef.h vendor/clang/dist/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/module.modulemap vendor/clang/dist/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stddef.h vendor/clang/dist/test/Modules/cxx-templates.cpp vendor/clang/dist/test/OpenMP/nesting_of_regions.cpp vendor/clang/dist/test/OpenMP/target_teams_distribute_collapse_messages.cpp vendor/clang/dist/test/OpenMP/threadprivate_codegen.cpp vendor/clang/dist/test/Preprocessor/predefined-arch-macros.c vendor/clang/dist/test/Profile/gcc-flag-compatibility.c vendor/clang/dist/test/Sema/atomic-ops.c vendor/clang/dist/test/Sema/warn-unreachable.c vendor/clang/dist/test/SemaCXX/coroutines.cpp vendor/clang/dist/test/SemaCXX/cxx0x-class.cpp vendor/clang/dist/test/SemaCXX/cxx1y-variable-templates_top_level.cpp vendor/clang/dist/test/SemaCXX/uninitialized.cpp vendor/clang/dist/test/SemaCXX/warn-shadow-in-lambdas.cpp vendor/clang/dist/test/SemaCXX/warn-shadow.cpp vendor/clang/dist/test/SemaTemplate/deduction.cpp vendor/clang/dist/test/SemaTemplate/temp_arg_template.cpp vendor/clang/dist/test/SemaTemplate/temp_arg_template_cxx1z.cpp vendor/clang/dist/tools/clang-fuzzer/ClangFuzzer.cpp vendor/clang/dist/tools/libclang/CIndex.cpp vendor/clang/dist/tools/libclang/CXCursor.cpp vendor/clang/dist/unittests/AST/SourceLocationTest.cpp vendor/clang/dist/unittests/Format/FormatTest.cpp vendor/clang/dist/www/cxx_dr_status.html vendor/clang/dist/www/cxx_status.html vendor/clang/dist/www/index.html vendor/clang/dist/www/make_cxx_dr_status Modified: vendor/clang/dist/CMakeLists.txt ============================================================================== --- vendor/clang/dist/CMakeLists.txt Sat Jan 14 15:37:58 2017 (r312174) +++ vendor/clang/dist/CMakeLists.txt Sat Jan 14 15:38:35 2017 (r312175) @@ -16,7 +16,8 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR "--libdir" "--includedir" "--prefix" - "--src-root") + "--src-root" + "--cmakedir") execute_process( COMMAND ${CONFIG_COMMAND} RESULT_VARIABLE HAD_ERROR @@ -41,6 +42,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR list(GET CONFIG_OUTPUT 3 INCLUDE_DIR) list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT) list(GET CONFIG_OUTPUT 5 MAIN_SRC_DIR) + list(GET CONFIG_OUTPUT 6 LLVM_CMAKE_PATH) if(NOT MSVC_IDE) set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS} @@ -58,7 +60,6 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH) - set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake") if(EXISTS ${LLVMCONFIG_FILE}) list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}") Modified: vendor/clang/dist/bindings/python/clang/cindex.py ============================================================================== --- vendor/clang/dist/bindings/python/clang/cindex.py Sat Jan 14 15:37:58 2017 (r312174) +++ vendor/clang/dist/bindings/python/clang/cindex.py Sat Jan 14 15:38:35 2017 (r312175) @@ -64,7 +64,6 @@ call is efficient. from ctypes import * import collections -import sys import clang.enumerations @@ -74,33 +73,6 @@ import clang.enumerations # this by marshalling object arguments as void**. c_object_p = POINTER(c_void_p) -if sys.version_info[0] > 2: -# Python 3 strings are unicode, translate them to/from utf8 for C-interop -# Python 3 replaces xrange with range, we want xrange behaviour - xrange = range - - class c_string_p(c_char_p): - def __init__(self, p=None): - if type(p) == str: - p = p.encode("utf8") - super(c_char_p, self).__init__(p) - - def __str__(self): - return str(self.value) - - @property - def value(self): - if super(c_char_p, self).value is None: - return None - return super(c_char_p, self).value.decode("utf8") - - @classmethod - def from_param(cls, param): - return cls(param) -else: - c_string_p = c_char_p - - callbacks = {} ### Exception Classes ### @@ -175,7 +147,7 @@ class CachedProperty(object): class _CXString(Structure): """Helper for transforming CXString results.""" - _fields_ = [("spelling", c_string_p), ("free", c_int)] + _fields_ = [("spelling", c_char_p), ("free", c_int)] def __del__(self): conf.lib.clang_disposeString(self) @@ -357,7 +329,7 @@ class Diagnostic(object): @property def spelling(self): - return str(conf.lib.clang_getDiagnosticSpelling(self)) + return conf.lib.clang_getDiagnosticSpelling(self) @property def ranges(self): @@ -386,8 +358,8 @@ class Diagnostic(object): def __getitem__(self, key): range = SourceRange() - value = str(conf.lib.clang_getDiagnosticFixIt(self.diag, key, - byref(range))) + value = conf.lib.clang_getDiagnosticFixIt(self.diag, key, + byref(range)) if len(value) == 0: raise IndexError @@ -420,12 +392,12 @@ class Diagnostic(object): @property def category_name(self): """The string name of the category for this diagnostic.""" - return str(conf.lib.clang_getDiagnosticCategoryText(self)) + return conf.lib.clang_getDiagnosticCategoryText(self) @property def option(self): """The command-line option that enables this diagnostic.""" - return str(conf.lib.clang_getDiagnosticOption(self, None)) + return conf.lib.clang_getDiagnosticOption(self, None) @property def disable_option(self): @@ -433,7 +405,7 @@ class Diagnostic(object): disable = _CXString() conf.lib.clang_getDiagnosticOption(self, byref(disable)) - return str(conf.lib.clang_getCString(disable)) + return conf.lib.clang_getCString(disable) def format(self, options=None): """ @@ -582,8 +554,8 @@ class BaseEnumeration(object): if value >= len(self.__class__._kinds): self.__class__._kinds += [None] * (value - len(self.__class__._kinds) + 1) if self.__class__._kinds[value] is not None: - raise ValueError('{0} value {1} already loaded'.format( - str(self.__class__), value)) + raise ValueError,'{0} value {1} already loaded'.format( + str(self.__class__), value) self.value = value self.__class__._kinds[value] = self self.__class__._name_map = None @@ -600,12 +572,12 @@ class BaseEnumeration(object): for key, value in self.__class__.__dict__.items(): if isinstance(value, self.__class__): self._name_map[value] = key - return str(self._name_map[self]) + return self._name_map[self] @classmethod def from_id(cls, id): if id >= len(cls._kinds) or cls._kinds[id] is None: - raise ValueError('Unknown template argument kind %d' % id) + raise ValueError,'Unknown template argument kind %d' % id return cls._kinds[id] def __repr__(self): @@ -624,7 +596,7 @@ class CursorKind(BaseEnumeration): @staticmethod def get_all_kinds(): """Return all CursorKind enumeration instances.""" - return [x for x in CursorKind._kinds if x] + return filter(None, CursorKind._kinds) def is_declaration(self): """Test if this is a declaration kind.""" @@ -1457,9 +1429,9 @@ class Cursor(Structure): def spelling(self): """Return the spelling of the entity pointed at by the cursor.""" if not hasattr(self, '_spelling'): - self._spelling = str(conf.lib.clang_getCursorSpelling(self)) + self._spelling = conf.lib.clang_getCursorSpelling(self) - return str(self._spelling) + return self._spelling @property def displayname(self): @@ -1471,7 +1443,7 @@ class Cursor(Structure): arguments of a class template specialization. """ if not hasattr(self, '_displayname'): - self._displayname = str(conf.lib.clang_getCursorDisplayName(self)) + self._displayname = conf.lib.clang_getCursorDisplayName(self) return self._displayname @@ -1479,7 +1451,7 @@ class Cursor(Structure): def mangled_name(self): """Return the mangled name for the entity referenced by this cursor.""" if not hasattr(self, '_mangled_name'): - self._mangled_name = str(conf.lib.clang_Cursor_getMangling(self)) + self._mangled_name = conf.lib.clang_Cursor_getMangling(self) return self._mangled_name @@ -1618,7 +1590,7 @@ class Cursor(Structure): self._objc_type_encoding = \ conf.lib.clang_getDeclObjCTypeEncoding(self) - return str(self._objc_type_encoding) + return self._objc_type_encoding @property def hash(self): @@ -1665,23 +1637,17 @@ class Cursor(Structure): @property def brief_comment(self): """Returns the brief comment text associated with that Cursor""" - r = conf.lib.clang_Cursor_getBriefCommentText(self) - if not r: - return None - return str(r) + return conf.lib.clang_Cursor_getBriefCommentText(self) @property def raw_comment(self): """Returns the raw comment text associated with that Cursor""" - r = conf.lib.clang_Cursor_getRawCommentText(self) - if not r: - return None - return str(r) + return conf.lib.clang_Cursor_getRawCommentText(self) def get_arguments(self): """Return an iterator for accessing the arguments of this cursor.""" num_args = conf.lib.clang_Cursor_getNumArguments(self) - for i in xrange(0, num_args): + for i in range(0, num_args): yield conf.lib.clang_Cursor_getArgument(self, i) def get_num_template_arguments(self): @@ -1811,7 +1777,7 @@ class StorageClass(object): if value >= len(StorageClass._kinds): StorageClass._kinds += [None] * (value - len(StorageClass._kinds) + 1) if StorageClass._kinds[value] is not None: - raise ValueError('StorageClass already loaded') + raise ValueError,'StorageClass already loaded' self.value = value StorageClass._kinds[value] = self StorageClass._name_map = None @@ -1832,7 +1798,7 @@ class StorageClass(object): @staticmethod def from_id(id): if id >= len(StorageClass._kinds) or not StorageClass._kinds[id]: - raise ValueError('Unknown storage class %d' % id) + raise ValueError,'Unknown storage class %d' % id return StorageClass._kinds[id] def __repr__(self): @@ -1885,7 +1851,7 @@ class TypeKind(BaseEnumeration): @property def spelling(self): """Retrieve the spelling of this TypeKind.""" - return str(conf.lib.clang_getTypeKindSpelling(self.value)) + return conf.lib.clang_getTypeKindSpelling(self.value) def __repr__(self): return 'TypeKind.%s' % (self.name,) @@ -2161,7 +2127,7 @@ class Type(Structure): """ Retrieve the offset of a field in the record. """ - return conf.lib.clang_Type_getOffsetOf(self, fieldname) + return conf.lib.clang_Type_getOffsetOf(self, c_char_p(fieldname)) def get_ref_qualifier(self): """ @@ -2188,7 +2154,7 @@ class Type(Structure): @property def spelling(self): """Retrieve the spelling of this Type.""" - return str(conf.lib.clang_getTypeSpelling(self)) + return conf.lib.clang_getTypeSpelling(self) def __eq__(self, other): if type(other) != type(self): @@ -2220,7 +2186,7 @@ class ClangObject(object): class _CXUnsavedFile(Structure): """Helper for passing unsaved file arguments.""" - _fields_ = [("name", c_string_p), ("contents", c_string_p), ('length', c_ulong)] + _fields_ = [("name", c_char_p), ("contents", c_char_p), ('length', c_ulong)] # Functions calls through the python interface are rather slow. Fortunately, # for most symboles, we do not need to perform a function call. Their spelling @@ -2266,7 +2232,7 @@ class CompletionChunk: self.__kindNumberCache = -1 def __repr__(self): - return "{'" + str(self.spelling) + "', " + str(self.kind) + "}" + return "{'" + self.spelling + "', " + str(self.kind) + "}" @CachedProperty def spelling(self): @@ -2575,9 +2541,7 @@ class TranslationUnit(ClangObject): args_array = None if len(args) > 0: - args_array = (c_string_p * len(args))() - for i,a in enumerate(args): - args_array[i] = c_string_p(a) + args_array = (c_char_p * len(args))(* args) unsaved_array = None if len(unsaved_files) > 0: @@ -2586,8 +2550,8 @@ class TranslationUnit(ClangObject): if hasattr(contents, "read"): contents = contents.read() - unsaved_array[i].name = c_string_p(name) - unsaved_array[i].contents = c_string_p(contents) + unsaved_array[i].name = name + unsaved_array[i].contents = contents unsaved_array[i].length = len(contents) ptr = conf.lib.clang_parseTranslationUnit(index, filename, args_array, @@ -2642,7 +2606,7 @@ class TranslationUnit(ClangObject): @property def spelling(self): """Get the original translation unit source file name.""" - return str(conf.lib.clang_getTranslationUnitSpelling(self)) + return conf.lib.clang_getTranslationUnitSpelling(self) def get_includes(self): """ @@ -2765,9 +2729,9 @@ class TranslationUnit(ClangObject): # FIXME: It would be great to support an efficient version # of this, one day. value = value.read() - print(value) + print value if not isinstance(value, str): - raise TypeError('Unexpected unsaved file contents.') + raise TypeError,'Unexpected unsaved file contents.' unsaved_files_array[i].name = name unsaved_files_array[i].contents = value unsaved_files_array[i].length = len(value) @@ -2829,11 +2793,11 @@ class TranslationUnit(ClangObject): # FIXME: It would be great to support an efficient version # of this, one day. value = value.read() - print(value) + print value if not isinstance(value, str): - raise TypeError('Unexpected unsaved file contents.') - unsaved_files_array[i].name = c_string_p(name) - unsaved_files_array[i].contents = c_string_p(value) + raise TypeError,'Unexpected unsaved file contents.' + unsaved_files_array[i].name = name + unsaved_files_array[i].contents = value unsaved_files_array[i].length = len(value) ptr = conf.lib.clang_codeCompleteAt(self, path, line, column, unsaved_files_array, len(unsaved_files), options) @@ -2868,7 +2832,7 @@ class File(ClangObject): @property def name(self): """Return the complete file and path name of the file.""" - return str(conf.lib.clang_getCString(conf.lib.clang_getFileName(self))) + return conf.lib.clang_getCString(conf.lib.clang_getFileName(self)) @property def time(self): @@ -2876,7 +2840,7 @@ class File(ClangObject): return conf.lib.clang_getFileTime(self) def __str__(self): - return str(self.name) + return self.name def __repr__(self): return "<File: %s>" % (self.name) @@ -2945,12 +2909,12 @@ class CompileCommand(object): @property def directory(self): """Get the working directory for this CompileCommand""" - return str(conf.lib.clang_CompileCommand_getDirectory(self.cmd)) + return conf.lib.clang_CompileCommand_getDirectory(self.cmd) @property def filename(self): """Get the working filename for this CompileCommand""" - return str(conf.lib.clang_CompileCommand_getFilename(self.cmd)) + return conf.lib.clang_CompileCommand_getFilename(self.cmd) @property def arguments(self): @@ -2962,7 +2926,7 @@ class CompileCommand(object): """ length = conf.lib.clang_CompileCommand_getNumArgs(self.cmd) for i in xrange(length): - yield str(conf.lib.clang_CompileCommand_getArg(self.cmd, i)) + yield conf.lib.clang_CompileCommand_getArg(self.cmd, i) class CompileCommands(object): """ @@ -3056,7 +3020,7 @@ class Token(Structure): This is the textual representation of the token in source. """ - return str(conf.lib.clang_getTokenSpelling(self._tu, self)) + return conf.lib.clang_getTokenSpelling(self._tu, self) @property def kind(self): @@ -3099,7 +3063,7 @@ functionList = [ [c_object_p]), ("clang_CompilationDatabase_fromDirectory", - [c_string_p, POINTER(c_uint)], + [c_char_p, POINTER(c_uint)], c_object_p, CompilationDatabase.from_result), @@ -3109,7 +3073,7 @@ functionList = [ CompileCommands.from_result), ("clang_CompilationDatabase_getCompileCommands", - [c_object_p, c_string_p], + [c_object_p, c_char_p], c_object_p, CompileCommands.from_result), @@ -3144,7 +3108,7 @@ functionList = [ c_uint), ("clang_codeCompleteAt", - [TranslationUnit, c_string_p, c_int, c_int, c_void_p, c_int, c_int], + [TranslationUnit, c_char_p, c_int, c_int, c_void_p, c_int, c_int], POINTER(CCRStructure)), ("clang_codeCompleteGetDiagnostic", @@ -3160,7 +3124,7 @@ functionList = [ c_object_p), ("clang_createTranslationUnit", - [Index, c_string_p], + [Index, c_char_p], c_object_p), ("clang_CXXConstructor_isConvertingConstructor", @@ -3310,7 +3274,7 @@ functionList = [ ("clang_getCString", [_CXString], - c_string_p), + c_char_p), ("clang_getCursor", [TranslationUnit, SourceLocation], @@ -3457,7 +3421,7 @@ functionList = [ Type.from_result), ("clang_getFile", - [TranslationUnit, c_string_p], + [TranslationUnit, c_char_p], c_object_p), ("clang_getFileName", @@ -3586,7 +3550,7 @@ functionList = [ ("clang_getTUResourceUsageName", [c_uint], - c_string_p), + c_char_p), ("clang_getTypeDeclaration", [Type], @@ -3681,7 +3645,7 @@ functionList = [ bool), ("clang_parseTranslationUnit", - [Index, c_string_p, c_void_p, c_int, c_void_p, c_int, c_int], + [Index, c_char_p, c_void_p, c_int, c_void_p, c_int, c_int], c_object_p), ("clang_reparseTranslationUnit", @@ -3689,7 +3653,7 @@ functionList = [ c_int), ("clang_saveTranslationUnit", - [TranslationUnit, c_string_p, c_uint], + [TranslationUnit, c_char_p, c_uint], c_int), ("clang_tokenize", @@ -3761,7 +3725,7 @@ functionList = [ Type.from_result), ("clang_Type_getOffsetOf", - [Type, c_string_p], + [Type, c_char_p], c_longlong), ("clang_Type_getSizeOf", @@ -3820,8 +3784,7 @@ def register_functions(lib, ignore_error def register(item): return register_function(lib, item, ignore_errors) - for f in functionList: - register(f) + map(register, functionList) class Config: library_path = None Modified: vendor/clang/dist/bindings/python/tests/cindex/test_translation_unit.py ============================================================================== --- vendor/clang/dist/bindings/python/tests/cindex/test_translation_unit.py Sat Jan 14 15:37:58 2017 (r312174) +++ vendor/clang/dist/bindings/python/tests/cindex/test_translation_unit.py Sat Jan 14 15:38:35 2017 (r312175) @@ -59,13 +59,9 @@ int SOME_DEFINE; assert spellings[-1] == 'y' def test_unsaved_files_2(): - try: - from StringIO import StringIO - except: - from io import StringIO - + import StringIO tu = TranslationUnit.from_source('fake.c', unsaved_files = [ - ('fake.c', StringIO('int x;'))]) + ('fake.c', StringIO.StringIO('int x;'))]) spellings = [c.spelling for c in tu.cursor.get_children()] assert spellings[-1] == 'x' Modified: vendor/clang/dist/docs/AttributeReference.rst ============================================================================== --- vendor/clang/dist/docs/AttributeReference.rst Sat Jan 14 15:37:58 2017 (r312174) +++ vendor/clang/dist/docs/AttributeReference.rst Sat Jan 14 15:38:35 2017 (r312175) @@ -1,13 +1,3118 @@ .. ------------------------------------------------------------------- NOTE: This file is automatically generated by running clang-tblgen - -gen-attr-docs. Do not edit this file by hand!! The contents for - this file are automatically generated by a server-side process. - - Please do not commit this file. The file exists for local testing - purposes only. + -gen-attr-docs. Do not edit this file by hand!! ------------------------------------------------------------------- =================== Attributes in Clang -=================== \ No newline at end of file +=================== +.. contents:: + :local: + +Introduction +============ + +This page lists the attributes currently supported by Clang. + +Function Attributes +=================== + + +interrupt +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" + + "X","","","", "" + +Clang supports the GNU style ``__attribute__((interrupt("TYPE")))`` attribute on +ARM targets. This attribute may be attached to a function definition and +instructs the backend to generate appropriate function entry/exit code so that +it can be used directly as an interrupt service routine. + +The parameter passed to the interrupt attribute is optional, but if +provided it must be a string literal with one of the following values: "IRQ", +"FIQ", "SWI", "ABORT", "UNDEF". + +The semantics are as follows: + +- If the function is AAPCS, Clang instructs the backend to realign the stack to + 8 bytes on entry. This is a general requirement of the AAPCS at public + interfaces, but may not hold when an exception is taken. Doing this allows + other AAPCS functions to be called. +- If the CPU is M-class this is all that needs to be done since the architecture + itself is designed in such a way that functions obeying the normal AAPCS ABI + constraints are valid exception handlers. +- If the CPU is not M-class, the prologue and epilogue are modified to save all + non-banked registers that are used, so that upon return the user-mode state + will not be corrupted. Note that to avoid unnecessary overhead, only + general-purpose (integer) registers are saved in this way. If VFP operations + are needed, that state must be saved manually. + + Specifically, interrupt kinds other than "FIQ" will save all core registers + except "lr" and "sp". "FIQ" interrupts will save r0-r7. +- If the CPU is not M-class, the return instruction is changed to one of the + canonical sequences permitted by the architecture for exception return. Where + possible the function itself will make the necessary "lr" adjustments so that + the "preferred return address" is selected. + + Unfortunately the compiler is unable to make this guarantee for an "UNDEF" + handler, where the offset from "lr" to the preferred return address depends on + the execution state of the code which generated the exception. In this case + a sequence equivalent to "movs pc, lr" will be used. + + +abi_tag (gnu::abi_tag) +---------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" + + "X","X","","", "" + +The ``abi_tag`` attribute can be applied to a function, variable, class or +inline namespace declaration to modify the mangled name of the entity. It gives +the ability to distinguish between different versions of the same entity but +with different ABI versions supported. For example, a newer version of a class +could have a different set of data members and thus have a different size. Using +the ``abi_tag`` attribute, it is possible to have different mangled names for +a global variable of the class type. Therefor, the old code could keep using +the old manged name and the new code will use the new mangled name with tags. + + +acquire_capability (acquire_shared_capability, clang::acquire_capability, clang::acquire_shared_capability) +----------------------------------------------------------------------------------------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" + + "X","X","","", "" + +Marks a function as acquiring a capability. + + +alloc_size (gnu::alloc_size) +---------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" + + "X","X","","", "" + +The ``alloc_size`` attribute can be placed on functions that return pointers in +order to hint to the compiler how many bytes of memory will be available at the +returned poiner. ``alloc_size`` takes one or two arguments. + +- ``alloc_size(N)`` implies that argument number N equals the number of + available bytes at the returned pointer. +- ``alloc_size(N, M)`` implies that the product of argument number N and + argument number M equals the number of available bytes at the returned + pointer. + +Argument numbers are 1-based. + +An example of how to use ``alloc_size`` + +.. code-block:: c + + void *my_malloc(int a) __attribute__((alloc_size(1))); + void *my_calloc(int a, int b) __attribute__((alloc_size(1, 2))); + + int main() { + void *const p = my_malloc(100); + assert(__builtin_object_size(p, 0) == 100); + void *const a = my_calloc(20, 5); + assert(__builtin_object_size(a, 0) == 100); + } + +.. Note:: This attribute works differently in clang than it does in GCC. + Specifically, clang will only trace ``const`` pointers (as above); we give up + on pointers that are not marked as ``const``. In the vast majority of cases, + this is unimportant, because LLVM has support for the ``alloc_size`` + attribute. However, this may cause mildly unintuitive behavior when used with + other attributes, such as ``enable_if``. + + +interrupt +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" + + "X","","","", "" + +Clang supports the GNU style ``__attribute__((interrupt))`` attribute on +x86/x86-64 targets.The compiler generates function entry and exit sequences +suitable for use in an interrupt handler when this attribute is present. +The 'IRET' instruction, instead of the 'RET' instruction, is used to return +from interrupt or exception handlers. All registers, except for the EFLAGS +register which is restored by the 'IRET' instruction, are preserved by the +compiler. + +Any interruptible-without-stack-switch code must be compiled with +-mno-red-zone since interrupt handlers can and will, because of the +hardware design, touch the red zone. + +1. interrupt handler must be declared with a mandatory pointer argument: + + .. code-block:: c + + struct interrupt_frame + { + uword_t ip; + uword_t cs; + uword_t flags; + uword_t sp; + uword_t ss; + }; + + __attribute__ ((interrupt)) + void f (struct interrupt_frame *frame) { + ... + } + +2. exception handler: + + The exception handler is very similar to the interrupt handler with + a different mandatory function signature: + + .. code-block:: c + + __attribute__ ((interrupt)) + void f (struct interrupt_frame *frame, uword_t error_code) { + ... + } + + and compiler pops 'ERROR_CODE' off stack before the 'IRET' instruction. + + The exception handler should only be used for exceptions which push an + error code and all other exceptions must use the interrupt handler. + The system will crash if the wrong handler is used. + + +assert_capability (assert_shared_capability, clang::assert_capability, clang::assert_shared_capability) +------------------------------------------------------------------------------------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" + + "X","X","","", "" + +Marks a function that dynamically tests whether a capability is held, and halts +the program if it is not held. + + +assume_aligned (gnu::assume_aligned) +------------------------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" + + "X","X","","", "" + +Use ``__attribute__((assume_aligned(<alignment>[,<offset>]))`` on a function +declaration to specify that the return value of the function (which must be a +pointer type) has the specified offset, in bytes, from an address with the +specified alignment. The offset is taken to be zero if omitted. + +.. code-block:: c++ + + // The returned pointer value has 32-byte alignment. + void *a() __attribute__((assume_aligned (32))); + + // The returned pointer value is 4 bytes greater than an address having + // 32-byte alignment. + void *b() __attribute__((assume_aligned (32, 4))); + +Note that this attribute provides information to the compiler regarding a +condition that the code already ensures is true. It does not cause the compiler +to enforce the provided alignment assumption. + + +availability +------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" + + "X","","","", "" + +The ``availability`` attribute can be placed on declarations to describe the +lifecycle of that declaration relative to operating system versions. Consider +the function declaration for a hypothetical function ``f``: + +.. code-block:: c++ + + void f(void) __attribute__((availability(macos,introduced=10.4,deprecated=10.6,obsoleted=10.7))); + +The availability attribute states that ``f`` was introduced in Mac OS X 10.4, +deprecated in Mac OS X 10.6, and obsoleted in Mac OS X 10.7. This information +is used by Clang to determine when it is safe to use ``f``: for example, if +Clang is instructed to compile code for Mac OS X 10.5, a call to ``f()`` +succeeds. If Clang is instructed to compile code for Mac OS X 10.6, the call +succeeds but Clang emits a warning specifying that the function is deprecated. +Finally, if Clang is instructed to compile code for Mac OS X 10.7, the call +fails because ``f()`` is no longer available. + +The availability attribute is a comma-separated list starting with the +platform name and then including clauses specifying important milestones in the +declaration's lifetime (in any order) along with additional information. Those +clauses can be: + +introduced=\ *version* + The first version in which this declaration was introduced. + +deprecated=\ *version* + The first version in which this declaration was deprecated, meaning that + users should migrate away from this API. + +obsoleted=\ *version* + The first version in which this declaration was obsoleted, meaning that it + was removed completely and can no longer be used. + +unavailable + This declaration is never available on this platform. + +message=\ *string-literal* + Additional message text that Clang will provide when emitting a warning or + error about use of a deprecated or obsoleted declaration. Useful to direct + users to replacement APIs. + +replacement=\ *string-literal* + Additional message text that Clang will use to provide Fix-It when emitting + a warning about use of a deprecated declaration. The Fix-It will replace + the deprecated declaration with the new declaration specified. + +Multiple availability attributes can be placed on a declaration, which may +correspond to different platforms. Only the availability attribute with the +platform corresponding to the target platform will be used; any others will be +ignored. If no availability attribute specifies availability for the current +target platform, the availability attributes are ignored. Supported platforms +are: + +``ios`` + Apple's iOS operating system. The minimum deployment target is specified by + the ``-mios-version-min=*version*`` or ``-miphoneos-version-min=*version*`` + command-line arguments. + +``macos`` + Apple's Mac OS X operating system. The minimum deployment target is + specified by the ``-mmacosx-version-min=*version*`` command-line argument. + ``macosx`` is supported for backward-compatibility reasons, but it is + deprecated. + +``tvos`` + Apple's tvOS operating system. The minimum deployment target is specified by + the ``-mtvos-version-min=*version*`` command-line argument. + +``watchos`` + Apple's watchOS operating system. The minimum deployment target is specified by + the ``-mwatchos-version-min=*version*`` command-line argument. + +A declaration can typically be used even when deploying back to a platform +version prior to when the declaration was introduced. When this happens, the +declaration is `weakly linked +<https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html>`_, +as if the ``weak_import`` attribute were added to the declaration. A +weakly-linked declaration may or may not be present a run-time, and a program +can determine whether the declaration is present by checking whether the +address of that declaration is non-NULL. + +The flag ``strict`` disallows using API when deploying back to a +platform version prior to when the declaration was introduced. An +attempt to use such API before its introduction causes a hard error. +Weakly-linking is almost always a better API choice, since it allows +users to query availability at runtime. + +If there are multiple declarations of the same entity, the availability +attributes must either match on a per-platform basis or later +declarations must not have availability attributes for that +platform. For example: + +.. code-block:: c + + void g(void) __attribute__((availability(macos,introduced=10.4))); + void g(void) __attribute__((availability(macos,introduced=10.4))); // okay, matches + void g(void) __attribute__((availability(ios,introduced=4.0))); // okay, adds a new platform + void g(void); // okay, inherits both macos and ios availability from above. + void g(void) __attribute__((availability(macos,introduced=10.5))); // error: mismatch + +When one method overrides another, the overriding method can be more widely available than the overridden method, e.g.,: + +.. code-block:: objc + + @interface A + - (id)method __attribute__((availability(macos,introduced=10.4))); + - (id)method2 __attribute__((availability(macos,introduced=10.4))); + @end + + @interface B : A + - (id)method __attribute__((availability(macos,introduced=10.3))); // okay: method moved into base class later + - (id)method __attribute__((availability(macos,introduced=10.5))); // error: this method was available via the base class in 10.4 + @end + + +_Noreturn +--------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" + + "","","","X", "" + +A function declared as ``_Noreturn`` shall not return to its caller. The +compiler will generate a diagnostic for a function declared as ``_Noreturn`` +that appears to be capable of returning to its caller. + + +noreturn +-------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" + + "","X","","", "" + +A function declared as ``[[noreturn]]`` shall not return to its caller. The +compiler will generate a diagnostic for a function declared as ``[[noreturn]]`` +that appears to be capable of returning to its caller. + + +carries_dependency +------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" + + "X","X","","", "" + +The ``carries_dependency`` attribute specifies dependency propagation into and +out of functions. + +When specified on a function or Objective-C method, the ``carries_dependency`` +attribute means that the return value carries a dependency out of the function, +so that the implementation need not constrain ordering upon return from that +function. Implementations of the function and its caller may choose to preserve +dependencies instead of emitting memory ordering instructions such as fences. + +Note, this attribute does not change the meaning of the program, but may result +in generation of more efficient code. + + +convergent (clang::convergent) +------------------------------ +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" + + "X","X","","", "" + +The ``convergent`` attribute can be placed on a function declaration. It is +translated into the LLVM ``convergent`` attribute, which indicates that the call +instructions of a function with this attribute cannot be made control-dependent +on any additional values. + +In languages designed for SPMD/SIMT programming model, e.g. OpenCL or CUDA, +the call instructions of a function with this attribute must be executed by +all work items or threads in a work group or sub group. + +This attribute is different from ``noduplicate`` because it allows duplicating +function calls if it can be proved that the duplicated function calls are +not made control-dependent on any additional values, e.g., unrolling a loop +executed by all work items. + +Sample usage: +.. code-block:: c + + void convfunc(void) __attribute__((convergent)); + // Setting it as a C++11 attribute is also valid in a C++ program. + // void convfunc(void) [[clang::convergent]]; + + +deprecated (gnu::deprecated) +---------------------------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" + + "X","X","X","", "" + +The ``deprecated`` attribute can be applied to a function, a variable, or a +type. This is useful when identifying functions, variables, or types that are +expected to be removed in a future version of a program. + +Consider the function declaration for a hypothetical function ``f``: + +.. code-block:: c++ + + void f(void) __attribute__((deprecated("message", "replacement"))); + +When spelled as `__attribute__((deprecated))`, the deprecated attribute can have +two optional string arguments. The first one is the message to display when +emitting the warning; the second one enables the compiler to provide a Fix-It +to replace the deprecated name with a new name. Otherwise, when spelled as +`[[gnu::deprecated]] or [[deprecated]]`, the attribute can have one optional +string argument which is the message to display when emitting the warning. + + +diagnose_if +----------- +.. csv-table:: Supported Syntaxes + :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" + + "X","","","", "" + +The ``diagnose_if`` attribute can be placed on function declarations to emit +warnings or errors at compile-time if calls to the attributed function meet +certain user-defined criteria. For example: + +.. code-block:: c + void abs(int a) + __attribute__((diagnose_if(a >= 0, "Redundant abs call", "warning"))); + void must_abs(int a) + __attribute__((diagnose_if(a >= 0, "Redundant abs call", "error"))); + + int val = abs(1); // warning: Redundant abs call + int val2 = must_abs(1); // error: Redundant abs call + int val3 = abs(val); + int val4 = must_abs(val); // Because run-time checks are not emitted for + // diagnose_if attributes, this executes without + // issue. + + +``diagnose_if`` is closely related to ``enable_if``, with a few key differences: + *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701141538.v0EFcZ3X026728>