llvm/clang/unittests/AST/StructuralEquivalenceTest.cpp

#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTStructuralEquivalence.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Testing/CommandLineArgs.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/TargetParser/Host.h"

#include "DeclMatcher.h"

#include "gtest/gtest.h"

namespace clang {
namespace ast_matchers {

get;

struct StructuralEquivalenceTest : ::testing::Test {};

TEST_F(StructuralEquivalenceTest, Int) {}

TEST_F(StructuralEquivalenceTest, IntVsSignedInt) {}

TEST_F(StructuralEquivalenceTest, Char) {}

// This test is disabled for now.
// FIXME Whether this is equivalent is dependent on the target.
TEST_F(StructuralEquivalenceTest, DISABLED_CharVsSignedChar) {}

TEST_F(StructuralEquivalenceTest, ForwardRecordDecl) {}

TEST_F(StructuralEquivalenceTest, IntVsSignedIntInStruct) {}

TEST_F(StructuralEquivalenceTest, CharVsSignedCharInStruct) {}

TEST_F(StructuralEquivalenceTest, IntVsSignedIntTemplateSpec) {}

TEST_F(StructuralEquivalenceTest, CharVsSignedCharTemplateSpec) {}

TEST_F(StructuralEquivalenceTest, CharVsSignedCharTemplateSpecWithInheritance) {}

// This test is disabled for now.
// FIXME Enable it, once the check is implemented.
TEST_F(StructuralEquivalenceTest, DISABLED_WrongOrderInNamespace) {}

TEST_F(StructuralEquivalenceTest, WrongOrderOfFieldsInClass) {}

struct StructuralEquivalenceFunctionTest : StructuralEquivalenceTest {};

TEST_F(StructuralEquivalenceFunctionTest, TemplateVsNonTemplate) {}

TEST_F(StructuralEquivalenceFunctionTest, DifferentOperators) {}

TEST_F(StructuralEquivalenceFunctionTest, SameOperators) {}

TEST_F(StructuralEquivalenceFunctionTest, CtorVsDtor) {}

TEST_F(StructuralEquivalenceFunctionTest, ParamConstWithRef) {}

TEST_F(StructuralEquivalenceFunctionTest, ParamConstSimple) {}

TEST_F(StructuralEquivalenceFunctionTest, Throw) {}

TEST_F(StructuralEquivalenceFunctionTest, Noexcept) {}

TEST_F(StructuralEquivalenceFunctionTest, ThrowVsNoexcept) {}

TEST_F(StructuralEquivalenceFunctionTest, ThrowVsNoexceptFalse) {}

TEST_F(StructuralEquivalenceFunctionTest, ThrowVsNoexceptTrue) {}

TEST_F(StructuralEquivalenceFunctionTest, NoexceptNonMatch) {}

TEST_F(StructuralEquivalenceFunctionTest, NoexceptMatch) {}

TEST_F(StructuralEquivalenceFunctionTest, NoexceptVsNoexceptFalse) {}

TEST_F(StructuralEquivalenceFunctionTest, NoexceptVsNoexceptTrue) {}

TEST_F(StructuralEquivalenceFunctionTest, ReturnType) {}

TEST_F(StructuralEquivalenceFunctionTest, ReturnConst) {}

TEST_F(StructuralEquivalenceFunctionTest, ReturnRef) {}

TEST_F(StructuralEquivalenceFunctionTest, ParamCount) {}

TEST_F(StructuralEquivalenceFunctionTest, ParamType) {}

TEST_F(StructuralEquivalenceFunctionTest, ParamName) {}

TEST_F(StructuralEquivalenceFunctionTest, Variadic) {}

TEST_F(StructuralEquivalenceFunctionTest, ParamPtr) {}

TEST_F(StructuralEquivalenceFunctionTest, NameInParen) {}

TEST_F(StructuralEquivalenceFunctionTest, NameInParenWithExceptionSpec) {}

TEST_F(StructuralEquivalenceFunctionTest, NameInParenWithConst) {}

TEST_F(StructuralEquivalenceFunctionTest, FunctionsWithDifferentNoreturnAttr) {}

TEST_F(StructuralEquivalenceFunctionTest,
    FunctionsWithDifferentCallingConventions) {}

TEST_F(StructuralEquivalenceFunctionTest, FunctionsWithDifferentSavedRegsAttr) {}

struct StructuralEquivalenceCXXMethodTest : StructuralEquivalenceTest {};

TEST_F(StructuralEquivalenceCXXMethodTest, Virtual) {}

TEST_F(StructuralEquivalenceCXXMethodTest, Pure) {}

TEST_F(StructuralEquivalenceCXXMethodTest, DISABLED_Final) {}

TEST_F(StructuralEquivalenceCXXMethodTest, Const) {}

TEST_F(StructuralEquivalenceCXXMethodTest, Static) {}

TEST_F(StructuralEquivalenceCXXMethodTest, Ref1) {}

TEST_F(StructuralEquivalenceCXXMethodTest, Ref2) {}

TEST_F(StructuralEquivalenceCXXMethodTest, AccessSpecifier) {}

TEST_F(StructuralEquivalenceCXXMethodTest, Delete) {}

TEST_F(StructuralEquivalenceCXXMethodTest, Constructor) {}

TEST_F(StructuralEquivalenceCXXMethodTest, ConstructorParam) {}

TEST_F(StructuralEquivalenceCXXMethodTest, ConstructorExplicit) {}

TEST_F(StructuralEquivalenceCXXMethodTest, ConstructorDefault) {}

TEST_F(StructuralEquivalenceCXXMethodTest, Conversion) {}

TEST_F(StructuralEquivalenceCXXMethodTest, Operator) {}

TEST_F(StructuralEquivalenceCXXMethodTest, OutOfClass1) {}

TEST_F(StructuralEquivalenceCXXMethodTest, OutOfClass2) {}

struct StructuralEquivalenceRecordTest : StructuralEquivalenceTest {};

TEST_F(StructuralEquivalenceRecordTest, Name) {}

TEST_F(StructuralEquivalenceRecordTest, Fields) {}

TEST_F(StructuralEquivalenceRecordTest, DISABLED_Methods) {}

TEST_F(StructuralEquivalenceRecordTest, Bases) {}

TEST_F(StructuralEquivalenceRecordTest, InheritanceVirtual) {}

TEST_F(StructuralEquivalenceRecordTest, DISABLED_InheritanceType) {}

TEST_F(StructuralEquivalenceRecordTest, Match) {}

TEST_F(StructuralEquivalenceRecordTest, UnnamedRecordsShouldBeInequivalent) {}

TEST_F(StructuralEquivalenceRecordTest, AnonymousRecordsShouldBeInequivalent) {}

TEST_F(StructuralEquivalenceRecordTest,
       RecordsAreInequivalentIfOrderOfAnonRecordsIsDifferent) {}

TEST_F(StructuralEquivalenceRecordTest,
       UnnamedRecordsShouldBeInequivalentEvenIfTheSecondIsBeingDefined) {}

TEST_F(StructuralEquivalenceRecordTest, TemplateVsNonTemplate) {}

TEST_F(StructuralEquivalenceRecordTest,
    FwdDeclRecordShouldBeEqualWithFwdDeclRecord) {}

TEST_F(StructuralEquivalenceRecordTest,
       FwdDeclRecordShouldBeEqualWithRecordWhichHasDefinition) {}

TEST_F(StructuralEquivalenceRecordTest,
       RecordShouldBeEqualWithRecordWhichHasDefinition) {}

TEST_F(StructuralEquivalenceRecordTest, RecordsWithDifferentBody) {}

TEST_F(StructuralEquivalenceRecordTest, SameFriendMultipleTimes) {}

TEST_F(StructuralEquivalenceRecordTest, SameFriendsDifferentOrder) {}

TEST_F(StructuralEquivalenceRecordTest, SameFriendsSameOrder) {}

struct StructuralEquivalenceLambdaTest : StructuralEquivalenceTest {};

TEST_F(StructuralEquivalenceLambdaTest, LambdaClassesWithDifferentMethods) {}

TEST_F(StructuralEquivalenceLambdaTest, LambdaClassesWithEqMethods) {}

TEST_F(StructuralEquivalenceLambdaTest, LambdaClassesWithDifferentFields) {}

TEST_F(StructuralEquivalenceLambdaTest, LambdaClassesWithEqFields) {}

TEST_F(StructuralEquivalenceTest, CompareSameDeclWithMultiple) {}

TEST_F(StructuralEquivalenceTest, ExplicitBoolDifferent) {}

TEST_F(StructuralEquivalenceTest, ExplicitBoolSame) {}

struct StructuralEquivalenceRecordContextTest : StructuralEquivalenceTest {};

TEST_F(StructuralEquivalenceRecordContextTest, NamespaceNoVsNamed) {}

TEST_F(StructuralEquivalenceRecordContextTest, NamespaceNamedVsNamed) {}

TEST_F(StructuralEquivalenceRecordContextTest, NamespaceAnonVsNamed) {}

TEST_F(StructuralEquivalenceRecordContextTest, NamespaceNoVsAnon) {}

TEST_F(StructuralEquivalenceRecordContextTest, NamespaceAnonVsAnon) {}

TEST_F(StructuralEquivalenceRecordContextTest, NamespaceAnonVsAnonAnon) {}

TEST_F(StructuralEquivalenceRecordContextTest,
       NamespaceNamedNamedVsNamedNamed) {}

TEST_F(StructuralEquivalenceRecordContextTest, NamespaceNamedVsInline) {}

TEST_F(StructuralEquivalenceRecordContextTest, NamespaceInlineVsInline) {}

TEST_F(StructuralEquivalenceRecordContextTest, NamespaceInlineTopLevel) {}

TEST_F(StructuralEquivalenceRecordContextTest, TransparentContext) {}

TEST_F(StructuralEquivalenceRecordContextTest, TransparentContextNE) {}

TEST_F(StructuralEquivalenceRecordContextTest, TransparentContextInNamespace) {}

TEST_F(StructuralEquivalenceRecordContextTest,
       ClassTemplateSpecializationContext) {}

TEST_F(StructuralEquivalenceTest, NamespaceOfRecordMember) {}

TEST_F(StructuralEquivalenceTest, StructDefinitionInPrototype) {}

TEST_F(StructuralEquivalenceTest, StructDefinitionInPrototypeDifferentName) {}

TEST_F(StructuralEquivalenceRecordContextTest, RecordInsideFunction) {}

struct StructuralEquivalenceEnumTest : StructuralEquivalenceTest {};

TEST_F(StructuralEquivalenceEnumTest, FwdDeclEnumShouldBeEqualWithFwdDeclEnum) {}

TEST_F(StructuralEquivalenceEnumTest,
       FwdDeclEnumShouldBeEqualWithEnumWhichHasDefinition) {}

TEST_F(StructuralEquivalenceEnumTest,
       EnumShouldBeEqualWithEnumWhichHasDefinition) {}

TEST_F(StructuralEquivalenceEnumTest, EnumsWithDifferentBody) {}

TEST_F(StructuralEquivalenceEnumTest, AnonymousEnumsWithSameConsts) {}

TEST_F(StructuralEquivalenceEnumTest, AnonymousEnumsWithDiffConsts) {}

struct StructuralEquivalenceEnumConstantTest : StructuralEquivalenceTest {};

TEST_F(StructuralEquivalenceEnumConstantTest, EnumConstantsWithSameValues) {}

TEST_F(StructuralEquivalenceEnumConstantTest,
       EnumConstantsWithDifferentValues) {}

TEST_F(StructuralEquivalenceEnumConstantTest,
       EnumConstantsWithDifferentExprsButSameValues) {}

TEST_F(StructuralEquivalenceEnumConstantTest,
       EnumConstantsWithDifferentSignedness) {}

TEST_F(StructuralEquivalenceEnumConstantTest, EnumConstantsWithDifferentWidth) {}

TEST_F(StructuralEquivalenceEnumConstantTest, EnumConstantsWithDifferentName) {}

struct StructuralEquivalenceObjCCategoryTest : StructuralEquivalenceTest {};

TEST_F(StructuralEquivalenceObjCCategoryTest, MatchinCategoryNames) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, CategoriesForDifferentClasses) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, CategoriesWithDifferentNames) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, CategoriesWithoutInterfaces) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, CategoryAndExtension) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, MatchingProtocols) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, DifferentProtocols) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, DifferentProtocolsOrder) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, MatchingIvars) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, DifferentIvarName) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, DifferentIvarType) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, DifferentIvarBitfieldWidth) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, DifferentIvarVisibility) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, DifferentIvarNumber) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, DifferentIvarOrder) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, MatchingMethods) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, DifferentMethodName) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, DifferentMethodClassInstance) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, DifferentMethodReturnType) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, DifferentMethodParameterType) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, DifferentMethodParameterName) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, DifferentMethodNumber) {}

TEST_F(StructuralEquivalenceObjCCategoryTest, DifferentMethodOrder) {}

struct StructuralEquivalenceTemplateTest : StructuralEquivalenceTest {};

TEST_F(StructuralEquivalenceTemplateTest, ExactlySameTemplates) {}

TEST_F(StructuralEquivalenceTemplateTest, DifferentTemplateArgName) {}

TEST_F(StructuralEquivalenceTemplateTest, DifferentTemplateArgKind) {}

TEST_F(StructuralEquivalenceTemplateTest, BitFieldDecl) {}

TEST_F(StructuralEquivalenceTemplateTest, BitFieldDeclDifferentWidth) {}

TEST_F(StructuralEquivalenceTemplateTest, DependentBitFieldDecl) {}

TEST_F(StructuralEquivalenceTemplateTest, DependentBitFieldDeclDifferentVal) {}

TEST_F(StructuralEquivalenceTemplateTest, DependentBitFieldDeclDifferentVal2) {}

TEST_F(StructuralEquivalenceTemplateTest, ExplicitBoolSame) {}

TEST_F(StructuralEquivalenceTemplateTest, ExplicitBoolDifference) {}

TEST_F(StructuralEquivalenceTemplateTest,
       TemplateVsSubstTemplateTemplateParmInArgEq) {}

TEST_F(StructuralEquivalenceTemplateTest,
       TemplateVsSubstTemplateTemplateParmInArgNotEq) {}

struct StructuralEquivalenceDependentTemplateArgsTest
    : StructuralEquivalenceTemplateTest {};

TEST_F(StructuralEquivalenceDependentTemplateArgsTest,
       SameStructsInDependentArgs) {}

TEST_F(StructuralEquivalenceDependentTemplateArgsTest,
       DifferentStructsInDependentArgs) {}

TEST_F(StructuralEquivalenceDependentTemplateArgsTest,
       SameStructsInDependentScopeDeclRefExpr) {}

TEST_F(StructuralEquivalenceDependentTemplateArgsTest,
       DifferentStructsInDependentScopeDeclRefExpr) {}

TEST_F(StructuralEquivalenceDependentTemplateArgsTest,
       DifferentValueInDependentScopeDeclRefExpr) {}

TEST_F(
    StructuralEquivalenceTemplateTest,
    ClassTemplSpecWithQualifiedAndNonQualifiedTypeArgsShouldBeEqual) {}

TEST_F(
    StructuralEquivalenceTemplateTest,
    ClassTemplSpecWithInequivalentQualifiedAndNonQualifiedTypeArgs) {}

TEST_F(
    StructuralEquivalenceTemplateTest,
    ClassTemplSpecWithQualifiedAndNonQualifiedTemplArgsShouldBeEqual) {}

TEST_F(
    StructuralEquivalenceTemplateTest,
    ClassTemplSpecWithInequivalentQualifiedAndNonQualifiedTemplArgs) {}

TEST_F(StructuralEquivalenceTemplateTest,
       IgnoreTemplateParmDepthAtTemplateTypeParmDecl) {}

TEST_F(StructuralEquivalenceTemplateTest,
       IgnoreTemplateParmDepthAtNonTypeTemplateParmDecl) {}

TEST_F(
    StructuralEquivalenceTemplateTest,
    ClassTemplSpecWithInequivalentShadowedTemplArg) {}
struct StructuralEquivalenceCacheTest : public StructuralEquivalenceTest {};

TEST_F(StructuralEquivalenceCacheTest, SimpleNonEq) {}

TEST_F(StructuralEquivalenceCacheTest, ReturnStmtNonEq) {}

TEST_F(StructuralEquivalenceCacheTest, VarDeclNoEq) {}

TEST_F(StructuralEquivalenceCacheTest, VarDeclWithDifferentStorageClassNoEq) {}

TEST_F(StructuralEquivalenceCacheTest,
       NonTypeTemplateParmWithDifferentPositionNoEq) {}

TEST_F(StructuralEquivalenceCacheTest, VarDeclWithInitNoEq) {}

TEST_F(StructuralEquivalenceCacheTest, SpecialNonEq) {}

TEST_F(StructuralEquivalenceCacheTest, Cycle) {}

struct StructuralEquivalenceStmtTest : StructuralEquivalenceTest {};

/// Fallback matcher to be used only when there is no specific matcher for a
/// Expr subclass. Remove this once all Expr subclasses have their own matcher.
static auto &fallbackExprMatcher =;

TEST_F(StructuralEquivalenceStmtTest, AddrLabelExpr) {}

TEST_F(StructuralEquivalenceStmtTest, AddrLabelExprDifferentLabel) {}

static const std::string MemoryOrderSrc =;

TEST_F(StructuralEquivalenceStmtTest, AtomicExpr) {}

TEST_F(StructuralEquivalenceStmtTest, AtomicExprDifferentOp) {}

TEST_F(StructuralEquivalenceStmtTest, BinaryOperator) {}

TEST_F(StructuralEquivalenceStmtTest, BinaryOperatorDifferentOps) {}

TEST_F(StructuralEquivalenceStmtTest, CallExpr) {}

TEST_F(StructuralEquivalenceStmtTest, CallExprDifferentCallee) {}

TEST_F(StructuralEquivalenceStmtTest, CharacterLiteral) {}

TEST_F(StructuralEquivalenceStmtTest, CharacterLiteralDifferentValues) {}

TEST_F(StructuralEquivalenceStmtTest, ExpressionTraitExpr) {}

TEST_F(StructuralEquivalenceStmtTest, ExpressionTraitExprDifferentKind) {}

TEST_F(StructuralEquivalenceStmtTest, FloatingLiteral) {}

TEST_F(StructuralEquivalenceStmtTest, FloatingLiteralDifferentSpelling) {}

TEST_F(StructuralEquivalenceStmtTest, FloatingLiteralDifferentType) {}

TEST_F(StructuralEquivalenceStmtTest, FloatingLiteralDifferentValue) {}

TEST_F(StructuralEquivalenceStmtTest, GenericSelectionExprSame) {}

TEST_F(StructuralEquivalenceStmtTest, GenericSelectionExprSignsDiffer) {}

TEST_F(StructuralEquivalenceStmtTest, GenericSelectionExprOrderDiffers) {}

TEST_F(StructuralEquivalenceStmtTest, GenericSelectionExprDependentResultSame) {}

TEST_F(StructuralEquivalenceStmtTest,
       GenericSelectionExprDependentResultOrderDiffers) {}
TEST_F(StructuralEquivalenceStmtTest, IntegerLiteral) {}

TEST_F(StructuralEquivalenceStmtTest, IntegerLiteralDifferentSpelling) {}

TEST_F(StructuralEquivalenceStmtTest, IntegerLiteralDifferentValue) {}

TEST_F(StructuralEquivalenceStmtTest, IntegerLiteralDifferentTypes) {}

TEST_F(StructuralEquivalenceStmtTest, MemberExpr) {}

TEST_F(StructuralEquivalenceStmtTest, MemberExprDifferentMember) {}

TEST_F(StructuralEquivalenceStmtTest, ObjCStringLiteral) {}

TEST_F(StructuralEquivalenceStmtTest, ObjCStringLiteralDifferentContent) {}

TEST_F(StructuralEquivalenceStmtTest, StringLiteral) {}

TEST_F(StructuralEquivalenceStmtTest, StringLiteralDifferentContent) {}

TEST_F(StructuralEquivalenceStmtTest, StringLiteralDifferentLength) {}

TEST_F(StructuralEquivalenceStmtTest, TypeTraitExpr) {}

TEST_F(StructuralEquivalenceStmtTest, TypeTraitExprDifferentType) {}

TEST_F(StructuralEquivalenceStmtTest, TypeTraitExprDifferentTrait) {}

TEST_F(StructuralEquivalenceStmtTest, TypeTraitExprDifferentTraits) {}

TEST_F(StructuralEquivalenceStmtTest, UnaryExprOrTypeTraitExpr) {}

TEST_F(StructuralEquivalenceStmtTest, UnaryExprOrTypeTraitExprDifferentKind) {}

TEST_F(StructuralEquivalenceStmtTest, UnaryExprOrTypeTraitExprDifferentType) {}

TEST_F(StructuralEquivalenceStmtTest, UnaryOperator) {}

TEST_F(StructuralEquivalenceStmtTest, UnaryOperatorDifferentOps) {}

TEST_F(StructuralEquivalenceStmtTest,
       CXXOperatorCallExprVsUnaryBinaryOperator) {}

TEST_F(StructuralEquivalenceStmtTest,
       CXXOperatorCallExprVsUnaryBinaryOperatorNe) {}

TEST_F(StructuralEquivalenceStmtTest, NonTypeTemplateParm) {}

TEST_F(StructuralEquivalenceStmtTest, UnresolvedLookupDifferentName) {}

TEST_F(StructuralEquivalenceStmtTest, UnresolvedLookupDifferentQualifier) {}

TEST_F(StructuralEquivalenceStmtTest,
       UnresolvedLookupDifferentTemplateArgument) {}

TEST_F(StructuralEquivalenceStmtTest, UnresolvedLookup) {}

TEST_F(StructuralEquivalenceCacheTest, GotoStmtNoEq) {}

TEST_F(StructuralEquivalenceStmtTest, DeclRefExpr) {}

TEST_F(StructuralEquivalenceCacheTest, CXXDependentScopeMemberExprNoEq) {}

} // end namespace ast_matchers
} // end namespace clang