Index: clang-tidy/validate_check.py
===================================================================
--- /dev/null
+++ clang-tidy/validate_check.py
@@ -0,0 +1,133 @@
+#!/usr/bin/env python
+#
+#===- validate_check.py - validate clang-tidy files ----------*- python -*--===#
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+#===------------------------------------------------------------------------===#
+
+from __future__ import print_function
+
+import argparse
+import os
+import re
+import sys
+
+# Adds a release notes entry.
+def validate_release_notes(module_path, module, check_name):
+ check_name_dashes = module + '-' + check_name
+ filename = os.path.normpath(os.path.join(module_path,
+ '../../docs/ReleaseNotes.rst'))
+ validate_rst(module_path, module, check_name, filename)
+
+def validate_docs(module_path, module, check_name):
+ check_name_dashes = module + '-' + check_name
+ filename = os.path.normpath(os.path.join(
+ module_path, '../../docs/clang-tidy/checks/', check_name_dashes + '.rst'))
+ validate_rst(module_path, module, check_name, filename)
+
+def validate_rst(module_path, module, check_name, filename):
+ with open(filename, 'r') as f:
+ lines = f.readlines()
+
+ print('Checking %s...' % filename)
+
+ line_num = 0
+ last_line = ""
+ in_code_block = False
+ skip_blank_line = False
+ for line in lines:
+ line_num = line_num + 1
+ if (skip_blank_line):
+ skip_blank_line = False
+ continue
+
+ if (line.startswith(".. code-block::")):
+ in_code_block = True
+ skip_blank_line = True
+ last_line = ""
+ continue
+ if (line.startswith(".. ")):
+ in_code_block = False
+ last_line = ""
+ continue
+ if (line.startswith("---")):
+ last_line = ""
+ continue
+ if (line.startswith(" :")):
+ last_line = ""
+ continue
+ if (line.startswith("===")):
+ last_line = ""
+ continue
+ if (line.startswith("^^^^")):
+ last_line = ""
+ continue
+ if (line == "\n"):
+ last_line = ""
+ continue
+ if (in_code_block):
+ if (not line.startswith(" ")):
+ last_line = ""
+ in_code_block=False
+ else:
+ continue
+
+ if (in_code_block):
+ print("Code:%s",line)
+
+ if len(line) > 80:
+ print('Line %d is in excess of 80 characters (%d) : %s...' % (line_num, len(line), line))
+ elif (len(line)) > 0:
+ if ((len(last_line) > 0) and (len(last_line) < 80)):
+ words = line.split()
+ if (len(words) > 0 and len(words[0])>0 and not
+ words[0].startswith("`") and not words[0].startswith("<")):
+ # allow for the space that would be needed
+ if ((len(words[0]) + len(last_line)) < 80):
+ print("Line %d maximize 80 characters by joining:'[%s]'\nand\n'[%s]\n\n" %
+ (line_num, last_line, words[0]))
+
+ last_line = line
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument(
+ 'module',
+ nargs='?',
+ help='module directory under which to place the tidy check (e.g., misc)')
+ parser.add_argument(
+ 'check',
+ nargs='?',
+ help='name of new tidy check to check (e.g. foo-do-the-stuff)')
+ args = parser.parse_args()
+
+ if not args.module or not args.check:
+ print('Module and check must be specified.')
+ parser.print_usage()
+ return
+
+ module = args.module
+ check_name = args.check
+
+ if check_name.startswith(module):
+ print('Check name "%s" must not start with the module "%s". Exiting.' % (
+ check_name, module))
+ return
+
+ check_name_camel = ''.join(map(lambda elem: elem.capitalize(),
+ check_name.split('-'))) + 'Check'
+ clang_tidy_path = os.path.dirname(sys.argv[0])
+ module_path = os.path.join(clang_tidy_path, module)
+
+ validate_release_notes(module_path, module, check_name)
+ validate_docs(module_path, module, check_name)
+ print('You are ready to review!')
+
+
+if __name__ == '__main__':
+ main()
Index: docs/ReleaseNotes.rst
===================================================================
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -23,14 +23,14 @@
feature work. All LLVM releases may be downloaded from the `LLVM releases web
site `_.
-For more information about Clang or LLVM, including information about
-the latest release, please see the `Clang Web Site `_ or
+For more information about Clang or LLVM, including information about the
+latest release, please see the `Clang Web Site `_ or
the `LLVM Web Site `_.
-Note that if you are reading this file from a Subversion checkout or the
-main Clang web page, this document applies to the *next* release, not
-the current one. To see the release notes for a specific release, please
-see the `releases page `_.
+Note that if you are reading this file from a Subversion checkout or the main
+Clang web page, this document applies to the *next* release, not the current
+one. To see the release notes for a specific release, please see the
+`releases page `_.
What's New in Extra Clang Tools 8.0.0?
======================================
@@ -76,9 +76,9 @@
- New :doc:`abseil-duration-division
` check.
- Checks for uses of ``absl::Duration`` division that is done in a
- floating-point context, and recommends the use of a function that
- returns a floating-point value.
+ Checks for uses of ``absl::Duration`` division that is done in a
+ floating-point context, and recommends the use of a function that returns a
+ floating-point value.
- New :doc:`abseil-duration-factory-float
` check.
@@ -158,14 +158,21 @@
` check.
Checks for uses of nested namespaces in the form of
- ``namespace a { namespace b { ... }}`` and offers change to
- syntax introduced in C++17 standard: ``namespace a::b { ... }``.
+ ``namespace a { namespace b { ... }}`` and offers change to syntax introduced
+ in C++17 standard: ``namespace a::b { ... }``.
- New :doc:`modernize-deprecated-ios-base-aliases
` check.
- Detects usage of the deprecated member types of ``std::ios_base`` and replaces
- those that have a non-deprecated equivalent.
+ Detects usage of the deprecated member types of ``std::ios_base`` and
+ replaces those that have a non-deprecated equivalent.
+
+- New :doc:`modernize-use-nodiscard
+ ` check.
+
+ Adds ``[[nodiscard]]`` attributes (introduced in C++17) to member functions
+ to highlight at compile time where the return value of a function should not
+ be ignored.
- New :doc:`readability-isolate-decl
` check.
@@ -194,8 +201,7 @@
- New alias :doc:`cert-dcl16-c
` to :doc:`readability-uppercase-literal-suffix
- `
- added.
+ ` added.
- New alias :doc:`cppcoreguidelines-avoid-c-arrays
`
@@ -216,8 +222,7 @@
- New alias :doc:`hicpp-uppercase-literal-suffix
` to
:doc:`readability-uppercase-literal-suffix
- `
- added.
+ ` added.
- The :doc:`readability-redundant-smartptr-get
` check does not warn
Index: docs/clang-tidy/checks/modernize-use-noexcept.rst
===================================================================
--- docs/clang-tidy/checks/modernize-use-noexcept.rst
+++ docs/clang-tidy/checks/modernize-use-noexcept.rst
@@ -3,11 +3,10 @@
modernize-use-noexcept
======================
-This check replaces deprecated dynamic exception specifications with
-the appropriate noexcept specification (introduced in C++11). By
-default this check will replace ``throw()`` with ``noexcept``,
-and ``throw([,...])`` or ``throw(...)`` with
-``noexcept(false)``.
+This check replaces deprecated dynamic exception specifications with the
+appropriate noexcept specification (introduced in C++11). By default this
+check will replace ``throw()`` with ``noexcept``, and
+``throw([,...])`` or ``throw(...)`` with ``noexcept(false)``.
Example
-------
@@ -29,11 +28,10 @@
.. option:: ReplacementString
-Users can use :option:`ReplacementString` to specify a macro to use
-instead of ``noexcept``. This is useful when maintaining source code
-that uses custom exception specification marking other than
-``noexcept``. Fix-it hints will only be generated for non-throwing
-specifications.
+Users can use :option:`ReplacementString` to specify a macro to use instead of
+``noexcept``. This is useful when maintaining source code that uses custom
+exception specification marking other than ``noexcept``. Fix-it hints will
+only be generated for non-throwing specifications.
Example
^^^^^^^
@@ -54,11 +52,10 @@
.. option:: UseNoexceptFalse
-Enabled by default, disabling will generate fix-it hints that remove
-throwing dynamic exception specs, e.g., ``throw()``,
-completely without providing a replacement text, except for
-destructors and delete operators that are ``noexcept(true)`` by
-default.
+Enabled by default, disabling will generate fix-it hints that remove throwing
+dynamic exception specs, e.g., ``throw()``, completely without
+providing a replacement text, except for destructors and delete operators that
+are ``noexcept(true)`` by default.
Example
^^^^^^^