struct StructuralEquivalenceContext
Declaration
struct StructuralEquivalenceContext { /* full declaration omitted */ };
Declared at: clang/include/clang/AST/ASTStructuralEquivalence.h:41
Member Variables
- public clang::ASTContext& FromCtx
- AST contexts for which we are checking structural equivalence.
- public clang::ASTContext& ToCtx
- AST contexts for which we are checking structural equivalence.
- public std::queue<std::pair<Decl*, Decl*>> DeclsToCheck
- public llvm::DenseSet<std::pair<Decl*, Decl*>> VisitedDecls
- public llvm::DenseSet<std::pair<Decl*, Decl*>>& NonEquivalentDecls
- Declaration (from, to) pairs that are known not to be equivalent (which we have already complained about).
- public clang::StructuralEquivalenceKind EqKind
- public bool StrictTypeSpelling
- Whether we're being strict about the spelling of types when unifying two types.
- public bool ErrorOnTagTypeMismatch
- Whether warn or error on tag type mismatches.
- public bool Complain
- Whether to complain about failures.
- public bool LastDiagFromC2 = false
- \c true if the last diagnostic came from ToCtx.
Method Overview
- private bool CheckCommonEquivalence(clang::Decl * D1, clang::Decl * D2)
- private bool CheckKindSpecificEquivalence(clang::Decl * D1, clang::Decl * D2)
- public clang::DiagnosticBuilder Diag1(clang::SourceLocation Loc, unsigned int DiagID)
- public clang::DiagnosticBuilder Diag2(clang::SourceLocation Loc, unsigned int DiagID)
- private bool Finish()
- public bool IsEquivalent(clang::Decl * D1, clang::Decl * D2)
- public bool IsEquivalent(clang::QualType T1, clang::QualType T2)
- public bool IsEquivalent(clang::Stmt * S1, clang::Stmt * S2)
- public StructuralEquivalenceContext(clang::ASTContext & FromCtx, clang::ASTContext & ToCtx, llvm::DenseSet<std::pair<Decl *, Decl *>> & NonEquivalentDecls, clang::StructuralEquivalenceKind EqKind, bool StrictTypeSpelling = false, bool Complain = true, bool ErrorOnTagTypeMismatch = false)
- public static llvm::Optional<unsigned int> findUntaggedStructOrUnionIndex(clang::RecordDecl * Anon)
- public unsigned int getApplicableDiagnostic(unsigned int ErrorDiagnostic)
Methods
¶bool CheckCommonEquivalence(clang::Decl* D1,
clang::Decl* D2)
bool CheckCommonEquivalence(clang::Decl* D1,
clang::Decl* D2)
Description
Check for common properties at Finish.
Declared at: clang/include/clang/AST/ASTStructuralEquivalence.h:134
Parameters
- clang::Decl* D1
- clang::Decl* D2
Returns
true if D1 and D2 may be equivalent, false if they are for sure not.
¶bool CheckKindSpecificEquivalence(clang::Decl* D1,
clang::Decl* D2)
bool CheckKindSpecificEquivalence(clang::Decl* D1,
clang::Decl* D2)
Description
Check for class dependent properties at Finish.
Declared at: clang/include/clang/AST/ASTStructuralEquivalence.h:139
Parameters
- clang::Decl* D1
- clang::Decl* D2
Returns
true if D1 and D2 may be equivalent, false if they are for sure not.
¶clang::DiagnosticBuilder Diag1(
clang::SourceLocation Loc,
unsigned int DiagID)
clang::DiagnosticBuilder Diag1(
clang::SourceLocation Loc,
unsigned int DiagID)
Declared at: clang/include/clang/AST/ASTStructuralEquivalence.h:82
Parameters
- clang::SourceLocation Loc
- unsigned int DiagID
¶clang::DiagnosticBuilder Diag2(
clang::SourceLocation Loc,
unsigned int DiagID)
clang::DiagnosticBuilder Diag2(
clang::SourceLocation Loc,
unsigned int DiagID)
Declared at: clang/include/clang/AST/ASTStructuralEquivalence.h:83
Parameters
- clang::SourceLocation Loc
- unsigned int DiagID
¶bool Finish()
bool Finish()
Description
Finish checking all of the structural equivalences.
Declared at: clang/include/clang/AST/ASTStructuralEquivalence.h:129
Returns
true if the equivalence check failed (non-equivalence detected), false if equivalence was detected.
¶bool IsEquivalent(clang::Decl* D1,
clang::Decl* D2)
bool IsEquivalent(clang::Decl* D1,
clang::Decl* D2)
Description
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 (\c DeclsToCheck and\c VisitedDecls members) and can cause faulty equivalent results.
Declared at: clang/include/clang/AST/ASTStructuralEquivalence.h:91
Parameters
- clang::Decl* D1
- clang::Decl* D2
¶bool IsEquivalent(clang::QualType T1,
clang::QualType T2)
bool IsEquivalent(clang::QualType T1,
clang::QualType T2)
Description
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 (\c DeclsToCheck and\c VisitedDecls members) and can cause faulty equivalent results.
Declared at: clang/include/clang/AST/ASTStructuralEquivalence.h:98
Parameters
¶bool IsEquivalent(clang::Stmt* S1,
clang::Stmt* S2)
bool IsEquivalent(clang::Stmt* S1,
clang::Stmt* S2)
Description
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 (\c DeclsToCheck and\c VisitedDecls members) and can cause faulty equivalent results.
Declared at: clang/include/clang/AST/ASTStructuralEquivalence.h:105
Parameters
- clang::Stmt* S1
- clang::Stmt* S2
¶StructuralEquivalenceContext(
clang::ASTContext& FromCtx,
clang::ASTContext& ToCtx,
llvm::DenseSet<std::pair<Decl*, Decl*>>&
NonEquivalentDecls,
clang::StructuralEquivalenceKind EqKind,
bool StrictTypeSpelling = false,
bool Complain = true,
bool ErrorOnTagTypeMismatch = false)
StructuralEquivalenceContext(
clang::ASTContext& FromCtx,
clang::ASTContext& ToCtx,
llvm::DenseSet<std::pair<Decl*, Decl*>>&
NonEquivalentDecls,
clang::StructuralEquivalenceKind EqKind,
bool StrictTypeSpelling = false,
bool Complain = true,
bool ErrorOnTagTypeMismatch = false)
Declared at: clang/include/clang/AST/ASTStructuralEquivalence.h:72
Parameters
- clang::ASTContext& FromCtx
- clang::ASTContext& ToCtx
- llvm::DenseSet<std::pair<Decl*, Decl*>>& NonEquivalentDecls
- clang::StructuralEquivalenceKind EqKind
- bool StrictTypeSpelling = false
- bool Complain = true
- bool ErrorOnTagTypeMismatch = false
¶static llvm::Optional<unsigned int>
findUntaggedStructOrUnionIndex(
clang::RecordDecl* Anon)
static llvm::Optional<unsigned int>
findUntaggedStructOrUnionIndex(
clang::RecordDecl* Anon)
Description
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.
Declared at: clang/include/clang/AST/ASTStructuralEquivalence.h:118
Parameters
- clang::RecordDecl* Anon
Returns
Returns the index of this anonymous struct/union in its context, including the next assigned index (if none of them match). Returns an empty option if the context is not a record, i.e.. if the anonymous struct/union is at namespace or block scope.
¶unsigned int getApplicableDiagnostic(
unsigned int ErrorDiagnostic)
unsigned int getApplicableDiagnostic(
unsigned int ErrorDiagnostic)
Declared at: clang/include/clang/AST/ASTStructuralEquivalence.h:122
Parameters
- unsigned int ErrorDiagnostic