clang API Documentation

Classes | Namespaces | Defines | Functions
ASTImporter.cpp File Reference
#include "clang/AST/ASTImporter.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclVisitor.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/AST/TypeVisitor.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "llvm/Support/MemoryBuffer.h"
#include <deque>
#include "clang/AST/BuiltinTypes.def"
Include dependency graph for ASTImporter.cpp:

Go to the source code of this file.

Classes

class  clang::ASTNodeImporter

Namespaces

namespace  clang

Defines

#define SHARED_SINGLETON_TYPE(Expansion)
#define BUILTIN_TYPE(Id, SingletonId)   case BuiltinType::Id: return Importer.getToContext().SingletonId;

Functions

static bool IsStructurallyEquivalent (StructuralEquivalenceContext &Context, QualType T1, QualType T2)
 Determine structural equivalence of two types.
static bool IsStructurallyEquivalent (StructuralEquivalenceContext &Context, Decl *D1, Decl *D2)
 Determine structural equivalence of two declarations.
static bool IsStructurallyEquivalent (StructuralEquivalenceContext &Context, Expr *E1, Expr *E2)
 Determine structural equivalence of two expressions.
static bool IsStructurallyEquivalent (const IdentifierInfo *Name1, const IdentifierInfo *Name2)
 Determine whether two identifiers are equivalent.
static bool IsStructurallyEquivalent (StructuralEquivalenceContext &Context, NestedNameSpecifier *NNS1, NestedNameSpecifier *NNS2)
 Determine whether two nested-name-specifiers are equivalent.
static bool IsStructurallyEquivalent (StructuralEquivalenceContext &Context, const TemplateArgument &Arg1, const TemplateArgument &Arg2)
 Determine whether two template arguments are equivalent.
static bool IsArrayStructurallyEquivalent (StructuralEquivalenceContext &Context, const ArrayType *Array1, const ArrayType *Array2)
 Determine structural equivalence for the common part of array types.
static bool IsStructurallyEquivalent (StructuralEquivalenceContext &Context, FieldDecl *Field1, FieldDecl *Field2)
 Determine structural equivalence of two fields.
static Optional< unsignedfindAnonymousStructOrUnionIndex (RecordDecl *Anon)
 Find the index of the given anonymous struct/union within its context.
static bool IsStructurallyEquivalent (StructuralEquivalenceContext &Context, RecordDecl *D1, RecordDecl *D2)
 Determine structural equivalence of two records.
static bool IsStructurallyEquivalent (StructuralEquivalenceContext &Context, EnumDecl *D1, EnumDecl *D2)
 Determine structural equivalence of two enums.
static bool IsStructurallyEquivalent (StructuralEquivalenceContext &Context, TemplateParameterList *Params1, TemplateParameterList *Params2)
static bool IsStructurallyEquivalent (StructuralEquivalenceContext &Context, TemplateTypeParmDecl *D1, TemplateTypeParmDecl *D2)
static bool IsStructurallyEquivalent (StructuralEquivalenceContext &Context, NonTypeTemplateParmDecl *D1, NonTypeTemplateParmDecl *D2)
static bool IsStructurallyEquivalent (StructuralEquivalenceContext &Context, TemplateTemplateParmDecl *D1, TemplateTemplateParmDecl *D2)
static bool IsStructurallyEquivalent (StructuralEquivalenceContext &Context, ClassTemplateDecl *D1, ClassTemplateDecl *D2)
static unsigned getFieldIndex (Decl *F)
static bool ImportCastPath (CastExpr *E, CXXCastPath &Path)

Define Documentation

#define BUILTIN_TYPE (   Id,
  SingletonId 
)    case BuiltinType::Id: return Importer.getToContext().SingletonId;
#define SHARED_SINGLETON_TYPE (   Expansion)

Function Documentation

static Optional<unsigned> findAnonymousStructOrUnionIndex ( 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.

Definition at line 924 of file ASTImporter.cpp.

References Context, clang::Decl::getASTContext(), clang::Decl::getDeclContext(), clang::ASTContext::getRecordType(), clang::ASTContext::hasSameType(), and clang::DeclContext::noload_decls().

Referenced by IsStructurallyEquivalent(), and clang::ASTNodeImporter::VisitRecordDecl().

static unsigned getFieldIndex ( Decl F) [static]
static bool ImportCastPath ( CastExpr E,
CXXCastPath Path 
) [static]
static bool IsArrayStructurallyEquivalent ( StructuralEquivalenceContext &  Context,
const ArrayType Array1,
const ArrayType Array2 
) [static]

Determine structural equivalence for the common part of array types.

Definition at line 350 of file ASTImporter.cpp.

References clang::ArrayType::getElementType(), clang::ArrayType::getIndexTypeQualifiers(), clang::ArrayType::getSizeModifier(), and IsStructurallyEquivalent().

Referenced by IsStructurallyEquivalent().

static bool IsStructurallyEquivalent ( StructuralEquivalenceContext &  Context,
QualType  T1,
QualType  T2 
) [static]

Determine structural equivalence of two types.

Definition at line 366 of file ASTImporter.cpp.

References clang::EST_ComputedNoexcept, clang::EST_Dynamic, clang::TemplateSpecializationType::getArg(), clang::DependentTemplateSpecializationType::getArg(), clang::SubstTemplateTypeParmPackType::getArgumentPack(), clang::ObjCObjectType::getBaseType(), clang::MemberPointerType::getClass(), clang::ObjCInterfaceType::getDecl(), clang::TemplateTypeParmType::getDepth(), clang::DependentSizedExtVectorType::getElementType(), clang::VectorType::getElementType(), getElementType(), clang::FunctionProtoType::getExceptionSpecType(), clang::FunctionProtoType::getExceptionType(), clang::FunctionType::getExtInfo(), clang::DependentNameType::getIdentifier(), clang::DependentTemplateSpecializationType::getIdentifier(), clang::TemplateTypeParmType::getIndex(), clang::InjectedClassNameType::getInjectedSpecializationType(), clang::TypeWithKeyword::getKeyword(), getKind(), clang::ElaboratedType::getNamedType(), clang::FunctionProtoType::getNoexceptExpr(), clang::TemplateSpecializationType::getNumArgs(), clang::DependentTemplateSpecializationType::getNumArgs(), clang::VectorType::getNumElements(), clang::FunctionProtoType::getNumExceptions(), clang::FunctionProtoType::getNumParams(), clang::ObjCObjectType::getNumProtocols(), clang::FunctionProtoType::getParamType(), clang::Type::getPointeeType(), clang::MemberPointerType::getPointeeType(), clang::ObjCObjectPointerType::getPointeeType(), clang::ReferenceType::getPointeeTypeAsWritten(), clang::ObjCObjectType::getProtocol(), clang::ElaboratedType::getQualifier(), clang::DependentNameType::getQualifier(), clang::DependentTemplateSpecializationType::getQualifier(), clang::QualType::getQualifiers(), clang::SubstTemplateTypeParmType::getReplacedParameter(), clang::SubstTemplateTypeParmPackType::getReplacedParameter(), clang::SubstTemplateTypeParmType::getReplacementType(), clang::FunctionType::getReturnType(), clang::ConstantArrayType::getSize(), clang::VariableArrayType::getSizeExpr(), clang::DependentSizedArrayType::getSizeExpr(), clang::DependentSizedExtVectorType::getSizeExpr(), clang::TemplateSpecializationType::getTemplateName(), clang::Type::getTypeClass(), clang::FunctionProtoType::getTypeQuals(), getUnderlyingType(), clang::VectorType::getVectorKind(), IsArrayStructurallyEquivalent(), clang::ReferenceType::isInnerRef(), clang::QualType::isNull(), clang::TemplateTypeParmType::isParameterPack(), clang::ReferenceType::isSpelledAsLValue(), clang::FunctionProtoType::isVariadic(), Paren, and Record.

Referenced by IsArrayStructurallyEquivalent(), and IsStructurallyEquivalent().

static bool IsStructurallyEquivalent ( StructuralEquivalenceContext &  Context,
Decl D1,
Decl D2 
) [static]

Determine structural equivalence of two declarations.

Definition at line 1270 of file ASTImporter.cpp.

References clang::Decl::getCanonicalDecl().

static bool IsStructurallyEquivalent ( StructuralEquivalenceContext &  Context,
Expr E1,
Expr E2 
) [static]

Determine structural equivalence of two expressions.

Definition at line 265 of file ASTImporter.cpp.

static bool IsStructurallyEquivalent ( const IdentifierInfo Name1,
const IdentifierInfo Name2 
) [static]

Determine whether two identifiers are equivalent.

Definition at line 275 of file ASTImporter.cpp.

References clang::IdentifierInfo::getName().

static bool IsStructurallyEquivalent ( StructuralEquivalenceContext &  Context,
NestedNameSpecifier NNS1,
NestedNameSpecifier NNS2 
) [static]

Determine whether two nested-name-specifiers are equivalent.

Definition at line 284 of file ASTImporter.cpp.

static bool IsStructurallyEquivalent ( StructuralEquivalenceContext &  Context,
const TemplateArgument Arg1,
const TemplateArgument Arg2 
) [static]
static bool IsStructurallyEquivalent ( StructuralEquivalenceContext &  Context,
FieldDecl Field1,
FieldDecl Field2 
) [static]
static bool IsStructurallyEquivalent ( StructuralEquivalenceContext &  Context,
RecordDecl D1,
RecordDecl D2 
) [static]
static bool IsStructurallyEquivalent ( StructuralEquivalenceContext &  Context,
EnumDecl D1,
EnumDecl D2 
) [static]

Determine structural equivalence of two enums.

Definition at line 1106 of file ASTImporter.cpp.

References clang::Decl::getLocation(), and IsStructurallyEquivalent().

static bool IsStructurallyEquivalent ( StructuralEquivalenceContext &  Context,
TemplateParameterList Params1,
TemplateParameterList Params2 
) [static]
static bool IsStructurallyEquivalent ( StructuralEquivalenceContext &  Context,
TemplateTypeParmDecl D1,
TemplateTypeParmDecl D2 
) [static]
static bool IsStructurallyEquivalent ( StructuralEquivalenceContext &  Context,
NonTypeTemplateParmDecl D1,
NonTypeTemplateParmDecl D2 
) [static]
static bool IsStructurallyEquivalent ( StructuralEquivalenceContext &  Context,
TemplateTemplateParmDecl D1,
TemplateTemplateParmDecl D2 
) [static]
static bool IsStructurallyEquivalent ( StructuralEquivalenceContext &  Context,
ClassTemplateDecl D1,
ClassTemplateDecl D2 
) [static]