[PATCH] D17990: [clang-tidy] minor improvements in modernise-deprecated-headers check
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 10 05:20:11 PDT 2016
aaron.ballman added a subscriber: aaron.ballman.
aaron.ballman requested changes to this revision.
aaron.ballman added a reviewer: aaron.ballman.
This revision now requires changes to proceed.
================
Comment at: clang-tidy/modernize/DeprecatedHeadersCheck.cpp:79
@@ -69,3 +78,3 @@
for (const auto &KeyValue :
std::vector<std::pair<llvm::StringRef, std::string>>(
{{"fenv.h", "cfenv"},
----------------
This will definitely fail in MSVC 2013.
================
Comment at: clang-tidy/modernize/DeprecatedHeadersCheck.cpp:89
@@ +88,3 @@
+ for (const auto &Key :
+ std::vector<std::string>({"stdalign.h", "stdbool.h", "iso646.h"})) {
+ DeleteHeaders.insert(Key);
----------------
This one will work fine, but this pattern does not seem safe to me (same as above). StringSet::insert expects a StringRef. This vector (and all the std::string elements) will be destroyed at the end of the for loop, which means the StringSet will have dangling references.
https://reviews.llvm.org/D17990
More information about the cfe-commits
mailing list