Author: Nikolas Klauser Date: 2023-06-26T09:34:36-07:00 New Revision: f6d557ee34b6bbdb1dc32f29e34b4a4a8ad35e81
URL: https://github.com/llvm/llvm-project/commit/f6d557ee34b6bbdb1dc32f29e34b4a4a8ad35e81 DIFF: https://github.com/llvm/llvm-project/commit/f6d557ee34b6bbdb1dc32f29e34b4a4a8ad35e81.diff LOG: [clang][NFC] Remove trailing whitespaces and enforce it in lib, include and docs A lot of editors remove trailing whitespaces. This patch removes any trailing whitespaces and makes sure that no new ones are added. Reviewed By: erichkeane, paulkirth, #libc, philnik Spies: wangpc, aheejin, MaskRay, pcwang-thead, cfe-commits, libcxx-commits, dschuff, nemanjai, arichardson, kbarton, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, Jim, s.egerton, sameer.abuasal, apazos, luismarques, martong, frasercrmck, steakhal, luke Differential Revision: https://reviews.llvm.org/D151963 Added: Modified: clang/docs/ClangFormatStyleOptions.rst clang/docs/ClangLinkerWrapper.rst clang/docs/ClangOffloadPackager.rst clang/docs/ClangTransformerTutorial.rst clang/docs/DebuggingCoroutines.rst clang/docs/ExternalClangExamples.rst clang/docs/JSONCompilationDatabase.rst clang/docs/LanguageExtensions.rst clang/docs/MisExpect.rst clang/docs/SourceBasedCodeCoverage.rst clang/docs/StandardCPlusPlusModules.rst clang/docs/UndefinedBehaviorSanitizer.rst clang/docs/analyzer/checkers.rst clang/docs/analyzer/developer-docs/DebugChecks.rst clang/docs/tools/dump_ast_matchers.py clang/docs/tools/dump_format_style.py clang/include/clang/AST/DeclCXX.h clang/include/clang/AST/DeclObjC.h clang/include/clang/AST/TypeProperties.td clang/include/clang/Analysis/AnalysisDeclContext.h clang/include/clang/Analysis/CallGraph.h clang/include/clang/Basic/AttrDocs.td clang/include/clang/Basic/DiagnosticGroups.td clang/include/clang/Basic/DiagnosticParseKinds.td clang/include/clang/Basic/OpenCLExtensions.def clang/include/clang/Basic/TypeNodes.td clang/include/clang/Basic/riscv_vector.td clang/include/clang/Driver/Options.td clang/include/clang/Sema/CMakeLists.txt clang/include/clang/StaticAnalyzer/Checkers/Checkers.td clang/lib/Analysis/FlowSensitive/CMakeLists.txt clang/lib/Analysis/UninitializedValues.cpp clang/lib/Analysis/UnsafeBufferUsage.cpp clang/lib/Basic/Targets/PPC.cpp clang/lib/CodeGen/CGBuiltin.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Headers/CMakeLists.txt clang/lib/Sema/AnalysisBasedWarnings.cpp clang/lib/Sema/SemaDeclAttr.cpp clang/lib/Sema/SemaOverload.cpp clang/lib/Sema/SemaTemplateDeduction.cpp clang/lib/Serialization/ASTReaderStmt.cpp clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp clang/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp clang/lib/StaticAnalyzer/Core/ExprEngine.cpp libcxx/utils/ci/buildkite-pipeline-clang.yml Removed: ################################################################################ diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst index fa552d65e208a..b715d1c20706e 100644 --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -239,7 +239,7 @@ the configuration (without a prefix: ``Auto``). ) - .. warning:: + .. warning:: Note: This currently only applies to parentheses. @@ -3318,7 +3318,7 @@ the configuration (without a prefix: ``Auto``). and ``while``) in C++ unless the control statements are inside macro definitions or the braces would enclose preprocessor directives. - .. warning:: + .. warning:: Setting this option to `true` could lead to incorrect code formatting due to clang-format's lack of complete semantic information. As such, extra @@ -4109,7 +4109,7 @@ the configuration (without a prefix: ``Auto``). **QualifierAlignment** (``QualifierAlignmentStyle``) :versionbadge:`clang-format 14` :ref:`¶ <QualifierAlignment>` Different ways to arrange specifiers and qualifiers (e.g. const/volatile). - .. warning:: + .. warning:: Setting ``QualifierAlignment`` to something other than `Leave`, COULD lead to incorrect code formatting due to incorrect decisions made due to @@ -4285,11 +4285,11 @@ the configuration (without a prefix: ``Auto``). Remove optional braces of control statements (``if``, ``else``, ``for``, and ``while``) in C++ according to the LLVM coding style. - .. warning:: + .. warning:: This option will be renamed and expanded to support other styles. - .. warning:: + .. warning:: Setting this option to `true` could lead to incorrect code formatting due to clang-format's lack of complete semantic information. As such, extra @@ -4342,7 +4342,7 @@ the configuration (without a prefix: ``Auto``). **RemoveSemicolon** (``Boolean``) :versionbadge:`clang-format 16` :ref:`¶ <RemoveSemicolon>` Remove semicolons after the closing brace of a non-empty function. - .. warning:: + .. warning:: Setting this option to `true` could lead to incorrect code formatting due to clang-format's lack of complete semantic information. As such, extra diff --git a/clang/docs/ClangLinkerWrapper.rst b/clang/docs/ClangLinkerWrapper.rst index 28c4086d6b5cf..fbabb4f8613b3 100644 --- a/clang/docs/ClangLinkerWrapper.rst +++ b/clang/docs/ClangLinkerWrapper.rst @@ -28,7 +28,7 @@ only for the linker wrapper will be forwarded to the wrapped linker job. .. code-block:: console USAGE: clang-linker-wrapper [options] -- <options to passed to the linker> - + OPTIONS: --bitcode-library=<kind>-<triple>-<arch>=<path> Extra bitcode library to link diff --git a/clang/docs/ClangOffloadPackager.rst b/clang/docs/ClangOffloadPackager.rst index 295eb48ac0dcb..1d6ded952e8ad 100644 --- a/clang/docs/ClangOffloadPackager.rst +++ b/clang/docs/ClangOffloadPackager.rst @@ -146,7 +146,7 @@ Usage This tool can be used with the following arguments. Generally information is passed as a key-value pair to the ``image=`` argument. The ``file`` and ``triple``, -arguments are considered mandatory to make a valid image. The ``arch`` argument +arguments are considered mandatory to make a valid image. The ``arch`` argument is suggested. .. code-block:: console @@ -154,19 +154,19 @@ is suggested. OVERVIEW: A utility for bundling several object files into a single binary. The output binary can then be embedded into the host section table to create a fatbinary containing offloading code. - + USAGE: clang-offload-packager [options] - + OPTIONS: - + Generic Options: - + --help - Display available options (--help-hidden for more) --help-list - Display list of available options (--help-list-hidden for more) --version - Display the version of this program - + clang-offload-packager options: - + --image=<<key>=<value>,...> - List of key and value arguments. Required keywords are 'file' and 'triple'. -o <file> - Write output to <file>. @@ -181,9 +181,9 @@ single output file with all the images combined. clang-offload-packager -o out.bin --image=file=input.o,triple=nvptx64,arch=sm_70 -The inverse operation can be performed instead by passing the packaged binary as -input. In this mode the matching images will either be placed in the output -specified by the ``file`` option. If no ``file`` argument is provided a name +The inverse operation can be performed instead by passing the packaged binary as +input. In this mode the matching images will either be placed in the output +specified by the ``file`` option. If no ``file`` argument is provided a name will be generated for each matching image. .. code-block:: console diff --git a/clang/docs/ClangTransformerTutorial.rst b/clang/docs/ClangTransformerTutorial.rst index 33931ad201a58..b07b83f80f17d 100644 --- a/clang/docs/ClangTransformerTutorial.rst +++ b/clang/docs/ClangTransformerTutorial.rst @@ -48,7 +48,7 @@ worthwhile somewhere between 100 and 500 files. Getting Started --------------- -Patterns in Transformer are expressed with :doc:`clang's AST matchers <LibASTMatchers>`. +Patterns in Transformer are expressed with :doc:`clang's AST matchers <LibASTMatchers>`. Matchers are a language of combinators for describing portions of a clang Abstract Syntax Tree (AST). Since clang's AST includes complete type information (within the limits of single `Translation Unit (TU)`_, @@ -69,7 +69,7 @@ Assume you have a style-guide rule which forbids functions from being named can express this a Transformer rewrite rule: .. code-block:: c++ - + makeRule(functionDecl(hasName("MkX").bind("fun"), noopEdit(node("fun")), cat("The name ``MkX`` is not allowed for functions; please rename")); @@ -96,7 +96,7 @@ Now, let's extend this example to a *transformation*; specifically, the second example above: .. code-block:: c++ - + makeRule(declRefExpr(to(functionDecl(hasName("MkX")))), changeTo(cat("MakeX")), cat("MkX has been renamed MakeX")); @@ -129,7 +129,7 @@ change that ignores the type of ``s``. That is, it will modify *any* method call where the method is named "size": .. code-block:: c++ - + llvm::StringRef s = "str"; makeRule( cxxMemberCallExpr( @@ -152,7 +152,7 @@ those on ``std::string``\ s. We can achieve this change simply by refining our matcher. The rest of the rule remains unchanged: .. code-block:: c++ - + llvm::StringRef s = "str"; makeRule( cxxMemberCallExpr( @@ -170,7 +170,7 @@ invocations. This scenario can arise, for example, if you want to collapse a substructure into its parent. .. code-block:: c++ - + llvm::StringRef e = "expr", m = "member"; auto child_call = cxxMemberCallExpr(on(expr().bind(e)), callee(cxxMethodDecl(hasName("child")))); @@ -190,7 +190,7 @@ construct a field/method access. In our example, the member access is expressed as: .. code-block:: c++ - + access(e, cat(member(m))) The first argument specifies the object being accessed and the second, a @@ -199,7 +199,7 @@ name should be copied from the source -- specifically, the source range of ``m`` member. To construct the method call, we would use this expression in ``cat``: .. code-block:: c++ - + cat(access(e, cat(member(m))), "()") Reference: ranges, stencils, edits, rules @@ -280,7 +280,7 @@ specify the particular portion of code to be replaced, using the same in a function declaration with: .. code-block:: c++ - + makeRule(functionDecl(hasName("bad")).bind(f), changeTo(name(f), cat("good")), cat("bad is now good")); @@ -298,7 +298,7 @@ For this, we provide an overload of ``makeRule`` that takes a list of edits, rather than just a single one. Our example might look like: .. code-block:: c++ - + makeRule(callExpr(...), {changeTo(node(arg0), cat(node(arg2))), changeTo(node(arg2), cat(node(arg0)))}, @@ -312,7 +312,7 @@ or a list of such. But, not all edits can be expressed as ``ASTEdit``\ s. So, we also support a very general signature for edit generators: .. code-block:: c++ - + using EditGenerator = MatchConsumer<llvm::SmallVector<Edit, 1>>; That is, an ``EditGenerator`` is function that maps a ``MatchResult`` to a set @@ -340,7 +340,7 @@ empty compound statement and the other handles non-empty compound statements. With ``applyFirst``, these rules can be expressed compactly as: .. code-block:: c++ - + applyFirst({ makeRule(compoundStmt(statementCountIs(0)).bind("empty"), ...), makeRule(compoundStmt().bind("non-empty"),...) diff --git a/clang/docs/DebuggingCoroutines.rst b/clang/docs/DebuggingCoroutines.rst index 591d2eadabe53..842f7645f967b 100644 --- a/clang/docs/DebuggingCoroutines.rst +++ b/clang/docs/DebuggingCoroutines.rst @@ -384,7 +384,7 @@ Here is an example to print the asynchronous stack for the normal task implement struct promise_type { task get_return_object(); std::suspend_always initial_suspend() { return {}; } - + void unhandled_exception() noexcept {} struct FinalSuspend { diff --git a/clang/docs/ExternalClangExamples.rst b/clang/docs/ExternalClangExamples.rst index c119d8165561d..8e986b83fd065 100644 --- a/clang/docs/ExternalClangExamples.rst +++ b/clang/docs/ExternalClangExamples.rst @@ -18,7 +18,7 @@ where Clang is used are: - Static analysis. - Documentation/cross-reference generation. -If you know of (or wrote!) a tool or project using Clang, please post on +If you know of (or wrote!) a tool or project using Clang, please post on `the Discourse forums (Clang Frontend category) <https://discourse.llvm.org/c/clang/6>`_ to have it added. (or if you are already a Clang contributor, feel free to directly commit diff --git a/clang/docs/JSONCompilationDatabase.rst b/clang/docs/JSONCompilationDatabase.rst index 0227f0bfe3e62..f5432278bd4d4 100644 --- a/clang/docs/JSONCompilationDatabase.rst +++ b/clang/docs/JSONCompilationDatabase.rst @@ -40,8 +40,8 @@ works) with the option ``CMAKE_EXPORT_COMPILE_COMMANDS``. For projects on Linux, there is an alternative to intercept compiler calls with a tool called `Bear <https://github.com/rizsotto/Bear>`_. -`Bazel <https://bazel.build>`_ can export a compilation database via -`this extractor extension +`Bazel <https://bazel.build>`_ can export a compilation database via +`this extractor extension <https://github.com/hedronvision/bazel-compile-commands-extractor>`_. Bazel is otherwise resistant to Bear and other compiler-intercept techniques. @@ -126,4 +126,3 @@ Example: Here ``-I libwidget/include`` is two arguments, and so becomes two lines. Paths are relative to the directory containing ``compile_flags.txt``. - diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index c78a1231513e9..38a73f3106487 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -2333,18 +2333,18 @@ targets. WebAssembly Features ==================== -Clang supports the WebAssembly features documented below. For further +Clang supports the WebAssembly features documented below. For further information related to the semantics of the builtins, please refer to the `WebAssembly Specification <https://webassembly.github.io/spec/core/>`_. -In this section, when we refer to reference types, we are referring to +In this section, when we refer to reference types, we are referring to WebAssembly reference types, not C++ reference types unless stated otherwise. ``__builtin_wasm_table_set`` ---------------------------- -This builtin function stores a value in a WebAssembly table. +This builtin function stores a value in a WebAssembly table. It takes three arguments. -The first argument is the table to store a value into, the second +The first argument is the table to store a value into, the second argument is the index to which to store the value into, and the third argument is a value of reference type to store in the table. It returns nothing. @@ -2356,7 +2356,7 @@ It returns nothing. void store(int index) { __builtin_wasm_table_set(table, index, JSObj); - } + } ``__builtin_wasm_table_get`` ---------------------------- @@ -2364,14 +2364,14 @@ It returns nothing. This builtin function is the counterpart to ``__builtin_wasm_table_set`` and loads a value from a WebAssembly table of reference typed values. It takes 2 arguments. -The first argument is a table of reference typed values and the +The first argument is a table of reference typed values and the second argument is an index from which to load the value. It returns the loaded reference typed value. .. code-block:: c++ static __externref_t table[0]; - + __externref_t load(int index) { __externref_t Obj = __builtin_wasm_table_get(table, index); return Obj; @@ -2397,11 +2397,11 @@ with the current table size. ----------------------------- This builtin function grows the WebAssembly table by a certain amount. -Currently, as all WebAssembly tables created in C/C++ are zero-sized, -this always needs to be called to grow the table. +Currently, as all WebAssembly tables created in C/C++ are zero-sized, +this always needs to be called to grow the table. -It takes three arguments. The first argument is the WebAssembly table -to grow. The second argument is the reference typed value to store in +It takes three arguments. The first argument is the WebAssembly table +to grow. The second argument is the reference typed value to store in the new table entries (the initialization value), and the third argument is the amound to grow the table by. It returns the previous table size or -1. It will return -1 if not enough space could be allocated. @@ -2422,11 +2422,11 @@ or -1. It will return -1 if not enough space could be allocated. ``__builtin_wasm_table_fill`` ----------------------------- -This builtin function sets all the entries of a WebAssembly table to a given -reference typed value. It takes four arguments. The first argument is -the WebAssembly table, the second argument is the index that starts the -range, the third argument is the value to set in the new entries, and -the fourth and the last argument is the size of the range. It returns +This builtin function sets all the entries of a WebAssembly table to a given +reference typed value. It takes four arguments. The first argument is +the WebAssembly table, the second argument is the index that starts the +range, the third argument is the value to set in the new entries, and +the fourth and the last argument is the size of the range. It returns nothing. .. code-block:: c++ @@ -2442,11 +2442,11 @@ nothing. ``__builtin_wasm_table_copy`` ----------------------------- -This builtin function copies elements from a source WebAssembly table +This builtin function copies elements from a source WebAssembly table to a possibly overlapping destination region. It takes five arguments. The first argument is the destination WebAssembly table, and the second -argument is the source WebAssembly table. The third argument is the -destination index from where the copy starts, the fourth argument is the +argument is the source WebAssembly table. The third argument is the +destination index from where the copy starts, the fourth argument is the source index from there the copy starts, and the fifth and last argument is the number of elements to copy. It returns nothing. diff --git a/clang/docs/MisExpect.rst b/clang/docs/MisExpect.rst index 29eb1269b8982..0db73d5f292ea 100644 --- a/clang/docs/MisExpect.rst +++ b/clang/docs/MisExpect.rst @@ -13,7 +13,7 @@ be incorrect for a variety of reasons: changes to the code base invalidate them silently, the developer mis-annotated them (e.g., using ``LIKELY`` instead of ``UNLIKELY``), or perhaps they assumed something incorrectly when they wrote the annotation. Regardless of why, it is useful to detect these situations so -that the optimizer can make more useful decisions about the code. +that the optimizer can make more useful decisions about the code. MisExpect diagnostics are intended to help developers identify and address these situations, by comparing the branch weights added by the ``llvm.expect`` @@ -54,7 +54,7 @@ scripts in LLVM. .. option:: -fdiagnostic-misexpect-tolerance=N - Relaxes misexpect checking to tolerate profiling values within N% of the + Relaxes misexpect checking to tolerate profiling values within N% of the expected branch weight. e.g., a value of ``N=5`` allows misexpect to check against ``0.95 * Threshold`` @@ -72,4 +72,3 @@ Sampling. MisExpect Diagnostics are compatible with all Profiling formats. +----------------+--------------------------------------------------------------------------------------+ | Sampling | Profiles collected through sampling with external tools, such as ``perf`` on Linux | +----------------+--------------------------------------------------------------------------------------+ - diff --git a/clang/docs/SourceBasedCodeCoverage.rst b/clang/docs/SourceBasedCodeCoverage.rst index 710f9e9dba0a6..2be6fa3d717a4 100644 --- a/clang/docs/SourceBasedCodeCoverage.rst +++ b/clang/docs/SourceBasedCodeCoverage.rst @@ -86,7 +86,7 @@ directory structure will be created. Additionally, the following special is specified, the runtime creates a pool of N raw profiles which are used for on-line profile merging. The runtime takes care of selecting a raw profile from the pool, locking it, and updating it before the program exits. If N is - not specified (i.e the pattern is "%m"), it's assumed that ``N = 1``. The + not specified (i.e the pattern is "%m"), it's assumed that ``N = 1``. The merge pool specifier can only occur once per filename pattern. * "%c" expands out to nothing, but enables a mode in which profile counter diff --git a/clang/docs/StandardCPlusPlusModules.rst b/clang/docs/StandardCPlusPlusModules.rst index 6ad33b1b74b2d..0e0e796751186 100644 --- a/clang/docs/StandardCPlusPlusModules.rst +++ b/clang/docs/StandardCPlusPlusModules.rst @@ -227,7 +227,7 @@ We can generate a BMI for an importable module unit by either ``--precompile`` or ``-fmodule-output`` flags. The ``--precompile`` option generates the BMI as the output of the compilation and the output path -can be specified using the ``-o`` option. +can be specified using the ``-o`` option. The ``-fmodule-output`` option generates the BMI as a by-product of the compilation. If ``-fmodule-output=`` is specified, the BMI will be emitted the specified location. Then if @@ -390,7 +390,7 @@ For example, the traditional compilation processes for headers are like: .. code-block:: text - src1.cpp -+> clang++ src1.cpp --> src1.o ---, + src1.cpp -+> clang++ src1.cpp --> src1.o ---, hdr1.h --' +-> clang++ src1.o src2.o -> executable hdr2.h --, | src2.cpp -+> clang++ src2.cpp --> src2.o ---' @@ -399,7 +399,7 @@ And the compilation process for module units are like: .. code-block:: text - src1.cpp ----------------------------------------+> clang++ src1.cpp -------> src1.o -, + src1.cpp ----------------------------------------+> clang++ src1.cpp -------> src1.o -, (header unit) hdr1.h -> clang++ hdr1.h ... -> hdr1.pcm --' +-> clang++ src1.o mod1.o src2.o -> executable mod1.cppm -> clang++ mod1.cppm ... -> mod1.pcm --,--> clang++ mod1.pcm ... -> mod1.o -+ src2.cpp ----------------------------------------+> clang++ src2.cpp -------> src2.o -' @@ -427,7 +427,7 @@ The following example is not allowed: // M.cppm export module M; - + // Use.cpp import M; @@ -446,7 +446,7 @@ For example, the following example is allowed: # Inconsistent optimization level. $ clang++ -std=c++20 -O3 Use.cpp -fprebuilt-module-path=. # Inconsistent debugging level. - $ clang++ -std=c++20 -g Use.cpp -fprebuilt-module-path=. + $ clang++ -std=c++20 -g Use.cpp -fprebuilt-module-path=. Although the two examples have inconsistent optimization and debugging level, both of them are accepted. @@ -766,7 +766,7 @@ It would be simpler if we are using libcxx: .. code-block:: console - $ clang++ -std=c++20 main.cpp -fimplicit-modules -fimplicit-module-maps + $ clang++ -std=c++20 main.cpp -fimplicit-modules -fimplicit-module-maps Since there is already one `module map <https://github.com/llvm/llvm-project/blob/main/libcxx/include/module.modulemap.in>`_ @@ -1085,14 +1085,14 @@ So we could get a big win for the compilation time in O0. But with optimizations, things are diff erent: -(we omit ``code generation`` part for each end due to the limited space) +(we omit ``code generation`` part for each end due to the limited space) .. code-block:: none ├-------- frontend ---------┼--------------- middle end --------------------┼------ backend ----┤ │ │ │ │ └--- parsing ---- sema -----┴--- optimizations --- IPO ---- optimizations---┴--- optimizations -┘ - + ┌-----------------------------------------------------------------------------------------------┐ │ │ │ source file │ @@ -1120,7 +1120,7 @@ But we could still save the time for optimizations after IPO and the whole backe Overall, at ``O0`` the implementations of functions defined in a module will not impact module users, but at higher optimization levels the definitions of such functions are provided to user compilations for the purposes of optimization (but definitions of these functions are still not included in the use's object file)- -this means the build speedup at higher optimization levels may be lower than expected given ``O0`` experience, +this means the build speedup at higher optimization levels may be lower than expected given ``O0`` experience, but does provide by more optimization opportunities. Interoperability with Clang Modules diff --git a/clang/docs/UndefinedBehaviorSanitizer.rst b/clang/docs/UndefinedBehaviorSanitizer.rst index d8bad280ba45a..b8ad3804f1890 100644 --- a/clang/docs/UndefinedBehaviorSanitizer.rst +++ b/clang/docs/UndefinedBehaviorSanitizer.rst @@ -185,7 +185,7 @@ Available checks are: ``-fsanitize=shift-exponent`` to check only left-hand side or right-hand side of shift operation, respectively. - ``-fsanitize=unsigned-shift-base``: check that an unsigned left-hand side of - a left shift operation doesn't overflow. Issues caught by this sanitizer are + a left shift operation doesn't overflow. Issues caught by this sanitizer are not undefined behavior, but are often unintentional. - ``-fsanitize=signed-integer-overflow``: Signed integer overflow, where the result of a signed integer computation cannot be represented in its type. diff --git a/clang/docs/analyzer/checkers.rst b/clang/docs/analyzer/checkers.rst index 6494860915b93..73b4967b1ffde 100644 --- a/clang/docs/analyzer/checkers.rst +++ b/clang/docs/analyzer/checkers.rst @@ -66,7 +66,7 @@ Check for null pointers passed as arguments to a function whose arguments are re core.NullDereference (C, C++, ObjC) """"""""""""""""""""""""""""""""""" -Check for dereferences of null pointers. +Check for dereferences of null pointers. This checker specifically does not report null pointer dereferences for x86 and x86-64 targets when the @@ -75,7 +75,7 @@ segment). See `X86/X86-64 Language Extensions <https://clang.llvm.org/docs/LanguageExtensions.html#memory-references-to-specified-segments>`__ for reference. -The ``SuppressAddressSpaces`` option suppresses +The ``SuppressAddressSpaces`` option suppresses warnings for null dereferences of all pointers with address spaces. You can disable this behavior with the option ``-analyzer-config core.NullDereference:SuppressAddressSpaces=false``. @@ -2780,7 +2780,7 @@ alpha.unix.cstring.UninitializedRead (C) Check for uninitialized reads from common memory copy/manipulation functions such as: ``memcpy, mempcpy, memmove, memcmp, strcmp, strncmp, strcpy, strlen, strsep`` and many more. -.. code-block:: c +.. code-block:: c void test() { char src[10]; @@ -2789,12 +2789,12 @@ Check for uninitialized reads from common memory copy/manipulation functions suc } Limitations: - + - Due to limitations of the memory modeling in the analyzer, one can likely observe a lot of false-positive reports like this: .. code-block:: c - + void false_positive() { int src[] = {1, 2, 3, 4}; int dst[5] = {0}; @@ -2803,9 +2803,9 @@ Limitations: // that since the analyzer could not see a direct initialization of the // very last byte of the source buffer. } - + More details at the corresponding `GitHub issue <https://github.com/llvm/llvm-project/issues/43459>`_. - + .. _alpha-nondeterminism-PointerIteration: alpha.nondeterminism.PointerIteration (C++) @@ -3073,4 +3073,3 @@ View Call Graph using GraphViz. debug.ViewExplodedGraph """"""""""""""""""""""" View Exploded Graphs using GraphViz. - diff --git a/clang/docs/analyzer/developer-docs/DebugChecks.rst b/clang/docs/analyzer/developer-docs/DebugChecks.rst index d038cb5d7ccac..f03a6ecf2683f 100644 --- a/clang/docs/analyzer/developer-docs/DebugChecks.rst +++ b/clang/docs/analyzer/developer-docs/DebugChecks.rst @@ -309,22 +309,22 @@ ExprInspection checks clang_analyzer_dumpExtent(a); // expected-warning {{8 S64b}} clang_analyzer_dumpElementCount(a); // expected-warning {{2 S64b}} } - + - ``clang_analyzer_value(a single argument of integer or pointer type)`` Prints an associated value for the given argument. Supported argument types are integers, enums and pointers. The value can be represented either as a range set or as a concrete integer. For the rest of the types function prints ``n/a`` (aka not available). - + **Note:** This function will print nothing for clang built with Z3 constraint manager. This may cause crashes of your tests. To manage this use one of the test constraining techniques: - + * llvm-lit commands ``REQUIRES no-z3`` or ``UNSUPPORTED z3`` `See for details. <https://llvm.org/docs/TestingGuide.html#constraining-test-execution>`_ - + * a preprocessor directive ``#ifndef ANALYZER_CM_Z3`` - + * a clang command argument ``-analyzer-constraints=range`` Example usage:: diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py index a2d96aab91294..8ac3c2166d423 100755 --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -474,7 +474,7 @@ def act_on_decl(declaration, comment, allowed_types): # Parse free standing matcher functions, like: # Matcher<ResultType> Name(Matcher<ArgumentType> InnerMatcher) { m = re.match( - r"""^\s*(?:template\s+<\s*(?:class|typename)\s+(.+)\s*>\s+)? + r"""^\s*(?:template\s+<\s*(?:class|typename)\s+(.+)\s*>\s+)? (.*)\s+ ([^\s\(]+)\s*\( (.*) diff --git a/clang/docs/tools/dump_format_style.py b/clang/docs/tools/dump_format_style.py index e531032e26587..0b7399aee9fd5 100755 --- a/clang/docs/tools/dump_format_style.py +++ b/clang/docs/tools/dump_format_style.py @@ -252,7 +252,7 @@ def __clean_comment_line(self, line: str): match = re.match(r"^/// \\warning$", line) if match: - return "\n.. warning:: \n\n" + return "\n.. warning::\n\n" endwarning_match = re.match(r"^/// +\\endwarning$", line) if endwarning_match: diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h index e382ba39e321d..b8e5224a0f225 100644 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -1450,7 +1450,7 @@ class CXXRecordDecl : public RecordDecl { } /// Notify the class that this destructor is now selected. - /// + /// /// Important properties of the class depend on destructor properties. Since /// C++20, it is possible to have multiple destructor declarations in a class /// out of which one will be selected at the end. diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h index 3d650b82f2b9b..ee8ec7a6a016b 100644 --- a/clang/include/clang/AST/DeclObjC.h +++ b/clang/include/clang/AST/DeclObjC.h @@ -172,7 +172,7 @@ class ObjCMethodDecl : public NamedDecl, public DeclContext { Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo, DeclContext *contextDecl, bool isInstance = true, bool isVariadic = false, bool isPropertyAccessor = false, - bool isSynthesizedAccessorStub = false, + bool isSynthesizedAccessorStub = false, bool isImplicitlyDeclared = false, bool isDefined = false, ImplementationControl impControl = None, bool HasRelatedResultType = false); diff --git a/clang/include/clang/AST/TypeProperties.td b/clang/include/clang/AST/TypeProperties.td index 6205985e286c1..3cc826c1463a9 100644 --- a/clang/include/clang/AST/TypeProperties.td +++ b/clang/include/clang/AST/TypeProperties.td @@ -11,7 +11,7 @@ include "clang/Basic/TypeNodes.td" let Class = ComplexType in { def : Property<"elementType", QualType> { - let Read = [{ node->getElementType() }]; + let Read = [{ node->getElementType() }]; } def : Creator<[{ return ctx.getComplexType(elementType); }]>; @@ -591,7 +591,7 @@ let Class = ParenType in { def : Creator<[{ return ctx.getParenType(innerType); - }]>; + }]>; } let Class = MacroQualifiedType in { @@ -893,7 +893,7 @@ let Class = ObjCInterfaceType in { let Class = ObjCTypeParamType in { def : Property<"declaration", ObjCTypeParamDeclRef> { let Read = [{ node->getDecl() }]; - } + } def : Property<"qualifiers", Array<ObjCProtocolDeclRef>> { let Read = [{ node->getProtocols() }]; } diff --git a/clang/include/clang/Analysis/AnalysisDeclContext.h b/clang/include/clang/Analysis/AnalysisDeclContext.h index ce60ad56af4ed..a517a4e757c9f 100644 --- a/clang/include/clang/Analysis/AnalysisDeclContext.h +++ b/clang/include/clang/Analysis/AnalysisDeclContext.h @@ -331,7 +331,7 @@ class StackFrameContext : public LocationContext { unsigned getIndex() const { return Index; } CFGElement getCallSiteCFGElement() const { return (*Block)[Index]; } - + void Profile(llvm::FoldingSetNodeID &ID) override; static void Profile(llvm::FoldingSetNodeID &ID, AnalysisDeclContext *ADC, diff --git a/clang/include/clang/Analysis/CallGraph.h b/clang/include/clang/Analysis/CallGraph.h index 999ac5da8acb6..78f8d11555017 100644 --- a/clang/include/clang/Analysis/CallGraph.h +++ b/clang/include/clang/Analysis/CallGraph.h @@ -66,7 +66,7 @@ class CallGraph : public RecursiveASTVisitor<CallGraph> { /// Determine if a declaration should be included in the graph. static bool includeInGraph(const Decl *D); - /// Determine if a declaration should be included in the graph for the + /// Determine if a declaration should be included in the graph for the /// purposes of being a callee. This is similar to includeInGraph except /// it permits declarations, not just definitions. static bool includeCalleeInGraph(const Decl *D); diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index 5bf3333972b13..5178ca43b9710 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -539,16 +539,16 @@ def NoMergeDocs : Documentation { let Category = DocCatStmt; let Content = [{ If a statement is marked ``nomerge`` and contains call expressions, those call -expressions inside the statement will not be merged during optimization. This +expressions inside the statement will not be merged during optimization. This attribute can be used to prevent the optimizer from obscuring the source location of certain calls. For example, it will prevent tail merging otherwise identical code sequences that raise an exception or terminate the program. Tail merging normally reduces the precision of source location information, making stack traces less useful for debugging. This attribute gives the user control -over the tradeoff between code size and debug information precision. +over the tradeoff between code size and debug information precision. -``nomerge`` attribute can also be used as function attribute to prevent all -calls to the specified function from merging. It has no effect on indirect +``nomerge`` attribute can also be used as function attribute to prevent all +calls to the specified function from merging. It has no effect on indirect calls. }]; } @@ -1584,7 +1584,7 @@ attributes are ignored. Supported platforms are: ``watchos`` Apple's watchOS operating system. The minimum deployment target is specified by the ``-mwatchos-version-min=*version*`` command-line argument. - + ``driverkit`` Apple's DriverKit userspace kernel extensions. The minimum deployment target is specified as part of the triple. @@ -3933,7 +3933,7 @@ Whether a particular pointer may be "null" is an important concern when working with pointers in the C family of languages. The various nullability attributes indicate whether a particular pointer can be null or not, which makes APIs more expressive and can help static analysis tools identify bugs involving null -pointers. Clang supports several kinds of nullability attributes: the +pointers. Clang supports several kinds of nullability attributes: the ``nonnull`` and ``returns_nonnull`` attributes indicate which function or method parameters and result types can never be null, while nullability type qualifiers indicate which pointer types can be null (``_Nullable``) or cannot @@ -4109,7 +4109,7 @@ memory is not available rather than returning a null pointer: The ``returns_nonnull`` attribute implies that returning a null pointer is undefined behavior, which the optimizer may take advantage of. The ``_Nonnull`` type qualifier indicates that a pointer cannot be null in a more general manner -(because it is part of the type system) and does not imply undefined behavior, +(because it is part of the type system) and does not imply undefined behavior, making it more widely applicable }]; } @@ -6065,15 +6065,15 @@ def CFGuardDocs : Documentation { let Content = [{ Code can indicate CFG checks are not wanted with the ``__declspec(guard(nocf))`` attribute. This directs the compiler to not insert any CFG checks for the entire -function. This approach is typically used only sparingly in specific situations -where the programmer has manually inserted "CFG-equivalent" protection. The -programmer knows that they are calling through some read-only function table -whose address is obtained through read-only memory references and for which the -index is masked to the function table limit. This approach may also be applied -to small wrapper functions that are not inlined and that do nothing more than -make a call through a function pointer. Since incorrect usage of this directive -can compromise the security of CFG, the programmer must be very careful using -the directive. Typically, this usage is limited to very small functions that +function. This approach is typically used only sparingly in specific situations +where the programmer has manually inserted "CFG-equivalent" protection. The +programmer knows that they are calling through some read-only function table +whose address is obtained through read-only memory references and for which the +index is masked to the function table limit. This approach may also be applied +to small wrapper functions that are not inlined and that do nothing more than +make a call through a function pointer. Since incorrect usage of this directive +can compromise the security of CFG, the programmer must be very careful using +the directive. Typically, this usage is limited to very small functions that only call one function. `Control Flow Guard documentation <https://docs.microsoft.com/en-us/windows/win32/secbp/pe-metadata>` @@ -7021,8 +7021,8 @@ def ReadOnlyPlacementDocs : Documentation { def WebAssemblyFuncrefDocs : Documentation { let Category = DocCatType; let Content = [{ -Clang supports the ``__funcref`` attribute for the WebAssembly target. -This attribute may be attached to a function pointer type, where it modifies +Clang supports the ``__funcref`` attribute for the WebAssembly target. +This attribute may be attached to a function pointer type, where it modifies its underlying representation to be a WebAssembly ``funcref``. }]; } diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td index 9944fa87aba23..7f5fb2c1b1495 100644 --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -1290,7 +1290,7 @@ invocation. The diagnostic information can be saved to a file in a machine readable format, like YAML by adding the `-foptimization-record-file=<file>` command-line flag. -Results can be filtered by function name by passing +Results can be filtered by function name by passing `-mllvm -filter-print-funcs=foo`, where `foo` is the target function's name. .. code-block: console diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index c926e81b36e71..4a375bb5c6655 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -553,7 +553,7 @@ def err_invalid_operator_on_type : Error< def err_expected_unqualified_id : Error< "expected %select{identifier|unqualified-id}0">; def err_while_loop_outside_of_a_function : Error< - "while loop outside of a function">; + "while loop outside of a function">; def err_brackets_go_after_unqualified_id : Error< "brackets are not allowed here; to declare an array, " "place the brackets after the %select{identifier|name}0">; diff --git a/clang/include/clang/Basic/OpenCLExtensions.def b/clang/include/clang/Basic/OpenCLExtensions.def index 70b4f15a95a78..6f73b26137500 100644 --- a/clang/include/clang/Basic/OpenCLExtensions.def +++ b/clang/include/clang/Basic/OpenCLExtensions.def @@ -31,7 +31,7 @@ // If extensions are to be enumerated without any information, // define OPENCLEXTNAME(ext) where ext is the name of the extension. // -// Difference between optional core feature and core feature is that the +// Difference between optional core feature and core feature is that the // later is unconditionally supported in specific OpenCL version. // // As per The OpenCL Extension Specification, Section 1.2, in this file, an diff --git a/clang/include/clang/Basic/TypeNodes.td b/clang/include/clang/Basic/TypeNodes.td index f8557d02e5bd6..649b071cebb94 100644 --- a/clang/include/clang/Basic/TypeNodes.td +++ b/clang/include/clang/Basic/TypeNodes.td @@ -3,7 +3,7 @@ include "clang/Basic/ASTNode.td" class TypeNode<TypeNode base, bit abstract = 0> : ASTNode { TypeNode Base = base; bit Abstract = abstract; -} +} /// A type node that is only used to represent dependent types in C++. For /// example, DependentTemplateSpecializationType is used to represent types diff --git a/clang/include/clang/Basic/riscv_vector.td b/clang/include/clang/Basic/riscv_vector.td index 3290f68f3d0fa..09f518cc54772 100644 --- a/clang/include/clang/Basic/riscv_vector.td +++ b/clang/include/clang/Basic/riscv_vector.td @@ -914,7 +914,7 @@ multiclass RVVPseudoVNCVTBuiltin<string IR, string MName, string type_range, if (PolicyAttrs & RVV_VTA) Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType)); } - Ops.insert(Ops.begin() + 2, llvm::Constant::getNullValue(Ops.back()->getType())); + Ops.insert(Ops.begin() + 2, llvm::Constant::getNullValue(Ops.back()->getType())); if (IsMasked) { Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs)); // maskedoff, op1, xlen, mask, vl diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 77dcef9c73b9e..312fa822bf5cc 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5292,7 +5292,7 @@ def flang_experimental_hlfir : Flag<["-"], "flang-experimental-hlfir">, def flang_experimental_polymorphism : Flag<["-"], "flang-experimental-polymorphism">, Flags<[FlangOption, FC1Option, FlangOnlyOption, NoXarchOption, HelpHidden]>, HelpText<"Enable Fortran 2003 polymorphism (experimental)">; - + //===----------------------------------------------------------------------===// // FLangOption + CoreOption + NoXarchOption diff --git a/clang/include/clang/Sema/CMakeLists.txt b/clang/include/clang/Sema/CMakeLists.txt index 5a48b901d2bfb..0b0e31ece3195 100644 --- a/clang/include/clang/Sema/CMakeLists.txt +++ b/clang/include/clang/Sema/CMakeLists.txt @@ -2,7 +2,7 @@ clang_tablegen(AttrTemplateInstantiate.inc -gen-clang-attr-template-instantiate -I ${CMAKE_CURRENT_SOURCE_DIR}/../../ SOURCE ../Basic/Attr.td TARGET ClangAttrTemplateInstantiate) - + clang_tablegen(AttrParsedAttrList.inc -gen-clang-attr-parsed-attr-list -I ${CMAKE_CURRENT_SOURCE_DIR}/../../ SOURCE ../Basic/Attr.td diff --git a/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td b/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td index 36c742a5221fa..885b1b68de963 100644 --- a/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td +++ b/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td @@ -463,12 +463,12 @@ def CStringNotNullTerm : Checker<"NotNullTerminated">, HelpText<"Check for arguments which are not null-terminating strings">, Dependencies<[CStringModeling]>, Documentation<HasDocumentation>; - + def CStringUninitializedRead : Checker<"UninitializedRead">, HelpText<"Checks if the string manipulation function would read uninitialized bytes">, Dependencies<[CStringModeling]>, Documentation<HasDocumentation>; - + } // end "alpha.unix.cstring" let ParentPackage = Unix in { diff --git a/clang/lib/Analysis/FlowSensitive/CMakeLists.txt b/clang/lib/Analysis/FlowSensitive/CMakeLists.txt index 39a7e34f7de03..d59bebf6a5a12 100644 --- a/clang/lib/Analysis/FlowSensitive/CMakeLists.txt +++ b/clang/lib/Analysis/FlowSensitive/CMakeLists.txt @@ -24,7 +24,7 @@ add_clang_library(clangAnalysisFlowSensitive add_subdirectory(Models) add_custom_command(OUTPUT HTMLLogger.inc - COMMAND "${Python3_EXECUTABLE}" ${CLANG_SOURCE_DIR}/utils/bundle_resources.py + COMMAND "${Python3_EXECUTABLE}" ${CLANG_SOURCE_DIR}/utils/bundle_resources.py ${CMAKE_CURRENT_BINARY_DIR}/HTMLLogger.inc HTMLLogger.html HTMLLogger.css HTMLLogger.js WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/clang/lib/Analysis/UninitializedValues.cpp b/clang/lib/Analysis/UninitializedValues.cpp index 3c097f44761f1..b796f7674cc1d 100644 --- a/clang/lib/Analysis/UninitializedValues.cpp +++ b/clang/lib/Analysis/UninitializedValues.cpp @@ -896,7 +896,7 @@ struct PruneBlocksHandler : public UninitVariablesHandler { hadUse[currentBlock] = true; hadAnyUse = true; } - + /// Called when the uninitialized variable analysis detects the /// idiom 'int x = x'. All other uses of 'x' within the initializer /// are handled by handleUseOfUninitVariable. diff --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp index aa29fb45726a8..685b098cfc614 100644 --- a/clang/lib/Analysis/UnsafeBufferUsage.cpp +++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp @@ -194,7 +194,7 @@ AST_MATCHER_P(CastExpr, castSubExpr, internal::Matcher<Expr>, innerMatcher) { // Matches a `UnaryOperator` whose operator is pre-increment: AST_MATCHER(UnaryOperator, isPreInc) { return Node.getOpcode() == UnaryOperator::Opcode::UO_PreInc; -} +} // Returns a matcher that matches any expression 'e' such that `innerMatcher` // matches 'e' and 'e' is in an Unspecified Lvalue Context. @@ -361,7 +361,7 @@ class FixableGadget : public Gadget { virtual std::optional<FixItList> getFixits(const Strategy &) const { return std::nullopt; } - + /// Returns a list of two elements where the first element is the LHS of a pointer assignment /// statement and the second element is the RHS. This two-element list represents the fact that /// the LHS buffer gets its bounds information from the RHS buffer. This information will be used @@ -608,10 +608,10 @@ class PointerAssignmentGadget : public FixableGadget { hasLHS(declRefExpr(hasPointerType(), to(varDecl())). bind(PointerAssignLHSTag)))); - + return stmt(isInUnspecifiedUntypedContext(PtrAssignExpr)); } - + virtual std::optional<FixItList> getFixits(const Strategy &S) const override; virtual const Stmt *getBaseStmt() const override { return nullptr; } @@ -2126,7 +2126,7 @@ getFixIts(FixableGadgetSets &FixablesForAllVars, const Strategy &S, FixItsForVariable.erase(VD); continue; } - + const auto VarGroupForVD = VarGrpMap.find(VD); if (VarGroupForVD != VarGrpMap.end()) { for (const VarDecl * V : VarGroupForVD->second) { @@ -2158,7 +2158,7 @@ getFixIts(FixableGadgetSets &FixablesForAllVars, const Strategy &S, continue; } } - + for (auto VD : FixItsForVariable) { const auto VarGroupForVD = VarGrpMap.find(VD.first); const Strategy::Kind ReplacementTypeForVD = S.lookup(VD.first); @@ -2167,7 +2167,7 @@ getFixIts(FixableGadgetSets &FixablesForAllVars, const Strategy &S, if (Var == VD.first) { continue; } - + FixItList GroupFix; if (FixItsForVariable.find(Var) == FixItsForVariable.end()) { GroupFix = fixVariable(Var, ReplacementTypeForVD, D, @@ -2175,7 +2175,7 @@ getFixIts(FixableGadgetSets &FixablesForAllVars, const Strategy &S, } else { GroupFix = FixItsForVariable[Var]; } - + for (auto Fix : GroupFix) { FixItsForVariable[VD.first].push_back(Fix); } @@ -2199,7 +2199,7 @@ void clang::checkUnsafeBufferUsage(const Decl *D, UnsafeBufferUsageHandler &Handler, bool EmitSuggestions) { assert(D && D->getBody()); - + // Do not emit fixit suggestions for functions declared in an // extern "C" block. if (const auto *FD = dyn_cast<FunctionDecl>(D)) { @@ -2210,7 +2210,7 @@ void clang::checkUnsafeBufferUsage(const Decl *D, } } } - + WarningGadgetSets UnsafeOps; FixableGadgetSets FixablesForAllVars; @@ -2254,12 +2254,12 @@ void clang::checkUnsafeBufferUsage(const Decl *D, llvm::SmallVector<const VarDecl *, 16> UnsafeVars; for (const auto &[VD, ignore] : FixablesForAllVars.byVar) UnsafeVars.push_back(VD); - + // Fixpoint iteration for pointer assignments using DepMapTy = DenseMap<const VarDecl *, std::set<const VarDecl *>>; DepMapTy DependenciesMap{}; DepMapTy PtrAssignmentGraph{}; - + for (auto it : FixablesForAllVars.byVar) { for (const FixableGadget *fixable : it.second) { std::optional<std::pair<const VarDecl *, const VarDecl *>> ImplPair = @@ -2270,7 +2270,7 @@ void clang::checkUnsafeBufferUsage(const Decl *D, } } } - + /* The following code does a BFS traversal of the `PtrAssignmentGraph` considering all unsafe vars as starting nodes and constructs an undirected @@ -2291,7 +2291,7 @@ void clang::checkUnsafeBufferUsage(const Decl *D, std::set<const VarDecl *> VisitedVarsDirected{}; for (const auto &[Var, ignore] : UnsafeOps.byVar) { if (VisitedVarsDirected.find(Var) == VisitedVarsDirected.end()) { - + std::queue<const VarDecl*> QueueDirected{}; QueueDirected.push(Var); while(!QueueDirected.empty()) { @@ -2309,14 +2309,14 @@ void clang::checkUnsafeBufferUsage(const Decl *D, } } } - + // Group Connected Components for Unsafe Vars // (Dependencies based on pointer assignments) std::set<const VarDecl *> VisitedVars{}; for (const auto &[Var, ignore] : UnsafeOps.byVar) { if (VisitedVars.find(Var) == VisitedVars.end()) { std::vector<const VarDecl *> VarGroup{}; - + std::queue<const VarDecl*> Queue{}; Queue.push(Var); while(!Queue.empty()) { diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp index bfef91affc482..89aa9bd585119 100644 --- a/clang/lib/Basic/Targets/PPC.cpp +++ b/clang/lib/Basic/Targets/PPC.cpp @@ -791,10 +791,10 @@ ArrayRef<TargetInfo::GCCRegAlias> PPCTargetInfo::getGCCRegAliases() const { // PPC ELFABIv2 DWARF Definitoin "Table 2.26. Mappings of Common Registers". // vs0 ~ vs31 is mapping to 32 - 63, -// vs32 ~ vs63 is mapping to 77 - 108. +// vs32 ~ vs63 is mapping to 77 - 108. const TargetInfo::AddlRegName GCCAddlRegNames[] = { // Table of additional register names to use in user input. - {{"vs0"}, 32}, {{"vs1"}, 33}, {{"vs2"}, 34}, {{"vs3"}, 35}, + {{"vs0"}, 32}, {{"vs1"}, 33}, {{"vs2"}, 34}, {{"vs3"}, 35}, {{"vs4"}, 36}, {{"vs5"}, 37}, {{"vs6"}, 38}, {{"vs7"}, 39}, {{"vs8"}, 40}, {{"vs9"}, 41}, {{"vs10"}, 42}, {{"vs11"}, 43}, {{"vs12"}, 44}, {{"vs13"}, 45}, {{"vs14"}, 46}, {{"vs15"}, 47}, @@ -815,8 +815,8 @@ const TargetInfo::AddlRegName GCCAddlRegNames[] = { ArrayRef<TargetInfo::AddlRegName> PPCTargetInfo::getGCCAddlRegNames() const { if (ABI == "elfv2") return llvm::ArrayRef(GCCAddlRegNames); - else - return TargetInfo::getGCCAddlRegNames(); + else + return TargetInfo::getGCCAddlRegNames(); } static constexpr llvm::StringLiteral ValidCPUNames[] = { diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index bf3e5a54f67b9..4ede75678652b 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -2494,7 +2494,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(*this, E, Intrinsic::roundeven, Intrinsic::experimental_constrained_roundeven)); - + case Builtin::BIsin: case Builtin::BIsinf: case Builtin::BIsinl: diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 82e135012d6c9..3b00d6d549954 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -1192,7 +1192,7 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA, getToolChain().getTriple().isAMDGCN())) { // Add include/gpu-none-libc/* to our system include path. This lets us use - // GPU-specific system headers first. + // GPU-specific system headers first. SmallString<128> P(llvm::sys::path::parent_path(D.InstalledDir)); llvm::sys::path::append(P, "include"); llvm::sys::path::append(P, "gpu-none-llvm"); diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt index f2ee2e036deb9..9d6ac8b7e449a 100644 --- a/clang/lib/Headers/CMakeLists.txt +++ b/clang/lib/Headers/CMakeLists.txt @@ -583,7 +583,7 @@ install( DESTINATION ${header_install_dir} EXCLUDE_FROM_ALL COMPONENT riscv-resource-headers) - + install( FILES ${systemz_files} DESTINATION ${header_install_dir} diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp index 5a194d8ad70a8..de0feaa125f25 100644 --- a/clang/lib/Sema/AnalysisBasedWarnings.cpp +++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp @@ -2231,7 +2231,7 @@ class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler { unsigned FixItStrategy = 0; // For now we only have 'std::span' strategy const auto &FD = S.Diag(Variable->getLocation(), diag::note_unsafe_buffer_variable_fixit_group); - + FD << Variable << FixItStrategy; std::string AllVars = ""; if (VarGroupForVD.size() > 1) { diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 834380ba10d5e..f4fb096bb2ffc 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -3845,7 +3845,7 @@ static void handleInitPriorityAttr(Sema &S, Decl *D, const ParsedAttr &AL) { S.Diag(AL.getLoc(), diag::warn_attribute_ignored) << AL; return; } - + if (S.getLangOpts().HLSL) { S.Diag(AL.getLoc(), diag::err_hlsl_init_priority_unsupported); return; diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index d4f1c61259c03..0d2db9fe88c48 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -14011,8 +14011,8 @@ ExprResult Sema::CreateOverloadedBinOp(SourceLocation OpLoc, Diag(FnDecl->getLocation(), diag::note_ovl_ambiguous_oper_binary_reversed_self); // Mark member== const or provide matching != to disallow reversed - // args. Eg. - // struct S { bool operator==(const S&); }; + // args. Eg. + // struct S { bool operator==(const S&); }; // S()==S(); if (auto *MD = dyn_cast<CXXMethodDecl>(FnDecl)) if (Op == OverloadedOperatorKind::OO_EqualEqual && diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 5e3af14a13fae..6328149f5fdcf 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -3595,7 +3595,7 @@ Sema::TemplateDeductionResult Sema::FinishTemplateArgumentDeduction( if (FunctionTemplate->getFriendObjectKind()) Owner = FunctionTemplate->getLexicalDeclContext(); FunctionDecl *FD = FunctionTemplate->getTemplatedDecl(); - // additional check for inline friend, + // additional check for inline friend, // ``` // template <class F1> int foo(F1 X); // template <int A1> struct A { diff --git a/clang/lib/Serialization/ASTReaderStmt.cpp b/clang/lib/Serialization/ASTReaderStmt.cpp index c241a963918a6..96307c35ad32c 100644 --- a/clang/lib/Serialization/ASTReaderStmt.cpp +++ b/clang/lib/Serialization/ASTReaderStmt.cpp @@ -3527,7 +3527,7 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) { CollapsedNum, Empty); break; } - + case STMT_OMP_MASKED_TASKLOOP_DIRECTIVE: { unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields]; unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1]; diff --git a/clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp b/clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp index c2aca714bd1a1..65a2ec4076fdf 100644 --- a/clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp @@ -227,7 +227,7 @@ void ContainerModeling::checkDeadSymbols(SymbolReaper &SR, CheckerContext &C) const { // Cleanup auto State = C.getState(); - + auto ContMap = State->get<ContainerMap>(); for (const auto &Cont : ContMap) { if (!SR.isLiveRegion(Cont.first)) { @@ -1021,7 +1021,7 @@ SymbolRef rebaseSymbol(ProgramStateRef State, SValBuilder &SVB, SymbolRef NewSym) { auto &SymMgr = SVB.getSymbolManager(); auto Diff = SVB.evalBinOpNN(State, BO_Sub, nonloc::SymbolVal(OrigExpr), - nonloc::SymbolVal(OldExpr), + nonloc::SymbolVal(OldExpr), SymMgr.getType(OrigExpr)); const auto DiffInt = Diff.getAs<nonloc::ConcreteInt>(); diff --git a/clang/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp index be17e401fb534..bb01a3b776172 100644 --- a/clang/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp @@ -80,7 +80,7 @@ void ento::registerNSAutoreleasePoolChecker(CheckerManager &mgr) { mgr.registerChecker<NSAutoreleasePoolChecker>(); } -bool ento::shouldRegisterNSAutoreleasePoolChecker(const CheckerManager &mgr) { +bool ento::shouldRegisterNSAutoreleasePoolChecker(const CheckerManager &mgr) { const LangOptions &LO = mgr.getLangOpts(); return LO.getGC() != LangOptions::NonGC; } diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index 194a592fc019a..cbba7fac7b6fc 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -1242,7 +1242,7 @@ ExprEngine::prepareStateForArrayDestruction(const ProgramStateRef State, const QualType &ElementTy, const LocationContext *LCtx, SVal *ElementCountVal) { - assert(Region != nullptr && "Not-null region expected"); + assert(Region != nullptr && "Not-null region expected"); QualType Ty = ElementTy.getDesugaredType(getContext()); while (const auto *NTy = dyn_cast<ArrayType>(Ty)) diff --git a/libcxx/utils/ci/buildkite-pipeline-clang.yml b/libcxx/utils/ci/buildkite-pipeline-clang.yml index b951c3bbf2b22..58cea64b0d258 100644 --- a/libcxx/utils/ci/buildkite-pipeline-clang.yml +++ b/libcxx/utils/ci/buildkite-pipeline-clang.yml @@ -17,6 +17,21 @@ env: # LLVM RELEASE bump version LLVM_HEAD_VERSION: "17" steps: + - label: "Format" + commands: + - "! grep -rnI '[[:blank:]]$' clang/lib clang/include clang/docs || false" + + agents: + queue: "libcxx-builders" + os: "linux" + retry: + automatic: + - exit_status: -1 # Agent was lost + limit: 2 + timeout_in_minutes: 120 + + - wait + - label: "Building clang" commands: - "mkdir install" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits