[PATCH] D17811: [clang-tidy] Add check to detect dangling references in value handlers.

Jonathan B Coe via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 4 11:33:02 PST 2016


jbcoe added a comment.

I think there are some minor issues with the tests, easily fixed. I wonder if the matchers can catch things inside implementation-defined inline namespaces like `std::_v1_::experimental::library_fundamentals_v1::string_view`.


================
Comment at: clang-tidy/misc/DanglingHandleCheck.cpp:57
@@ +56,3 @@
+ast_matchers::internal::Matcher<RecordDecl> isASequence() {
+  return hasAnyName("::std::deque", "::std::forward_list", "::std::list",
+                    "::std::vector");
----------------
Will this (and similar checkers) handle inline namespaces?

================
Comment at: test/clang-tidy/misc-dangling-handle.cpp:73
@@ +72,3 @@
+  StringRef(const char*);  // NOLINT
+  StringRef(const std::string&);  // NOLINT
+};
----------------
What does `NOLINT` do here?

================
Comment at: test/clang-tidy/misc-dangling-handle.cpp:85
@@ +84,3 @@
+  std::string_view view_2 = ReturnsAString();
+  // CHECK-MESSAGES: [[@LINE-1]]:29: warning: std::basic_string_view outlives
+
----------------
This (and other) check-messages line looks truncated.


http://reviews.llvm.org/D17811





More information about the cfe-commits mailing list