clang  5.0.0
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:
[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< unsignedfindUntaggedStructOrUnionIndex (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

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

Definition at line 62 of file ASTStructuralEquivalence.h.

Member Function Documentation

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

Definition at line 1179 of file ASTStructuralEquivalence.cpp.

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

Definition at line 1188 of file ASTStructuralEquivalence.cpp.

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 1198 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::None.

Referenced by clang::ASTNodeImporter::VisitRecordDecl().

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

Determine whether the two declarations are structurally equivalent.

Definition at line 1236 of file ASTStructuralEquivalence.cpp.

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

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

Determine whether the two types are structurally equivalent.

Definition at line 1244 of file ASTStructuralEquivalence.cpp.

Member Data Documentation

bool clang::StructuralEquivalenceContext::Complain

Whether to complain about failures.

Definition at line 57 of file ASTStructuralEquivalence.h.

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.

bool clang::StructuralEquivalenceContext::ErrorOnTagTypeMismatch

Whether warn or error on tag type mismatches.

Definition at line 54 of file ASTStructuralEquivalence.h.

ASTContext& clang::StructuralEquivalenceContext::FromCtx

AST contexts for which we are checking structural equivalence.

Definition at line 34 of file ASTStructuralEquivalence.h.

bool clang::StructuralEquivalenceContext::LastDiagFromC2

true if the last diagnostic came from ToCtx.

Definition at line 60 of file ASTStructuralEquivalence.h.

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.

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.

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.

ASTContext & clang::StructuralEquivalenceContext::ToCtx

Definition at line 34 of file ASTStructuralEquivalence.h.


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