Skip to content

Commit

Permalink
Implemented Access Specifier import in Clang
Browse files Browse the repository at this point in the history
  • Loading branch information
esakellari committed Jan 20, 2016
1 parent 8713ece commit 986b2af
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions interpreter/llvm/src/tools/clang/lib/AST/ASTImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ namespace clang {
Decl *VisitCXXConversionDecl(CXXConversionDecl *D);
Decl *VisitFieldDecl(FieldDecl *D);
Decl *VisitIndirectFieldDecl(IndirectFieldDecl *D);
Decl *VisitAccessSpecDecl(AccessSpecDecl *D);
Decl *VisitObjCIvarDecl(ObjCIvarDecl *D);
Decl *VisitVarDecl(VarDecl *D);
Decl *VisitImplicitParamDecl(ImplicitParamDecl *D);
Expand Down Expand Up @@ -2850,6 +2851,31 @@ static unsigned getFieldIndex(Decl *F) {
return Index;
}

Decl *ASTNodeImporter::VisitAccessSpecDecl(AccessSpecDecl *D) {

SourceLocation Loc = Importer.Import(D->getLocation());
SourceLocation ColonLoc = Importer.Import(D->getColonLoc());

// Import the context of this declaration.
DeclContext *DC = Importer.ImportContext(D->getDeclContext());
if (!DC)
return nullptr;

AccessSpecDecl *accessSpecDecl
= AccessSpecDecl::Create(Importer.getToContext(), D->getAccess(),
DC, Loc, ColonLoc);

if (!accessSpecDecl)
return nullptr;

// Lexical DeclContext and Semantic DeclContext
// is always the same for the accessSpec.
accessSpecDecl->setLexicalDeclContext(DC);
DC->addDeclInternal(accessSpecDecl);

return accessSpecDecl;
}

Decl *ASTNodeImporter::VisitFieldDecl(FieldDecl *D) {
// Import the major distinguishing characteristics of a variable.
DeclContext *DC, *LexicalDC;
Expand Down

0 comments on commit 986b2af

Please sign in to comment.