Skip to content

Commit fd9d218

Browse files
Merge branch 'main' into flang/fix-pause-lowering
2 parents 5faab4d + a0e222f commit fd9d218

File tree

45 files changed

+421
-138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+421
-138
lines changed

clang-tools-extra/clang-tidy/ClangTidy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ ClangTidyASTConsumerFactory::ClangTidyASTConsumerFactory(
356356
if (Context.canExperimentalCustomChecks() && custom::RegisterCustomChecks)
357357
custom::RegisterCustomChecks(Context.getOptions(), *CheckFactories);
358358
#endif
359-
for (ClangTidyModuleRegistry::entry const E :
359+
for (const ClangTidyModuleRegistry::entry E :
360360
ClangTidyModuleRegistry::entries()) {
361361
std::unique_ptr<ClangTidyModule> Module = E.instantiate();
362362
Module->addCheckFactories(*CheckFactories);

clang-tools-extra/clang-tidy/readability/QualifiedAutoCheck.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ void QualifiedAutoCheck::registerMatchers(MatchFinder *Finder) {
146146
return qualType(anyOf(qualType(pointerType(pointee(InnerMatchers...))),
147147
qualType(substTemplateTypeParmType(hasReplacementType(
148148
pointerType(pointee(InnerMatchers...)))))));
149-
150149
};
151150

152151
auto IsAutoDeducedToPointer =

clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -562,17 +562,6 @@ ExceptionAnalyzer::throwsException(const Stmt *St,
562562
}
563563
}
564564
Results.merge(Uncaught);
565-
} else if (const auto *Call = dyn_cast<CallExpr>(St)) {
566-
if (const FunctionDecl *Func = Call->getDirectCallee()) {
567-
const ExceptionInfo Excs =
568-
throwsException(Func, Caught, CallStack, Call->getBeginLoc());
569-
Results.merge(Excs);
570-
}
571-
} else if (const auto *Construct = dyn_cast<CXXConstructExpr>(St)) {
572-
const ExceptionInfo Excs =
573-
throwsException(Construct->getConstructor(), Caught, CallStack,
574-
Construct->getBeginLoc());
575-
Results.merge(Excs);
576565
} else if (const auto *DefaultInit = dyn_cast<CXXDefaultInitExpr>(St)) {
577566
const ExceptionInfo Excs =
578567
throwsException(DefaultInit->getExpr(), Caught, CallStack);
@@ -602,10 +591,25 @@ ExceptionAnalyzer::throwsException(const Stmt *St,
602591
Results.merge(Excs);
603592
}
604593
} else {
594+
// Check whether any of this node's subexpressions throws.
605595
for (const Stmt *Child : St->children()) {
606596
const ExceptionInfo Excs = throwsException(Child, Caught, CallStack);
607597
Results.merge(Excs);
608598
}
599+
600+
// If this node is a call to a function or constructor, also check
601+
// whether the call itself throws.
602+
if (const auto *Call = dyn_cast<CallExpr>(St)) {
603+
if (const FunctionDecl *Func = Call->getDirectCallee()) {
604+
ExceptionInfo Excs =
605+
throwsException(Func, Caught, CallStack, Call->getBeginLoc());
606+
Results.merge(Excs);
607+
}
608+
} else if (const auto *Construct = dyn_cast<CXXConstructExpr>(St)) {
609+
ExceptionInfo Excs = throwsException(Construct->getConstructor(), Caught,
610+
CallStack, Construct->getBeginLoc());
611+
Results.merge(Excs);
612+
}
609613
}
610614
return Results;
611615
}

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,9 @@ Changes in existing checks
300300
- Improved :doc:`bugprone-exception-escape
301301
<clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
302302
exceptions from captures are now diagnosed, exceptions in the bodies of
303-
lambdas that aren't actually invoked are not.
303+
lambdas that aren't actually invoked are not. Additionally, fixed an issue
304+
where the check wouldn't diagnose throws in arguments to functions or
305+
constructors.
304306

305307
- Improved :doc:`bugprone-infinite-loop
306308
<clang-tidy/checks/bugprone/infinite-loop>` check by adding detection for

clang-tools-extra/docs/clang-tidy/checks/boost/use-ranges.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ If calls are made using reverse iterators on containers, The code will be
146146
fixed using the ``boost::adaptors::reverse`` adaptor.
147147

148148
.. code-block:: c++
149-
149+
150150
auto AreSame = std::equal(Items1.rbegin(), Items1.rend(),
151151
std::crbegin(Items2), std::crend(Items2));
152152

@@ -166,7 +166,7 @@ Options
166166
is `llvm`.
167167

168168
.. option:: IncludeBoostSystem
169-
169+
170170
If `true` (default value) the boost headers are included as system headers
171171
with angle brackets (`#include <boost.hpp>`), otherwise quotes are used
172172
(`#include "boost.hpp"`).

clang-tools-extra/docs/clang-tidy/checks/bugprone/assignment-in-if-condition.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Such assignments are bug-prone because they may have been intended as equality t
88

99
This check finds all assignments within `if` conditions, including ones that are not flagged
1010
by `-Wparentheses` due to an extra set of parentheses, and including assignments that call
11-
an overloaded `operator=()`. The identified assignments violate
11+
an overloaded `operator=()`. The identified assignments violate
1212
`BARR group "Rule 8.2.c" <https://barrgroup.com/embedded-systems/books/embedded-c-coding-standard/statement-rules/if-else-statements>`_.
1313

1414
.. code-block:: c++

clang-tools-extra/docs/clang-tidy/checks/bugprone/capturing-this-in-member-variable.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Possible fixes:
3030
- marking copy and move constructors and assignment operators deleted.
3131
- using class member method instead of class member variable with function
3232
object types.
33-
- passing ``this`` pointer as parameter
33+
- passing ``this`` pointer as parameter.
3434

3535
Options
3636
-------

clang-tools-extra/docs/clang-tidy/checks/bugprone/crtp-constructor-accessibility.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ bugprone-crtp-constructor-accessibility
66
Detects error-prone Curiously Recurring Template Pattern usage, when the CRTP
77
can be constructed outside itself and the derived class.
88

9-
The CRTP is an idiom, in which a class derives from a template class, where
9+
The CRTP is an idiom, in which a class derives from a template class, where
1010
itself is the template argument. It should be ensured that if a class is
1111
intended to be a base class in this idiom, it can only be instantiated if
1212
the derived class is its template argument.
@@ -23,7 +23,7 @@ Example:
2323

2424
class Derived : CRTP<Derived> {};
2525

26-
Below can be seen some common mistakes that will allow the breaking of the
26+
Below can be seen some common mistakes that will allow the breaking of the
2727
idiom.
2828

2929
If the constructor of a class intended to be used in a CRTP is public, then
@@ -62,7 +62,7 @@ Example:
6262
class Bad : CRTP<Good> {};
6363
Bad BadInstance;
6464

65-
To ensure that no accidental instantiation happens, the best practice is to
65+
To ensure that no accidental instantiation happens, the best practice is to
6666
make the constructor private and declare the derived class as friend. Note
6767
that as a tradeoff, this also gives the derived class access to every other
6868
private members of the CRTP. However, constructors can still be public or

clang-tools-extra/docs/clang-tidy/checks/bugprone/derived-method-shadowing-base-method.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Finds derived class methods that shadow a (non-virtual) base class method.
77

88
In order to be considered "shadowing", methods must have the same signature
99
(i.e. the same name, same number of parameters, same parameter types, etc).
10-
Only checks public, non-templated methods.
10+
Only checks public, non-templated methods.
1111

1212
The below example is bugprone because consumers of the ``Derived`` class will
1313
expect the ``reset`` method to do the work of ``Base::reset()`` in addition to extra
@@ -27,4 +27,4 @@ This is also a violation of the Liskov Substitution Principle.
2727
2828
struct Derived : public Base {
2929
void reset() {/* reset the derived class, but not the base class */};
30-
};
30+
};

clang-tools-extra/docs/clang-tidy/checks/bugprone/incorrect-enable-shared-from-this.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
bugprone-incorrect-enable-shared-from-this
44
==========================================
55

6-
Detect classes or structs that do not publicly inherit from
7-
``std::enable_shared_from_this``, because unintended behavior will
6+
Detect classes or structs that do not publicly inherit from
7+
``std::enable_shared_from_this``, because unintended behavior will
88
otherwise occur when calling ``shared_from_this``.
99

1010
Consider the following code:
@@ -15,7 +15,7 @@ Consider the following code:
1515

1616
// private inheritance
1717
class BadExample : std::enable_shared_from_this<BadExample> {
18-
18+
1919
// ``shared_from_this``` unintended behaviour
2020
// `libstdc++` implementation returns uninitialized ``weak_ptr``
2121
public:
@@ -29,6 +29,6 @@ Consider the following code:
2929
b_ex->bar();
3030
}
3131

32-
Using `libstdc++` implementation, ``shared_from_this`` will throw
33-
``std::bad_weak_ptr``. When ``using_not_public()`` is called, this code will
32+
Using `libstdc++` implementation, ``shared_from_this`` will throw
33+
``std::bad_weak_ptr``. When ``using_not_public()`` is called, this code will
3434
crash without exception handling.

0 commit comments

Comments
 (0)