clang  6.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, bool StrictTypeSpelling=false, bool Complain=true, bool ErrorOnTagTypeMismatch=false)
 
DiagnosticBuilder Diag1 (SourceLocation Loc, unsigned DiagID)
 
DiagnosticBuilder Diag2 (SourceLocation Loc, unsigned DiagID)
 
bool IsStructurallyEquivalent (Decl *D1, Decl *D2)
 Determine whether the two declarations are structurally equivalent. More...
 
bool IsStructurallyEquivalent (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...
 
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
 true if the last diagnostic came from ToCtx. More...
 

Detailed Description

Definition at line 32 of file ASTStructuralEquivalence.h.

Constructor & Destructor Documentation

◆ StructuralEquivalenceContext()

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

Member Function Documentation

◆ Diag1()

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

Definition at line 1194 of file ASTStructuralEquivalence.cpp.

Referenced by StructuralEquivalenceContext().

◆ Diag2()

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

Definition at line 1203 of file ASTStructuralEquivalence.cpp.

Referenced by StructuralEquivalenceContext().

◆ findUntaggedStructOrUnionIndex()

Optional< unsigned > clang::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 1213 of file ASTStructuralEquivalence.cpp.

References clang::Decl::getASTContext(), clang::Decl::getDeclContext(), clang::NamedDecl::getIdentifier(), clang::ASTContext::getRecordType(), clang::ASTContext::hasSameType(), clang::DeclContext::noload_decls(), and clang::diff::None.

Referenced by StructuralEquivalenceContext().

◆ IsStructurallyEquivalent() [1/2]

bool clang::StructuralEquivalenceContext::IsStructurallyEquivalent ( Decl D1,
Decl D2 
)

◆ IsStructurallyEquivalent() [2/2]

bool clang::StructuralEquivalenceContext::IsStructurallyEquivalent ( QualType  T1,
QualType  T2 
)

Determine whether the two types are structurally equivalent.

Definition at line 1259 of file ASTStructuralEquivalence.cpp.

References clang::Decl::getCanonicalDecl().

Member Data Documentation

◆ Complain

bool clang::StructuralEquivalenceContext::Complain

Whether to complain about failures.

Definition at line 57 of file ASTStructuralEquivalence.h.

◆ 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 43 of file ASTStructuralEquivalence.h.

◆ ErrorOnTagTypeMismatch

bool clang::StructuralEquivalenceContext::ErrorOnTagTypeMismatch

Whether warn or error on tag type mismatches.

Definition at line 54 of file ASTStructuralEquivalence.h.

◆ FromCtx

ASTContext& clang::StructuralEquivalenceContext::FromCtx

AST contexts for which we are checking structural equivalence.

Definition at line 34 of file ASTStructuralEquivalence.h.

◆ LastDiagFromC2

bool clang::StructuralEquivalenceContext::LastDiagFromC2

true if the last diagnostic came from ToCtx.

Definition at line 60 of file ASTStructuralEquivalence.h.

◆ 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 47 of file ASTStructuralEquivalence.h.

◆ StrictTypeSpelling

bool clang::StructuralEquivalenceContext::StrictTypeSpelling

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

Definition at line 51 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 39 of file ASTStructuralEquivalence.h.

◆ ToCtx

ASTContext & clang::StructuralEquivalenceContext::ToCtx

Definition at line 34 of file ASTStructuralEquivalence.h.


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