Coverage Report

Created: 2018-11-16 02:38

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/AST/Availability.h
Line
Count
Source
1
//===--- Availability.h - Classes for availability --------------*- 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 files defines some classes that implement availability checking.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_CLANG_AST_AVAILABILITY_H
15
#define LLVM_CLANG_AST_AVAILABILITY_H
16
17
#include "clang/Basic/SourceLocation.h"
18
#include "llvm/ADT/StringRef.h"
19
#include "llvm/Support/VersionTuple.h"
20
21
namespace clang {
22
23
/// One specifier in an @available expression.
24
///
25
/// \code
26
///   @available(macos 10.10, *)
27
/// \endcode
28
///
29
/// Here, 'macos 10.10' and '*' both map to an instance of this type.
30
///
31
class AvailabilitySpec {
32
  /// Represents the version that this specifier requires. If the host OS
33
  /// version is greater than or equal to Version, the @available will evaluate
34
  /// to true.
35
  VersionTuple Version;
36
37
  /// Name of the platform that Version corresponds to.
38
  StringRef Platform;
39
40
  SourceLocation BeginLoc, EndLoc;
41
42
public:
43
  AvailabilitySpec(VersionTuple Version, StringRef Platform,
44
                   SourceLocation BeginLoc, SourceLocation EndLoc)
45
      : Version(Version), Platform(Platform), BeginLoc(BeginLoc),
46
86
        EndLoc(EndLoc) {}
47
48
  /// This constructor is used when representing the '*' case.
49
  AvailabilitySpec(SourceLocation StarLoc)
50
77
      : BeginLoc(StarLoc), EndLoc(StarLoc) {}
51
52
64
  VersionTuple getVersion() const { return Version; }
53
182
  StringRef getPlatform() const { return Platform; }
54
1
  SourceLocation getBeginLoc() const { return BeginLoc; }
55
2
  SourceLocation getEndLoc() const { return EndLoc; }
56
57
  /// Returns true when this represents the '*' case.
58
160
  bool isOtherPlatformSpec() const { return Version.empty(); }
59
};
60
61
} // end namespace clang
62
63
#endif