summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2016-06-03 08:05:11 +0000
committerHaojian Wu <hokein@google.com>2016-06-03 08:05:11 +0000
commitd80c7c4808a7705decdcf9f4d9937ac02db6d6a1 (patch)
tree216c6a6212d44b928d8db19a7465629caf977395 /clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp
parent5e3d314488d598cd1e3767818e46b78746ce2826 (diff)
downloadbcm5719-llvm-d80c7c4808a7705decdcf9f4d9937ac02db6d6a1.tar.gz
bcm5719-llvm-d80c7c4808a7705decdcf9f4d9937ac02db6d6a1.zip
[clang-tidy] Ignore function context in misc-unused-using-decls.
Summary: Make the check's behavior more correct when handling using-decls in multiple scopes. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20909 llvm-svn: 271632
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp')
-rw-r--r--clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp b/clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp
index 92977cc048d..4d6b33252f1 100644
--- a/clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp
+++ b/clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp
@@ -17,6 +17,8 @@ class I {
static int ii;
};
template <typename T> class J {};
+class G;
+class H;
class Base {
public:
@@ -99,6 +101,24 @@ DEFINE_INT(test);
USING_FUNC
#undef USING_FUNC
+namespace N1 {
+// n::G is used in namespace N2.
+// Currently, the check doesn't support multiple scopes. All the relevant
+// using-decls will be marked as used once we see an usage even the usage is in
+// other scope.
+using n::G;
+}
+
+namespace N2 {
+using n::G;
+void f(G g);
+}
+
+void IgnoreFunctionScope() {
+// Using-decls defined in function scope will be ignored.
+using n::H;
+}
+
// ----- Usages -----
void f(B b);
void g() {
@@ -112,4 +132,3 @@ void g() {
UsedTemplateFunc<int>();
cout << endl;
}
-
OpenPOWER on IntegriCloud