[PATCH] D25571: Add and use isDiscardableGVALinkage function.
Justin Lebar via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 13 14:01:28 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284159: Add and use isDiscardableGVALinkage function. (authored by jlebar).
Changed prior to commit:
https://reviews.llvm.org/D25571?vs=74562&id=74580#toc
Repository:
rL LLVM
https://reviews.llvm.org/D25571
Files:
cfe/trunk/include/clang/Basic/Linkage.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/Sema/SemaCUDA.cpp
Index: cfe/trunk/lib/AST/ASTContext.cpp
===================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp
+++ cfe/trunk/lib/AST/ASTContext.cpp
@@ -8824,15 +8824,10 @@
}
}
- 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 @@
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.
Index: cfe/trunk/lib/Sema/SemaCUDA.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaCUDA.cpp
+++ cfe/trunk/lib/Sema/SemaCUDA.cpp
@@ -546,7 +546,7 @@
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
Index: cfe/trunk/include/clang/Basic/Linkage.h
===================================================================
--- cfe/trunk/include/clang/Basic/Linkage.h
+++ cfe/trunk/include/clang/Basic/Linkage.h
@@ -69,6 +69,10 @@
GVA_StrongODR
};
+inline bool isDiscardableGVALinkage(GVALinkage L) {
+ return L <= GVA_DiscardableODR;
+}
+
inline bool isExternallyVisible(Linkage L) {
return L == ExternalLinkage || L == VisibleNoLinkage;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25571.74580.patch
Type: text/x-patch
Size: 2157 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161013/21a1c99e/attachment.bin>
More information about the cfe-commits
mailing list