[clang-tools-extra] r314047 - Fix up clang-tidy after clang r314037.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 22 16:47:20 PDT 2017


Author: rsmith
Date: Fri Sep 22 16:47:20 2017
New Revision: 314047

URL: http://llvm.org/viewvc/llvm-project?rev=314047&view=rev
Log:
Fix up clang-tidy after clang r314037.

Modified:
    clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
    clang-tools-extra/trunk/test/clang-tidy/Inputs/modernize-smart-ptr/unique_ptr.h

Modified: clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp?rev=314047&r1=314046&r2=314047&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp Fri Sep 22 16:47:20 2017
@@ -94,7 +94,10 @@ void DefinitionsInHeadersCheck::check(co
   //
   // Although these might also cause ODR violations, we can be less certain and
   // should try to keep the false-positive rate down.
-  if (ND->getLinkageInternal() == InternalLinkage)
+  //
+  // FIXME: Should declarations in anonymous namespaces get the same treatment
+  // as static / const declarations?
+  if (!ND->hasExternalFormalLinkage() && !ND->isInAnonymousNamespace())
     return;
 
   if (const auto *FD = dyn_cast<FunctionDecl>(ND)) {

Modified: clang-tools-extra/trunk/test/clang-tidy/Inputs/modernize-smart-ptr/unique_ptr.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/Inputs/modernize-smart-ptr/unique_ptr.h?rev=314047&r1=314046&r2=314047&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/Inputs/modernize-smart-ptr/unique_ptr.h (original)
+++ clang-tools-extra/trunk/test/clang-tidy/Inputs/modernize-smart-ptr/unique_ptr.h Fri Sep 22 16:47:20 2017
@@ -6,20 +6,20 @@ class default_delete {};
 template <typename type, typename Deleter = std::default_delete<type>>
 class unique_ptr {
 public:
-  unique_ptr();
-  unique_ptr(type *ptr);
+  unique_ptr() {}
+  unique_ptr(type *ptr) {}
   unique_ptr(const unique_ptr<type> &t) = delete;
-  unique_ptr(unique_ptr<type> &&t);
-  ~unique_ptr();
+  unique_ptr(unique_ptr<type> &&t) {}
+  ~unique_ptr() {}
   type &operator*() { return *ptr; }
   type *operator->() { return ptr; }
-  type *release();
-  void reset();
-  void reset(type *pt);
-  void reset(type pt);
-  unique_ptr &operator=(unique_ptr &&);
+  type *release() { return ptr; }
+  void reset() {}
+  void reset(type *pt) {}
+  void reset(type pt) {}
+  unique_ptr &operator=(unique_ptr &&) { return *this; }
   template <typename T>
-  unique_ptr &operator=(unique_ptr<T> &&);
+  unique_ptr &operator=(unique_ptr<T> &&) { return *this; }
 
 private:
   type *ptr;




More information about the cfe-commits mailing list