Coverage Report

Created: 2024-01-17 10:31

/src/llvm-project/clang/include/clang/Sema/Weak.h
Line
Count
Source (jump to first uncovered line)
1
//===-- UnresolvedSet.h - Unresolved sets of declarations  ------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
//  This file defines the WeakInfo class, which is used to store
10
//  information about the target of a #pragma weak directive.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_CLANG_SEMA_WEAK_H
15
#define LLVM_CLANG_SEMA_WEAK_H
16
17
#include "clang/Basic/SourceLocation.h"
18
#include "llvm/ADT/DenseMapInfo.h"
19
20
namespace clang {
21
22
class IdentifierInfo;
23
24
/// Captures information about a \#pragma weak directive.
25
class WeakInfo {
26
  const IdentifierInfo *alias = nullptr; // alias (optional)
27
  SourceLocation loc;                    // for diagnostics
28
public:
29
  WeakInfo() = default;
30
  WeakInfo(const IdentifierInfo *Alias, SourceLocation Loc)
31
0
      : alias(Alias), loc(Loc) {}
32
0
  inline const IdentifierInfo *getAlias() const { return alias; }
33
0
  inline SourceLocation getLocation() const { return loc; }
34
  bool operator==(WeakInfo RHS) const = delete;
35
  bool operator!=(WeakInfo RHS) const = delete;
36
37
  struct DenseMapInfoByAliasOnly
38
      : private llvm::DenseMapInfo<const IdentifierInfo *> {
39
0
    static inline WeakInfo getEmptyKey() {
40
0
      return WeakInfo(DenseMapInfo::getEmptyKey(), SourceLocation());
41
0
    }
42
0
    static inline WeakInfo getTombstoneKey() {
43
0
      return WeakInfo(DenseMapInfo::getTombstoneKey(), SourceLocation());
44
0
    }
45
0
    static unsigned getHashValue(const WeakInfo &W) {
46
0
      return DenseMapInfo::getHashValue(W.getAlias());
47
0
    }
48
0
    static bool isEqual(const WeakInfo &LHS, const WeakInfo &RHS) {
49
0
      return DenseMapInfo::isEqual(LHS.getAlias(), RHS.getAlias());
50
0
    }
51
  };
52
};
53
54
} // end namespace clang
55
56
#endif // LLVM_CLANG_SEMA_WEAK_H