[PATCH] D15121: A new clang-tidy module to find calls to `std::swap`, and change them to use ADL
Marshall Clow via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 2 07:59:47 PST 2015
mclow.lists added inline comments.
================
Comment at: clang-tidy/misc/StdSwapCheck.cpp:24
@@ +23,3 @@
+/// source location will be invalid.
+static SourceLocation findSemiAfterLocation(SourceLocation loc,
+ ASTContext &Ctx,
----------------
aaron.ballman wrote:
> rsmith wrote:
> > Is there somewhere more central where this can live?
> If it is useful to multiple checkers, it could live in clangTidyUtils, or were you thinking of something more general for clang itself?
I'd love to have this in a library somewhere; I found a discussion about this from a year ago; Manuel seemed to think that it was a good idea, but nothing apparently came of that. I lifted this code from `llvm/tools/clang/lib/ARCMigrate/Transforms.cpp`
================
Comment at: test/clang-tidy/misc-StdSwap.cpp:3
@@ +2,3 @@
+
+#include <utility>
+
----------------
aaron.ballman wrote:
> It would be good to not have the #include <utility> here -- for instance, I think that this test will fail on Windows with MSVC if the only MSVC STL headers that can be found are from VS 2015 because there's no -fms-compatibility-version=19 option being used.
The reason that <utility> is included here is that that is where `swap` is declared.
http://reviews.llvm.org/D15121
More information about the cfe-commits
mailing list