本文整理汇总了C++中NamespaceDecl::removeDecl方法的典型用法代码示例。如果您正苦于以下问题:C++ NamespaceDecl::removeDecl方法的具体用法?C++ NamespaceDecl::removeDecl怎么用?C++ NamespaceDecl::removeDecl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NamespaceDecl
的用法示例。
在下文中一共展示了NamespaceDecl::removeDecl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: foo
TEST_F(StructuralEquivalenceTest, IntVsSignedIntTemplateSpec) {
auto Decls = makeDecls<ClassTemplateSpecializationDecl>(
R"(template <class T> struct foo; template<> struct foo<int>{};)",
R"(template <class T> struct foo; template<> struct foo<signed int>{};)",
Lang_CXX,
classTemplateSpecializationDecl());
auto Spec0 = get<0>(Decls);
auto Spec1 = get<1>(Decls);
EXPECT_TRUE(testStructuralMatch(Spec0, Spec1));
}
TEST_F(StructuralEquivalenceTest, CharVsSignedCharTemplateSpec) {
auto Decls = makeDecls<ClassTemplateSpecializationDecl>(
R"(template <class T> struct foo; template<> struct foo<char>{};)",
R"(template <class T> struct foo; template<> struct foo<signed char>{};)",
Lang_CXX,
classTemplateSpecializationDecl());
auto Spec0 = get<0>(Decls);
auto Spec1 = get<1>(Decls);
EXPECT_FALSE(testStructuralMatch(Spec0, Spec1));
}
TEST_F(StructuralEquivalenceTest, CharVsSignedCharTemplateSpecWithInheritance) {
auto Decls = makeDecls<ClassTemplateSpecializationDecl>(
R"(
struct true_type{};
template <class T> struct foo;
template<> struct foo<char> : true_type {};
)",
R"(
struct true_type{};
template <class T> struct foo;
template<> struct foo<signed char> : true_type {};
)",
Lang_CXX,
classTemplateSpecializationDecl());
EXPECT_FALSE(testStructuralMatch(Decls));
}
// This test is disabled for now.
// FIXME Enable it, once the check is implemented.
TEST_F(StructuralEquivalenceTest, DISABLED_WrongOrderInNamespace) {
auto Code =
R"(
namespace NS {
template <class T> class Base {
int a;
};
class Derived : Base<Derived> {
};
}
void foo(NS::Derived &);
)";
auto Decls = makeNamedDecls(Code, Code, Lang_CXX);
NamespaceDecl *NS =
LastDeclMatcher<NamespaceDecl>().match(get<1>(Decls), namespaceDecl());
ClassTemplateDecl *TD = LastDeclMatcher<ClassTemplateDecl>().match(
get<1>(Decls), classTemplateDecl(hasName("Base")));
// Reorder the decls, move the TD to the last place in the DC.
NS->removeDecl(TD);
NS->addDeclInternal(TD);
EXPECT_FALSE(testStructuralMatch(Decls));
}