summaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2007-04-29 18:35:00 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2007-04-29 18:35:00 +0000
commit6f9896fcc81a1128b5f436d1763cc6213745adf1 (patch)
tree89f99df6a320347cd98adf490edeea24432c86f6 /include/llvm
parentc6c98af9e5814e8066c82f20ca11cf646a5fc289 (diff)
downloadexternal_llvm-6f9896fcc81a1128b5f436d1763cc6213745adf1.zip
external_llvm-6f9896fcc81a1128b5f436d1763cc6213745adf1.tar.gz
external_llvm-6f9896fcc81a1128b5f436d1763cc6213745adf1.tar.bz2
Implement protected visibility. This partly implements PR1363. Linker
should be taught to deal with protected symbols. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36565 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/GlobalValue.h8
-rw-r--r--include/llvm/Target/TargetAsmInfo.h9
2 files changed, 14 insertions, 3 deletions
diff --git a/include/llvm/GlobalValue.h b/include/llvm/GlobalValue.h
index 014cdbe..4f6b1e6 100644
--- a/include/llvm/GlobalValue.h
+++ b/include/llvm/GlobalValue.h
@@ -43,7 +43,8 @@ public:
/// @brief An enumeration for the kinds of visibility of global values.
enum VisibilityTypes {
DefaultVisibility = 0, ///< The GV is visible
- HiddenVisibility ///< The GV is hidden
+ HiddenVisibility, ///< The GV is hidden
+ ProtectedVisibility ///< The GV is protected
};
protected:
@@ -58,7 +59,7 @@ protected:
// Note: VC++ treats enums as signed, so an extra bit is required to prevent
// Linkage and Visibility from turning into negative values.
LinkageTypes Linkage : 5; // The linkage of this global
- unsigned Visibility : 1; // The visibility style of this global
+ unsigned Visibility : 2; // The visibility style of this global
unsigned Alignment : 16; // Alignment of this symbol, must be power of two
std::string Section; // Section to emit this into, empty mean default
public:
@@ -74,6 +75,9 @@ public:
VisibilityTypes getVisibility() const { return (VisibilityTypes)Visibility; }
bool hasHiddenVisibility() const { return Visibility == HiddenVisibility; }
+ bool hasProtectedVisibility() const {
+ return Visibility == ProtectedVisibility;
+ }
void setVisibility(VisibilityTypes V) { Visibility = V; }
bool hasSection() const { return !Section.empty(); }
diff --git a/include/llvm/Target/TargetAsmInfo.h b/include/llvm/Target/TargetAsmInfo.h
index 60de430..b13a3fb 100644
--- a/include/llvm/Target/TargetAsmInfo.h
+++ b/include/llvm/Target/TargetAsmInfo.h
@@ -256,7 +256,11 @@ namespace llvm {
/// HiddenDirective - This directive, if non-null, is used to declare a
/// global or function as having hidden visibility.
const char *HiddenDirective; // Defaults to "\t.hidden\t".
-
+
+ /// ProtectedDirective - This directive, if non-null, is used to declare a
+ /// global or function as having protected visibility.
+ const char *ProtectedDirective; // Defaults to "\t.protected\t".
+
//===--- Dwarf Emission Directives -----------------------------------===//
/// AbsoluteSectionOffsets - True if we should emit abolute section
@@ -523,6 +527,9 @@ namespace llvm {
const char *getHiddenDirective() const {
return HiddenDirective;
}
+ const char *getProtectedDirective() const {
+ return ProtectedDirective;
+ }
bool isAbsoluteSectionOffsets() const {
return AbsoluteSectionOffsets;
}