diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -239,7 +239,7 @@ ) - .. warning:: + .. warning:: Note: This currently only applies to parentheses. @@ -3318,7 +3318,7 @@ 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 @@ **QualifierAlignment** (``QualifierAlignmentStyle``) :versionbadge:`clang-format 14` :ref:`¶ ` 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 @@ 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 @@ **RemoveSemicolon** (``Boolean``) :versionbadge:`clang-format 16` :ref:`¶ ` 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 --- a/clang/docs/ClangLinkerWrapper.rst +++ b/clang/docs/ClangLinkerWrapper.rst @@ -28,7 +28,7 @@ .. code-block:: console USAGE: clang-linker-wrapper [options] -- - + OPTIONS: --bitcode-library=--= Extra bitcode library to link diff --git a/clang/docs/ClangOffloadPackager.rst b/clang/docs/ClangOffloadPackager.rst --- a/clang/docs/ClangOffloadPackager.rst +++ b/clang/docs/ClangOffloadPackager.rst @@ -146,7 +146,7 @@ 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 @@ 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=<=,...> - List of key and value arguments. Required keywords are 'file' and 'triple'. -o - Write output to . @@ -181,9 +181,9 @@ 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 --- a/clang/docs/ClangTransformerTutorial.rst +++ b/clang/docs/ClangTransformerTutorial.rst @@ -48,7 +48,7 @@ Getting Started --------------- -Patterns in Transformer are expressed with :doc:`clang's AST matchers `. +Patterns in Transformer are expressed with :doc:`clang's AST matchers `. 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 @@ 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 @@ example above: .. code-block:: c++ - + makeRule(declRefExpr(to(functionDecl(hasName("MkX")))), changeTo(cat("MakeX")), cat("MkX has been renamed MakeX")); @@ -129,7 +129,7 @@ where the method is named "size": .. code-block:: c++ - + llvm::StringRef s = "str"; makeRule( cxxMemberCallExpr( @@ -152,7 +152,7 @@ matcher. The rest of the rule remains unchanged: .. code-block:: c++ - + llvm::StringRef s = "str"; makeRule( cxxMemberCallExpr( @@ -170,7 +170,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ also support a very general signature for edit generators: .. code-block:: c++ - + using EditGenerator = MatchConsumer>; That is, an ``EditGenerator`` is function that maps a ``MatchResult`` to a set @@ -340,7 +340,7 @@ 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 --- a/clang/docs/DebuggingCoroutines.rst +++ b/clang/docs/DebuggingCoroutines.rst @@ -384,7 +384,7 @@ 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 --- a/clang/docs/ExternalClangExamples.rst +++ b/clang/docs/ExternalClangExamples.rst @@ -18,7 +18,7 @@ - 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) `_ 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 --- a/clang/docs/JSONCompilationDatabase.rst +++ b/clang/docs/JSONCompilationDatabase.rst @@ -40,8 +40,8 @@ For projects on Linux, there is an alternative to intercept compiler calls with a tool called `Bear `_. -`Bazel `_ can export a compilation database via -`this extractor extension +`Bazel `_ can export a compilation database via +`this extractor extension `_. Bazel is otherwise resistant to Bear and other compiler-intercept techniques. @@ -126,4 +126,3 @@ 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 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -2333,18 +2333,18 @@ 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 `_. -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 @@ void store(int index) { __builtin_wasm_table_set(table, index, JSObj); - } + } ``__builtin_wasm_table_get`` ---------------------------- @@ -2364,14 +2364,14 @@ 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 @@ ----------------------------- 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 @@ ``__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 @@ ``__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 --- a/clang/docs/MisExpect.rst +++ b/clang/docs/MisExpect.rst @@ -13,7 +13,7 @@ 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 @@ .. 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 | Profiles collected through sampling with external tools, such as ``perf`` on Linux | +----------------+--------------------------------------------------------------------------------------+ - diff --git a/clang/docs/SourceBasedCodeCoverage.rst b/clang/docs/SourceBasedCodeCoverage.rst --- a/clang/docs/SourceBasedCodeCoverage.rst +++ b/clang/docs/SourceBasedCodeCoverage.rst @@ -86,7 +86,7 @@ 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 --- a/clang/docs/StandardCPlusPlusModules.rst +++ b/clang/docs/StandardCPlusPlusModules.rst @@ -227,7 +227,7 @@ 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 @@ .. 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 @@ .. 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 @@ // M.cppm export module M; - + // Use.cpp import M; @@ -446,7 +446,7 @@ # 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 @@ .. 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 `_ @@ -1085,14 +1085,14 @@ But with optimizations, things are different: -(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 @@ 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 --- a/clang/docs/UndefinedBehaviorSanitizer.rst +++ b/clang/docs/UndefinedBehaviorSanitizer.rst @@ -185,7 +185,7 @@ ``-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 --- a/clang/docs/analyzer/checkers.rst +++ b/clang/docs/analyzer/checkers.rst @@ -66,7 +66,7 @@ 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 @@ `__ 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 @@ 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 @@ } 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 @@ // 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 `_. - + .. _alpha-nondeterminism-PointerIteration: alpha.nondeterminism.PointerIteration (C++) @@ -3073,4 +3073,3 @@ 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 --- a/clang/docs/analyzer/developer-docs/DebugChecks.rst +++ b/clang/docs/analyzer/developer-docs/DebugChecks.rst @@ -309,22 +309,22 @@ 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. `_ - + * 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 --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -474,7 +474,7 @@ # Parse free standing matcher functions, like: # Matcher Name(Matcher 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 --- a/clang/docs/tools/dump_format_style.py +++ b/clang/docs/tools/dump_format_style.py @@ -252,7 +252,7 @@ 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 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -1450,7 +1450,7 @@ } /// 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 --- a/clang/include/clang/AST/DeclObjC.h +++ b/clang/include/clang/AST/DeclObjC.h @@ -172,7 +172,7 @@ 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 --- a/clang/include/clang/AST/TypeProperties.td +++ b/clang/include/clang/AST/TypeProperties.td @@ -11,7 +11,7 @@ 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 @@ def : Creator<[{ return ctx.getParenType(innerType); - }]>; + }]>; } let Class = MacroQualifiedType in { @@ -893,7 +893,7 @@ let Class = ObjCTypeParamType in { def : Property<"declaration", ObjCTypeParamDeclRef> { let Read = [{ node->getDecl() }]; - } + } def : Property<"qualifiers", Array> { let Read = [{ node->getProtocols() }]; } diff --git a/clang/include/clang/Analysis/AnalysisDeclContext.h b/clang/include/clang/Analysis/AnalysisDeclContext.h --- a/clang/include/clang/Analysis/AnalysisDeclContext.h +++ b/clang/include/clang/Analysis/AnalysisDeclContext.h @@ -331,7 +331,7 @@ 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 --- a/clang/include/clang/Analysis/CallGraph.h +++ b/clang/include/clang/Analysis/CallGraph.h @@ -66,7 +66,7 @@ /// 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 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -539,16 +539,16 @@ 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 @@ ``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 @@ 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 @@ 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 @@ 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 ` @@ -7021,8 +7021,8 @@ 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 --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -1290,7 +1290,7 @@ The diagnostic information can be saved to a file in a machine readable format, like YAML by adding the `-foptimization-record-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 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -553,7 +553,7 @@ 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 --- 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 --- a/clang/include/clang/Basic/TypeNodes.td +++ b/clang/include/clang/Basic/TypeNodes.td @@ -3,7 +3,7 @@ class TypeNode : 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 --- a/clang/include/clang/Basic/riscv_vector.td +++ b/clang/include/clang/Basic/riscv_vector.td @@ -914,7 +914,7 @@ 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 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5292,7 +5292,7 @@ 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 --- a/clang/include/clang/Sema/CMakeLists.txt +++ b/clang/include/clang/Sema/CMakeLists.txt @@ -2,7 +2,7 @@ -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 --- a/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td +++ b/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td @@ -463,12 +463,12 @@ HelpText<"Check for arguments which are not null-terminating strings">, Dependencies<[CStringModeling]>, Documentation; - + def CStringUninitializedRead : Checker<"UninitializedRead">, HelpText<"Checks if the string manipulation function would read uninitialized bytes">, Dependencies<[CStringModeling]>, Documentation; - + } // end "alpha.unix.cstring" let ParentPackage = Unix in { diff --git a/clang/lib/Analysis/FlowSensitive/CMakeLists.txt b/clang/lib/Analysis/FlowSensitive/CMakeLists.txt --- a/clang/lib/Analysis/FlowSensitive/CMakeLists.txt +++ b/clang/lib/Analysis/FlowSensitive/CMakeLists.txt @@ -24,7 +24,7 @@ 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 --- a/clang/lib/Analysis/UninitializedValues.cpp +++ b/clang/lib/Analysis/UninitializedValues.cpp @@ -896,7 +896,7 @@ 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 --- a/clang/lib/Analysis/UnsafeBufferUsage.cpp +++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp @@ -194,7 +194,7 @@ // 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 @@ virtual std::optional 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 @@ hasLHS(declRefExpr(hasPointerType(), to(varDecl())). bind(PointerAssignLHSTag)))); - + return stmt(isInUnspecifiedUntypedContext(PtrAssignExpr)); } - + virtual std::optional getFixits(const Strategy &S) const override; virtual const Stmt *getBaseStmt() const override { return nullptr; } @@ -2126,7 +2126,7 @@ FixItsForVariable.erase(VD); continue; } - + const auto VarGroupForVD = VarGrpMap.find(VD); if (VarGroupForVD != VarGrpMap.end()) { for (const VarDecl * V : VarGroupForVD->second) { @@ -2158,7 +2158,7 @@ continue; } } - + for (auto VD : FixItsForVariable) { const auto VarGroupForVD = VarGrpMap.find(VD.first); const Strategy::Kind ReplacementTypeForVD = S.lookup(VD.first); @@ -2167,7 +2167,7 @@ if (Var == VD.first) { continue; } - + FixItList GroupFix; if (FixItsForVariable.find(Var) == FixItsForVariable.end()) { GroupFix = fixVariable(Var, ReplacementTypeForVD, D, @@ -2175,7 +2175,7 @@ } else { GroupFix = FixItsForVariable[Var]; } - + for (auto Fix : GroupFix) { FixItsForVariable[VD.first].push_back(Fix); } @@ -2199,7 +2199,7 @@ 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(D)) { @@ -2210,7 +2210,7 @@ } } } - + WarningGadgetSets UnsafeOps; FixableGadgetSets FixablesForAllVars; @@ -2254,12 +2254,12 @@ llvm::SmallVector UnsafeVars; for (const auto &[VD, ignore] : FixablesForAllVars.byVar) UnsafeVars.push_back(VD); - + // Fixpoint iteration for pointer assignments using DepMapTy = DenseMap>; DepMapTy DependenciesMap{}; DepMapTy PtrAssignmentGraph{}; - + for (auto it : FixablesForAllVars.byVar) { for (const FixableGadget *fixable : it.second) { std::optional> ImplPair = @@ -2270,7 +2270,7 @@ } } } - + /* 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 @@ std::set VisitedVarsDirected{}; for (const auto &[Var, ignore] : UnsafeOps.byVar) { if (VisitedVarsDirected.find(Var) == VisitedVarsDirected.end()) { - + std::queue QueueDirected{}; QueueDirected.push(Var); while(!QueueDirected.empty()) { @@ -2309,14 +2309,14 @@ } } } - + // Group Connected Components for Unsafe Vars // (Dependencies based on pointer assignments) std::set VisitedVars{}; for (const auto &[Var, ignore] : UnsafeOps.byVar) { if (VisitedVars.find(Var) == VisitedVars.end()) { std::vector VarGroup{}; - + std::queue Queue{}; Queue.push(Var); while(!Queue.empty()) { diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp --- a/clang/lib/Basic/Targets/PPC.cpp +++ b/clang/lib/Basic/Targets/PPC.cpp @@ -791,10 +791,10 @@ // 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 @@ ArrayRef 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 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -2494,7 +2494,7 @@ 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 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -1192,7 +1192,7 @@ 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 --- a/clang/lib/Headers/CMakeLists.txt +++ b/clang/lib/Headers/CMakeLists.txt @@ -583,7 +583,7 @@ 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 --- a/clang/lib/Sema/AnalysisBasedWarnings.cpp +++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp @@ -2231,7 +2231,7 @@ 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 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -3845,7 +3845,7 @@ 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 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -14011,8 +14011,8 @@ 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(FnDecl)) if (Op == OverloadedOperatorKind::OO_EqualEqual && diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -3595,7 +3595,7 @@ if (FunctionTemplate->getFriendObjectKind()) Owner = FunctionTemplate->getLexicalDeclContext(); FunctionDecl *FD = FunctionTemplate->getTemplatedDecl(); - // additional check for inline friend, + // additional check for inline friend, // ``` // template int foo(F1 X); // template struct A { diff --git a/clang/lib/Serialization/ASTReaderStmt.cpp b/clang/lib/Serialization/ASTReaderStmt.cpp --- a/clang/lib/Serialization/ASTReaderStmt.cpp +++ b/clang/lib/Serialization/ASTReaderStmt.cpp @@ -3527,7 +3527,7 @@ 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 --- a/clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp @@ -227,7 +227,7 @@ CheckerContext &C) const { // Cleanup auto State = C.getState(); - + auto ContMap = State->get(); for (const auto &Cont : ContMap) { if (!SR.isLiveRegion(Cont.first)) { @@ -1021,7 +1021,7 @@ 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(); diff --git a/clang/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp --- a/clang/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp @@ -80,7 +80,7 @@ mgr.registerChecker(); } -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 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -1242,7 +1242,7 @@ 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(Ty)) diff --git a/libcxx/utils/ci/buildkite-pipeline-clang.yml b/libcxx/utils/ci/buildkite-pipeline-clang.yml --- a/libcxx/utils/ci/buildkite-pipeline-clang.yml +++ b/libcxx/utils/ci/buildkite-pipeline-clang.yml @@ -17,6 +17,21 @@ # 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"