clang 22.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 (const LangOptions &LangOpts, 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 UnsignedOrNone | findUntaggedStructOrUnionIndex (RecordDecl *Anon) |
Find the index of the given anonymous struct/union within its context. |
Public Attributes | |
const LangOptions & | LangOpts |
The language options to use for making a structural equivalence check. | |
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 82 of file ASTStructuralEquivalence.h.
References Complain, EqKind, ErrorOnTagTypeMismatch, FromCtx, IgnoreTemplateParmDepth, LangOpts, NonEquivalentDecls, StrictTypeSpelling, and ToCtx.
DiagnosticBuilder StructuralEquivalenceContext::Diag1 | ( | SourceLocation | Loc, |
unsigned | DiagID ) |
Definition at line 2559 of file ASTStructuralEquivalence.cpp.
References Complain, FromCtx, LastDiagFromC2, and ToCtx.
Referenced by IsStructurallyEquivalent().
DiagnosticBuilder StructuralEquivalenceContext::Diag2 | ( | SourceLocation | Loc, |
unsigned | DiagID ) |
Definition at line 2568 of file ASTStructuralEquivalence.cpp.
References Complain, FromCtx, LastDiagFromC2, and ToCtx.
Referenced by IsStructurallyEquivalent().
|
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 2578 of file ASTStructuralEquivalence.cpp.
References clang::Decl::getASTContext(), clang::Decl::getDeclContext(), and clang::NamedDecl::getIdentifier().
Referenced by IsStructurallyEquivalent().
Definition at line 2616 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 2662 of file ASTStructuralEquivalence.cpp.
References DeclsToCheck, IsStructurallyEquivalent(), and VisitedDecls.
Referenced by clang::Sema::hasStructuralCompatLayout(), IsEquivalentFriend(), clang::ASTImporter::IsStructurallyEquivalent(), clang::ASTNodeImporter::IsStructuralMatch(), and clang::ASTContext::mergeTagDefinitions().
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 2681 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 2690 of file ASTStructuralEquivalence.cpp.
References DeclsToCheck, IsStructurallyEquivalent(), and VisitedDecls.
bool clang::StructuralEquivalenceContext::Complain |
Whether to complain about failures.
Definition at line 74 of file ASTStructuralEquivalence.h.
Referenced by Diag1(), Diag2(), and StructuralEquivalenceContext().
Definition at line 54 of file ASTStructuralEquivalence.h.
Referenced by IsEquivalent(), IsEquivalent(), and IsEquivalent().
StructuralEquivalenceKind clang::StructuralEquivalenceContext::EqKind |
Definition at line 64 of file ASTStructuralEquivalence.h.
Referenced by StructuralEquivalenceContext().
bool clang::StructuralEquivalenceContext::ErrorOnTagTypeMismatch |
Whether warn or error on tag type mismatches.
Definition at line 71 of file ASTStructuralEquivalence.h.
Referenced by getApplicableDiagnostic(), and StructuralEquivalenceContext().
ASTContext& clang::StructuralEquivalenceContext::FromCtx |
AST contexts for which we are checking structural equivalence.
Definition at line 50 of file ASTStructuralEquivalence.h.
Referenced by Diag1(), Diag2(), and StructuralEquivalenceContext().
bool clang::StructuralEquivalenceContext::IgnoreTemplateParmDepth |
Whether to ignore comparing the depth of template param(TemplateTypeParm)
Definition at line 80 of file ASTStructuralEquivalence.h.
Referenced by StructuralEquivalenceContext().
const LangOptions& clang::StructuralEquivalenceContext::LangOpts |
The language options to use for making a structural equivalence check.
Definition at line 47 of file ASTStructuralEquivalence.h.
Referenced by StructuralEquivalenceContext().
true
if the last diagnostic came from ToCtx.
Definition at line 77 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 62 of file ASTStructuralEquivalence.h.
Referenced by StructuralEquivalenceContext().
bool clang::StructuralEquivalenceContext::StrictTypeSpelling |
Whether we're being strict about the spelling of types when unifying two types.
Definition at line 68 of file ASTStructuralEquivalence.h.
Referenced by StructuralEquivalenceContext().
ASTContext & clang::StructuralEquivalenceContext::ToCtx |
Definition at line 50 of file ASTStructuralEquivalence.h.
Referenced by Diag1(), Diag2(), and StructuralEquivalenceContext().
Definition at line 58 of file ASTStructuralEquivalence.h.
Referenced by IsEquivalent(), IsEquivalent(), and IsEquivalent().