From owner-svn-src-vendor@freebsd.org Tue May 2 18:30:49 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 4DFD6D5BD23; Tue, 2 May 2017 18:30:49 +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 05C7E26C; Tue, 2 May 2017 18:30:48 +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 v42IUme5000866; Tue, 2 May 2017 18:30:48 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42IUkVx000848; Tue, 2 May 2017 18:30:46 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201705021830.v42IUkVx000848@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 2 May 2017 18:30:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317685 - in vendor/clang/dist: docs include/clang-c include/clang/AST include/clang/Basic include/clang/CodeGen include/clang/Driver include/clang/Edit include/clang/Frontend include/c... 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: Tue, 02 May 2017 18:30:49 -0000 Author: dim Date: Tue May 2 18:30:45 2017 New Revision: 317685 URL: https://svnweb.freebsd.org/changeset/base/317685 Log: Vendor import of clang trunk r301939: https://llvm.org/svn/llvm-project/cfe/trunk@301939 Added: vendor/clang/dist/include/clang/AST/ASTStructuralEquivalence.h (contents, props changed) vendor/clang/dist/lib/AST/ASTStructuralEquivalence.cpp (contents, props changed) vendor/clang/dist/test/ARCMT/remap-applying.c (contents, props changed) vendor/clang/dist/test/ARCMT/remap-applying.c.result vendor/clang/dist/test/CodeGenCXX/attr-x86-no_caller_saved_registers.cpp (contents, props changed) vendor/clang/dist/test/CodeGenCXX/ubsan-nullability-assign.cpp (contents, props changed) vendor/clang/dist/test/CodeGenObjCXX/boxing.mm vendor/clang/dist/test/Frontend/Inputs/empty.h (contents, props changed) vendor/clang/dist/test/Headers/stdint-typeof-MINMAX.cpp (contents, props changed) vendor/clang/dist/test/Import/in-class-initializer/ vendor/clang/dist/test/Import/in-class-initializer/Inputs/ vendor/clang/dist/test/Import/in-class-initializer/Inputs/S.cpp (contents, props changed) vendor/clang/dist/test/Import/in-class-initializer/test.cpp (contents, props changed) vendor/clang/dist/test/Index/allow-editor-placeholders.cpp (contents, props changed) vendor/clang/dist/test/Index/target-info.c (contents, props changed) vendor/clang/dist/test/Modules/Inputs/diag_flags.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/ vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/ vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Headers/ vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Headers/Bar.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Headers/FooPublic.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Modules/ vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Modules/module.modulemap vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Modules/module.private.modulemap vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/PrivateHeaders/ vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/PrivateHeaders/Baz.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/incomplete-umbrella/Foo.framework/PrivateHeaders/Foo.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/malformed-overload/ vendor/clang/dist/test/Modules/Inputs/malformed-overload/X.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/malformed-overload/module.modulemap vendor/clang/dist/test/Modules/diag-flags.cpp (contents, props changed) vendor/clang/dist/test/Modules/import-syntax.c (contents, props changed) vendor/clang/dist/test/Modules/incomplete-umbrella.m vendor/clang/dist/test/Modules/malformed-overload.m vendor/clang/dist/test/Modules/preprocess-module.cpp (contents, props changed) vendor/clang/dist/test/Preprocessor/Inputs/nonportable-hmaps/ vendor/clang/dist/test/Preprocessor/Inputs/nonportable-hmaps/foo.hmap (contents, props changed) vendor/clang/dist/test/Preprocessor/Inputs/nonportable-hmaps/headers/ vendor/clang/dist/test/Preprocessor/Inputs/nonportable-hmaps/headers/foo/ vendor/clang/dist/test/Preprocessor/Inputs/nonportable-hmaps/headers/foo/Foo.h (contents, props changed) vendor/clang/dist/test/Preprocessor/nonportable-include-with-hmap.c (contents, props changed) vendor/clang/dist/test/Preprocessor/pragma_module.c (contents, props changed) vendor/clang/dist/test/SemaCXX/attr-non-x86-no_caller_saved_registers.cpp (contents, props changed) vendor/clang/dist/test/SemaCXX/attr-x86-no_caller_saved_registers.cpp (contents, props changed) vendor/clang/dist/test/SemaCXX/constexpr-array-unknown-bound.cpp (contents, props changed) vendor/clang/dist/test/SemaObjC/x86-method-vector-values.m Deleted: vendor/clang/dist/test/Frontend/Rewriter/ Modified: vendor/clang/dist/docs/SanitizerCoverage.rst vendor/clang/dist/include/clang-c/Index.h vendor/clang/dist/include/clang/AST/DeclBase.h vendor/clang/dist/include/clang/AST/Type.h vendor/clang/dist/include/clang/Basic/Attr.td vendor/clang/dist/include/clang/Basic/AttrDocs.td vendor/clang/dist/include/clang/Basic/DiagnosticASTKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticDriverKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td vendor/clang/dist/include/clang/Basic/DiagnosticLexKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td vendor/clang/dist/include/clang/Basic/LangOptions.def vendor/clang/dist/include/clang/CodeGen/CGFunctionInfo.h vendor/clang/dist/include/clang/Driver/CLCompatOptions.td vendor/clang/dist/include/clang/Edit/EditedSource.h vendor/clang/dist/include/clang/Frontend/FrontendActions.h vendor/clang/dist/include/clang/Frontend/FrontendOptions.h vendor/clang/dist/include/clang/Frontend/LangStandard.h vendor/clang/dist/include/clang/Frontend/LangStandards.def vendor/clang/dist/include/clang/Lex/HeaderSearch.h vendor/clang/dist/include/clang/Lex/MacroInfo.h vendor/clang/dist/include/clang/Lex/PPCallbacks.h vendor/clang/dist/include/clang/Lex/PreprocessingRecord.h vendor/clang/dist/include/clang/Lex/Preprocessor.h vendor/clang/dist/include/clang/Sema/Sema.h vendor/clang/dist/lib/ARCMigrate/ObjCMT.cpp vendor/clang/dist/lib/AST/ASTContext.cpp vendor/clang/dist/lib/AST/ASTImporter.cpp vendor/clang/dist/lib/AST/CMakeLists.txt vendor/clang/dist/lib/AST/DeclBase.cpp vendor/clang/dist/lib/AST/ExprConstant.cpp vendor/clang/dist/lib/AST/TypePrinter.cpp vendor/clang/dist/lib/Basic/Targets.cpp vendor/clang/dist/lib/CodeGen/BackendUtil.cpp vendor/clang/dist/lib/CodeGen/CGBlocks.cpp vendor/clang/dist/lib/CodeGen/CGCall.cpp vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp vendor/clang/dist/lib/CodeGen/CGDeclCXX.cpp vendor/clang/dist/lib/CodeGen/CGExpr.cpp vendor/clang/dist/lib/CodeGen/CGObjC.cpp vendor/clang/dist/lib/CodeGen/CGObjCMac.cpp vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp vendor/clang/dist/lib/CodeGen/CodeGenAction.cpp vendor/clang/dist/lib/CodeGen/CodeGenFunction.h vendor/clang/dist/lib/CodeGen/CodeGenModule.cpp vendor/clang/dist/lib/CodeGen/CodeGenModule.h vendor/clang/dist/lib/CodeGen/MacroPPCallbacks.cpp vendor/clang/dist/lib/CodeGen/MacroPPCallbacks.h vendor/clang/dist/lib/Driver/Job.cpp vendor/clang/dist/lib/Driver/ToolChains/Clang.cpp vendor/clang/dist/lib/Edit/EditedSource.cpp vendor/clang/dist/lib/Format/UnwrappedLineParser.cpp vendor/clang/dist/lib/Frontend/ASTUnit.cpp vendor/clang/dist/lib/Frontend/CompilerInstance.cpp vendor/clang/dist/lib/Frontend/CompilerInvocation.cpp vendor/clang/dist/lib/Frontend/FrontendAction.cpp vendor/clang/dist/lib/Frontend/FrontendActions.cpp vendor/clang/dist/lib/Frontend/FrontendOptions.cpp vendor/clang/dist/lib/Frontend/InitPreprocessor.cpp vendor/clang/dist/lib/Frontend/LangStandards.cpp vendor/clang/dist/lib/Frontend/PrintPreprocessedOutput.cpp vendor/clang/dist/lib/Frontend/Rewrite/InclusionRewriter.cpp vendor/clang/dist/lib/Frontend/VerifyDiagnosticConsumer.cpp vendor/clang/dist/lib/Headers/avx512fintrin.h vendor/clang/dist/lib/Headers/avxintrin.h vendor/clang/dist/lib/Headers/bmiintrin.h vendor/clang/dist/lib/Headers/emmintrin.h vendor/clang/dist/lib/Headers/stdint.h vendor/clang/dist/lib/Index/IndexDecl.cpp vendor/clang/dist/lib/Index/USRGeneration.cpp vendor/clang/dist/lib/Lex/HeaderSearch.cpp vendor/clang/dist/lib/Lex/MacroInfo.cpp vendor/clang/dist/lib/Lex/PPDirectives.cpp vendor/clang/dist/lib/Lex/PPLexerChange.cpp vendor/clang/dist/lib/Lex/PPMacroExpansion.cpp vendor/clang/dist/lib/Lex/Pragma.cpp vendor/clang/dist/lib/Lex/PreprocessingRecord.cpp vendor/clang/dist/lib/Sema/SemaChecking.cpp vendor/clang/dist/lib/Sema/SemaDecl.cpp vendor/clang/dist/lib/Sema/SemaDeclAttr.cpp vendor/clang/dist/lib/Sema/SemaDeclObjC.cpp vendor/clang/dist/lib/Sema/SemaExpr.cpp vendor/clang/dist/lib/Sema/SemaExprObjC.cpp vendor/clang/dist/lib/Sema/SemaOpenMP.cpp vendor/clang/dist/lib/Sema/SemaOverload.cpp vendor/clang/dist/lib/Sema/SemaType.cpp vendor/clang/dist/lib/Serialization/ASTReader.cpp vendor/clang/dist/lib/Serialization/ASTWriter.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/MallocChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Frontend/ModelInjector.cpp vendor/clang/dist/test/Analysis/malloc.c vendor/clang/dist/test/CodeGen/atomic-ops-libcall.c vendor/clang/dist/test/CodeGen/avx-builtins.c vendor/clang/dist/test/CodeGen/avx512f-builtins.c vendor/clang/dist/test/CodeGen/sse2-builtins.c vendor/clang/dist/test/CodeGenCXX/debug-info-namespace.cpp vendor/clang/dist/test/CodeGenObjC/arc-blocks.m vendor/clang/dist/test/CodeGenObjC/arc-foreach.m vendor/clang/dist/test/CodeGenObjC/ubsan-nullability.m vendor/clang/dist/test/Driver/cl-options.c vendor/clang/dist/test/Driver/split-debug.c vendor/clang/dist/test/Driver/unknown-std.c vendor/clang/dist/test/Driver/unknown-std.cl vendor/clang/dist/test/Driver/unknown-std.cpp vendor/clang/dist/test/Frontend/gnu-inline.c vendor/clang/dist/test/Frontend/rewrite-includes-line-markers.c vendor/clang/dist/test/Frontend/rewrite-includes-modules.c vendor/clang/dist/test/Index/Core/index-source.m vendor/clang/dist/test/Index/cursor-dynamic-call.mm vendor/clang/dist/test/Index/index-module.m vendor/clang/dist/test/Index/print-type.cpp vendor/clang/dist/test/Index/usrs.cpp vendor/clang/dist/test/Modules/ExtDebugInfo.cpp vendor/clang/dist/test/Modules/Inputs/module.map vendor/clang/dist/test/Modules/crash-vfs-path-emptydir-entries.m vendor/clang/dist/test/Modules/crash-vfs-path-symlink-component.m vendor/clang/dist/test/Modules/crash-vfs-path-symlink-topheader.m vendor/clang/dist/test/Modules/crash-vfs-path-traversal.m vendor/clang/dist/test/Modules/crash-vfs-relative-incdir.m vendor/clang/dist/test/Modules/crash-vfs-relative-overlay.m vendor/clang/dist/test/Modules/crash-vfs-run-reproducer.m vendor/clang/dist/test/Modules/odr_hash.cpp vendor/clang/dist/test/Modules/preprocess.cpp vendor/clang/dist/test/Modules/preprocess.m vendor/clang/dist/test/OpenMP/distribute_parallel_for_simd_aligned_messages.cpp vendor/clang/dist/test/OpenMP/distribute_simd_aligned_messages.cpp vendor/clang/dist/test/OpenMP/for_simd_aligned_messages.cpp vendor/clang/dist/test/OpenMP/parallel_for_simd_aligned_messages.cpp vendor/clang/dist/test/OpenMP/simd_aligned_messages.cpp vendor/clang/dist/test/OpenMP/target_parallel_for_simd_aligned_messages.cpp vendor/clang/dist/test/OpenMP/target_simd_aligned_messages.cpp vendor/clang/dist/test/OpenMP/target_teams_distribute_parallel_for_simd_aligned_messages.cpp vendor/clang/dist/test/OpenMP/target_teams_distribute_simd_aligned_messages.cpp vendor/clang/dist/test/OpenMP/taskloop_simd_aligned_messages.cpp vendor/clang/dist/test/OpenMP/teams_distribute_parallel_for_simd_aligned_messages.cpp vendor/clang/dist/test/OpenMP/teams_distribute_simd_aligned_messages.cpp vendor/clang/dist/test/Preprocessor/init.c vendor/clang/dist/test/Preprocessor/pp-modules.c vendor/clang/dist/test/Preprocessor/pragma_diagnostic.c vendor/clang/dist/test/Preprocessor/stdint.c vendor/clang/dist/test/Profile/c-outdated-data.c vendor/clang/dist/test/Sema/integer-overflow.c vendor/clang/dist/test/SemaCXX/typo-correction.cpp vendor/clang/dist/tools/c-index-test/c-index-test.c vendor/clang/dist/tools/libclang/CIndex.cpp vendor/clang/dist/tools/libclang/CXCursor.cpp vendor/clang/dist/tools/libclang/CXTranslationUnit.h vendor/clang/dist/tools/libclang/CXType.cpp vendor/clang/dist/tools/libclang/Indexing.cpp vendor/clang/dist/tools/libclang/libclang.exports vendor/clang/dist/unittests/Basic/SourceManagerTest.cpp vendor/clang/dist/unittests/Format/FormatTestJS.cpp vendor/clang/dist/unittests/Frontend/CodeGenActionTest.cpp vendor/clang/dist/unittests/Frontend/FrontendActionTest.cpp vendor/clang/dist/utils/TableGen/ClangAttrEmitter.cpp Modified: vendor/clang/dist/docs/SanitizerCoverage.rst ============================================================================== --- vendor/clang/dist/docs/SanitizerCoverage.rst Tue May 2 18:30:20 2017 (r317684) +++ vendor/clang/dist/docs/SanitizerCoverage.rst Tue May 2 18:30:45 2017 (r317685) @@ -8,202 +8,12 @@ SanitizerCoverage Introduction ============ -Sanitizer tools have a very simple code coverage tool built in. It allows to -get function-level, basic-block-level, and edge-level coverage at a very low -cost. - -How to build and run -==================== - -SanitizerCoverage can be used with :doc:`AddressSanitizer`, -:doc:`LeakSanitizer`, :doc:`MemorySanitizer`, -UndefinedBehaviorSanitizer, or without any sanitizer. Pass one of the -following compile-time flags: - -* ``-fsanitize-coverage=func`` for function-level coverage (very fast). -* ``-fsanitize-coverage=bb`` for basic-block-level coverage (may add up to 30% - **extra** slowdown). -* ``-fsanitize-coverage=edge`` for edge-level coverage (up to 40% slowdown). - -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``. - -Example: - -.. code-block:: console - - % cat -n cov.cc - 1 #include - 2 __attribute__((noinline)) - 3 void foo() { printf("foo\n"); } - 4 - 5 int main(int argc, char **argv) { - 6 if (argc == 2) - 7 foo(); - 8 printf("main\n"); - 9 } - % clang++ -g cov.cc -fsanitize=address -fsanitize-coverage=func - % ASAN_OPTIONS=coverage=1 ./a.out; ls -l *sancov - main - -rw-r----- 1 kcc eng 4 Nov 27 12:21 a.out.22673.sancov - % ASAN_OPTIONS=coverage=1 ./a.out foo ; ls -l *sancov - foo - main - -rw-r----- 1 kcc eng 4 Nov 27 12:21 a.out.22673.sancov - -rw-r----- 1 kcc eng 8 Nov 27 12:21 a.out.22679.sancov - -Every time you run an executable instrumented with SanitizerCoverage -one ``*.sancov`` file is created during the process shutdown. -If the executable is dynamically linked against instrumented DSOs, -one ``*.sancov`` file will be also created for every DSO. - -Postprocessing -============== - -The format of ``*.sancov`` files is very simple: the first 8 bytes is the magic, -one of ``0xC0BFFFFFFFFFFF64`` and ``0xC0BFFFFFFFFFFF32``. The last byte of the -magic defines the size of the following offsets. The rest of the data is the -offsets in the corresponding binary/DSO that were executed during the run. - -A simple script -``$LLVM/projects/compiler-rt/lib/sanitizer_common/scripts/sancov.py`` is -provided to dump these offsets. - -.. code-block:: console - - % sancov.py print a.out.22679.sancov a.out.22673.sancov - sancov.py: read 2 PCs from a.out.22679.sancov - sancov.py: read 1 PCs from a.out.22673.sancov - sancov.py: 2 files merged; 2 PCs total - 0x465250 - 0x4652a0 - -You can then filter the output of ``sancov.py`` through ``addr2line --exe -ObjectFile`` or ``llvm-symbolizer --obj ObjectFile`` to get file names and line -numbers: - -.. code-block:: console - - % sancov.py print a.out.22679.sancov a.out.22673.sancov 2> /dev/null | llvm-symbolizer --obj a.out - cov.cc:3 - cov.cc:5 - -Sancov Tool -=========== - -A new experimental ``sancov`` tool is developed to process coverage files. -The tool is part of LLVM project and is currently supported only on Linux. -It can handle symbolization tasks autonomously without any extra support -from the environment. You need to pass .sancov files (named -``..sancov`` and paths to all corresponding binary elf files. -Sancov matches these files using module names and binaries file names. - -.. code-block:: console - - USAGE: sancov [options] (|<.sancov file>)... - - Action (required) - -print - Print coverage addresses - -covered-functions - Print all covered functions. - -not-covered-functions - Print all not covered functions. - -symbolize - Symbolizes the report. - - Options - -blacklist= - Blacklist file (sanitizer blacklist format). - -demangle - Print demangled function name. - -strip_path_prefix= - Strip this prefix from file paths in reports - - -Coverage Reports (Experimental) -================================ - -``.sancov`` files do not contain enough information to generate a source-level -coverage report. The missing information is contained -in debug info of the binary. Thus the ``.sancov`` has to be symbolized -to produce a ``.symcov`` file first: - -.. code-block:: console - - sancov -symbolize my_program.123.sancov my_program > my_program.123.symcov - -The ``.symcov`` file can be browsed overlayed over the source code by -running ``tools/sancov/coverage-report-server.py`` script that will start -an HTTP server. - - -How good is the coverage? -========================= - -It is possible to find out which PCs are not covered, by subtracting the covered -set from the set of all instrumented PCs. The latter can be obtained by listing -all callsites of ``__sanitizer_cov()`` in the binary. On Linux, ``sancov.py`` -can do this for you. Just supply the path to binary and a list of covered PCs: - -.. code-block:: console - - % sancov.py print a.out.12345.sancov > covered.txt - sancov.py: read 2 64-bit PCs from a.out.12345.sancov - sancov.py: 1 file merged; 2 PCs total - % sancov.py missing a.out < covered.txt - sancov.py: found 3 instrumented PCs in a.out - sancov.py: read 2 PCs from stdin - sancov.py: 1 PCs missing from coverage - 0x4cc61c - -Edge coverage -============= - -Consider this code: - -.. code-block:: c++ - - void foo(int *a) { - if (a) - *a = 0; - } - -It contains 3 basic blocks, let's name them A, B, C: - -.. code-block:: none - - A - |\ - | \ - | B - | / - |/ - C - -If blocks A, B, and C are all covered we know for certain that the edges A=>B -and B=>C were executed, but we still don't know if the edge A=>C was executed. -Such edges of control flow graph are called -`critical `_. The -edge-level coverage (``-fsanitize-coverage=edge``) simply splits all critical -edges by introducing new dummy blocks and then instruments those blocks: - -.. code-block:: none - - A - |\ - | \ - D B - | / - |/ - C - -Tracing PCs -=========== - -*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. -With an additional ``...=trace-pc,indirect-calls`` flag -``__sanitizer_cov_trace_pc_indirect(void *callee)`` will be inserted on every indirect call. -These callbacks are not implemented in the Sanitizer run-time and should be defined -by the user. So, these flags do not require the other sanitizer to be used. -This mechanism is used for fuzzing the Linux kernel (https://github.com/google/syzkaller) -and can be used with `AFL `__. +LLVM has a simple code coverage instrumentation built in (SanitizerCoverage). +It inserts calls to user-defined functions on function-, basic-block-, and edge- levels. +Default implementations of those callbacks are provided and implement +simple coverage reporting and visualization, +however if you need *just* coverage visualization you may want to use +:doc:`SourceBasedCodeCoverage ` instead. Tracing PCs with guards ======================= @@ -217,7 +27,7 @@ on every edge: Every edge will have its own `guard_variable` (uint32_t). -The compler will also insert a module constructor that will call +The compler will also insert calls to a module constructor: .. code-block:: c++ @@ -226,7 +36,7 @@ The compler will also insert a module co // more than once with the same values of start/stop. __sanitizer_cov_trace_pc_guard_init(uint32_t *start, uint32_t *stop); -With `trace-pc-guards,indirect-calls` +With an additional ``...=trace-pc,indirect-calls`` flag ``__sanitizer_cov_trace_pc_indirect(void *callee)`` will be inserted on every indirect call. The functions `__sanitizer_cov_trace_pc_*` should be defined by the user. @@ -309,6 +119,75 @@ Example: guard: 0x71bcdc 4 PC 0x4ecdc7 in main trace-pc-guard-example.cc:4:17 guard: 0x71bcd0 1 PC 0x4ecd20 in foo() trace-pc-guard-example.cc:2:14 +Tracing PCs +=========== + +With ``-fsanitize-coverage=trace-pc`` the compiler will insert +``__sanitizer_cov_trace_pc()`` on every edge. +With an additional ``...=trace-pc,indirect-calls`` flag +``__sanitizer_cov_trace_pc_indirect(void *callee)`` will be inserted on every indirect call. +These callbacks are not implemented in the Sanitizer run-time and should be defined +by the user. +This mechanism is used for fuzzing the Linux kernel +(https://github.com/google/syzkaller). + + +Instrumentation points +====================== +Sanitizer Coverage offers different levels of instrumentation. + +* ``edge`` (default): edges are instrumented (see below). +* ``bb``: basic blocks are instrumented. +* ``func``: only the entry block of every function will be instrumented. + +Use these flags together with ``trace-pc-guard`` or ``trace-pc``, +like this: ``-fsanitize-coverage=func,trace-pc-guard``. + +When ``edge`` or ``bb`` is used, some of the edges/blocks may still be left +uninstrumented if such instrumentation is considered redundant. +**TODO**: add a user-visible option to disable the optimization. + + +Edge coverage +------------- + +Consider this code: + +.. code-block:: c++ + + void foo(int *a) { + if (a) + *a = 0; + } + +It contains 3 basic blocks, let's name them A, B, C: + +.. code-block:: none + + A + |\ + | \ + | B + | / + |/ + C + +If blocks A, B, and C are all covered we know for certain that the edges A=>B +and B=>C were executed, but we still don't know if the edge A=>C was executed. +Such edges of control flow graph are called +`critical `_. The +edge-level coverage simply splits all critical +edges by introducing new dummy blocks and then instruments those blocks: + +.. code-block:: none + + A + |\ + | \ + D B + | / + |/ + C Tracing data flow ================= @@ -349,50 +228,107 @@ the `LLVM GEP instructions + 2 __attribute__((noinline)) + 3 void foo() { printf("foo\n"); } + 4 + 5 int main(int argc, char **argv) { + 6 if (argc == 2) + 7 foo(); + 8 printf("main\n"); + 9 } + % clang++ -g cov.cc -fsanitize=address -fsanitize-coverage=trace-pc-guard + % ASAN_OPTIONS=coverage=1 ./a.out; wc -c *.sancov + main + SanitizerCoverage: ./a.out.7312.sancov 2 PCs written + 24 a.out.7312.sancov + % ASAN_OPTIONS=coverage=1 ./a.out foo ; wc -c *.sancov + foo + main + SanitizerCoverage: ./a.out.7316.sancov 3 PCs written + 24 a.out.7312.sancov + 32 a.out.7316.sancov -Sudden death -============ +Every time you run an executable instrumented with SanitizerCoverage +one ``*.sancov`` file is created during the process shutdown. +If the executable is dynamically linked against instrumented DSOs, +one ``*.sancov`` file will be also created for every DSO. -Normally, coverage data is collected in memory and saved to disk when the -program exits (with an ``atexit()`` handler), when a SIGSEGV is caught, or when -``__sanitizer_cov_dump()`` is called. - -If the program ends with a signal that ASan does not handle (or can not handle -at all, like SIGKILL), coverage data will be lost. This is a big problem on -Android, where SIGKILL is a normal way of evicting applications from memory. +Sancov data format +------------------ -With ``ASAN_OPTIONS=coverage=1:coverage_direct=1`` coverage data is written to a -memory-mapped file as soon as it collected. +The format of ``*.sancov`` files is very simple: the first 8 bytes is the magic, +one of ``0xC0BFFFFFFFFFFF64`` and ``0xC0BFFFFFFFFFFF32``. The last byte of the +magic defines the size of the following offsets. The rest of the data is the +offsets in the corresponding binary/DSO that were executed during the run. + +Sancov Tool +----------- + +An simple ``sancov`` tool is provided to process coverage files. +The tool is part of LLVM project and is currently supported only on Linux. +It can handle symbolization tasks autonomously without any extra support +from the environment. You need to pass .sancov files (named +``..sancov`` and paths to all corresponding binary elf files. +Sancov matches these files using module names and binaries file names. .. code-block:: console - % ASAN_OPTIONS="coverage=1:coverage_direct=1" ./a.out - main - % ls - 7036.sancov.map 7036.sancov.raw a.out - % sancov.py rawunpack 7036.sancov.raw - sancov.py: reading map 7036.sancov.map - sancov.py: unpacking 7036.sancov.raw - writing 1 PCs to a.out.7036.sancov - % sancov.py print a.out.7036.sancov - sancov.py: read 1 PCs from a.out.7036.sancov - sancov.py: 1 files merged; 1 PCs total - 0x4b2bae + USAGE: sancov [options] (|<.sancov file>)... -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. + Action (required) + -print - Print coverage addresses + -covered-functions - Print all covered functions. + -not-covered-functions - Print all not covered functions. + -symbolize - Symbolizes the report. + + Options + -blacklist= - Blacklist file (sanitizer blacklist format). + -demangle - Print demangled function name. + -strip_path_prefix= - Strip this prefix from file paths in reports + + +Coverage Reports +---------------- + +**Experimental** + +``.sancov`` files do not contain enough information to generate a source-level +coverage report. The missing information is contained +in debug info of the binary. Thus the ``.sancov`` has to be symbolized +to produce a ``.symcov`` file first: + +.. code-block:: console + + sancov -symbolize my_program.123.sancov my_program > my_program.123.symcov + +The ``.symcov`` file can be browsed overlayed over the source code by +running ``tools/sancov/coverage-report-server.py`` script that will start +an HTTP server. + +Output directory +---------------- + +By default, .sancov files are created in the current working directory. +This can be changed with ``ASAN_OPTIONS=coverage_dir=/path``: + +.. code-block:: console + % ASAN_OPTIONS="coverage=1:coverage_dir=/tmp/cov" ./a.out foo + % ls -l /tmp/cov/*sancov + -rw-r----- 1 kcc eng 4 Nov 27 12:21 a.out.22673.sancov + -rw-r----- 1 kcc eng 8 Nov 27 12:21 a.out.22679.sancov Modified: vendor/clang/dist/include/clang-c/Index.h ============================================================================== --- vendor/clang/dist/include/clang-c/Index.h Tue May 2 18:30:20 2017 (r317684) +++ vendor/clang/dist/include/clang-c/Index.h Tue May 2 18:30:45 2017 (r317685) @@ -32,7 +32,7 @@ * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. */ #define CINDEX_VERSION_MAJOR 0 -#define CINDEX_VERSION_MINOR 37 +#define CINDEX_VERSION_MINOR 38 #define CINDEX_VERSION_ENCODE(major, minor) ( \ ((major) * 10000) \ @@ -81,6 +81,12 @@ extern "C" { typedef void *CXIndex; /** + * \brief An opaque type representing target information for a given translation + * unit. + */ +typedef struct CXTargetInfoImpl *CXTargetInfo; + +/** * \brief A single translation unit, which resides in an index. */ typedef struct CXTranslationUnitImpl *CXTranslationUnit; @@ -1553,6 +1559,36 @@ CINDEX_LINKAGE CXTUResourceUsage clang_g CINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage); /** + * \brief Get target information for this translation unit. + * + * The CXTargetInfo object cannot outlive the CXTranslationUnit object. + */ +CINDEX_LINKAGE CXTargetInfo +clang_getTranslationUnitTargetInfo(CXTranslationUnit CTUnit); + +/** + * \brief Destroy the CXTargetInfo object. + */ +CINDEX_LINKAGE void +clang_TargetInfo_dispose(CXTargetInfo Info); + +/** + * \brief Get the normalized target triple as a string. + * + * Returns the empty string in case of any error. + */ +CINDEX_LINKAGE CXString +clang_TargetInfo_getTriple(CXTargetInfo Info); + +/** + * \brief Get the pointer width of the target in bits. + * + * Returns -1 in case of error. + */ +CINDEX_LINKAGE int +clang_TargetInfo_getPointerWidth(CXTargetInfo Info); + +/** * @} */ @@ -3975,8 +4011,8 @@ CINDEX_LINKAGE int clang_Cursor_getObjCS CINDEX_LINKAGE int clang_Cursor_isDynamicCall(CXCursor C); /** - * \brief Given a cursor pointing to an Objective-C message, returns the CXType - * of the receiver. + * \brief Given a cursor pointing to an Objective-C message or property + * reference, or C++ method call, returns the CXType of the receiver. */ CINDEX_LINKAGE CXType clang_Cursor_getReceiverType(CXCursor C); Added: vendor/clang/dist/include/clang/AST/ASTStructuralEquivalence.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist/include/clang/AST/ASTStructuralEquivalence.h Tue May 2 18:30:45 2017 (r317685) @@ -0,0 +1,101 @@ +//===--- ASTStructuralEquivalence.h - ---------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the StructuralEquivalenceContext class which checks for +// structural equivalence between types. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_AST_ASTSTRUCTURALEQUIVALENCE_H +#define LLVM_CLANG_AST_ASTSTRUCTURALEQUIVALENCE_H + +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/DenseSet.h" +#include "llvm/ADT/Optional.h" +#include + +namespace clang { + +class ASTContext; +class Decl; +class DiagnosticBuilder; +class QualType; +class RecordDecl; +class SourceLocation; + +struct StructuralEquivalenceContext { + /// AST contexts for which we are checking structural equivalence. + ASTContext &FromCtx, &ToCtx; + + /// The set of "tentative" equivalences between two canonical + /// declarations, mapping from a declaration in the first context to the + /// declaration in the second context that we believe to be equivalent. + llvm::DenseMap TentativeEquivalences; + + /// Queue of declarations in the first context whose equivalence + /// with a declaration in the second context still needs to be verified. + std::deque DeclsToCheck; + + /// Declaration (from, to) pairs that are known not to be equivalent + /// (which we have already complained about). + llvm::DenseSet> &NonEquivalentDecls; + + /// Whether we're being strict about the spelling of types when + /// unifying two types. + bool StrictTypeSpelling; + + /// Whether warn or error on tag type mismatches. + bool ErrorOnTagTypeMismatch; + + /// Whether to complain about failures. + bool Complain; + + /// \c true if the last diagnostic came from ToCtx. + bool LastDiagFromC2; + + StructuralEquivalenceContext( + ASTContext &FromCtx, ASTContext &ToCtx, + llvm::DenseSet> &NonEquivalentDecls, + bool StrictTypeSpelling = false, bool Complain = true) + : FromCtx(FromCtx), ToCtx(ToCtx), NonEquivalentDecls(NonEquivalentDecls), + StrictTypeSpelling(StrictTypeSpelling), Complain(Complain), + LastDiagFromC2(false) {} + + DiagnosticBuilder Diag1(SourceLocation Loc, unsigned DiagID); + DiagnosticBuilder Diag2(SourceLocation Loc, unsigned DiagID); + + /// Determine whether the two declarations are structurally + /// equivalent. + bool IsStructurallyEquivalent(Decl *D1, Decl *D2); + + /// Determine whether the two types are structurally equivalent. + bool IsStructurallyEquivalent(QualType T1, QualType T2); + + /// Find the index of the given anonymous struct/union within its + /// context. + /// + /// \returns Returns the index of this anonymous struct/union in its context, + /// including the next assigned index (if none of them match). Returns an + /// empty option if the context is not a record, i.e.. if the anonymous + /// struct/union is at namespace or block scope. + /// + /// FIXME: This is needed by ASTImporter and ASTStructureEquivalence. It + /// probably makes more sense in some other common place then here. + static llvm::Optional + findUntaggedStructOrUnionIndex(RecordDecl *Anon); + +private: + /// Finish checking all of the structural equivalences. + /// + /// \returns true if an error occurred, false otherwise. + bool Finish(); +}; +} // namespace clang + +#endif // LLVM_CLANG_AST_ASTSTRUCTURALEQUIVALENCE_H Modified: vendor/clang/dist/include/clang/AST/DeclBase.h ============================================================================== --- vendor/clang/dist/include/clang/AST/DeclBase.h Tue May 2 18:30:20 2017 (r317684) +++ vendor/clang/dist/include/clang/AST/DeclBase.h Tue May 2 18:30:45 2017 (r317685) @@ -616,6 +616,14 @@ public: getAvailability(std::string *Message = nullptr, VersionTuple EnclosingVersion = VersionTuple()) const; + /// \brief Retrieve the version of the target platform in which this + /// declaration was introduced. + /// + /// \returns An empty version tuple if this declaration has no 'introduced' + /// availability attributes, or the version tuple that's specified in the + /// attribute otherwise. + VersionTuple getVersionIntroduced() const; + /// \brief Determine whether this declaration is marked 'deprecated'. /// /// \param Message If non-NULL and the declaration is deprecated, Modified: vendor/clang/dist/include/clang/AST/Type.h ============================================================================== --- vendor/clang/dist/include/clang/AST/Type.h Tue May 2 18:30:20 2017 (r317684) +++ vendor/clang/dist/include/clang/AST/Type.h Tue May 2 18:30:45 2017 (r317685) @@ -1396,7 +1396,7 @@ protected: /// Extra information which affects how the function is called, like /// regparm and the calling convention. - unsigned ExtInfo : 10; + unsigned ExtInfo : 11; /// Used only by FunctionProtoType, put here to pack with the /// other bitfields. @@ -2941,19 +2941,23 @@ class FunctionType : public Type { // * AST read and write // * Codegen class ExtInfo { - // Feel free to rearrange or add bits, but if you go over 10, + // Feel free to rearrange or add bits, but if you go over 11, // you'll need to adjust both the Bits field below and // Type::FunctionTypeBitfields. - // | CC |noreturn|produces|regparm| - // |0 .. 4| 5 | 6 | 7 .. 9| + // | CC |noreturn|produces|nocallersavedregs|regparm| + // |0 .. 4| 5 | 6 | 7 |8 .. 10| // // regparm is either 0 (no regparm attribute) or the regparm value+1. enum { CallConvMask = 0x1F }; enum { NoReturnMask = 0x20 }; enum { ProducesResultMask = 0x40 }; - enum { RegParmMask = ~(CallConvMask | NoReturnMask | ProducesResultMask), - RegParmOffset = 7 }; // Assumed to be the last field + enum { NoCallerSavedRegsMask = 0x80 }; + enum { + RegParmMask = ~(CallConvMask | NoReturnMask | ProducesResultMask | + NoCallerSavedRegsMask), + RegParmOffset = 8 + }; // Assumed to be the last field uint16_t Bits; @@ -2964,13 +2968,13 @@ class FunctionType : public Type { public: // Constructor with no defaults. Use this when you know that you // have all the elements (when reading an AST file for example). - ExtInfo(bool noReturn, bool hasRegParm, unsigned regParm, CallingConv cc, - bool producesResult) { - assert((!hasRegParm || regParm < 7) && "Invalid regparm value"); - Bits = ((unsigned) cc) | - (noReturn ? NoReturnMask : 0) | - (producesResult ? ProducesResultMask : 0) | - (hasRegParm ? ((regParm + 1) << RegParmOffset) : 0); + ExtInfo(bool noReturn, bool hasRegParm, unsigned regParm, CallingConv cc, + bool producesResult, bool noCallerSavedRegs) { + assert((!hasRegParm || regParm < 7) && "Invalid regparm value"); + Bits = ((unsigned)cc) | (noReturn ? NoReturnMask : 0) | + (producesResult ? ProducesResultMask : 0) | + (noCallerSavedRegs ? NoCallerSavedRegsMask : 0) | + (hasRegParm ? ((regParm + 1) << RegParmOffset) : 0); } // Constructor with all defaults. Use when for example creating a @@ -2983,6 +2987,7 @@ class FunctionType : public Type { bool getNoReturn() const { return Bits & NoReturnMask; } bool getProducesResult() const { return Bits & ProducesResultMask; } + bool getNoCallerSavedRegs() const { return Bits & NoCallerSavedRegsMask; } bool getHasRegParm() const { return (Bits >> RegParmOffset) != 0; } unsigned getRegParm() const { unsigned RegParm = Bits >> RegParmOffset; @@ -3016,6 +3021,13 @@ class FunctionType : public Type { return ExtInfo(Bits & ~ProducesResultMask); } + ExtInfo withNoCallerSavedRegs(bool noCallerSavedRegs) const { + if (noCallerSavedRegs) + return ExtInfo(Bits | NoCallerSavedRegsMask); + else + return ExtInfo(Bits & ~NoCallerSavedRegsMask); + } + ExtInfo withRegParm(unsigned RegParm) const { assert(RegParm < 7 && "Invalid regparm value"); return ExtInfo((Bits & ~RegParmMask) | Modified: vendor/clang/dist/include/clang/Basic/Attr.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/Attr.td Tue May 2 18:30:20 2017 (r317684) +++ vendor/clang/dist/include/clang/Basic/Attr.td Tue May 2 18:30:45 2017 (r317685) @@ -1931,6 +1931,12 @@ def AnyX86Interrupt : InheritableAttr, T let Documentation = [AnyX86InterruptDocs]; } +def AnyX86NoCallerSavedRegisters : InheritableAttr, + TargetSpecificAttr { + let Spellings = [GCC<"no_caller_saved_registers">]; + let Documentation = [AnyX86NoCallerSavedRegistersDocs]; +} + def X86ForceAlignArgPointer : InheritableAttr, TargetSpecificAttr { let Spellings = [GNU<"force_align_arg_pointer">]; // Technically, this appertains to a FunctionDecl, but the target-specific Modified: vendor/clang/dist/include/clang/Basic/AttrDocs.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/AttrDocs.td Tue May 2 18:30:20 2017 (r317684) +++ vendor/clang/dist/include/clang/Basic/AttrDocs.td Tue May 2 18:30:45 2017 (r317685) @@ -2657,6 +2657,40 @@ hardware design, touch the red zone. }]; } +def AnyX86NoCallerSavedRegistersDocs : Documentation { + let Category = DocCatFunction; + let Content = [{ +Use this attribute to indicate that the specified function has no +caller-saved registers. That is, all registers are callee-saved except for +registers used for passing parameters to the function or returning parameters +from the function. +The compiler saves and restores any modified registers that were not used for +passing or returning arguments to the function. + +The user can call functions specified with the 'no_caller_saved_registers' +attribute from an interrupt handler without saving and restoring all +call-clobbered registers. + +Note that 'no_caller_saved_registers' attribute is not a calling convention. +In fact, it only overrides the decision of which registers should be saved by +the caller, but not how the parameters are passed from the caller to the callee. + +For example: + + .. code-block:: c + + __attribute__ ((no_caller_saved_registers, fastcall)) + void f (int arg1, int arg2) { + ... + } + + In this case parameters 'arg1' and 'arg2' will be passed in registers. + In this case, on 32-bit x86 targets, the function 'f' will use ECX and EDX as + register parameters. However, it will not assume any scratch registers and + should save and restore any modified registers except for ECX and EDX. + }]; +} + def SwiftCallDocs : Documentation { let Category = DocCatVariable; let Content = [{ Modified: vendor/clang/dist/include/clang/Basic/DiagnosticASTKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticASTKinds.td Tue May 2 18:30:20 2017 (r317684) +++ vendor/clang/dist/include/clang/Basic/DiagnosticASTKinds.td Tue May 2 18:30:45 2017 (r317685) @@ -154,12 +154,14 @@ def note_constexpr_baa_insufficient_alig def note_constexpr_baa_value_insufficient_alignment : Note< "value of the aligned pointer (%0) is not a multiple of the asserted %1 " "%plural{1:byte|:bytes}1">; +def note_constexpr_array_unknown_bound_arithmetic : Note< + "cannot perform pointer arithmetic on pointer to array without constant bound">; def warn_integer_constant_overflow : Warning< "overflow in expression; result is %0 with type %1">, InGroup>; -// This is a temporary diagnostic, and shall be removed once our +// This is a temporary diagnostic, and shall be removed once our // implementation is complete, and like the preceding constexpr notes belongs // in Sema. def note_unimplemented_constexpr_lambda_feature_ast : Note< Modified: vendor/clang/dist/include/clang/Basic/DiagnosticDriverKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticDriverKinds.td Tue May 2 18:30:20 2017 (r317684) +++ vendor/clang/dist/include/clang/Basic/DiagnosticDriverKinds.td Tue May 2 18:30:45 2017 (r317685) @@ -233,7 +233,9 @@ def note_drv_t_option_is_global : Note< "The last /TC or /TP option takes precedence over earlier instances">; def note_drv_address_sanitizer_debug_runtime : Note< "AddressSanitizer doesn't support linking with debug runtime libraries yet">; -def note_drv_use_standard : Note<"use '%0' for '%1' standard">; +def note_drv_use_standard : Note<"use '%0'" + "%select{| or '%3'|, '%3', or '%4'|, '%3', '%4', or '%5'}2 " + "for '%1' standard">; def err_analyzer_config_no_value : Error< "analyzer-config option '%0' has a key but no value">; Modified: vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td Tue May 2 18:30:20 2017 (r317684) +++ vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td Tue May 2 18:30:45 2017 (r317685) @@ -890,6 +890,7 @@ def BackendOptimizationRemarkAnalysis : def BackendOptimizationFailure : DiagGroup<"pass-failed">; // Instrumentation based profiling warnings. +def ProfileInstrMissing : DiagGroup<"profile-instr-missing">; def ProfileInstrOutOfDate : DiagGroup<"profile-instr-out-of-date">; def ProfileInstrUnprofiled : DiagGroup<"profile-instr-unprofiled">; Modified: vendor/clang/dist/include/clang/Basic/DiagnosticLexKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticLexKinds.td Tue May 2 18:30:20 2017 (r317684) +++ vendor/clang/dist/include/clang/Basic/DiagnosticLexKinds.td Tue May 2 18:30:45 2017 (r317685) @@ -475,6 +475,8 @@ def warn_pragma_pop_macro_no_push : Warn def warn_pragma_message : Warning<"%0">, InGroup, DefaultWarnNoWerror; def err_pragma_message : Error<"%0">; +def err_pragma_module_import_expected_module_name : Error< + "expected %select{identifier in|'.' or end of directive after}0 module name">; def warn_pragma_ignored : Warning<"unknown pragma ignored">, InGroup, DefaultIgnore; def ext_stdc_pragma_ignored : ExtWarn<"unknown pragma in STDC namespace">, @@ -503,7 +505,7 @@ def warn_pragma_diagnostic_invalid_token InGroup; def warn_pragma_diagnostic_unknown_warning : ExtWarn<"unknown warning group '%0', ignored">, - InGroup; + InGroup; // - #pragma __debug def warn_pragma_debug_unexpected_command : Warning< "unexpected debug command '%0'">, InGroup; Modified: vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Tue May 2 18:30:20 2017 (r317684) +++ vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Tue May 2 18:30:45 2017 (r317685) @@ -1180,6 +1180,10 @@ def err_objc_kindof_nonobject : Error< def err_objc_kindof_wrong_position : Error< "'__kindof' type specifier must precede the declarator">; +def err_objc_method_unsupported_param_ret_type : Error< + "%0 %select{parameter|return}1 type is unsupported; " + "support for vector types for this target is introduced in %2">; + // C++ declarations def err_static_assert_expression_is_not_constant : Error< "static_assert expression is not an integral constant expression">; @@ -2819,6 +2823,9 @@ def err_regparm_mismatch : Error<"functi def err_returns_retained_mismatch : Error< "function declared with the ns_returns_retained attribute " "was previously declared without the ns_returns_retained attribute">; +def err_function_attribute_mismatch : Error< + "function declared with %0 attribute " + "was previously declared without the %0 attribute">; def err_objc_precise_lifetime_bad_type : Error< "objc_precise_lifetime only applies to retainable types; type here is %0">; def warn_objc_precise_lifetime_meaningless : Error< @@ -8931,8 +8938,13 @@ def warn_not_a_doxygen_trailing_member_c let CategoryName = "Instrumentation Issue" in { def warn_profile_data_out_of_date : Warning< "profile data may be out of date: of %0 function%s0, %1 %plural{1:has|:have}1" - " no data and %2 %plural{1:has|:have}2 mismatched data that will be ignored">, + " mismatched data that will be ignored">, InGroup; +def warn_profile_data_missing : Warning< + "profile data may be incomplete: of %0 function%s0, %1 %plural{1:has|:have}1" + " no data">, + InGroup, + DefaultIgnore; def warn_profile_data_unprofiled : Warning< "no profile data available for file \"%0\"">, InGroup; Modified: vendor/clang/dist/include/clang/Basic/LangOptions.def ============================================================================== --- vendor/clang/dist/include/clang/Basic/LangOptions.def Tue May 2 18:30:20 2017 (r317684) +++ vendor/clang/dist/include/clang/Basic/LangOptions.def Tue May 2 18:30:45 2017 (r317685) @@ -266,7 +266,8 @@ LANGOPT(SanitizeAddressFieldPadding, 2, LANGOPT(XRayInstrument, 1, 0, "controls whether to do XRay instrumentation") -LANGOPT(AllowEditorPlaceholders, 1, 0, "allow editor placeholders in source") +BENIGN_LANGOPT(AllowEditorPlaceholders, 1, 0, + "allow editor placeholders in source") #undef LANGOPT #undef COMPATIBLE_LANGOPT Modified: vendor/clang/dist/include/clang/CodeGen/CGFunctionInfo.h ============================================================================== --- vendor/clang/dist/include/clang/CodeGen/CGFunctionInfo.h Tue May 2 18:30:20 2017 (r317684) +++ vendor/clang/dist/include/clang/CodeGen/CGFunctionInfo.h Tue May 2 18:30:45 2017 (r317685) @@ -461,7 +461,7 @@ class CGFunctionInfo final unsigned EffectiveCallingConvention : 8; /// The clang::CallingConv that this was originally created with. - unsigned ASTCallingConvention : 8; + unsigned ASTCallingConvention : 7; /// Whether this is an instance method. unsigned InstanceMethod : 1; @@ -475,6 +475,9 @@ class CGFunctionInfo final /// Whether this function is returns-retained. unsigned ReturnsRetained : 1; + /// Whether this function saved caller registers. + unsigned NoCallerSavedRegs : 1; + /// How many arguments to pass inreg. unsigned HasRegParm : 1; unsigned RegParm : 3; @@ -560,6 +563,9 @@ public: /// is not always reliable for call sites. bool isReturnsRetained() const { return ReturnsRetained; } + /// Whether this function no longer saves caller registers. + bool isNoCallerSavedRegs() const { return NoCallerSavedRegs; } + /// getASTCallingConvention() - Return the AST-specified calling /// convention. CallingConv getASTCallingConvention() const { @@ -583,10 +589,9 @@ public: unsigned getRegParm() const { return RegParm; } FunctionType::ExtInfo getExtInfo() const { - return FunctionType::ExtInfo(isNoReturn(), - getHasRegParm(), getRegParm(), - getASTCallingConvention(), - isReturnsRetained()); + return FunctionType::ExtInfo(isNoReturn(), getHasRegParm(), getRegParm(), + getASTCallingConvention(), isReturnsRetained(), + isNoCallerSavedRegs()); } CanQualType getReturnType() const { return getArgsBuffer()[0].type; } @@ -623,6 +628,7 @@ public: ID.AddBoolean(ChainCall); ID.AddBoolean(NoReturn); ID.AddBoolean(ReturnsRetained); + ID.AddBoolean(NoCallerSavedRegs); ID.AddBoolean(HasRegParm); ID.AddInteger(RegParm); ID.AddInteger(Required.getOpaqueData()); @@ -648,6 +654,7 @@ public: ID.AddBoolean(ChainCall); ID.AddBoolean(info.getNoReturn()); ID.AddBoolean(info.getProducesResult()); + ID.AddBoolean(info.getNoCallerSavedRegs()); ID.AddBoolean(info.getHasRegParm()); ID.AddInteger(info.getRegParm()); ID.AddInteger(required.getOpaqueData()); Modified: vendor/clang/dist/include/clang/Driver/CLCompatOptions.td ============================================================================== --- vendor/clang/dist/include/clang/Driver/CLCompatOptions.td Tue May 2 18:30:20 2017 (r317684) +++ vendor/clang/dist/include/clang/Driver/CLCompatOptions.td Tue May 2 18:30:45 2017 (r317685) @@ -61,6 +61,8 @@ def _SLASH_Brepro_ : CLFlag<"Brepro-">, def _SLASH_C : CLFlag<"C">, HelpText<"Don't discard comments when preprocessing">, Alias; def _SLASH_c : CLFlag<"c">, HelpText<"Compile only">, Alias; +def _SLASH_d1reportAllClassLayout : CLFlag<"d1reportAllClassLayout">, + HelpText<"Dump record layout information">, Alias; def _SLASH_D : CLJoinedOrSeparate<"D">, HelpText<"Define macro">, MetaVarName<"">, Alias; def _SLASH_E : CLFlag<"E">, HelpText<"Preprocess to stdout">, Alias; Modified: vendor/clang/dist/include/clang/Edit/EditedSource.h ============================================================================== --- vendor/clang/dist/include/clang/Edit/EditedSource.h Tue May 2 18:30:20 2017 (r317684) +++ vendor/clang/dist/include/clang/Edit/EditedSource.h Tue May 2 18:30:45 2017 (r317685) @@ -65,7 +65,7 @@ public: bool commit(const Commit &commit); - void applyRewrites(EditsReceiver &receiver); + void applyRewrites(EditsReceiver &receiver, bool adjustRemovals = true); void clearRewrites(); StringRef copyString(StringRef str) { return str.copy(StrAlloc); } Modified: vendor/clang/dist/include/clang/Frontend/FrontendActions.h ============================================================================== --- vendor/clang/dist/include/clang/Frontend/FrontendActions.h Tue May 2 18:30:20 2017 (r317684) +++ vendor/clang/dist/include/clang/Frontend/FrontendActions.h Tue May 2 18:30:45 2017 (r317685) @@ -99,8 +99,6 @@ class GenerateModuleAction : public ASTF CreateOutputFile(CompilerInstance &CI, StringRef InFile) = 0; protected: - bool BeginSourceFileAction(CompilerInstance &CI, StringRef Filename) override; - std::unique_ptr CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override; @@ -112,20 +110,11 @@ protected: }; class GenerateModuleFromModuleMapAction : public GenerateModuleAction { - clang::Module *Module = nullptr; - const FileEntry *ModuleMapForUniquing = nullptr; - bool IsSystem = false; - private: bool BeginSourceFileAction(CompilerInstance &CI, StringRef Filename) override; std::unique_ptr CreateOutputFile(CompilerInstance &CI, StringRef InFile) override; - *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***