clang 20.0.0git
|
#include "clang/AST/ASTStructuralEquivalence.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclFriend.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclOpenMP.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprConcepts.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/ExprOpenMP.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/StmtObjC.h"
#include "clang/AST/StmtOpenACC.h"
#include "clang/AST/StmtOpenMP.h"
#include "clang/AST/TemplateBase.h"
#include "clang/AST/TemplateName.h"
#include "clang/AST/Type.h"
#include "clang/Basic/ExceptionSpecificationType.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include <cassert>
#include <optional>
#include <utility>
#include "clang/AST/StmtNodes.inc"
#include "clang/AST/DeclNodes.inc"
Go to the source code of this file.
Macros | |
#define | STMT(CLASS, PARENT) |
#define | STMT(CLASS, PARENT) |
#define | ABSTRACT_STMT(S) |
#define | ABSTRACT_DECL(DECL) |
#define | DECL(DERIVED, BASE) |
#define ABSTRACT_DECL | ( | DECL | ) |
#define ABSTRACT_STMT | ( | S | ) |
#define DECL | ( | DERIVED, | |
BASE | |||
) |
#define STMT | ( | CLASS, | |
PARENT | |||
) |
Definition at line 413 of file ASTStructuralEquivalence.cpp.
#define STMT | ( | CLASS, | |
PARENT | |||
) |
Definition at line 413 of file ASTStructuralEquivalence.cpp.
|
static |
Determine structural equivalence for the common part of array types.
Definition at line 732 of file ASTStructuralEquivalence.cpp.
References clang::ArrayType::getElementType(), clang::ArrayType::getIndexTypeQualifiers(), clang::ArrayType::getSizeModifier(), and IsStructurallyEquivalent().
Referenced by IsStructurallyEquivalent().
|
static |
Check the equivalence of exception specifications.
Definition at line 773 of file ASTStructuralEquivalence.cpp.
References clang::EST_Dynamic, clang::FunctionProtoType::getExceptionSpecType(), clang::FunctionProtoType::getExceptionType(), clang::FunctionProtoType::getNoexceptExpr(), clang::FunctionProtoType::getNumExceptions(), I, clang::isComputedNoexcept(), IsStructurallyEquivalent(), and clang::isUnresolvedExceptionSpec().
Referenced by IsStructurallyEquivalent().
|
static |
Determine if context of a class is equivalent.
Definition at line 1561 of file ASTStructuralEquivalence.cpp.
References clang::Decl::getDeclContext(), clang::DeclContext::getDeclKind(), clang::DeclContext::getNonTransparentContext(), clang::DeclContext::getParent(), clang::DeclContext::isFunctionOrMethod(), clang::DeclContext::isInlineNamespace(), IsStructurallyEquivalent(), and clang::DeclContext::isTranslationUnit().
Referenced by IsStructurallyEquivalent().
|
static |
Determine whether two identifiers are equivalent.
Definition at line 533 of file ASTStructuralEquivalence.cpp.
References clang::IdentifierInfo::getName().
|
static |
Determine structural equivalence of two template argument lists.
Definition at line 710 of file ASTStructuralEquivalence.cpp.
References I, and IsStructurallyEquivalent().
|
static |
Definition at line 2060 of file ASTStructuralEquivalence.cpp.
References clang::ClassTemplateDecl::getTemplatedDecl(), IsStructurallyEquivalent(), and IsTemplateDeclCommonStructurallyEquivalent().
|
static |
Definition at line 2096 of file ASTStructuralEquivalence.cpp.
References clang::ConceptDecl::getConstraintExpr(), IsStructurallyEquivalent(), and IsTemplateDeclCommonStructurallyEquivalent().
|
static |
Definition at line 468 of file ASTStructuralEquivalence.cpp.
References clang::CallExpr::getArg(), clang::BinaryOperator::getLHS(), clang::BinaryOperator::getOpcode(), clang::CXXOperatorCallExpr::getOperator(), clang::BinaryOperator::getOverloadedOperator(), clang::BinaryOperator::getRHS(), and IsStructurallyEquivalent().
|
static |
Definition at line 477 of file ASTStructuralEquivalence.cpp.
References clang::CallExpr::getArg(), clang::BinaryOperator::getLHS(), clang::BinaryOperator::getOpcode(), clang::CXXOperatorCallExpr::getOperator(), clang::BinaryOperator::getOverloadedOperator(), clang::BinaryOperator::getRHS(), and IsStructurallyEquivalent().
|
static |
|
static |
Definition at line 116 of file ASTStructuralEquivalence.cpp.
References clang::DeclarationName::CXXConstructorName, clang::DeclarationName::CXXConversionFunctionName, clang::DeclarationName::CXXDeductionGuideName, clang::DeclarationName::CXXDestructorName, clang::DeclarationName::CXXLiteralOperatorName, clang::DeclarationName::CXXOperatorName, clang::DeclarationName::CXXUsingDirective, clang::DeclarationName::getAsIdentifierInfo(), clang::DeclarationName::getCXXDeductionGuideTemplate(), clang::DeclarationName::getCXXLiteralIdentifier(), clang::DeclarationName::getCXXNameType(), clang::DeclarationName::getCXXOverloadedOperator(), clang::NamedDecl::getDeclName(), clang::DeclarationName::getNameKind(), clang::DeclarationName::Identifier, IsStructurallyEquivalent(), clang::DeclarationName::ObjCMultiArgSelector, clang::DeclarationName::ObjCOneArgSelector, and clang::DeclarationName::ObjCZeroArgSelector.
|
static |
Determine structural equivalence of two statements.
Definition at line 487 of file ASTStructuralEquivalence.cpp.
References clang::Stmt::children(), and IsStructurallyEquivalent().
|
static |
Determine whether two template arguments are equivalent.
Definition at line 658 of file ASTStructuralEquivalence.cpp.
References clang::TemplateArgument::Declaration, clang::TemplateArgument::Expression, clang::TemplateArgument::getAsDecl(), clang::TemplateArgument::getAsExpr(), clang::TemplateArgument::getAsIntegral(), clang::TemplateArgument::getAsTemplate(), clang::TemplateArgument::getAsTemplateOrTemplatePattern(), clang::TemplateArgument::getAsType(), clang::TemplateArgument::getIntegralType(), clang::TemplateArgument::getKind(), clang::TemplateArgument::Integral, IsStructurallyEquivalent(), clang::TemplateArgument::Null, clang::TemplateArgument::NullPtr, clang::TemplateArgument::Pack, clang::TemplateArgument::pack_elements(), clang::TemplateArgument::structurallyEquals(), clang::TemplateArgument::StructuralValue, clang::TemplateArgument::Template, clang::TemplateArgument::TemplateExpansion, and clang::TemplateArgument::Type.
|
static |
Determine whether two template argument locations are equivalent.
Definition at line 723 of file ASTStructuralEquivalence.cpp.
References clang::TemplateArgumentLoc::getArgument(), and IsStructurallyEquivalent().
|
static |
Definition at line 580 of file ASTStructuralEquivalence.cpp.
References clang::TemplateName::AssumedTemplate, clang::OverloadedTemplateStorage::begin(), clang::TemplateName::DependentTemplate, clang::OverloadedTemplateStorage::end(), clang::SubstTemplateTemplateParmPackStorage::getArgumentPack(), clang::TemplateName::getAsAssumedTemplateName(), clang::TemplateName::getAsDependentTemplateName(), clang::TemplateName::getAsOverloadedTemplate(), clang::SubstTemplateTemplateParmPackStorage::getAssociatedDecl(), clang::TemplateName::getAsSubstTemplateTemplateParmPack(), clang::TemplateName::getAsTemplateDecl(), clang::AssumedTemplateStorage::getDeclName(), clang::DependentTemplateName::getIdentifier(), clang::SubstTemplateTemplateParmPackStorage::getIndex(), clang::TemplateName::getKind(), clang::DependentTemplateName::getOperator(), clang::DependentTemplateName::getQualifier(), clang::DependentTemplateName::isIdentifier(), clang::DependentTemplateName::isOverloadedOperator(), IsStructurallyEquivalent(), clang::TemplateName::OverloadedTemplate, clang::TemplateName::QualifiedTemplate, clang::TemplateName::SubstTemplateTemplateParm, clang::TemplateName::SubstTemplateTemplateParmPack, clang::TemplateName::Template, and clang::TemplateName::UsingTemplate.
|
static |
|
static |
Determine structural equivalence of two methods.
Definition at line 1493 of file ASTStructuralEquivalence.cpp.
References clang::Decl::getAccess(), clang::DeclContext::getDeclKind(), clang::NamedDecl::getIdentifier(), clang::FunctionDecl::getOverloadedOperator(), clang::CXXMethodDecl::getRefQualifier(), clang::ValueDecl::getType(), clang::CXXMethodDecl::isConst(), clang::FunctionDecl::isDefaulted(), clang::FunctionDecl::isDeleted(), clang::CXXMethodDecl::isImplicitObjectMemberFunction(), clang::FunctionDecl::isPureVirtual(), clang::CXXMethodDecl::isStatic(), IsStructurallyEquivalent(), clang::CXXMethodDecl::isVirtual(), and clang::CXXMethodDecl::isVolatile().
|
static |
Determine structural equivalence of two declarations.
Definition at line 2279 of file ASTStructuralEquivalence.cpp.
References clang::Decl::getCanonicalDecl(), and P.
|
static |
Definition at line 1857 of file ASTStructuralEquivalence.cpp.
References clang::NamedDecl::getIdentifier(), clang::EnumConstantDecl::getInitExpr(), clang::EnumConstantDecl::getInitVal(), and IsStructurallyEquivalent().
|
static |
Determine structural equivalence of two enums.
Definition at line 1878 of file ASTStructuralEquivalence.cpp.
References clang::EnumDecl::enumerator_begin(), clang::EnumDecl::enumerator_end(), clang::EnumDecl::getDefinition(), clang::Decl::getLocation(), clang::ASTContext::getTypeDeclType(), IsStructurallyEquivalent(), NameIsStructurallyEquivalent(), and toString().
|
static |
Determine structural equivalence of two fields.
Definition at line 1485 of file ASTStructuralEquivalence.cpp.
References clang::Decl::getDeclContext(), clang::ASTContext::getTypeDeclType(), and IsStructurallyEquivalent().
|
static |
Definition at line 1430 of file ASTStructuralEquivalence.cpp.
References clang::Type::castAs(), clang::FieldDecl::getBitWidth(), clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::NamedDecl::getIdentifier(), clang::Decl::getLocation(), clang::ValueDecl::getType(), clang::FieldDecl::isAnonymousStructOrUnion(), clang::FieldDecl::isBitField(), and IsStructurallyEquivalent().
|
static |
Definition at line 2108 of file ASTStructuralEquivalence.cpp.
References clang::FriendDecl::getFriendDecl(), clang::FriendDecl::getFriendType(), clang::TypeSourceInfo::getType(), and IsStructurallyEquivalent().
|
static |
Definition at line 2133 of file ASTStructuralEquivalence.cpp.
References clang::NamedDecl::getIdentifier(), clang::FunctionDecl::getOverloadedOperator(), clang::ValueDecl::getType(), clang::FunctionDecl::isOverloadedOperator(), and IsStructurallyEquivalent().
|
static |
Definition at line 2072 of file ASTStructuralEquivalence.cpp.
References clang::FunctionTemplateDecl::getTemplatedDecl(), clang::ValueDecl::getType(), IsStructurallyEquivalent(), and IsTemplateDeclCommonStructurallyEquivalent().
|
static |
Determine structural equivalence based on the ExtInfo of functions.
This is inspired by ASTContext::mergeFunctionTypes(), we compare calling conventions bits but must not compare some other bits.
Definition at line 749 of file ASTStructuralEquivalence.cpp.
References clang::FunctionType::ExtInfo::getCC(), clang::FunctionType::ExtInfo::getHasRegParm(), clang::FunctionType::ExtInfo::getNoCallerSavedRegs(), clang::FunctionType::ExtInfo::getNoCfCheck(), clang::FunctionType::ExtInfo::getProducesResult(), and clang::FunctionType::ExtInfo::getRegParm().
|
static |
Determine whether two nested-name-specifiers are equivalent.
Definition at line 542 of file ASTStructuralEquivalence.cpp.
References clang::NestedNameSpecifier::getAsIdentifier(), clang::NestedNameSpecifier::getAsNamespace(), clang::NestedNameSpecifier::getAsNamespaceAlias(), clang::NestedNameSpecifier::getAsRecordDecl(), clang::NestedNameSpecifier::getAsType(), clang::NestedNameSpecifier::getKind(), clang::NestedNameSpecifier::getPrefix(), clang::NestedNameSpecifier::Global, clang::NestedNameSpecifier::Identifier, IsStructurallyEquivalent(), clang::NestedNameSpecifier::Namespace, clang::NestedNameSpecifier::NamespaceAlias, clang::NestedNameSpecifier::Super, clang::NestedNameSpecifier::TypeSpec, and clang::NestedNameSpecifier::TypeSpecWithTemplate.
|
static |
Definition at line 1995 of file ASTStructuralEquivalence.cpp.
References clang::NonTypeTemplateParmDecl::getDepth(), clang::NonTypeTemplateParmDecl::getIndex(), clang::Decl::getLocation(), clang::ValueDecl::getType(), clang::NonTypeTemplateParmDecl::isParameterPack(), and IsStructurallyEquivalent().
|
static |
Definition at line 2215 of file ASTStructuralEquivalence.cpp.
References clang::ObjCCategoryDecl::getClassInterface(), clang::NamedDecl::getIdentifier(), clang::ASTContext::getObjCInterfaceType(), IsStructurallyEquivalent(), clang::ObjCCategoryDecl::ivar_begin(), clang::ObjCCategoryDecl::ivar_end(), clang::ObjCContainerDecl::meth_begin(), clang::ObjCContainerDecl::meth_end(), clang::ObjCCategoryDecl::protocol_begin(), and clang::ObjCCategoryDecl::protocol_end().
|
static |
Definition at line 2162 of file ASTStructuralEquivalence.cpp.
References clang::ObjCIvarDecl::getContainingInterface(), clang::ASTContext::getObjCInterfaceType(), and IsStructurallyEquivalent().
|
static |
Definition at line 2152 of file ASTStructuralEquivalence.cpp.
References clang::ObjCIvarDecl::getAccessControl(), and IsStructurallyEquivalent().
|
static |
Definition at line 2169 of file ASTStructuralEquivalence.cpp.
References clang::Selector::getIdentifierInfoForSlot(), clang::Selector::getNumArgs(), clang::ObjCMethodDecl::getReturnType(), clang::ObjCMethodDecl::getSelector(), I, clang::ObjCMethodDecl::isDirectMethod(), clang::ObjCMethodDecl::isInstanceMethod(), IsStructurallyEquivalent(), clang::ObjCMethodDecl::isVariadic(), clang::ObjCMethodDecl::param_size(), clang::ObjCMethodDecl::param_type_begin(), and clang::ObjCMethodDecl::param_type_end().
|
static |
Determine structural equivalence of two types.
Definition at line 803 of file ASTStructuralEquivalence.cpp.
References clang::ASTContext::getCanonicalType(), clang::DependentSizedMatrixType::getColumnExpr(), clang::QualType::getDesugaredType(), clang::MatrixType::getElementType(), getKind(), clang::ConstantMatrixType::getNumColumns(), clang::ConstantMatrixType::getNumRows(), getPointeeType(), clang::QualType::getQualifiers(), clang::DependentSizedMatrixType::getRowExpr(), clang::Type::getTypeClass(), getUnderlyingType(), I, IsArrayStructurallyEquivalent(), IsEquivalentExceptionSpec(), clang::QualType::isNull(), and IsStructurallyEquivalent().
Referenced by IsArrayStructurallyEquivalent(), clang::StructuralEquivalenceContext::IsEquivalent(), IsEquivalentExceptionSpec(), IsRecordContextStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalentLambdas(), IsTemplateDeclCommonStructurallyEquivalent(), and NameIsStructurallyEquivalent().
|
static |
Determine structural equivalence of two records.
Definition at line 1614 of file ASTStructuralEquivalence.cpp.
References clang::ExternalASTSource::CompleteType(), clang::RecordDecl::field_begin(), clang::RecordDecl::field_end(), clang::StructuralEquivalenceContext::findUntaggedStructOrUnionIndex(), clang::Decl::getASTContext(), clang::CXXBaseSpecifier::getBeginLoc(), clang::NamedDecl::getDeclName(), clang::RecordDecl::getDefinition(), clang::ASTContext::getExternalSource(), clang::Decl::getLocation(), clang::CXXBaseSpecifier::getSourceRange(), clang::TagDecl::getTagKind(), clang::CXXBaseSpecifier::getType(), clang::ASTContext::getTypeDeclType(), clang::DeclContext::hasExternalLexicalStorage(), I, clang::TagDecl::isBeingDefined(), IsRecordContextStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalentLambdas(), clang::TagDecl::isUnion(), and NameIsStructurallyEquivalent().
|
static |
Definition at line 1942 of file ASTStructuralEquivalence.cpp.
References clang::Decl::getKind(), clang::Decl::getLocation(), clang::TemplateParameterList::getParam(), clang::TemplateParameterList::getTemplateLoc(), I, IsStructurallyEquivalent(), and clang::TemplateParameterList::size().
|
static |
Definition at line 2029 of file ASTStructuralEquivalence.cpp.
References clang::Decl::getLocation(), clang::TemplateDecl::getTemplateParameters(), clang::TemplateTemplateParmDecl::isParameterPack(), and IsStructurallyEquivalent().
|
static |
Definition at line 1977 of file ASTStructuralEquivalence.cpp.
References clang::Decl::getLocation(), and clang::TemplateTypeParmDecl::isParameterPack().
|
static |
Definition at line 2084 of file ASTStructuralEquivalence.cpp.
References clang::TypeAliasTemplateDecl::getTemplatedDecl(), IsStructurallyEquivalent(), and IsTemplateDeclCommonStructurallyEquivalent().
|
static |
Definition at line 2124 of file ASTStructuralEquivalence.cpp.
References clang::NamedDecl::getIdentifier(), clang::TypedefNameDecl::getUnderlyingType(), and IsStructurallyEquivalent().
|
static |
Definition at line 1408 of file ASTStructuralEquivalence.cpp.
References clang::NamedDecl::getIdentifier(), clang::VarDecl::getInit(), clang::VarDecl::getStorageClass(), clang::ValueDecl::getType(), IsStructurallyEquivalent(), and clang::VarDecl::isThisDeclarationADefinition().
|
static |
Determine structural equivalence of two lambda classes.
Definition at line 1548 of file ASTStructuralEquivalence.cpp.
References clang::CXXRecordDecl::getLambdaCallOperator(), clang::CXXRecordDecl::isLambda(), and IsStructurallyEquivalent().
Referenced by IsStructurallyEquivalent().
|
static |
Definition at line 2049 of file ASTStructuralEquivalence.cpp.
References clang::NamedDecl::getIdentifier(), clang::NamedDecl::getNameAsString(), clang::TemplateDecl::getTemplateParameters(), and IsStructurallyEquivalent().
Referenced by IsStructurallyEquivalent().
Definition at line 1602 of file ASTStructuralEquivalence.cpp.
References D, and IsStructurallyEquivalent().
Referenced by IsStructurallyEquivalent().