summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2015-11-10 21:28:44 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2015-11-10 21:28:44 +0000
commitae6ebd3af525c23c6216b76dd28a282790dce78f (patch)
tree2a5c4d4171297adb8b9edadf927bed30bae45563 /clang/lib/AST/Decl.cpp
parent2d5fb8cac4ec7b6f763c6f91b52f6a954ad99942 (diff)
downloadbcm5719-llvm-ae6ebd3af525c23c6216b76dd28a282790dce78f.tar.gz
bcm5719-llvm-ae6ebd3af525c23c6216b76dd28a282790dce78f.zip
Implement __attribute__((internal_linkage)).
The attrubite is applicable to functions and variables and changes the linkage of the subject to internal. This is the same functionality as C-style "static", but applicable to class methods; and the same as anonymouns namespaces, but can apply to individual methods of a class. Following the proposal in http://lists.llvm.org/pipermail/cfe-dev/2015-October/045580.html llvm-svn: 252648
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index f7600799ba4..0f6e8b09706 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1217,6 +1217,10 @@ getOutermostEnclosingLambda(const CXXRecordDecl *Record) {
static LinkageInfo computeLVForDecl(const NamedDecl *D,
LVComputationKind computation) {
+ // Internal_linkage attribute overrides other considerations.
+ if (D->hasAttr<InternalLinkageAttr>())
+ return LinkageInfo::internal();
+
// Objective-C: treat all Objective-C declarations as having external
// linkage.
switch (D->getKind()) {
@@ -1307,6 +1311,10 @@ class LinkageComputer {
public:
static LinkageInfo getLVForDecl(const NamedDecl *D,
LVComputationKind computation) {
+ // Internal_linkage attribute overrides other considerations.
+ if (D->hasAttr<InternalLinkageAttr>())
+ return LinkageInfo::internal();
+
if (computation == LVForLinkageOnly && D->hasCachedLinkage())
return LinkageInfo(D->getCachedLinkage(), DefaultVisibility, false);
OpenPOWER on IntegriCloud