clang 20.0.0git
|
#include "clang/AST/ASTStructuralEquivalence.h"
Public Member Functions | |
StructuralEquivalenceContext (ASTContext &FromCtx, ASTContext &ToCtx, llvm::DenseSet< std::pair< Decl *, Decl * > > &NonEquivalentDecls, StructuralEquivalenceKind EqKind, bool StrictTypeSpelling=false, bool Complain=true, bool ErrorOnTagTypeMismatch=false, bool IgnoreTemplateParmDepth=false) | |
DiagnosticBuilder | Diag1 (SourceLocation Loc, unsigned DiagID) |
DiagnosticBuilder | Diag2 (SourceLocation Loc, unsigned DiagID) |
bool | IsEquivalent (Decl *D1, Decl *D2) |
Determine whether the two declarations are structurally equivalent. | |
bool | IsEquivalent (QualType T1, QualType T2) |
Determine whether the two types are structurally equivalent. | |
bool | IsEquivalent (Stmt *S1, Stmt *S2) |
Determine whether the two statements are structurally equivalent. | |
unsigned | getApplicableDiagnostic (unsigned ErrorDiagnostic) |
Static Public Member Functions | |
static std::optional< unsigned > | findUntaggedStructOrUnionIndex (RecordDecl *Anon) |
Find the index of the given anonymous struct/union within its context. | |
Public Attributes | |
ASTContext & | FromCtx |
AST contexts for which we are checking structural equivalence. | |
ASTContext & | ToCtx |
std::queue< std::pair< Decl *, Decl * > > | DeclsToCheck |
llvm::DenseSet< std::pair< Decl *, Decl * > > | VisitedDecls |
llvm::DenseSet< std::pair< Decl *, Decl * > > & | NonEquivalentDecls |
Declaration (from, to) pairs that are known not to be equivalent (which we have already complained about). | |
StructuralEquivalenceKind | EqKind |
bool | StrictTypeSpelling |
Whether we're being strict about the spelling of types when unifying two types. | |
bool | ErrorOnTagTypeMismatch |
Whether warn or error on tag type mismatches. | |
bool | Complain |
Whether to complain about failures. | |
bool | LastDiagFromC2 = false |
true if the last diagnostic came from ToCtx. | |
bool | IgnoreTemplateParmDepth |
Whether to ignore comparing the depth of template param(TemplateTypeParm) | |
Definition at line 41 of file ASTStructuralEquivalence.h.
|
inline |
Definition at line 75 of file ASTStructuralEquivalence.h.
DiagnosticBuilder StructuralEquivalenceContext::Diag1 | ( | SourceLocation | Loc, |
unsigned | DiagID | ||
) |
Definition at line 2304 of file ASTStructuralEquivalence.cpp.
References Complain, FromCtx, clang::ASTContext::getDiagnostics(), LastDiagFromC2, Loc, clang::DiagnosticsEngine::notePriorDiagnosticFrom(), clang::DiagnosticsEngine::Report(), and ToCtx.
DiagnosticBuilder StructuralEquivalenceContext::Diag2 | ( | SourceLocation | Loc, |
unsigned | DiagID | ||
) |
Definition at line 2313 of file ASTStructuralEquivalence.cpp.
References Complain, FromCtx, clang::ASTContext::getDiagnostics(), LastDiagFromC2, Loc, clang::DiagnosticsEngine::notePriorDiagnosticFrom(), clang::DiagnosticsEngine::Report(), and ToCtx.
|
static |
Find the index of the given anonymous struct/union within its context.
FIXME: This is needed by ASTImporter and ASTStructureEquivalence. It probably makes more sense in some other common place then here.
Definition at line 2323 of file ASTStructuralEquivalence.cpp.
References D, clang::Decl::getASTContext(), clang::Decl::getDeclContext(), clang::NamedDecl::getIdentifier(), clang::ASTContext::getRecordType(), and clang::ASTContext::hasSameType().
Referenced by IsStructurallyEquivalent().
Definition at line 2365 of file ASTStructuralEquivalence.cpp.
References ErrorOnTagTypeMismatch.
Determine whether the two declarations are structurally equivalent.
Implementation functions (all static functions in ASTStructuralEquivalence.cpp) must never call this function because that will wreak havoc the internal state (DeclsToCheck
and VisitedDecls
members) and can cause faulty equivalent results.
Definition at line 2411 of file ASTStructuralEquivalence.cpp.
References DeclsToCheck, IsStructurallyEquivalent(), and VisitedDecls.
Referenced by clang::Sema::hasStructuralCompatLayout(), IsEquivalentFriend(), clang::ASTImporter::IsStructurallyEquivalent(), and clang::ASTNodeImporter::IsStructuralMatch().
Determine whether the two types are structurally equivalent.
Implementation functions (all static functions in ASTStructuralEquivalence.cpp) must never call this function because that will wreak havoc the internal state (DeclsToCheck
and VisitedDecls
members) and can cause faulty equivalent results.
Definition at line 2430 of file ASTStructuralEquivalence.cpp.
References DeclsToCheck, IsStructurallyEquivalent(), and VisitedDecls.
Determine whether the two statements are structurally equivalent.
Implementation functions (all static functions in ASTStructuralEquivalence.cpp) must never call this function because that will wreak havoc the internal state (DeclsToCheck
and VisitedDecls
members) and can cause faulty equivalent results.
Definition at line 2439 of file ASTStructuralEquivalence.cpp.
References DeclsToCheck, IsStructurallyEquivalent(), and VisitedDecls.
bool clang::StructuralEquivalenceContext::Complain |
Whether to complain about failures.
Definition at line 67 of file ASTStructuralEquivalence.h.
Definition at line 47 of file ASTStructuralEquivalence.h.
Referenced by IsEquivalent().
StructuralEquivalenceKind clang::StructuralEquivalenceContext::EqKind |
Definition at line 57 of file ASTStructuralEquivalence.h.
bool clang::StructuralEquivalenceContext::ErrorOnTagTypeMismatch |
Whether warn or error on tag type mismatches.
Definition at line 64 of file ASTStructuralEquivalence.h.
Referenced by getApplicableDiagnostic().
ASTContext& clang::StructuralEquivalenceContext::FromCtx |
AST contexts for which we are checking structural equivalence.
Definition at line 43 of file ASTStructuralEquivalence.h.
bool clang::StructuralEquivalenceContext::IgnoreTemplateParmDepth |
Whether to ignore comparing the depth of template param(TemplateTypeParm)
Definition at line 73 of file ASTStructuralEquivalence.h.
true
if the last diagnostic came from ToCtx.
Definition at line 70 of file ASTStructuralEquivalence.h.
Declaration (from, to) pairs that are known not to be equivalent (which we have already complained about).
Definition at line 55 of file ASTStructuralEquivalence.h.
bool clang::StructuralEquivalenceContext::StrictTypeSpelling |
Whether we're being strict about the spelling of types when unifying two types.
Definition at line 61 of file ASTStructuralEquivalence.h.
ASTContext & clang::StructuralEquivalenceContext::ToCtx |
Definition at line 43 of file ASTStructuralEquivalence.h.
Definition at line 51 of file ASTStructuralEquivalence.h.
Referenced by IsEquivalent().