[PATCH] D23585: [ASTMatchers] Add narrowing matcher: hasExternalFormalLinkage

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 16 16:06:28 PDT 2016


aaron.ballman added a subscriber: aaron.ballman.
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a comment.

A few minor nits, but thank you for the patch!


================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:5481
@@ +5480,3 @@
+///
+/// Example matches only z (matcher = varDecl(hasExternalFormalLinkage()))
+/// \code
----------------
It might also be good to point out the case of an anonymous namespace member which has external linkage (despite having internal semantic linkage because the member has a unique name in all translation units).

================
Comment at: unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp:1942
@@ +1941,3 @@
+  EXPECT_TRUE(matches("int a = 0;", namedDecl(hasExternalFormalLinkage())));
+  EXPECT_FALSE(
+      matches("static int a = 0;", namedDecl(hasExternalFormalLinkage())));
----------------
Should use `EXPECT_TRUE` with `notMatches()` here and below.


https://reviews.llvm.org/D23585





More information about the cfe-commits mailing list