summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
diff options
context:
space:
mode:
authorAngel Garcia Gomez <angelgarcia@google.com>2015-10-14 09:29:55 +0000
committerAngel Garcia Gomez <angelgarcia@google.com>2015-10-14 09:29:55 +0000
commit2df36481b6e20664b6a0206165e71cffda0569ba (patch)
tree504a9c8e45230b7e63bdd904e19dd785107537eb /clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
parentbaf573eb4cecd5f3a8ebc55210fbf45de2ff7c78 (diff)
downloadbcm5719-llvm-2df36481b6e20664b6a0206165e71cffda0569ba.tar.gz
bcm5719-llvm-2df36481b6e20664b6a0206165e71cffda0569ba.zip
Prevent modernize-use-auto from emitting a warning when 'auto' was already being used.
Summary: This fixes https://llvm.org/bugs/show_bug.cgi?id=25082 . Reviewers: bkramer, klimek Subscribers: cfe-commits, alexfh Differential Revision: http://reviews.llvm.org/D13504 llvm-svn: 250284
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
index a9405471d29..1469909a85c 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
@@ -222,6 +222,9 @@ StatementMatcher makeDeclWithNewMatcher() {
has(varDecl()),
unless(has(varDecl(anyOf(
unless(hasInitializer(ignoringParenImpCasts(cxxNewExpr()))),
+ // Skip declarations that are already using auto.
+ anyOf(hasType(autoType()),
+ hasType(pointerType(pointee(autoType())))),
// FIXME: TypeLoc information is not reliable where CV
// qualifiers are concerned so these types can't be
// handled for now.
OpenPOWER on IntegriCloud