diff options
author | Artem Belevich <tra@google.com> | 2015-09-23 17:44:53 +0000 |
---|---|---|
committer | Artem Belevich <tra@google.com> | 2015-09-23 17:44:53 +0000 |
commit | 7b41f70e6c323615d54ce5058220214c46279add (patch) | |
tree | 85f22f8bd0309eef236e376142df8bc1f6e4fb0c /clang/lib/AST/ASTContext.cpp | |
parent | ade3abd2d9fa3465718cb4baeaf535de39fa6161 (diff) | |
download | bcm5719-llvm-7b41f70e6c323615d54ce5058220214c46279add.tar.gz bcm5719-llvm-7b41f70e6c323615d54ce5058220214c46279add.zip |
[CUDA] __global__ functions should always be visible externally.
Adjust __global__ functions with DiscardableODR linkage to use
StrongODR linkage instead, so they are visible externally.
Differential Revision: http://reviews.llvm.org/D13067
llvm-svn: 248400
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index b98e3d4ed94..85add927925 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -8284,13 +8284,13 @@ static GVALinkage basicGVALinkageForFunction(const ASTContext &Context, return GVA_DiscardableODR; } -static GVALinkage adjustGVALinkageForDLLAttribute(GVALinkage L, const Decl *D) { +static GVALinkage adjustGVALinkageForAttributes(GVALinkage L, const Decl *D) { // See http://msdn.microsoft.com/en-us/library/xa0d9ste.aspx // dllexport/dllimport on inline functions. if (D->hasAttr<DLLImportAttr>()) { if (L == GVA_DiscardableODR || L == GVA_StrongODR) return GVA_AvailableExternally; - } else if (D->hasAttr<DLLExportAttr>()) { + } else if (D->hasAttr<DLLExportAttr>() || D->hasAttr<CUDAGlobalAttr>()) { if (L == GVA_DiscardableODR) return GVA_StrongODR; } @@ -8298,8 +8298,8 @@ static GVALinkage adjustGVALinkageForDLLAttribute(GVALinkage L, const Decl *D) { } GVALinkage ASTContext::GetGVALinkageForFunction(const FunctionDecl *FD) const { - return adjustGVALinkageForDLLAttribute(basicGVALinkageForFunction(*this, FD), - FD); + return adjustGVALinkageForAttributes(basicGVALinkageForFunction(*this, FD), + FD); } static GVALinkage basicGVALinkageForVariable(const ASTContext &Context, @@ -8355,8 +8355,8 @@ static GVALinkage basicGVALinkageForVariable(const ASTContext &Context, } GVALinkage ASTContext::GetGVALinkageForVariable(const VarDecl *VD) { - return adjustGVALinkageForDLLAttribute(basicGVALinkageForVariable(*this, VD), - VD); + return adjustGVALinkageForAttributes(basicGVALinkageForVariable(*this, VD), + VD); } bool ASTContext::DeclMustBeEmitted(const Decl *D) { |