From owner-svn-src-vendor@freebsd.org Thu Apr 20 21:20:53 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 570A7D487FC; Thu, 20 Apr 2017 21:20:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 01A181226; Thu, 20 Apr 2017 21:20:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3KLKqlf002669; Thu, 20 Apr 2017 21:20:52 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3KLKpHB002660; Thu, 20 Apr 2017 21:20:51 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704202120.v3KLKpHB002660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 20 Apr 2017 21:20:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317220 - in vendor/clang/dist: bindings/python/clang bindings/python/tests/cindex docs include/clang/AST include/clang/Basic include/clang/Driver include/clang/Index include/clang/Lex ... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Apr 2017 21:20:53 -0000 Author: dim Date: Thu Apr 20 21:20:51 2017 New Revision: 317220 URL: https://svnweb.freebsd.org/changeset/base/317220 Log: Vendor import of clang trunk r300890: https://llvm.org/svn/llvm-project/cfe/trunk@300890 Added: vendor/clang/dist/include/clang/Basic/AttrSubjectMatchRules.h (contents, props changed) vendor/clang/dist/test/CodeGen/fp-contract-on-asm.c (contents, props changed) vendor/clang/dist/test/CodeGen/thinlto-backend-option.ll vendor/clang/dist/test/CodeGenCXX/cxx1z-class-deduction.cpp (contents, props changed) vendor/clang/dist/test/CodeGenCXX/unaligned-duplicated-mangle-name.cpp (contents, props changed) vendor/clang/dist/test/CodeGenOpenCL/byval.cl vendor/clang/dist/test/CodeGenOpenCL/lifetime.cl vendor/clang/dist/test/CoverageMapping/pr32679.cpp (contents, props changed) vendor/clang/dist/test/Driver/arm-default-build-attributes.s (contents, props changed) vendor/clang/dist/test/Driver/avr-mmcu.c (contents, props changed) vendor/clang/dist/test/FixIt/fixit-pragma-attribute.c (contents, props changed) vendor/clang/dist/test/FixIt/fixit-pragma-attribute.cpp (contents, props changed) vendor/clang/dist/test/Lexer/newline-nul.c (contents, props changed) vendor/clang/dist/test/Misc/pragma-attribute-cxx-subject-match-rules.cpp (contents, props changed) vendor/clang/dist/test/Misc/pragma-attribute-cxx.cpp (contents, props changed) vendor/clang/dist/test/Misc/pragma-attribute-objc-subject-match-rules.m vendor/clang/dist/test/Misc/pragma-attribute-objc.m vendor/clang/dist/test/Misc/pragma-attribute-strict-subjects.c (contents, props changed) vendor/clang/dist/test/Misc/pragma-attribute-supported-attributes-list.test vendor/clang/dist/test/OpenMP/distribute_parallel_for_messages.cpp (contents, props changed) vendor/clang/dist/test/Parser/editor-placeholder-recovery.cpp (contents, props changed) vendor/clang/dist/test/Parser/pragma-attribute-declspec.cpp (contents, props changed) vendor/clang/dist/test/Parser/pragma-attribute.cpp (contents, props changed) vendor/clang/dist/test/Sema/pragma-attribute-strict-subjects.c (contents, props changed) vendor/clang/dist/test/Sema/pragma-attribute.c (contents, props changed) Modified: vendor/clang/dist/bindings/python/clang/__init__.py vendor/clang/dist/bindings/python/clang/cindex.py vendor/clang/dist/bindings/python/tests/cindex/test_translation_unit.py vendor/clang/dist/docs/LanguageExtensions.rst vendor/clang/dist/docs/SanitizerCoverage.rst vendor/clang/dist/docs/doxygen.cfg.in vendor/clang/dist/include/clang/AST/Decl.h vendor/clang/dist/include/clang/AST/StmtOpenMP.h vendor/clang/dist/include/clang/AST/TypeLoc.h vendor/clang/dist/include/clang/Basic/Attr.td vendor/clang/dist/include/clang/Basic/CMakeLists.txt vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td vendor/clang/dist/include/clang/Basic/DiagnosticLexKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td vendor/clang/dist/include/clang/Basic/IdentifierTable.h vendor/clang/dist/include/clang/Basic/LangOptions.def vendor/clang/dist/include/clang/Basic/TokenKinds.def 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/Lexer.h vendor/clang/dist/include/clang/Lex/Token.h vendor/clang/dist/include/clang/Parse/CMakeLists.txt 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/lib/AST/ASTContext.cpp vendor/clang/dist/lib/AST/Decl.cpp vendor/clang/dist/lib/AST/DeclPrinter.cpp vendor/clang/dist/lib/AST/ExternalASTMerger.cpp vendor/clang/dist/lib/AST/ItaniumMangle.cpp vendor/clang/dist/lib/AST/StmtOpenMP.cpp vendor/clang/dist/lib/ASTMatchers/Dynamic/Registry.cpp vendor/clang/dist/lib/Basic/Attributes.cpp vendor/clang/dist/lib/Basic/OpenMPKinds.cpp vendor/clang/dist/lib/Basic/Targets.cpp vendor/clang/dist/lib/CodeGen/BackendUtil.cpp vendor/clang/dist/lib/CodeGen/CGCall.cpp vendor/clang/dist/lib/CodeGen/CGCall.h vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp vendor/clang/dist/lib/CodeGen/CGDecl.cpp vendor/clang/dist/lib/CodeGen/CGExpr.cpp vendor/clang/dist/lib/CodeGen/CGExprConstant.cpp vendor/clang/dist/lib/CodeGen/CGObjC.cpp vendor/clang/dist/lib/CodeGen/CGStmt.cpp vendor/clang/dist/lib/CodeGen/CGVTables.cpp vendor/clang/dist/lib/CodeGen/CodeGenModule.cpp vendor/clang/dist/lib/CodeGen/CodeGenModule.h vendor/clang/dist/lib/CodeGen/CodeGenTypeCache.h vendor/clang/dist/lib/CodeGen/ModuleBuilder.cpp vendor/clang/dist/lib/Driver/SanitizerArgs.cpp vendor/clang/dist/lib/Driver/ToolChains/Clang.cpp vendor/clang/dist/lib/Driver/ToolChains/CommonArgs.cpp vendor/clang/dist/lib/Driver/ToolChains/CommonArgs.h vendor/clang/dist/lib/Driver/ToolChains/Gnu.cpp vendor/clang/dist/lib/Driver/ToolChains/MinGW.cpp vendor/clang/dist/lib/Driver/ToolChains/MinGW.h vendor/clang/dist/lib/Format/FormatTokenLexer.cpp vendor/clang/dist/lib/Format/TokenAnnotator.cpp vendor/clang/dist/lib/Frontend/CompilerInvocation.cpp vendor/clang/dist/lib/Headers/smmintrin.h vendor/clang/dist/lib/Headers/xmmintrin.h vendor/clang/dist/lib/Index/CommentToXML.cpp 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/Lexer.cpp vendor/clang/dist/lib/Lex/ModuleMap.cpp vendor/clang/dist/lib/Lex/PPLexerChange.cpp vendor/clang/dist/lib/Parse/ParsePragma.cpp vendor/clang/dist/lib/Parse/ParseStmt.cpp vendor/clang/dist/lib/Parse/Parser.cpp vendor/clang/dist/lib/Sema/AttributeList.cpp vendor/clang/dist/lib/Sema/JumpDiagnostics.cpp vendor/clang/dist/lib/Sema/Sema.cpp vendor/clang/dist/lib/Sema/SemaAttr.cpp vendor/clang/dist/lib/Sema/SemaCXXScopeSpec.cpp vendor/clang/dist/lib/Sema/SemaChecking.cpp vendor/clang/dist/lib/Sema/SemaCoroutine.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/SemaDeclObjC.cpp vendor/clang/dist/lib/Sema/SemaExpr.cpp vendor/clang/dist/lib/Sema/SemaOpenMP.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/Serialization/ASTReaderStmt.cpp vendor/clang/dist/lib/Serialization/ASTWriterStmt.cpp vendor/clang/dist/test/CodeGen/debug-info-vla.c vendor/clang/dist/test/CodeGenCXX/debug-info.cpp vendor/clang/dist/test/CodeGenCXX/ubsan-suppress-checks.cpp vendor/clang/dist/test/CodeGenCXX/windows-itanium-dllexport.cpp vendor/clang/dist/test/CodeGenCoroutines/coro-alloc.cpp vendor/clang/dist/test/CodeGenObjC/empty-collection-literals.m vendor/clang/dist/test/CodeGenOpenCL/amdgpu-debug-info-variable-expression.cl vendor/clang/dist/test/Driver/cl-options.c vendor/clang/dist/test/Driver/clang_f_opts.c vendor/clang/dist/test/Driver/fopenmp.c vendor/clang/dist/test/Driver/fsanitize-coverage.c vendor/clang/dist/test/Driver/linux-as.c vendor/clang/dist/test/Driver/modules-ts.cpp vendor/clang/dist/test/Index/Core/index-source.cpp vendor/clang/dist/test/Lexer/cxx1z-trigraphs.cpp vendor/clang/dist/test/Misc/ast-print-out-of-line-func.cpp vendor/clang/dist/test/Modules/odr_hash.cpp vendor/clang/dist/test/Modules/umbrella-header-include-builtin.mm vendor/clang/dist/test/OpenMP/distribute_parallel_for_ast_print.cpp vendor/clang/dist/test/Parser/placeholder-recovery.m vendor/clang/dist/test/Preprocessor/init.c vendor/clang/dist/test/Sema/alloc-align-attr.c vendor/clang/dist/test/Sema/attr-availability.c vendor/clang/dist/test/Sema/attr-selectany.c vendor/clang/dist/test/SemaCXX/attr-selectany.cpp vendor/clang/dist/test/SemaCXX/coroutine-unhandled_exception-warning.cpp vendor/clang/dist/test/SemaCXX/coroutines.cpp vendor/clang/dist/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp vendor/clang/dist/test/SemaCXX/warn-unused-result.cpp vendor/clang/dist/test/SemaObjC/foreach.m vendor/clang/dist/test/lit.cfg vendor/clang/dist/test/lit.site.cfg.in vendor/clang/dist/tools/driver/cc1as_main.cpp vendor/clang/dist/unittests/Driver/ToolChainTest.cpp vendor/clang/dist/unittests/Format/FormatTestComments.cpp vendor/clang/dist/utils/TableGen/ClangAttrEmitter.cpp vendor/clang/dist/utils/TableGen/TableGen.cpp vendor/clang/dist/utils/TableGen/TableGenBackends.h Modified: vendor/clang/dist/bindings/python/clang/__init__.py ============================================================================== --- vendor/clang/dist/bindings/python/clang/__init__.py Thu Apr 20 21:19:16 2017 (r317219) +++ vendor/clang/dist/bindings/python/clang/__init__.py Thu Apr 20 21:20:51 2017 (r317220) @@ -20,13 +20,5 @@ The available modules are: Bindings for the Clang indexing library. """ - -# Python 3 uses unicode for strings. The bindings, in particular the interaction -# with ctypes, need modifying to handle conversions between unicode and -# c-strings. -import sys -if sys.version_info[0] != 2: - raise Exception("Only Python 2 is supported.") - __all__ = ['cindex'] Modified: vendor/clang/dist/bindings/python/clang/cindex.py ============================================================================== --- vendor/clang/dist/bindings/python/clang/cindex.py Thu Apr 20 21:19:16 2017 (r317219) +++ vendor/clang/dist/bindings/python/clang/cindex.py Thu Apr 20 21:20:51 2017 (r317220) @@ -67,6 +67,60 @@ import collections import clang.enumerations +import sys +if sys.version_info[0] == 3: + # Python 3 strings are unicode, translate them to/from utf8 for C-interop. + class c_interop_string(c_char_p): + + def __init__(self, p=None): + if p is None: + p = "" + if isinstance(p, str): + p = p.encode("utf8") + super(c_char_p, self).__init__(p) + + def __str__(self): + return 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): + if isinstance(param, str): + return cls(param) + if isinstance(param, bytes): + return cls(param) + raise TypeError("Cannot convert '{}' to '{}'".format(type(param).__name__, cls.__name__)) + + @staticmethod + def to_python_string(x, *args): + return x.value + + def b(x): + if isinstance(x, bytes): + return x + return x.encode('utf8') + + xrange = range + +elif sys.version_info[0] == 2: + # Python 2 strings are utf8 byte strings, no translation is needed for + # C-interop. + c_interop_string = c_char_p + + def _to_python_string(x, *args): + return x + + c_interop_string.to_python_string = staticmethod(_to_python_string) + + def b(x): + return x + + # ctypes doesn't implicitly convert c_void_p to the appropriate wrapper # object. This is a problem, because it means that from_parameter will see an # integer and pass the wrong value on platforms where int != void*. Work around @@ -157,6 +211,7 @@ class _CXString(Structure): assert isinstance(res, _CXString) return conf.lib.clang_getCString(res) + class SourceLocation(Structure): """ A SourceLocation represents a particular location within a source file. @@ -596,7 +651,7 @@ class CursorKind(BaseEnumeration): @staticmethod def get_all_kinds(): """Return all CursorKind enumeration instances.""" - return filter(None, CursorKind._kinds) + return [x for x in CursorKind._kinds if not x is None] def is_declaration(self): """Test if this is a declaration kind.""" @@ -2128,7 +2183,7 @@ class Type(Structure): """ Retrieve the offset of a field in the record. """ - return conf.lib.clang_Type_getOffsetOf(self, c_char_p(fieldname)) + return conf.lib.clang_Type_getOffsetOf(self, fieldname) def get_ref_qualifier(self): """ @@ -2239,7 +2294,7 @@ class CompletionChunk: def spelling(self): if self.__kindNumber in SpellingCache: return SpellingCache[self.__kindNumber] - return conf.lib.clang_getCompletionChunkText(self.cs, self.key).spelling + return conf.lib.clang_getCompletionChunkText(self.cs, self.key) # We do not use @CachedProperty here, as the manual implementation is # apparently still significantly faster. Please profile carefully if you @@ -2345,7 +2400,7 @@ class CompletionString(ClangObject): return " | ".join([str(a) for a in self]) \ + " || Priority: " + str(self.priority) \ + " || Availability: " + str(self.availability) \ - + " || Brief comment: " + str(self.briefComment.spelling) + + " || Brief comment: " + str(self.briefComment) availabilityKinds = { 0: CompletionChunk.Kind("Available"), @@ -2542,7 +2597,7 @@ class TranslationUnit(ClangObject): args_array = None if len(args) > 0: - args_array = (c_char_p * len(args))(* args) + args_array = (c_char_p * len(args))(*[b(x) for x in args]) unsaved_array = None if len(unsaved_files) > 0: @@ -2551,8 +2606,8 @@ class TranslationUnit(ClangObject): if hasattr(contents, "read"): contents = contents.read() - unsaved_array[i].name = name - unsaved_array[i].contents = contents + unsaved_array[i].name = b(name) + unsaved_array[i].contents = b(contents) unsaved_array[i].length = len(contents) ptr = conf.lib.clang_parseTranslationUnit(index, filename, args_array, @@ -2797,8 +2852,8 @@ class TranslationUnit(ClangObject): print(value) if not isinstance(value, str): raise TypeError('Unexpected unsaved file contents.') - unsaved_files_array[i].name = name - unsaved_files_array[i].contents = value + unsaved_files_array[i].name = b(name) + unsaved_files_array[i].contents = b(value) unsaved_files_array[i].length = len(value) ptr = conf.lib.clang_codeCompleteAt(self, path, line, column, unsaved_files_array, len(unsaved_files), options) @@ -2833,7 +2888,7 @@ class File(ClangObject): @property def name(self): """Return the complete file and path name of the file.""" - return conf.lib.clang_getCString(conf.lib.clang_getFileName(self)) + return conf.lib.clang_getFileName(self) @property def time(self): @@ -3064,7 +3119,7 @@ functionList = [ [c_object_p]), ("clang_CompilationDatabase_fromDirectory", - [c_char_p, POINTER(c_uint)], + [c_interop_string, POINTER(c_uint)], c_object_p, CompilationDatabase.from_result), @@ -3074,7 +3129,7 @@ functionList = [ CompileCommands.from_result), ("clang_CompilationDatabase_getCompileCommands", - [c_object_p, c_char_p], + [c_object_p, c_interop_string], c_object_p, CompileCommands.from_result), @@ -3109,7 +3164,7 @@ functionList = [ c_uint), ("clang_codeCompleteAt", - [TranslationUnit, c_char_p, c_int, c_int, c_void_p, c_int, c_int], + [TranslationUnit, c_interop_string, c_int, c_int, c_void_p, c_int, c_int], POINTER(CCRStructure)), ("clang_codeCompleteGetDiagnostic", @@ -3125,7 +3180,7 @@ functionList = [ c_object_p), ("clang_createTranslationUnit", - [Index, c_char_p], + [Index, c_interop_string], c_object_p), ("clang_CXXConstructor_isConvertingConstructor", @@ -3215,7 +3270,8 @@ functionList = [ ("clang_formatDiagnostic", [Diagnostic, c_uint], - _CXString), + _CXString, + _CXString.from_result), ("clang_getArgType", [Type, c_uint], @@ -3255,7 +3311,8 @@ functionList = [ ("clang_getCompletionBriefComment", [c_void_p], - _CXString), + _CXString, + _CXString.from_result), ("clang_getCompletionChunkCompletionString", [c_void_p, c_int], @@ -3267,7 +3324,8 @@ functionList = [ ("clang_getCompletionChunkText", [c_void_p, c_int], - _CXString), + _CXString, + _CXString.from_result), ("clang_getCompletionPriority", [c_void_p], @@ -3275,7 +3333,8 @@ functionList = [ ("clang_getCString", [_CXString], - c_char_p), + c_interop_string, + c_interop_string.to_python_string), ("clang_getCursor", [TranslationUnit, SourceLocation], @@ -3422,12 +3481,13 @@ functionList = [ Type.from_result), ("clang_getFile", - [TranslationUnit, c_char_p], + [TranslationUnit, c_interop_string], c_object_p), ("clang_getFileName", [File], - _CXString), # TODO go through _CXString.from_result? + _CXString, + _CXString.from_result), ("clang_getFileTime", [File], @@ -3551,7 +3611,8 @@ functionList = [ ("clang_getTUResourceUsageName", [c_uint], - c_char_p), + c_interop_string, + c_interop_string.to_python_string), ("clang_getTypeDeclaration", [Type], @@ -3646,7 +3707,7 @@ functionList = [ bool), ("clang_parseTranslationUnit", - [Index, c_char_p, c_void_p, c_int, c_void_p, c_int, c_int], + [Index, c_interop_string, c_void_p, c_int, c_void_p, c_int, c_int], c_object_p), ("clang_reparseTranslationUnit", @@ -3654,7 +3715,7 @@ functionList = [ c_int), ("clang_saveTranslationUnit", - [TranslationUnit, c_char_p, c_uint], + [TranslationUnit, c_interop_string, c_uint], c_int), ("clang_tokenize", @@ -3726,7 +3787,7 @@ functionList = [ Type.from_result), ("clang_Type_getOffsetOf", - [Type, c_char_p], + [Type, c_interop_string], c_longlong), ("clang_Type_getSizeOf", @@ -3785,7 +3846,8 @@ def register_functions(lib, ignore_error def register(item): return register_function(lib, item, ignore_errors) - map(register, functionList) + for f in functionList: + register(f) 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 Thu Apr 20 21:19:16 2017 (r317219) +++ vendor/clang/dist/bindings/python/tests/cindex/test_translation_unit.py Thu Apr 20 21:20:51 2017 (r317220) @@ -59,9 +59,12 @@ int SOME_DEFINE; assert spellings[-1] == 'y' def test_unsaved_files_2(): - import StringIO + try: + from StringIO import StringIO + except: + from io import StringIO tu = TranslationUnit.from_source('fake.c', unsaved_files = [ - ('fake.c', StringIO.StringIO('int x;'))]) + ('fake.c', StringIO('int x;'))]) spellings = [c.spelling for c in tu.cursor.get_children()] assert spellings[-1] == 'x' Modified: vendor/clang/dist/docs/LanguageExtensions.rst ============================================================================== --- vendor/clang/dist/docs/LanguageExtensions.rst Thu Apr 20 21:19:16 2017 (r317219) +++ vendor/clang/dist/docs/LanguageExtensions.rst Thu Apr 20 21:20:51 2017 (r317220) @@ -2346,3 +2346,178 @@ statements in C) The pragma can also be used with ``off`` which turns FP contraction off for a section of the code. This can be useful when fast contraction is otherwise enabled for the translation unit with the ``-ffp-contract=fast`` flag. + +Specifying an attribute for multiple declarations (#pragma clang attribute) +=========================================================================== + +The ``#pragma clang attribute`` directive can be used to apply an attribute to +multiple declarations. The ``#pragma clang attribute push`` variation of the +directive pushes a new attribute to the attribute stack. The declarations that +follow the pragma receive the attributes that are on the attribute stack, until +the stack is cleared using a ``#pragma clang attribute pop`` directive. Multiple +push directives can be nested inside each other. + +The attributes that are used in the ``#pragma clang attribute`` directives +can be written using the GNU-style syntax: + +.. code-block:: c++ + + #pragma clang attribute push(__attribute__((annotate("custom"))), apply_to = function) + + void function(); // The function now has the annotate("custom") attribute + + #pragma clang attribute pop + +The attributes can also be written using the C++11 style syntax: + +.. code-block:: c++ + + #pragma clang attribute push([[noreturn]], apply_to = function) + + void function(); // The function now has the [[noreturn]] attribute + + #pragma clang attribute pop + +The ``__declspec`` style syntax is also supported: + +.. code-block:: c++ + + #pragma clang attribute push(__declspec(dllexport), apply_to = function) + + void function(); // The function now has the __declspec(dllexport) attribute + + #pragma clang attribute pop + +A single push directive accepts only one attribute regardless of the syntax +used. + +Subject Match Rules +------------------- + +The set of declarations that receive a single attribute from the attribute stack +depends on the subject match rules that were specified in the pragma. Subject +match rules are specified after the attribute. The compiler expects an +identifier that corresponds to the subject set specifier. The ``apply_to`` +specifier is currently the only supported subject set specifier. It allows you +to specify match rules that form a subset of the attribute's allowed subject +set, i.e. the compiler doesn't require all of the attribute's subjects. For +example, an attribute like ``[[nodiscard]]`` whose subject set includes +``enum``, ``record`` and ``hasType(functionType)``, requires the presence of at +least one of these rules after ``apply_to``: + +.. code-block:: c++ + + #pragma clang attribute push([[nodiscard]], apply_to = enum) + + enum Enum1 { A1, B1 }; // The enum will receive [[nodiscard]] + + struct Record1 { }; // The struct will *not* receive [[nodiscard]] + + #pragma clang attribute pop + + #pragma clang attribute push([[nodiscard]], apply_to = any(record, enum)) + + enum Enum2 { A2, B2 }; // The enum will receive [[nodiscard]] + + struct Record2 { }; // The struct *will* receive [[nodiscard]] + + #pragma clang attribute pop + + // This is an error, since [[nodiscard]] can't be applied to namespaces: + #pragma clang attribute push([[nodiscard]], apply_to = any(record, namespace)) + + #pragma clang attribute pop + +Multiple match rules can be specified using the ``any`` match rule, as shown +in the example above. The ``any`` rule applies attributes to all declarations +that are matched by at least one of the rules in the ``any``. It doesn't nest +and can't be used inside the other match rules. Redundant match rules or rules +that conflict with one another should not be used inside of ``any``. + +Clang supports the following match rules: + +- ``function``: Can be used to apply attributes to functions. This includes C++ + member functions, static functions, operators, and constructors/destructors. + +- ``function(is_member)``: Can be used to apply attributes to C++ member + functions. This includes members like static functions, operators, and + constructors/destructors. + +- ``hasType(functionType)``: Can be used to apply attributes to functions, C++ + member functions, and variables/fields whose type is a function pointer. It + does not apply attributes to Objective-C methods or blocks. + +- ``type_alias``: Can be used to apply attributes to ``typedef`` declarations + and C++11 type aliases. + +- ``record``: Can be used to apply attributes to ``struct``, ``class``, and + ``union`` declarations. + +- ``record(unless(is_union))``: Can be used to apply attributes only to + ``struct`` and ``class`` declarations. + +- ``enum``: Can be be used to apply attributes to enumeration declarations. + +- ``enum_constant``: Can be used to apply attributes to enumerators. + +- ``variable``: Can be used to apply attributes to variables, including + local variables, parameters, global variables, and static member variables. + It does not apply attributes to instance member variables or Objective-C + ivars. + +- ``variable(is_thread_local)``: Can be used to apply attributes to thread-local + variables only. + +- ``variable(is_global)``: Can be used to apply attributes to global variables + only. + +- ``variable(is_parameter)``: Can be used to apply attributes to parameters + only. + +- ``variable(unless(is_parameter))``: Can be used to apply attributes to all + the variables that are not parameters. + +- ``field``: Can be used to apply attributes to non-static member variables + in a record. This includes Objective-C ivars. + +- ``namespace``: Can be used to apply attributes to ``namespace`` declarations. + +- ``objc_interface``: Can be used to apply attributes to ``@interface`` + declarations. + +- ``objc_protocol``: Can be used to apply attributes to ``@protocol`` + declarations. + +- ``objc_category``: Can be used to apply attributes to category declarations, + including class extensions. + +- ``objc_method``: Can be used to apply attributes to Objective-C methods, + including instance and class methods. Implicit methods like implicit property + getters and setters do not receive the attribute. + +- ``objc_method(is_instance)``: Can be used to apply attributes to Objective-C + instance methods. + +- ``objc_property``: Can be used to apply attributes to ``@property`` + declarations. + +- ``block``: Can be used to apply attributes to block declarations. This does + not include variables/fields of block pointer type. + +The use of ``unless`` in match rules is currently restricted to a strict set of +sub-rules that are used by the supported attributes. That means that even though +``variable(unless(is_parameter))`` is a valid match rule, +``variable(unless(is_thread_local))`` is not. + +Supported Attributes +-------------------- + +Not all attributes can be used with the ``#pragma clang attribute`` directive. +Notably, statement attributes like ``[[fallthrough]]`` or type attributes +like ``address_space`` aren't supported by this directive. You can determine +whether or not an attribute is supported by the pragma by referring to the +:doc:`individual documentation for that attribute `. + +The attributes are applied to all matching declarations individually, even when +the attribute is semantically incorrect. The attributes that aren't applied to +any declaration are not verified semantically. Modified: vendor/clang/dist/docs/SanitizerCoverage.rst ============================================================================== --- vendor/clang/dist/docs/SanitizerCoverage.rst Thu Apr 20 21:19:16 2017 (r317219) +++ vendor/clang/dist/docs/SanitizerCoverage.rst Thu Apr 20 21:20:51 2017 (r317220) @@ -25,17 +25,10 @@ following compile-time flags: **extra** slowdown). * ``-fsanitize-coverage=edge`` for edge-level coverage (up to 40% slowdown). -You may also specify ``-fsanitize-coverage=indirect-calls`` for -additional `caller-callee coverage`_. - At run time, pass ``coverage=1`` in ``ASAN_OPTIONS``, ``LSAN_OPTIONS``, ``MSAN_OPTIONS`` or ``UBSAN_OPTIONS``, as appropriate. For the standalone coverage mode, use ``UBSAN_OPTIONS``. -To get `Coverage counters`_, add ``-fsanitize-coverage=8bit-counters`` -to one of the above compile-time flags. At runtime, use -``*SAN_OPTIONS=coverage=1:coverage_counters=1``. - Example: .. code-block:: console @@ -199,135 +192,9 @@ edges by introducing new dummy blocks an |/ C -Bitset -====== - -When ``coverage_bitset=1`` run-time flag is given, the coverage will also be -dumped as a bitset (text file with 1 for blocks that have been executed and 0 -for blocks that were not). - -.. code-block:: console - - % clang++ -fsanitize=address -fsanitize-coverage=edge cov.cc - % ASAN_OPTIONS="coverage=1:coverage_bitset=1" ./a.out - main - % ASAN_OPTIONS="coverage=1:coverage_bitset=1" ./a.out 1 - foo - main - % head *bitset* - ==> a.out.38214.bitset-sancov <== - 01101 - ==> a.out.6128.bitset-sancov <== - 11011% - -For a given executable the length of the bitset is always the same (well, -unless dlopen/dlclose come into play), so the bitset coverage can be -easily used for bitset-based corpus distillation. - -Caller-callee coverage -====================== - -**Deprecated, don't use** - -Every indirect function call is instrumented with a run-time function call that -captures caller and callee. At the shutdown time the process dumps a separate -file called ``caller-callee.PID.sancov`` which contains caller/callee pairs as -pairs of lines (odd lines are callers, even lines are callees) - -.. code-block:: console - - a.out 0x4a2e0c - a.out 0x4a6510 - a.out 0x4a2e0c - a.out 0x4a87f0 - -Current limitations: - -* Only the first 14 callees for every caller are recorded, the rest are silently - ignored. -* The output format is not very compact since caller and callee may reside in - different modules and we need to spell out the module names. -* The routine that dumps the output is not optimized for speed -* Only Linux x86_64 is tested so far. -* Sandboxes are not supported. - -Coverage counters -================= - -**Deprecated, don't use** - -This experimental feature is inspired by -`AFL `__'s coverage -instrumentation. With additional compile-time and run-time flags you can get -more sensitive coverage information. In addition to boolean values assigned to -every basic block (edge) the instrumentation will collect imprecise counters. -On exit, every counter will be mapped to a 8-bit bitset representing counter -ranges: ``1, 2, 3, 4-7, 8-15, 16-31, 32-127, 128+`` and those 8-bit bitsets will -be dumped to disk. - -.. code-block:: console - - % clang++ -g cov.cc -fsanitize=address -fsanitize-coverage=edge,8bit-counters - % ASAN_OPTIONS="coverage=1:coverage_counters=1" ./a.out - % ls -l *counters-sancov - ... a.out.17110.counters-sancov - % xxd *counters-sancov - 0000000: 0001 0100 01 - -These counters may also be used for in-process coverage-guided fuzzers. See -``include/sanitizer/coverage_interface.h``: - -.. code-block:: c++ - - // The coverage instrumentation may optionally provide imprecise counters. - // Rather than exposing the counter values to the user we instead map - // the counters to a bitset. - // Every counter is associated with 8 bits in the bitset. - // We define 8 value ranges: 1, 2, 3, 4-7, 8-15, 16-31, 32-127, 128+ - // The i-th bit is set to 1 if the counter value is in the i-th range. - // This counter-based coverage implementation is *not* thread-safe. - - // Returns the number of registered coverage counters. - uintptr_t __sanitizer_get_number_of_counters(); - // Updates the counter 'bitset', clears the counters and returns the number of - // new bits in 'bitset'. - // If 'bitset' is nullptr, only clears the counters. - // Otherwise 'bitset' should be at least - // __sanitizer_get_number_of_counters bytes long and 8-aligned. - uintptr_t - __sanitizer_update_counter_bitset_and_clear_counters(uint8_t *bitset); - -Tracing basic blocks -==================== - -**Deprecated, don't use** - -Experimental support for basic block (or edge) tracing. -With ``-fsanitize-coverage=trace-bb`` the compiler will insert -``__sanitizer_cov_trace_basic_block(s32 *id)`` before every function, basic block, or edge -(depending on the value of ``-fsanitize-coverage=[func,bb,edge]``). -Example: - -.. code-block:: console - - % clang -g -fsanitize=address -fsanitize-coverage=edge,trace-bb foo.cc - % ASAN_OPTIONS=coverage=1 ./a.out - -This will produce two files after the process exit: -`trace-points.PID.sancov` and `trace-events.PID.sancov`. -The first file will contain a textual description of all the instrumented points in the program -in the form that you can feed into llvm-symbolizer (e.g. `a.out 0x4dca89`), one per line. -The second file will contain the actual execution trace as a sequence of 4-byte integers --- these integers are the indices into the array of instrumented points (the first file). - -Basic block tracing is currently supported only for single-threaded applications. - - Tracing PCs =========== -**Deprecated, don't use** - *Experimental* feature similar to tracing basic blocks, but with a different API. With ``-fsanitize-coverage=trace-pc`` the compiler will insert ``__sanitizer_cov_trace_pc()`` on every edge. @@ -529,62 +396,3 @@ memory-mapped file as soon as it collect Note that on 64-bit platforms, this method writes 2x more data than the default, because it stores full PC values instead of 32-bit offsets. -In-process fuzzing -================== - -Coverage data could be useful for fuzzers and sometimes it is preferable to run -a fuzzer in the same process as the code being fuzzed (in-process fuzzer). - -You can use ``__sanitizer_get_total_unique_coverage()`` from -```` which returns the number of currently -covered entities in the program. This will tell the fuzzer if the coverage has -increased after testing every new input. - -If a fuzzer finds a bug in the ASan run, you will need to save the reproducer -before exiting the process. Use ``__asan_set_death_callback`` from -```` to do that. - -An example of such fuzzer can be found in `the LLVM tree -`_. - -Performance -=========== - -This coverage implementation is **fast**. With function-level coverage -(``-fsanitize-coverage=func``) the overhead is not measurable. With -basic-block-level coverage (``-fsanitize-coverage=bb``) the overhead varies -between 0 and 25%. - -============== ========= ========= ========= ========= ========= ========= - benchmark cov0 cov1 diff 0-1 cov2 diff 0-2 diff 1-2 -============== ========= ========= ========= ========= ========= ========= - 400.perlbench 1296.00 1307.00 1.01 1465.00 1.13 1.12 - 401.bzip2 858.00 854.00 1.00 1010.00 1.18 1.18 - 403.gcc 613.00 617.00 1.01 683.00 1.11 1.11 - 429.mcf 605.00 582.00 0.96 610.00 1.01 1.05 - 445.gobmk 896.00 880.00 0.98 1050.00 1.17 1.19 - 456.hmmer 892.00 892.00 1.00 918.00 1.03 1.03 - 458.sjeng 995.00 1009.00 1.01 1217.00 1.22 1.21 -462.libquantum 497.00 492.00 0.99 534.00 1.07 1.09 - 464.h264ref 1461.00 1467.00 1.00 1543.00 1.06 1.05 - 471.omnetpp 575.00 590.00 1.03 660.00 1.15 1.12 - 473.astar 658.00 652.00 0.99 715.00 1.09 1.10 - 483.xalancbmk 471.00 491.00 1.04 582.00 1.24 1.19 - 433.milc 616.00 627.00 1.02 627.00 1.02 1.00 - 444.namd 602.00 601.00 1.00 654.00 1.09 1.09 - 447.dealII 630.00 634.00 1.01 653.00 1.04 1.03 - 450.soplex 365.00 368.00 1.01 395.00 1.08 1.07 - 453.povray 427.00 434.00 1.02 495.00 1.16 1.14 - 470.lbm 357.00 375.00 1.05 370.00 1.04 0.99 - 482.sphinx3 927.00 928.00 1.00 1000.00 1.08 1.08 -============== ========= ========= ========= ========= ========= ========= - -Why another coverage? -===================== - -Why did we implement yet another code coverage? - * We needed something that is lightning fast, plays well with - AddressSanitizer, and does not significantly increase the binary size. - * Traditional coverage implementations based in global counters - `suffer from contention on counters - `_. Modified: vendor/clang/dist/docs/doxygen.cfg.in ============================================================================== --- vendor/clang/dist/docs/doxygen.cfg.in Thu Apr 20 21:19:16 2017 (r317219) +++ vendor/clang/dist/docs/doxygen.cfg.in Thu Apr 20 21:20:51 2017 (r317220) @@ -132,7 +132,7 @@ INLINE_INHERITED_MEMB = NO # shortest path that makes the file name unique will be used # The default value is: YES. -FULL_PATH_NAMES = NO +FULL_PATH_NAMES = YES # The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. # Stripping is only done if one of the specified strings matches the left-hand @@ -144,7 +144,7 @@ FULL_PATH_NAMES = NO # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. -STRIP_FROM_PATH = ../.. +STRIP_FROM_PATH = @abs_srcdir@/.. # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which @@ -153,7 +153,7 @@ STRIP_FROM_PATH = ../.. # specify the list of include paths that are normally passed to the compiler # using the -I flag. -STRIP_FROM_INC_PATH = +STRIP_FROM_INC_PATH = @abs_srcdir@/../include # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but # less readable) file names. This can be useful is your file systems doesn't @@ -513,7 +513,7 @@ SHOW_GROUPED_MEMB_INC = NO # files with double quotes in the documentation rather than with sharp brackets. # The default value is: NO. -FORCE_LOCAL_INCLUDES = NO +FORCE_LOCAL_INCLUDES = YES # If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the # documentation for inline members. Modified: vendor/clang/dist/include/clang/AST/Decl.h ============================================================================== --- vendor/clang/dist/include/clang/AST/Decl.h Thu Apr 20 21:19:16 2017 (r317219) +++ vendor/clang/dist/include/clang/AST/Decl.h Thu Apr 20 21:20:51 2017 (r317220) @@ -2082,10 +2082,7 @@ public: const Attr *getUnusedResultAttr() const; /// \brief Returns true if this function or its return type has the - /// warn_unused_result attribute. If the return type has the attribute and - /// this function is a method of the return type's class, then false will be - /// returned to avoid spurious warnings on member methods such as assignment - /// operators. + /// warn_unused_result attribute. bool hasUnusedResultAttr() const { return getUnusedResultAttr() != nullptr; } /// \brief Returns the storage class as written in the source. For the Modified: vendor/clang/dist/include/clang/AST/StmtOpenMP.h ============================================================================== --- vendor/clang/dist/include/clang/AST/StmtOpenMP.h Thu Apr 20 21:19:16 2017 (r317219) +++ vendor/clang/dist/include/clang/AST/StmtOpenMP.h Thu Apr 20 21:20:51 2017 (r317220) @@ -318,8 +318,9 @@ class OMPLoopDirective : public OMPExecu /// \brief Offsets to the stored exprs. /// This enumeration contains offsets to all the pointers to children /// expressions stored in OMPLoopDirective. - /// The first 9 children are nesessary for all the loop directives, and - /// the next 10 are specific to the worksharing ones. + /// The first 9 children are necessary for all the loop directives, + /// the next 8 are specific to the worksharing ones, and the next 11 are + /// used for combined constructs containing two pragmas associated to loops. /// After the fixed children, three arrays of length CollapsedNum are /// allocated: loop counters, their updates and final values. /// PrevLowerBound and PrevUpperBound are used to communicate blocking @@ -344,7 +345,7 @@ class OMPLoopDirective : public OMPExecu // specify the offset to the end (and start of the following counters/ // updates/finals arrays). DefaultEnd = 9, - // The following 12 exprs are used by worksharing and distribute loops only. + // The following 8 exprs are used by worksharing and distribute loops only. IsLastIterVariableOffset = 9, LowerBoundVariableOffset = 10, UpperBoundVariableOffset = 11, @@ -353,13 +354,22 @@ class OMPLoopDirective : public OMPExecu NextLowerBoundOffset = 14, NextUpperBoundOffset = 15, NumIterationsOffset = 16, + // Offset to the end for worksharing loop directives. + WorksharingEnd = 17, PrevLowerBoundVariableOffset = 17, PrevUpperBoundVariableOffset = 18, DistIncOffset = 19, PrevEnsureUpperBoundOffset = 20, + CombinedLowerBoundVariableOffset = 21, + CombinedUpperBoundVariableOffset = 22, + CombinedEnsureUpperBoundOffset = 23, + CombinedInitOffset = 24, + CombinedConditionOffset = 25, + CombinedNextLowerBoundOffset = 26, + CombinedNextUpperBoundOffset = 27, // Offset to the end (and start of the following counters/updates/finals - // arrays) for worksharing loop directives. - WorksharingEnd = 21, + // arrays) for combined distribute loop directives. + CombinedDistributeEnd = 28, }; /// \brief Get the counters storage. @@ -423,11 +433,12 @@ protected: /// \brief Offset to the start of children expression arrays. static unsigned getArraysOffset(OpenMPDirectiveKind Kind) { - return (isOpenMPWorksharingDirective(Kind) || - isOpenMPTaskLoopDirective(Kind) || - isOpenMPDistributeDirective(Kind)) - ? WorksharingEnd - : DefaultEnd; + if (isOpenMPLoopBoundSharingDirective(Kind)) + return CombinedDistributeEnd; + if (isOpenMPWorksharingDirective(Kind) || isOpenMPTaskLoopDirective(Kind) || + isOpenMPDistributeDirective(Kind)) + return WorksharingEnd; + return DefaultEnd; } /// \brief Children number. @@ -515,33 +526,60 @@ protected: *std::next(child_begin(), NumIterationsOffset) = NI; } void setPrevLowerBoundVariable(Expr *PrevLB) { - assert((isOpenMPWorksharingDirective(getDirectiveKind()) || - isOpenMPTaskLoopDirective(getDirectiveKind()) || - isOpenMPDistributeDirective(getDirectiveKind())) && - "expected worksharing loop directive"); + assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && + "expected loop bound sharing directive"); *std::next(child_begin(), PrevLowerBoundVariableOffset) = PrevLB; } void setPrevUpperBoundVariable(Expr *PrevUB) { - assert((isOpenMPWorksharingDirective(getDirectiveKind()) || - isOpenMPTaskLoopDirective(getDirectiveKind()) || - isOpenMPDistributeDirective(getDirectiveKind())) && - "expected worksharing loop directive"); + assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && + "expected loop bound sharing directive"); *std::next(child_begin(), PrevUpperBoundVariableOffset) = PrevUB; } void setDistInc(Expr *DistInc) { - assert((isOpenMPWorksharingDirective(getDirectiveKind()) || - isOpenMPTaskLoopDirective(getDirectiveKind()) || - isOpenMPDistributeDirective(getDirectiveKind())) && - "expected worksharing loop directive"); + assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && + "expected loop bound sharing directive"); *std::next(child_begin(), DistIncOffset) = DistInc; } void setPrevEnsureUpperBound(Expr *PrevEUB) { - assert((isOpenMPWorksharingDirective(getDirectiveKind()) || - isOpenMPTaskLoopDirective(getDirectiveKind()) || - isOpenMPDistributeDirective(getDirectiveKind())) && - "expected worksharing loop directive"); + assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && + "expected loop bound sharing directive"); *std::next(child_begin(), PrevEnsureUpperBoundOffset) = PrevEUB; } + void setCombinedLowerBoundVariable(Expr *CombLB) { + assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && + "expected loop bound sharing directive"); + *std::next(child_begin(), CombinedLowerBoundVariableOffset) = CombLB; + } + void setCombinedUpperBoundVariable(Expr *CombUB) { + assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && + "expected loop bound sharing directive"); + *std::next(child_begin(), CombinedUpperBoundVariableOffset) = CombUB; + } + void setCombinedEnsureUpperBound(Expr *CombEUB) { + assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && + "expected loop bound sharing directive"); + *std::next(child_begin(), CombinedEnsureUpperBoundOffset) = CombEUB; + } + void setCombinedInit(Expr *CombInit) { + assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && + "expected loop bound sharing directive"); + *std::next(child_begin(), CombinedInitOffset) = CombInit; + } + void setCombinedCond(Expr *CombCond) { + assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && + "expected loop bound sharing directive"); + *std::next(child_begin(), CombinedConditionOffset) = CombCond; + } + void setCombinedNextLowerBound(Expr *CombNLB) { + assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && + "expected loop bound sharing directive"); + *std::next(child_begin(), CombinedNextLowerBoundOffset) = CombNLB; + } + void setCombinedNextUpperBound(Expr *CombNUB) { + assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && + "expected loop bound sharing directive"); + *std::next(child_begin(), CombinedNextUpperBoundOffset) = CombNUB; + } void setCounters(ArrayRef A); void setPrivateCounters(ArrayRef A); void setInits(ArrayRef A); @@ -549,6 +587,33 @@ protected: void setFinals(ArrayRef A); public: + /// The expressions built to support OpenMP loops in combined/composite + /// pragmas (e.g. pragma omp distribute parallel for) + struct DistCombinedHelperExprs { + /// DistributeLowerBound - used when composing 'omp distribute' with + /// 'omp for' in a same construct. + Expr *LB; + /// DistributeUpperBound - used when composing 'omp distribute' with + /// 'omp for' in a same construct. + Expr *UB; + /// DistributeEnsureUpperBound - used when composing 'omp distribute' + /// with 'omp for' in a same construct, EUB depends on DistUB + Expr *EUB; + /// Distribute loop iteration variable init used when composing 'omp + /// distribute' + /// with 'omp for' in a same construct + Expr *Init; + /// Distribute Loop condition used when composing 'omp distribute' + /// with 'omp for' in a same construct + Expr *Cond; + /// Update of LowerBound for statically sheduled omp loops for + /// outer loop in combined constructs (e.g. 'distribute parallel for') + Expr *NLB; + /// Update of UpperBound for statically sheduled omp loops for + /// outer loop in combined constructs (e.g. 'distribute parallel for') + Expr *NUB; + }; + /// \brief The expressions built for the OpenMP loop CodeGen for the /// whole collapsed loop nest. struct HelperExprs { @@ -611,6 +676,9 @@ public: /// Init statement for all captured expressions. Stmt *PreInits; + /// Expressions used when combining OpenMP loop pragmas + DistCombinedHelperExprs DistCombinedFields; + /// \brief Check if all the expressions are built (does not check the /// worksharing ones). bool builtAll() { @@ -654,6 +722,13 @@ public: Finals[i] = nullptr; } PreInits = nullptr; + DistCombinedFields.LB = nullptr; + DistCombinedFields.UB = nullptr; + DistCombinedFields.EUB = nullptr; + DistCombinedFields.Init = nullptr; + DistCombinedFields.Cond = nullptr; + DistCombinedFields.NLB = nullptr; + DistCombinedFields.NUB = nullptr; } }; @@ -757,37 +832,71 @@ public: *std::next(child_begin(), NumIterationsOffset))); } Expr *getPrevLowerBoundVariable() const { - assert((isOpenMPWorksharingDirective(getDirectiveKind()) || - isOpenMPTaskLoopDirective(getDirectiveKind()) || - isOpenMPDistributeDirective(getDirectiveKind())) && - "expected worksharing loop directive"); + assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && + "expected loop bound sharing directive"); return const_cast(reinterpret_cast( *std::next(child_begin(), PrevLowerBoundVariableOffset))); } Expr *getPrevUpperBoundVariable() const { - assert((isOpenMPWorksharingDirective(getDirectiveKind()) || - isOpenMPTaskLoopDirective(getDirectiveKind()) || - isOpenMPDistributeDirective(getDirectiveKind())) && - "expected worksharing loop directive"); + assert(isOpenMPLoopBoundSharingDirective(getDirectiveKind()) && + "expected loop bound sharing directive"); return const_cast(reinterpret_cast( *std::next(child_begin(), PrevUpperBoundVariableOffset))); } Expr *getDistInc() const { - assert((isOpenMPWorksharingDirective(getDirectiveKind()) || - isOpenMPTaskLoopDirective(getDirectiveKind()) || - isOpenMPDistributeDirective(getDirectiveKind())) && - "expected worksharing loop directive"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***