Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/llvm/dist/clang Import Clang 3.8.1+ r280599.



details:   https://anonhg.NetBSD.org/src/rev/affb44038aff
branches:  trunk
changeset: 347582:affb44038aff
user:      joerg <joerg%NetBSD.org@localhost>
date:      Sat Sep 03 23:11:41 2016 +0000

description:
Import Clang 3.8.1+ r280599.

diffstat:

 external/bsd/llvm/dist/clang/docs/ReleaseNotes.rst         |  209 +++++++++---
 external/bsd/llvm/dist/clang/lib/Basic/Targets.cpp         |    6 +
 external/bsd/llvm/dist/clang/lib/CodeGen/CGExprAgg.cpp     |    7 +-
 external/bsd/llvm/dist/clang/lib/CodeGen/CGExprScalar.cpp  |    8 +-
 external/bsd/llvm/dist/clang/lib/CodeGen/TargetInfo.cpp    |   80 ++++-
 external/bsd/llvm/dist/clang/lib/Driver/Tools.cpp          |   21 +-
 external/bsd/llvm/dist/clang/test/CodeGen/builtins-sparc.c |   10 +
 external/bsd/llvm/dist/clang/test/CodeGen/le32-vaarg.c     |    8 +-
 external/bsd/llvm/dist/clang/test/CodeGen/sparc-vaarg.c    |   35 ++
 external/bsd/llvm/dist/clang/test/Driver/netbsd.c          |   36 ++
 10 files changed, 327 insertions(+), 93 deletions(-)

diffs (truncated from 680 to 300 lines):

diff -r 4803fea0a8c4 -r affb44038aff external/bsd/llvm/dist/clang/docs/ReleaseNotes.rst
--- a/external/bsd/llvm/dist/clang/docs/ReleaseNotes.rst        Sat Sep 03 23:01:57 2016 +0000
+++ b/external/bsd/llvm/dist/clang/docs/ReleaseNotes.rst        Sat Sep 03 23:11:41 2016 +0000
@@ -16,7 +16,7 @@
 describe the status of Clang in some detail, including major
 improvements from the previous release and new feature work. For the
 general LLVM release notes, see `the LLVM
-documentation <http://llvm.org/docs/ReleaseNotes.html>`_. All LLVM
+documentation <../../../docs/ReleaseNotes.html>`_. All LLVM
 releases may be downloaded from the `LLVM releases web
 site <http://llvm.org/releases/>`_.
 
@@ -33,11 +33,6 @@
 infrastructure are described first, followed by language-specific
 sections with improvements to Clang's support for those languages.
 
-Major New Features
-------------------
-
-- Feature1...
-
 Improvements to Clang's diagnostics
 -----------------------------------
 
@@ -49,8 +44,6 @@
   choose to enable only a subset of these warnings. ``-Wno-microsoft`` still
   disables all these warnings, and ``-Wmicrosoft`` still enables them all.
 
--  ...
-
 New Compiler Flags
 ------------------
 
@@ -71,16 +64,89 @@
 
 Specifying ``-g`` without a tuning option will use a target-dependent default.
 
+The new ``-fstrict-vtable-pointers`` flag enables better devirtualization
+support (experimental).
 
-New Pragmas in Clang
------------------------
+
+Alignment
+---------
+Clang has gotten better at passing down strict type alignment information to LLVM,
+and several targets have gotten better at taking advantage of that information.
+
+Dereferencing a pointer that is not adequately aligned for its type is undefined
+behavior.  It may crash on target architectures that strictly enforce alignment, but
+even on architectures that do not, frequent use of unaligned pointers may hurt
+the performance of the generated code.
+
+If you find yourself fixing a bug involving an inadequately aligned pointer, you
+have several options.
+
+The best option, when practical, is to increase the alignment of the memory.
+For example, this array is not guaranteed to be sufficiently aligned to store
+a pointer value:
+
+.. code-block:: c
+
+  char buffer[sizeof(const char*)];
+
+Writing a pointer directly into it violates C's alignment rules:
+
+.. code-block:: c
+
+  ((const char**) buffer)[0] = "Hello, world!\n";
+
+But you can use alignment attributes to increase the required alignment:
+
+.. code-block:: c
+
+  __attribute__((aligned(__alignof__(const char*))))
+  char buffer[sizeof(const char*)];
 
-Clang now supports the ...
+When that's not practical, you can instead reduce the alignment requirements
+of the pointer.  If the pointer is to a struct that represents that layout of a
+serialized structure, consider making that struct packed; this will remove any
+implicit internal padding that the compiler might add to the struct and
+reduce its alignment requirement to 1.
+
+.. code-block:: c
+
+  struct file_header {
+    uint16_t magic_number;
+    uint16_t format_version;
+    uint16_t num_entries;
+  } __attribute__((packed));
+
+You may also override the default alignment assumptions of a pointer by
+using a typedef with explicit alignment:
+
+.. code-block:: c
+
+  typedef const char *unaligned_char_ptr __attribute__((aligned(1)));
+  ((unaligned_char_ptr*) buffer)[0] = "Hello, world!\n";
 
-Windows Support
----------------
+The final option is to copy the memory into something that is properly
+aligned.  Be aware, however, that Clang will assume that pointers are
+properly aligned for their type when you pass them to a library function
+like memcpy.  For example, this code will assume that the source and
+destination pointers are both properly aligned for an int:
+
+.. code-block:: c
+
+  void copy_int_array(int *dest, const int *src, size_t num) {
+    memcpy(dest, src, num * sizeof(int));
+  }
 
-Clang's support for building native Windows programs ...
+You may explicitly disable this assumption by casting the argument to a
+less-aligned pointer type:
+
+.. code-block:: c
+
+  void copy_unaligned_int_array(int *dest, const int *src, size_t num) {
+    memcpy((char*) dest, (const char*) src, num * sizeof(int));
+  }
+
+Clang promises not to look through the explicit cast when inferring the
+alignment of this memcpy.
 
 
 C Language Changes in Clang
@@ -117,30 +183,6 @@
 resolution in C, which allows the above example to compile (albeit potentially
 with a warning about an implicit conversion from ``int*`` to ``char*``).
 
-
-...
-
-
-C11 Feature Support
-^^^^^^^^^^^^^^^^^^^
-
-...
-
-C++ Language Changes in Clang
------------------------------
-
-- ...
-
-C++11 Feature Support
-^^^^^^^^^^^^^^^^^^^^^
-
-...
-
-Objective-C Language Changes in Clang
--------------------------------------
-
-...
-
 OpenCL C Language Changes in Clang
 ----------------------------------
 
@@ -180,10 +222,10 @@
 - Improved diagnostics for function pointers.
 
 OpenMP Support in Clang
----------------------
+-----------------------
 
-OpenMP 3.1 is fully supported and is enabled by default with -fopenmp 
-which now uses the clang OpenMP library instead of the GCC OpenMP library.
+OpenMP 3.1 is fully supported and is enabled by default with ``-fopenmp`` 
+which now uses the Clang OpenMP library instead of the GCC OpenMP library.
 The runtime can be built in-tree.  
 
 In addition to OpenMP 3.1, several important elements of the OpenMP 4.0/4.5 
@@ -214,7 +256,7 @@
   pipelines, links device-side code with appropriate CUDA bitcode and produces
   single object file with host and GPU code.
 
-- Implemented target attribute-based function overloading which allows clang to
+- Implemented target attribute-based function overloading which allows Clang to
   compile CUDA sources without splitting them into separate host/device TUs.
 
 Internal API Changes
@@ -271,17 +313,11 @@
 matches AST nodes of type RecordDecl. If a CXXRecordDecl is required, use the
 cxxRecordDecl() matcher instead.
 
-...
-
-libclang
---------
-
-...
 
 Static Analyzer
 ---------------
 
-The scan-build and scan-view tools will now be installed with clang. Use these
+The scan-build and scan-view tools will now be installed with Clang. Use these
 tools to run the static analyzer on projects and view the produced results.
 
 Static analysis of C++ lambdas has been greatly improved, including
@@ -302,25 +338,76 @@
   the following command to scan-build:
   ``-enable-checker optin.osx.cocoa.localizability``.
 
-Core Analysis Improvements
-==========================
+
+Clang-tidy
+----------
 
-- ...
+New checks have been added to clang-tidy:
+
+* Checks enforcing certain rules of the `CERT Secure Coding Standards
+  <https://www.securecoding.cert.org/confluence/display/seccode/SEI+CERT+Coding+Standards>`_:
 
-New Issues Found
-================
+  * `cert-dcl03-c <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/cert-dcl03-c.html>`_
+  * `cert-dcl50-cpp <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/cert-dcl50-cpp.html>`_
+  * `cert-err52-cpp <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/cert-err52-cpp.html>`_
+  * `cert-err58-cpp <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/cert-err58-cpp.html>`_
+  * `cert-err60-cpp <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/cert-err60-cpp.html>`_
+  * `cert-err61-cpp <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/cert-err61-cpp.html>`_
+  * `cert-fio38-c <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/cert-fio38-c.html>`_
+  * `cert-oop11-cpp <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/cert-oop11-cpp.html>`_
+
+* Checks supporting the `C++ Core Guidelines
+  <https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md>`_:
 
-- ...
+  * `cppcoreguidelines-pro-bounds-array-to-pointer-decay <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-array-to-pointer-decay.html>`_
+  * `cppcoreguidelines-pro-bounds-constant-array-index <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.html>`_
+  * `cppcoreguidelines-pro-bounds-pointer-arithmetic <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-pointer-arithmetic.html>`_
+  * `cppcoreguidelines-pro-type-const-cast <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-const-cast.html>`_
+  * `cppcoreguidelines-pro-type-cstyle-cast <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-cstyle-cast.html>`_
+  * `cppcoreguidelines-pro-type-reinterpret-cast <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-reinterpret-cast.html>`_
+  * `cppcoreguidelines-pro-type-static-cast-downcast <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-static-cast-downcast.html>`_
+  * `cppcoreguidelines-pro-type-union-access <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-union-access.html>`_
+  * `cppcoreguidelines-pro-type-vararg <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/cppcoreguidelines-pro-type-vararg.html>`_
+
+* The functionality of the clang-modernize tool has been moved to the new
+  ``modernize`` module in clang-tidy along with a few new checks:
 
-Python Binding Changes
-----------------------
+  * `modernize-loop-convert <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/modernize-loop-convert.html>`_
+  * `modernize-make-unique <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/modernize-make-unique.html>`_
+  * `modernize-pass-by-value <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/modernize-pass-by-value.html>`_
+  * `modernize-redundant-void-arg <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/modernize-redundant-void-arg.html>`_
+  * `modernize-replace-auto-ptr <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/modernize-replace-auto-ptr.html>`_
+  * `modernize-shrink-to-fit <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/modernize-shrink-to-fit.html>`_ (renamed from readability-shrink-to-fit)
+  * `modernize-use-auto <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/modernize-use-auto.html>`_
+  * `modernize-use-default <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/modernize-use-default.html>`_
+  * `modernize-use-nullptr <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/modernize-use-nullptr.html>`_
+  * `modernize-use-override <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/modernize-use-override.html>`_ (renamed from misc-use-override)
 
-The following methods have been added:
+* New checks flagging various readability-related issues:
+
+  * `readability-identifier-naming <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/readability-identifier-naming.html>`_
+  * `readability-implicit-bool-cast <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/readability-implicit-bool-cast.html>`_
+  * `readability-inconsistent-declaration-parameter-name <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/readability-inconsistent-declaration-parameter-name.html>`_
+  * `readability-uniqueptr-delete-release <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/readability-uniqueptr-delete-release.html>`_
 
--  ...
+* New ``performance`` module for checks targeting potential performance issues:
+
+  * performance-unnecessary-copy-initialization
+
+* A few new checks have been added to the ``misc`` module:
 
-Significant Known Problems
-==========================
+  * `misc-definitions-in-headers <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/misc-definitions-in-headers.html>`_
+  * misc-move-const-arg
+  * `misc-move-constructor-init <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/misc-move-constructor-init.html>`_
+  * `misc-new-delete-overloads <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/misc-new-delete-overloads.html>`_
+  * `misc-non-copyable-objects <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/misc-non-copyable-objects.html>`_
+  * `misc-sizeof-container <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/misc-sizeof-container.html>`_
+  * `misc-string-integer-assignment <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/misc-string-integer-assignment.html>`_
+  * `misc-throw-by-value-catch-by-reference <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.html>`_
+  * `misc-unused-alias-decls <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/misc-unused-alias-decls.html>`_
+  * `misc-unused-parameters <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/misc-unused-parameters.html>`_
+  * `misc-virtual-near-miss <http://llvm.org/releases/3.8.0/tools/clang/tools/extra/docs/clang-tidy/checks/misc-virtual-near-miss.html>`_
+
 
 Additional Information
 ======================
diff -r 4803fea0a8c4 -r affb44038aff external/bsd/llvm/dist/clang/lib/Basic/Targets.cpp
--- a/external/bsd/llvm/dist/clang/lib/Basic/Targets.cpp        Sat Sep 03 23:01:57 2016 +0000
+++ b/external/bsd/llvm/dist/clang/lib/Basic/Targets.cpp        Sat Sep 03 23:11:41 2016 +0000
@@ -5845,6 +5845,12 @@
   SparcTargetInfo(const llvm::Triple &Triple)
       : TargetInfo(Triple), SoftFloat(false) {}
 
+  int getEHDataRegisterNumber(unsigned RegNo) const override {
+    if (RegNo == 0) return 24;



Home | Main Index | Thread Index | Old Index