diff options
author | John McCall <rjmccall@apple.com> | 2010-10-22 21:05:15 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-10-22 21:05:15 +0000 |
commit | 1fb0caaa7bef765b85972274e3b434af2572c141 (patch) | |
tree | 39b9f78902f8581d6749d0d0dc99fc1f2ae1d8d5 /include/clang/Basic/Visibility.h | |
parent | 07ed93f378a8868c9a7c04ca7ae685b85c55e5ea (diff) | |
download | clang-1fb0caaa7bef765b85972274e3b434af2572c141.tar.gz clang-1fb0caaa7bef765b85972274e3b434af2572c141.tar.bz2 clang-1fb0caaa7bef765b85972274e3b434af2572c141.tar.xz |
Substantially revise how clang computes the visibility of a declaration to
more closely parallel the computation of linkage. This gets us to a state
much closer to what gcc emits, modulo bugs, which will undoubtedly arise in
abundance.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117147 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/Visibility.h')
-rw-r--r-- | include/clang/Basic/Visibility.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/include/clang/Basic/Visibility.h b/include/clang/Basic/Visibility.h new file mode 100644 index 0000000000..90e288a224 --- /dev/null +++ b/include/clang/Basic/Visibility.h @@ -0,0 +1,48 @@ +//===--- Visibility.h - Visibility enumeration and utilities ----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the Visibility enumeration and various utility +// functions. +// +//===----------------------------------------------------------------------===// +#ifndef LLVM_CLANG_BASIC_VISIBILITY_H +#define LLVM_CLANG_BASIC_VISIBILITY_H + +namespace clang { + +/// \link Describes the different kinds of visibility that a +/// declaration may have. Visibility determines how a declaration +/// interacts with the dynamic linker. It may also affect whether the +/// symbol can be found by runtime symbol lookup APIs. +/// +/// Visibility is not described in any language standard and +/// (nonetheless) sometimes has odd behavior. Not all platforms +/// support all visibility kinds. +enum Visibility { + /// Objects with "hidden" visibility are not seen by the dynamic + /// linker. + HiddenVisibility, + + /// Objects with "protected" visibility are seen by the dynamic + /// linker but always dynamically resolve to an object within this + /// shared object. + ProtectedVisibility, + + /// Objects with "default" visibility are seen by the dynamic linker + /// and act like normal objects. + DefaultVisibility +}; + +inline Visibility minVisibility(Visibility L, Visibility R) { + return L < R ? L : R; +} + +} + +#endif // LLVM_CLANG_BASIC_VISIBILITY_H |