 |
|
 |
|
| Files: |
1 |
|
Branches Taken: |
100.0% |
5 / 5 |
| Generated: |
2010-02-10 01:31 |
|
Branches Executed: |
100.0% |
5 / 5 |
| |
|
Line Coverage: |
100.0% |
4 / 4 |
| |
 |
|
 |
1 : //===--- Linkage.h - Linkage enumeration and utilities ----------*- C++ -*-===//
2 : //
3 : // The LLVM Compiler Infrastructure
4 : //
5 : // This file is distributed under the University of Illinois Open Source
6 : // License. See LICENSE.TXT for details.
7 : //
8 : //===----------------------------------------------------------------------===//
9 : //
10 : // This file defines the Linkage enumeration and various utility
11 : // functions.
12 : //
13 : //===----------------------------------------------------------------------===//
14 : #ifndef LLVM_CLANG_BASIC_LINKAGE_H
15 : #define LLVM_CLANG_BASIC_LINKAGE_H
16 :
17 : namespace clang {
18 :
19 : /// \brief Describes the different kinds of linkage
20 : /// (C++ [basic.link], C99 6.2.2) that an entity may have.
21 : enum Linkage {
22 : /// \brief No linkage, which means that the entity is unique and
23 : /// can only be referred to from within its scope.
24 : NoLinkage = 0,
25 :
26 : /// \brief Internal linkage, which indicates that the entity can
27 : /// be referred to from within the translation unit (but not other
28 : /// translation units).
29 : InternalLinkage,
30 :
31 : /// \brief External linkage within a unique namespace. From the
32 : /// langauge perspective, these entities have external
33 : /// linkage. However, since they reside in an anonymous namespace,
34 : /// their names are unique to this translation unit, which is
35 : /// equivalent to having internal linkage from the code-generation
36 : /// point of view.
37 : UniqueExternalLinkage,
38 :
39 : /// \brief External linkage, which indicates that the entity can
40 : /// be referred to from other translation units.
41 : ExternalLinkage
42 : };
43 :
44 : /// \brief Determine whether the given linkage is semantically
45 : /// external.
46 8758: inline bool isExternalLinkage(Linkage L) {
8719: branch 0 taken
39: branch 1 taken
8383: branch 2 taken
336: branch 3 taken
47 8758: return L == UniqueExternalLinkage || L == ExternalLinkage;
48 : }
49 :
50 : /// \brief Compute the minimum linkage given two linages.
51 3821: static inline Linkage minLinkage(Linkage L1, Linkage L2) {
3621: branch 1 taken
52 3821: return L1 < L2? L1 : L2;
53 : }
54 :
55 : } // end namespace clang
56 :
57 : #endif // LLVM_CLANG_BASIC_LINKAGE_H
Generated: 2010-02-10 01:31 by zcov