summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-10-13 20:52:17 +0000
committerJustin Lebar <jlebar@google.com>2016-10-13 20:52:17 +0000
commiteb0ae149757d64996935a281b0775978b1f2fe82 (patch)
tree63e73e52e0231b139a1e7a29da2d9ee164f9d4b7 /lib
parent45b902e6896fcf9db3e79c1e4a49424cb67c8447 (diff)
downloadclang-eb0ae149757d64996935a281b0775978b1f2fe82.tar.gz
Add and use isDiscardableGVALinkage function.
Reviewers: rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25571 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284159 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/ASTContext.cpp11
-rw-r--r--lib/Sema/SemaCUDA.cpp2
2 files changed, 3 insertions, 10 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index b75de00d56..e2fe6d2591 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -8824,15 +8824,10 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
}
}
- GVALinkage Linkage = GetGVALinkageForFunction(FD);
-
// static, static inline, always_inline, and extern inline functions can
// always be deferred. Normal inline functions can be deferred in C99/C++.
// Implicit template instantiations can also be deferred in C++.
- if (Linkage == GVA_Internal || Linkage == GVA_AvailableExternally ||
- Linkage == GVA_DiscardableODR)
- return false;
- return true;
+ return !isDiscardableGVALinkage(GetGVALinkageForFunction(FD));
}
const VarDecl *VD = cast<VarDecl>(D);
@@ -8843,9 +8838,7 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
return false;
// Variables that can be needed in other TUs are required.
- GVALinkage L = GetGVALinkageForVariable(VD);
- if (L != GVA_Internal && L != GVA_AvailableExternally &&
- L != GVA_DiscardableODR)
+ if (!isDiscardableGVALinkage(GetGVALinkageForVariable(VD)))
return true;
// Variables that have destruction with side-effects are required.
diff --git a/lib/Sema/SemaCUDA.cpp b/lib/Sema/SemaCUDA.cpp
index 5333a44275..18751d4104 100644
--- a/lib/Sema/SemaCUDA.cpp
+++ b/lib/Sema/SemaCUDA.cpp
@@ -546,7 +546,7 @@ static bool IsKnownEmitted(Sema &S, FunctionDecl *FD) {
return false;
// Externally-visible and similar functions are always emitted.
- if (S.getASTContext().GetGVALinkageForFunction(FD) > GVA_DiscardableODR)
+ if (!isDiscardableGVALinkage(S.getASTContext().GetGVALinkageForFunction(FD)))
return true;
// Otherwise, the function is known-emitted if it's in our set of