summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/docs/clang-tidy/checks/misc-forward-declaration-namespace.rst
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2016-02-24 13:35:32 +0000
committerAlexander Kornienko <alexfh@google.com>2016-02-24 13:35:32 +0000
commitea9fd99215088b136c224d40074f2faa735a073b (patch)
treece0a473299df3a7a7a170d5d61d61bb419f06831 /clang-tools-extra/docs/clang-tidy/checks/misc-forward-declaration-namespace.rst
parent31bcca47d3c5e988826416a42a1bd92d511f5d38 (diff)
downloadbcm5719-llvm-ea9fd99215088b136c224d40074f2faa735a073b.tar.gz
bcm5719-llvm-ea9fd99215088b136c224d40074f2faa735a073b.zip
[clang-tidy] Added a check for forward declaration in the potentially wrong namespace
Adds a new check "misc-forward-declaration-namespace". In check, A forward declaration is considerred in a potentially wrong namespace if there is any definition/declaration with the same name exists in a different namespace. Reviewers: akuegel, hokein, alexfh Patch by Eric Liu! Differential Revision: http://reviews.llvm.org/D17195 llvm-svn: 261737
Diffstat (limited to 'clang-tools-extra/docs/clang-tidy/checks/misc-forward-declaration-namespace.rst')
-rw-r--r--clang-tools-extra/docs/clang-tidy/checks/misc-forward-declaration-namespace.rst19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc-forward-declaration-namespace.rst b/clang-tools-extra/docs/clang-tidy/checks/misc-forward-declaration-namespace.rst
new file mode 100644
index 00000000000..c8527b09fcd
--- /dev/null
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc-forward-declaration-namespace.rst
@@ -0,0 +1,19 @@
+.. title:: clang-tidy - misc-forward-declaration-namespace
+
+misc-forward-declaration-namespace
+==================================
+
+Checks if an unused forward declaration is in a wrong namespace.
+
+The check inspects all unused forward declarations and checks if there is any
+declaration/definition with the same name existing, which could indicate that
+the forward declaration is in a potentially wrong namespace.
+
+.. code:: c++
+ namespace na { struct A; }
+ namespace nb { struct A {}; }
+ nb::A a;
+ // warning : no definition found for 'A', but a definition with the same name
+ // 'A' found in another namespace 'nb::'
+
+This check can only generate warnings, but it can't suggest a fix at this point.
OpenPOWER on IntegriCloud