|
clang 23.0.0git
|
#include "clang/AST/ASTStructuralEquivalence.h"#include "clang/AST/ASTContext.h"#include "clang/AST/ASTDiagnostic.h"#include "clang/AST/Attr.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/DeclOpenACC.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/StmtSYCL.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/STLExtras.h"#include "llvm/ADT/StringExtras.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 416 of file ASTStructuralEquivalence.cpp.
| #define STMT | ( | CLASS, | |
| PARENT ) |
Definition at line 416 of file ASTStructuralEquivalence.cpp.
|
static |
Determines whether D1 and D2 have compatible sets of attributes for the purposes of structural equivalence checking.
Definition at line 471 of file ASTStructuralEquivalence.cpp.
References clang::Decl::attrs(), and clang::Decl::isImplicit().
Referenced by CheckStructurallyEquivalentAttributes().
|
static |
Definition at line 506 of file ASTStructuralEquivalence.cpp.
References areDeclAttrsEquivalent(), clang::cast(), and clang::AttributeCommonInfo::getLoc().
Referenced by IsStructurallyEquivalent(), IsStructurallyEquivalent(), and IsStructurallyEquivalent().
|
static |
Determine structural equivalence for the common part of array types.
Definition at line 817 of file ASTStructuralEquivalence.cpp.
References clang::ArrayType::getElementType(), clang::ArrayType::getIndexTypeQualifiers(), clang::ArrayType::getSizeModifier(), and IsStructurallyEquivalent().
Referenced by clang::ASTStructuralEquivalence::isEquivalent().
|
static |
Check the equivalence of exception specifications.
Definition at line 858 of file ASTStructuralEquivalence.cpp.
References clang::EST_Dynamic, clang::FunctionProtoType::getExceptionSpecType(), clang::FunctionProtoType::getExceptionType(), clang::FunctionProtoType::getNoexceptExpr(), clang::FunctionProtoType::getNumExceptions(), clang::isComputedNoexcept(), IsStructurallyEquivalent(), and clang::isUnresolvedExceptionSpec().
Referenced by clang::ASTStructuralEquivalence::isEquivalent().
|
static |
Determine if context of a class is equivalent.
Definition at line 1751 of file ASTStructuralEquivalence.cpp.
References clang::cast(), 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 |
Definition at line 624 of file ASTStructuralEquivalence.cpp.
References clang::ASTStructuralEquivalence::isEquivalent().
|
static |
Determine structural equivalence of two template argument lists.
Definition at line 795 of file ASTStructuralEquivalence.cpp.
References IsStructurallyEquivalent().
|
static |
Definition at line 2362 of file ASTStructuralEquivalence.cpp.
References clang::ClassTemplateDecl::getTemplatedDecl(), IsStructurallyEquivalent(), and IsTemplateDeclCommonStructurallyEquivalent().
|
static |
Definition at line 2398 of file ASTStructuralEquivalence.cpp.
References clang::ConceptDecl::getConstraintExpr(), IsStructurallyEquivalent(), and IsTemplateDeclCommonStructurallyEquivalent().
|
static |
Definition at line 546 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 555 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 119 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 |
Definition at line 659 of file ASTStructuralEquivalence.cpp.
References clang::IdentifierOrOverloadedOperator::getIdentifier(), clang::DependentTemplateStorage::getName(), clang::IdentifierOrOverloadedOperator::getOperator(), clang::DependentTemplateStorage::getQualifier(), and IsStructurallyEquivalent().
|
static |
Definition at line 610 of file ASTStructuralEquivalence.cpp.
References clang::ASTStructuralEquivalence::isEquivalent().
|
static |
Determine whether two template arguments are equivalent.
Definition at line 743 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 808 of file ASTStructuralEquivalence.cpp.
References clang::TemplateArgumentLoc::getArgument(), and IsStructurallyEquivalent().
|
static |
Definition at line 672 of file ASTStructuralEquivalence.cpp.
References clang::TemplateName::AssumedTemplate, clang::OverloadedTemplateStorage::begin(), clang::TemplateName::DeducedTemplate, 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::SubstTemplateTemplateParmPackStorage::getIndex(), clang::TemplateName::getKind(), 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 1678 of file ASTStructuralEquivalence.cpp.
References clang::cast(), 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 2581 of file ASTStructuralEquivalence.cpp.
References clang::Decl::getCanonicalDecl().
|
static |
Definition at line 2086 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 2107 of file ASTStructuralEquivalence.cpp.
References CheckStructurallyEquivalentAttributes(), clang::EnumDecl::enumerators(), clang::EnumDecl::getDefinition(), clang::EnumDecl::getIntegerType(), clang::Decl::getLocation(), clang::NamedDecl::getName(), clang::EnumDecl::isFixed(), IsStructurallyEquivalent(), NameIsStructurallyEquivalent(), and toString().
|
static |
Determine structural equivalence of two fields.
Definition at line 1662 of file ASTStructuralEquivalence.cpp.
References clang::cast(), clang::Decl::getDeclContext(), and IsStructurallyEquivalent().
|
static |
Definition at line 1571 of file ASTStructuralEquivalence.cpp.
References clang::cast(), clang::Type::castAs(), CheckStructurallyEquivalentAttributes(), Diag(), clang::StructuralEquivalenceContext::Diag1(), clang::StructuralEquivalenceContext::Diag2(), clang::FieldDecl::getBitWidth(), clang::FieldDecl::getBitWidthValue(), 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 2410 of file ASTStructuralEquivalence.cpp.
References clang::FriendDecl::getFriendDecl(), clang::FriendDecl::getFriendType(), clang::TypeSourceInfo::getType(), and IsStructurallyEquivalent().
|
static |
Definition at line 2435 of file ASTStructuralEquivalence.cpp.
References clang::NamedDecl::getIdentifier(), clang::FunctionDecl::getOverloadedOperator(), clang::ValueDecl::getType(), clang::FunctionDecl::isOverloadedOperator(), and IsStructurallyEquivalent().
|
static |
Definition at line 2374 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 834 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 structural equivalence of two IndirectFields.
Definition at line 1670 of file ASTStructuralEquivalence.cpp.
References clang::IndirectFieldDecl::getAnonField(), and IsStructurallyEquivalent().
|
static |
Determine whether two nested-name-specifiers are equivalent.
Definition at line 630 of file ASTStructuralEquivalence.cpp.
References clang::NestedNameSpecifier::getAsMicrosoftSuper(), clang::NestedNameSpecifier::getAsNamespaceAndPrefix(), clang::NestedNameSpecifier::getAsType(), clang::NestedNameSpecifier::getKind(), clang::NestedNameSpecifier::Global, IsStructurallyEquivalent(), clang::NestedNameSpecifier::MicrosoftSuper, clang::NestedNameSpecifier::Namespace, clang::NestedNameSpecifier::Null, and clang::NestedNameSpecifier::Type.
|
static |
Definition at line 2296 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 2517 of file ASTStructuralEquivalence.cpp.
References clang::ObjCCategoryDecl::getClassInterface(), clang::NamedDecl::getIdentifier(), 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 2464 of file ASTStructuralEquivalence.cpp.
References clang::ObjCIvarDecl::getContainingInterface(), and IsStructurallyEquivalent().
|
static |
Definition at line 2454 of file ASTStructuralEquivalence.cpp.
References clang::cast(), clang::ObjCIvarDecl::getAccessControl(), and IsStructurallyEquivalent().
|
static |
Definition at line 2471 of file ASTStructuralEquivalence.cpp.
References clang::Selector::getIdentifierInfoForSlot(), clang::Selector::getNumArgs(), clang::ObjCMethodDecl::getReturnType(), clang::ObjCMethodDecl::getSelector(), 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 |
Definition at line 1544 of file ASTStructuralEquivalence.cpp.
References clang::ASTStructuralEquivalence::isEquivalent().
Referenced by IsArrayStructurallyEquivalent(), clang::StructuralEquivalenceContext::IsEquivalent(), clang::StructuralEquivalenceContext::IsEquivalent(), clang::StructuralEquivalenceContext::IsEquivalent(), clang::ASTStructuralEquivalence::isEquivalent(), clang::ASTStructuralEquivalence::isEquivalent(), IsEquivalentExceptionSpec(), IsRecordContextStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalentLambdas(), IsTemplateDeclCommonStructurallyEquivalent(), and NameIsStructurallyEquivalent().
|
static |
Determine structural equivalence of two records.
Definition at line 1804 of file ASTStructuralEquivalence.cpp.
References CheckStructurallyEquivalentAttributes(), clang::RecordDecl::field_begin(), clang::RecordDecl::field_end(), clang::StructuralEquivalenceContext::findUntaggedStructOrUnionIndex(), clang::CXXBaseSpecifier::getBeginLoc(), clang::NamedDecl::getDeclName(), clang::RecordDecl::getDefinition(), clang::Decl::getLocation(), clang::CXXBaseSpecifier::getSourceRange(), clang::TagDecl::getTagKind(), clang::CXXBaseSpecifier::getType(), clang::DeclContext::hasExternalLexicalStorage(), clang::TagDecl::isBeingDefined(), IsRecordContextStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalentLambdas(), clang::TagDecl::isUnion(), clang::Minimal, and NameIsStructurallyEquivalent().
|
static |
|
static |
|
static |
Definition at line 2278 of file ASTStructuralEquivalence.cpp.
References clang::Decl::getLocation(), and clang::TemplateTypeParmDecl::isParameterPack().
|
static |
Definition at line 2386 of file ASTStructuralEquivalence.cpp.
References clang::TypeAliasTemplateDecl::getTemplatedDecl(), IsStructurallyEquivalent(), and IsTemplateDeclCommonStructurallyEquivalent().
|
static |
Definition at line 2426 of file ASTStructuralEquivalence.cpp.
References clang::NamedDecl::getIdentifier(), clang::TypedefNameDecl::getUnderlyingType(), and IsStructurallyEquivalent().
|
static |
Definition at line 1549 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 1738 of file ASTStructuralEquivalence.cpp.
References clang::CXXRecordDecl::getLambdaCallOperator(), clang::CXXRecordDecl::isLambda(), and IsStructurallyEquivalent().
Referenced by IsStructurallyEquivalent().
|
static |
Definition at line 2351 of file ASTStructuralEquivalence.cpp.
References clang::NamedDecl::getIdentifier(), clang::NamedDecl::getNameAsString(), clang::TemplateDecl::getTemplateParameters(), and IsStructurallyEquivalent().
Referenced by IsStructurallyEquivalent(), IsStructurallyEquivalent(), IsStructurallyEquivalent(), and IsStructurallyEquivalent().
Definition at line 1792 of file ASTStructuralEquivalence.cpp.
References IsStructurallyEquivalent().
Referenced by IsStructurallyEquivalent(), and IsStructurallyEquivalent().