clang 20.0.0git
|
#include "clang/AST/ASTStructuralEquivalence.h"
Public Types | |
using | NonEquivalentDeclSet = llvm::DenseSet< std::tuple< Decl *, Decl *, int > > |
Store declaration pairs already found to be non-equivalent. | |
Public Member Functions | |
StructuralEquivalenceContext (ASTContext &FromCtx, ASTContext &ToCtx, NonEquivalentDeclSet &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 |
NonEquivalentDeclSet & | 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.
using clang::StructuralEquivalenceContext::NonEquivalentDeclSet = llvm::DenseSet<std::tuple<Decl *, Decl *, int> > |
Store declaration pairs already found to be non-equivalent.
key: (from, to, IgnoreTemplateParmDepth)
Definition at line 44 of file ASTStructuralEquivalence.h.
|
inline |
Definition at line 79 of file ASTStructuralEquivalence.h.
DiagnosticBuilder StructuralEquivalenceContext::Diag1 | ( | SourceLocation | Loc, |
unsigned | DiagID | ||
) |
Definition at line 2321 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 2330 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 2340 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 2382 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 2428 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 2447 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 2456 of file ASTStructuralEquivalence.cpp.
References DeclsToCheck, IsStructurallyEquivalent(), and VisitedDecls.
bool clang::StructuralEquivalenceContext::Complain |
Whether to complain about failures.
Definition at line 71 of file ASTStructuralEquivalence.h.
Definition at line 51 of file ASTStructuralEquivalence.h.
Referenced by IsEquivalent().
StructuralEquivalenceKind clang::StructuralEquivalenceContext::EqKind |
Definition at line 61 of file ASTStructuralEquivalence.h.
bool clang::StructuralEquivalenceContext::ErrorOnTagTypeMismatch |
Whether warn or error on tag type mismatches.
Definition at line 68 of file ASTStructuralEquivalence.h.
Referenced by getApplicableDiagnostic().
ASTContext& clang::StructuralEquivalenceContext::FromCtx |
AST contexts for which we are checking structural equivalence.
Definition at line 47 of file ASTStructuralEquivalence.h.
bool clang::StructuralEquivalenceContext::IgnoreTemplateParmDepth |
Whether to ignore comparing the depth of template param(TemplateTypeParm)
Definition at line 77 of file ASTStructuralEquivalence.h.
true
if the last diagnostic came from ToCtx.
Definition at line 74 of file ASTStructuralEquivalence.h.
NonEquivalentDeclSet& clang::StructuralEquivalenceContext::NonEquivalentDecls |
Declaration (from, to) pairs that are known not to be equivalent (which we have already complained about).
Definition at line 59 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 65 of file ASTStructuralEquivalence.h.
ASTContext & clang::StructuralEquivalenceContext::ToCtx |
Definition at line 47 of file ASTStructuralEquivalence.h.
Definition at line 55 of file ASTStructuralEquivalence.h.
Referenced by IsEquivalent().