From f8640737d4767cb88225e84515a6a2bd992cb84f Mon Sep 17 00:00:00 2001 From: Marcel Hlopko Date: Fri, 13 Mar 2020 10:54:18 +0100 Subject: [PATCH] Refactor SourceLocationTest to `using namespace` Summary: Only for the readability reasons. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D76120 --- clang/unittests/AST/SourceLocationTest.cpp | 37 ++++++++++++++---------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/clang/unittests/AST/SourceLocationTest.cpp b/clang/unittests/AST/SourceLocationTest.cpp index f401f77..c3eefc8 100644 --- a/clang/unittests/AST/SourceLocationTest.cpp +++ b/clang/unittests/AST/SourceLocationTest.cpp @@ -23,8 +23,10 @@ #include "llvm/Testing/Support/Annotations.h" #include "gtest/gtest.h" -namespace clang { -namespace ast_matchers { +using namespace clang; +using namespace clang::ast_matchers; + +namespace { // FIXME: Pull the *Verifier tests into their own test file. @@ -643,10 +645,8 @@ TEST(FunctionDecl, FunctionDeclWithThrowSpecification) { TEST(FunctionDecl, FunctionDeclWithNoExceptSpecification) { RangeVerifier Verifier; Verifier.expectRange(1, 1, 1, 24); - EXPECT_TRUE(Verifier.match( - "void f() noexcept(false);\n", - functionDecl(), - Language::Lang_CXX11)); + EXPECT_TRUE(Verifier.match("void f() noexcept(false);\n", functionDecl(), + Lang_CXX11)); } class FunctionDeclParametersRangeVerifier : public RangeVerifier { @@ -768,12 +768,10 @@ TEST(CXXMethodDecl, CXXMethodDeclWithThrowSpecification) { TEST(CXXMethodDecl, CXXMethodDeclWithNoExceptSpecification) { RangeVerifier Verifier; Verifier.expectRange(2, 1, 2, 24); - EXPECT_TRUE(Verifier.match( - "class A {\n" - "void f() noexcept(false);\n" - "};\n", - functionDecl(), - Language::Lang_CXX11)); + EXPECT_TRUE(Verifier.match("class A {\n" + "void f() noexcept(false);\n" + "};\n", + functionDecl(), Lang_CXX11)); } class ExceptionSpecRangeVerifier : public RangeVerifier { @@ -816,19 +814,19 @@ TEST(FunctionDecl, ExceptionSpecifications) { std::vector Args; Args.push_back("-fms-extensions"); EXPECT_TRUE(Verifier.match("void f() throw(...);\n", loc(functionType()), - Args, Language::Lang_CXX)); + Args, Lang_CXX)); Verifier.expectRange(1, 10, 1, 10); - EXPECT_TRUE(Verifier.match("void f() noexcept;\n", loc(functionType()), - Language::Lang_CXX11)); + EXPECT_TRUE( + Verifier.match("void f() noexcept;\n", loc(functionType()), Lang_CXX11)); Verifier.expectRange(1, 10, 1, 24); EXPECT_TRUE(Verifier.match("void f() noexcept(false);\n", loc(functionType()), - Language::Lang_CXX11)); + Lang_CXX11)); Verifier.expectRange(1, 10, 1, 32); EXPECT_TRUE(Verifier.match("void f() noexcept(noexcept(1+1));\n", - loc(functionType()), Language::Lang_CXX11)); + loc(functionType()), Lang_CXX11)); ParmVarExceptionSpecRangeVerifier Verifier2; Verifier2.expectRange(1, 25, 1, 31); @@ -840,7 +838,7 @@ TEST(FunctionDecl, ExceptionSpecifications) { EXPECT_TRUE(Verifier2.match("void g(void (*fp)(void) noexcept(true));\n", parmVarDecl(hasType(pointerType(pointee( parenType(innerType(functionType())))))), - Language::Lang_CXX11)); + Lang_CXX11)); } TEST(Decl, MemberPointerStarLoc) { @@ -861,5 +859,4 @@ TEST(Decl, MemberPointerStarLoc) { ASSERT_EQ(SM.getFileOffset(TL.getStarLoc()), Example.point("star")); } -} // end namespace ast_matchers -} // end namespace clang +} // end namespace -- 2.7.4