r223860 - Updated the AST importer to support importing
Nico Weber
thakis at chromium.org
Wed Dec 10 11:38:28 PST 2014
On Tue, Dec 9, 2014 at 4:00 PM, Sean Callanan <scallanan at apple.com> wrote:
> Author: spyffe
> Date: Tue Dec 9 18:00:37 2014
> New Revision: 223860
>
> URL: http://llvm.org/viewvc/llvm-project?rev=223860&view=rev
> Log:
> Updated the AST importer to support importing
> LinkageSpecDecls. This is relevant when LLDB
> wants to import Decls from non-C++ modules,
> since many declarations are in extern "C"
> blocks.
>
> Modified:
> cfe/trunk/lib/AST/ASTImporter.cpp
>
> Modified: cfe/trunk/lib/AST/ASTImporter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=223860&r1=223859&r2=223860&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/AST/ASTImporter.cpp (original)
> +++ cfe/trunk/lib/AST/ASTImporter.cpp Tue Dec 9 18:00:37 2014
> @@ -151,6 +151,7 @@ namespace clang {
> Decl *VisitObjCMethodDecl(ObjCMethodDecl *D);
> Decl *VisitObjCCategoryDecl(ObjCCategoryDecl *D);
> Decl *VisitObjCProtocolDecl(ObjCProtocolDecl *D);
> + Decl *VisitLinkageSpecDecl(LinkageSpecDecl *D);
> Decl *VisitObjCInterfaceDecl(ObjCInterfaceDecl *D);
> Decl *VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D);
> Decl *VisitObjCImplementationDecl(ObjCImplementationDecl *D);
> @@ -3470,6 +3471,35 @@ Decl *ASTNodeImporter::VisitObjCProtocol
> return ToProto;
> }
>
> +Decl *ASTNodeImporter::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
> + DeclContext *DC = Importer.ImportContext(D->getDeclContext());
> + DeclContext *LexicalDC =
> Importer.ImportContext(D->getLexicalDeclContext());
> +
> + SourceLocation ExternLoc = Importer.Import(D->getExternLoc());
> + SourceLocation LangLoc = Importer.Import(D->getLocation());
> +
> + bool HasBraces = D->hasBraces();
> +
> + LinkageSpecDecl *ToLinkageSpec =
> LinkageSpecDecl::Create(Importer.getToContext(),
>
clang follows llvm style: Please use <= 80 columns per line. You can use
clang-format-diff.py (or `git format`) to let clang-format fix things like
this automatically for you before you commit.
> + DC,
> + ExternLoc,
> + LangLoc,
> +
> D->getLanguage(),
> + HasBraces);
> +
> + if (HasBraces) {
> + SourceLocation RBraceLoc = Importer.Import(D->getRBraceLoc());
> + ToLinkageSpec->setRBraceLoc(RBraceLoc);
> + }
> +
> + ToLinkageSpec->setLexicalDeclContext(LexicalDC);
> + LexicalDC->addDeclInternal(ToLinkageSpec);
> +
> + Importer.Imported(D, ToLinkageSpec);
> +
> + return ToLinkageSpec;
> +}
> +
> bool ASTNodeImporter::ImportDefinition(ObjCInterfaceDecl *From,
> ObjCInterfaceDecl *To,
> ImportDefinitionKind Kind) {
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141210/1ed1f6c5/attachment.html>
More information about the cfe-commits
mailing list