TEST_F(StructuralEquivalenceCXXMethodTest, Conversion) { auto t = makeDecls<CXXConversionDecl>("struct X { operator bool(); };", "struct X { operator char(); };", Lang_CXX11, cxxConversionDecl()); EXPECT_FALSE(testStructuralMatch(t)); }
void VirtualNearMissCheck::registerMatchers(MatchFinder *Finder) { if (!getLangOpts().CPlusPlus) return; Finder->addMatcher( cxxMethodDecl( unless(anyOf(isOverride(), isImplicit(), cxxConstructorDecl(), cxxDestructorDecl(), cxxConversionDecl(), isStatic(), isOverloadedOperator()))) .bind("method"), this); }
void ExplicitConstructorCheck::registerMatchers(MatchFinder *Finder) { // Only register the matchers for C++; the functionality currently does not // provide any benefit to other languages, despite being benign. if (!getLangOpts().CPlusPlus) return; Finder->addMatcher( cxxConstructorDecl(unless(anyOf(isImplicit(), // Compiler-generated. isDeleted(), isInstantiated()))) .bind("ctor"), this); Finder->addMatcher( cxxConversionDecl(unless(anyOf(isExplicit(), // Already marked explicit. isImplicit(), // Compiler-generated. isDeleted(), isInstantiated()))) .bind("conversion"), this); }