Visibility.h revision 1fb0caaa7bef765b85972274e3b434af2572c141
11fb0caaa7bef765b85972274e3b434af2572c141John McCall//===--- Visibility.h - Visibility enumeration and utilities ----*- C++ -*-===//
21fb0caaa7bef765b85972274e3b434af2572c141John McCall//
31fb0caaa7bef765b85972274e3b434af2572c141John McCall//                     The LLVM Compiler Infrastructure
41fb0caaa7bef765b85972274e3b434af2572c141John McCall//
51fb0caaa7bef765b85972274e3b434af2572c141John McCall// This file is distributed under the University of Illinois Open Source
61fb0caaa7bef765b85972274e3b434af2572c141John McCall// License. See LICENSE.TXT for details.
71fb0caaa7bef765b85972274e3b434af2572c141John McCall//
81fb0caaa7bef765b85972274e3b434af2572c141John McCall//===----------------------------------------------------------------------===//
91fb0caaa7bef765b85972274e3b434af2572c141John McCall//
101fb0caaa7bef765b85972274e3b434af2572c141John McCall// This file defines the Visibility enumeration and various utility
111fb0caaa7bef765b85972274e3b434af2572c141John McCall// functions.
121fb0caaa7bef765b85972274e3b434af2572c141John McCall//
131fb0caaa7bef765b85972274e3b434af2572c141John McCall//===----------------------------------------------------------------------===//
141fb0caaa7bef765b85972274e3b434af2572c141John McCall#ifndef LLVM_CLANG_BASIC_VISIBILITY_H
151fb0caaa7bef765b85972274e3b434af2572c141John McCall#define LLVM_CLANG_BASIC_VISIBILITY_H
161fb0caaa7bef765b85972274e3b434af2572c141John McCall
171fb0caaa7bef765b85972274e3b434af2572c141John McCallnamespace clang {
181fb0caaa7bef765b85972274e3b434af2572c141John McCall
191fb0caaa7bef765b85972274e3b434af2572c141John McCall/// \link Describes the different kinds of visibility that a
201fb0caaa7bef765b85972274e3b434af2572c141John McCall/// declaration may have.  Visibility determines how a declaration
211fb0caaa7bef765b85972274e3b434af2572c141John McCall/// interacts with the dynamic linker.  It may also affect whether the
221fb0caaa7bef765b85972274e3b434af2572c141John McCall/// symbol can be found by runtime symbol lookup APIs.
231fb0caaa7bef765b85972274e3b434af2572c141John McCall///
241fb0caaa7bef765b85972274e3b434af2572c141John McCall/// Visibility is not described in any language standard and
251fb0caaa7bef765b85972274e3b434af2572c141John McCall/// (nonetheless) sometimes has odd behavior.  Not all platforms
261fb0caaa7bef765b85972274e3b434af2572c141John McCall/// support all visibility kinds.
271fb0caaa7bef765b85972274e3b434af2572c141John McCallenum Visibility {
281fb0caaa7bef765b85972274e3b434af2572c141John McCall  /// Objects with "hidden" visibility are not seen by the dynamic
291fb0caaa7bef765b85972274e3b434af2572c141John McCall  /// linker.
301fb0caaa7bef765b85972274e3b434af2572c141John McCall  HiddenVisibility,
311fb0caaa7bef765b85972274e3b434af2572c141John McCall
321fb0caaa7bef765b85972274e3b434af2572c141John McCall  /// Objects with "protected" visibility are seen by the dynamic
331fb0caaa7bef765b85972274e3b434af2572c141John McCall  /// linker but always dynamically resolve to an object within this
341fb0caaa7bef765b85972274e3b434af2572c141John McCall  /// shared object.
351fb0caaa7bef765b85972274e3b434af2572c141John McCall  ProtectedVisibility,
361fb0caaa7bef765b85972274e3b434af2572c141John McCall
371fb0caaa7bef765b85972274e3b434af2572c141John McCall  /// Objects with "default" visibility are seen by the dynamic linker
381fb0caaa7bef765b85972274e3b434af2572c141John McCall  /// and act like normal objects.
391fb0caaa7bef765b85972274e3b434af2572c141John McCall  DefaultVisibility
401fb0caaa7bef765b85972274e3b434af2572c141John McCall};
411fb0caaa7bef765b85972274e3b434af2572c141John McCall
421fb0caaa7bef765b85972274e3b434af2572c141John McCallinline Visibility minVisibility(Visibility L, Visibility R) {
431fb0caaa7bef765b85972274e3b434af2572c141John McCall  return L < R ? L : R;
441fb0caaa7bef765b85972274e3b434af2572c141John McCall}
451fb0caaa7bef765b85972274e3b434af2572c141John McCall
461fb0caaa7bef765b85972274e3b434af2572c141John McCall}
471fb0caaa7bef765b85972274e3b434af2572c141John McCall
481fb0caaa7bef765b85972274e3b434af2572c141John McCall#endif // LLVM_CLANG_BASIC_VISIBILITY_H
49