summaryrefslogtreecommitdiffstats
path: root/clang/lib/ASTMatchers/Dynamic/Registry.cpp
diff options
context:
space:
mode:
authorNathan James <n.james93@hotmail.co.uk>2020-01-02 13:37:41 -0500
committerAaron Ballman <aaron@aaronballman.com>2020-01-02 13:39:27 -0500
commitec3d8e61b527c6312f77a4dab095ffc34e954927 (patch)
treeeb8c58dc7399f236ec8288123b581cc0fc4a2008 /clang/lib/ASTMatchers/Dynamic/Registry.cpp
parenta81cb1b8bf580d6ab15d9ed6ff4f104eeedd3a1d (diff)
downloadbcm5719-llvm-ec3d8e61b527c6312f77a4dab095ffc34e954927.tar.gz
bcm5719-llvm-ec3d8e61b527c6312f77a4dab095ffc34e954927.zip
Handle init statements in readability-else-after-return
Adds a new ASTMatcher condition called 'hasInitStatement()' that matches if, switch and range-for statements with an initializer. Reworked clang-tidy readability-else-after-return to handle variables in the if condition or init statements in c++17 ifs. Also checks if removing the else would affect object lifetimes in the else branch. Fixes PR44364.
Diffstat (limited to 'clang/lib/ASTMatchers/Dynamic/Registry.cpp')
-rw-r--r--clang/lib/ASTMatchers/Dynamic/Registry.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/ASTMatchers/Dynamic/Registry.cpp b/clang/lib/ASTMatchers/Dynamic/Registry.cpp
index 8c11e069cb0..89722489fe2 100644
--- a/clang/lib/ASTMatchers/Dynamic/Registry.cpp
+++ b/clang/lib/ASTMatchers/Dynamic/Registry.cpp
@@ -279,6 +279,7 @@ RegistryMaps::RegistryMaps() {
REGISTER_MATCHER(hasIndex);
REGISTER_MATCHER(hasInit);
REGISTER_MATCHER(hasInitializer);
+ REGISTER_MATCHER(hasInitStatement);
REGISTER_MATCHER(hasKeywordSelector);
REGISTER_MATCHER(hasLHS);
REGISTER_MATCHER(hasLocalQualifiers);
OpenPOWER on IntegriCloud