[PATCH] D83700: Fix test for the hasExternalFormalLinkage matcher

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 14 06:45:42 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG8978032a17cd: Fix test for the hasExternalFormalLinkage matcher (authored by gribozavr).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83700/new/

https://reviews.llvm.org/D83700

Files:
  clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp


Index: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===================================================================
--- clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -2534,19 +2534,16 @@
 }
 
 TEST(HasExternalFormalLinkage, Basic) {
-  EXPECT_TRUE(matches("int a = 0;", namedDecl(hasExternalFormalLinkage())));
-  EXPECT_TRUE(
-      notMatches("static int a = 0;", namedDecl(hasExternalFormalLinkage())));
+  EXPECT_TRUE(matches("int a = 0;",
+                      namedDecl(hasName("a"), hasExternalFormalLinkage())));
+  EXPECT_TRUE(notMatches("static int a = 0;",
+                         namedDecl(hasName("a"), hasExternalFormalLinkage())));
   EXPECT_TRUE(notMatches("static void f(void) { int a = 0; }",
-                         namedDecl(hasExternalFormalLinkage())));
-  EXPECT_TRUE(matches("void f(void) { int a = 0; }",
-                      namedDecl(hasExternalFormalLinkage())));
-
-  // Despite having internal semantic linkage, the anonymous namespace member
-  // has external linkage because the member has a unique name in all
-  // translation units.
-  EXPECT_TRUE(matches("namespace { int a = 0; }",
-                      namedDecl(hasExternalFormalLinkage())));
+                         namedDecl(hasName("a"), hasExternalFormalLinkage())));
+  EXPECT_TRUE(notMatches("void f(void) { int a = 0; }",
+                         namedDecl(hasName("a"), hasExternalFormalLinkage())));
+  EXPECT_TRUE(notMatches("namespace { int a = 0; }",
+                         namedDecl(hasName("a"), hasExternalFormalLinkage())));
 }
 
 TEST(HasDefaultArgument, Basic) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83700.277811.patch
Type: text/x-patch
Size: 1676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200714/626db5bd/attachment.bin>


More information about the cfe-commits mailing list