clang  8.0.0svn
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
clang::StructuralEquivalenceContext Struct Reference

#include "clang/AST/ASTStructuralEquivalence.h"

Collaboration diagram for clang::StructuralEquivalenceContext:
Collaboration graph
[legend]

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)
 
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. More...
 
bool IsEquivalent (QualType T1, QualType T2)
 Determine whether the two types are structurally equivalent. More...
 

Static Public Member Functions

static llvm::Optional< unsigned > findUntaggedStructOrUnionIndex (RecordDecl *Anon)
 Find the index of the given anonymous struct/union within its context. More...
 

Public Attributes

ASTContextFromCtx
 AST contexts for which we are checking structural equivalence. More...
 
ASTContextToCtx
 
llvm::DenseMap< Decl *, Decl * > TentativeEquivalences
 The set of "tentative" equivalences between two canonical declarations, mapping from a declaration in the first context to the declaration in the second context that we believe to be equivalent. More...
 
std::deque< Decl * > DeclsToCheck
 Queue of declarations in the first context whose equivalence with a declaration in the second context still needs to be verified. More...
 
llvm::DenseSet< std::pair< Decl *, Decl * > > & NonEquivalentDecls
 Declaration (from, to) pairs that are known not to be equivalent (which we have already complained about). More...
 
StructuralEquivalenceKind EqKind
 
bool StrictTypeSpelling
 Whether we're being strict about the spelling of types when unifying two types. More...
 
bool ErrorOnTagTypeMismatch
 Whether warn or error on tag type mismatches. More...
 
bool Complain
 Whether to complain about failures. More...
 
bool LastDiagFromC2 = false
 true if the last diagnostic came from ToCtx. More...
 

Detailed Description

Definition at line 41 of file ASTStructuralEquivalence.h.

Constructor & Destructor Documentation

◆ StructuralEquivalenceContext()

clang::StructuralEquivalenceContext::StructuralEquivalenceContext ( ASTContext FromCtx,
ASTContext ToCtx,
llvm::DenseSet< std::pair< Decl *, Decl *>> &  NonEquivalentDecls,
StructuralEquivalenceKind  EqKind,
bool  StrictTypeSpelling = false,
bool  Complain = true,
bool  ErrorOnTagTypeMismatch = false 
)
inline

Definition at line 73 of file ASTStructuralEquivalence.h.

Member Function Documentation

◆ Diag1()

DiagnosticBuilder StructuralEquivalenceContext::Diag1 ( SourceLocation  Loc,
unsigned  DiagID 
)

◆ Diag2()

DiagnosticBuilder StructuralEquivalenceContext::Diag2 ( SourceLocation  Loc,
unsigned  DiagID 
)

◆ findUntaggedStructOrUnionIndex()

Optional< unsigned > StructuralEquivalenceContext::findUntaggedStructOrUnionIndex ( RecordDecl Anon)
static

Find the index of the given anonymous struct/union within its context.

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.

FIXME: This is needed by ASTImporter and ASTStructureEquivalence. It probably makes more sense in some other common place then here.

Definition at line 1440 of file ASTStructuralEquivalence.cpp.

◆ IsEquivalent() [1/2]

bool StructuralEquivalenceContext::IsEquivalent ( Decl D1,
Decl D2 
)

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 TentativeEquivalences members) and can cause faulty equivalent results.

Definition at line 1482 of file ASTStructuralEquivalence.cpp.

References DeclsToCheck, IsStructurallyEquivalent(), and TentativeEquivalences.

Referenced by clang::Sema::hasStructuralCompatLayout(), clang::ASTImporter::IsStructurallyEquivalent(), and clang::ASTNodeImporter::IsStructuralMatch().

◆ IsEquivalent() [2/2]

bool StructuralEquivalenceContext::IsEquivalent ( QualType  T1,
QualType  T2 
)

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 TentativeEquivalences members) and can cause faulty equivalent results.

Definition at line 1499 of file ASTStructuralEquivalence.cpp.

References DeclsToCheck, clang::Equivalent, clang::Decl::getCanonicalDecl(), clang::Decl::getDescribedTemplate(), IsStructurallyEquivalent(), NonEquivalentDecls, and TentativeEquivalences.

Member Data Documentation

◆ Complain

bool clang::StructuralEquivalenceContext::Complain

Whether to complain about failures.

Definition at line 68 of file ASTStructuralEquivalence.h.

Referenced by Diag1(), and Diag2().

◆ DeclsToCheck

std::deque<Decl *> clang::StructuralEquivalenceContext::DeclsToCheck

Queue of declarations in the first context whose equivalence with a declaration in the second context still needs to be verified.

Definition at line 52 of file ASTStructuralEquivalence.h.

Referenced by IsEquivalent().

◆ EqKind

StructuralEquivalenceKind clang::StructuralEquivalenceContext::EqKind

Definition at line 58 of file ASTStructuralEquivalence.h.

◆ ErrorOnTagTypeMismatch

bool clang::StructuralEquivalenceContext::ErrorOnTagTypeMismatch

Whether warn or error on tag type mismatches.

Definition at line 65 of file ASTStructuralEquivalence.h.

◆ FromCtx

ASTContext& clang::StructuralEquivalenceContext::FromCtx

AST contexts for which we are checking structural equivalence.

Definition at line 43 of file ASTStructuralEquivalence.h.

Referenced by Diag1(), and Diag2().

◆ LastDiagFromC2

bool clang::StructuralEquivalenceContext::LastDiagFromC2 = false

true if the last diagnostic came from ToCtx.

Definition at line 71 of file ASTStructuralEquivalence.h.

Referenced by Diag1(), and Diag2().

◆ NonEquivalentDecls

llvm::DenseSet<std::pair<Decl *, Decl *> >& clang::StructuralEquivalenceContext::NonEquivalentDecls

Declaration (from, to) pairs that are known not to be equivalent (which we have already complained about).

Definition at line 56 of file ASTStructuralEquivalence.h.

Referenced by IsEquivalent().

◆ StrictTypeSpelling

bool clang::StructuralEquivalenceContext::StrictTypeSpelling

Whether we're being strict about the spelling of types when unifying two types.

Definition at line 62 of file ASTStructuralEquivalence.h.

◆ TentativeEquivalences

llvm::DenseMap<Decl *, Decl *> clang::StructuralEquivalenceContext::TentativeEquivalences

The set of "tentative" equivalences between two canonical declarations, mapping from a declaration in the first context to the declaration in the second context that we believe to be equivalent.

Definition at line 48 of file ASTStructuralEquivalence.h.

Referenced by IsEquivalent().

◆ ToCtx

ASTContext & clang::StructuralEquivalenceContext::ToCtx

Definition at line 43 of file ASTStructuralEquivalence.h.

Referenced by Diag1(), and Diag2().


The documentation for this struct was generated from the following files: