clang 19.0.0git
Weak.h
Go to the documentation of this file.
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
18#include "llvm/ADT/DenseMapInfo.h"
19
20namespace clang {
21
22class IdentifierInfo;
23
24/// Captures information about a \#pragma weak directive.
25class WeakInfo {
26 const IdentifierInfo *alias = nullptr; // alias (optional)
27 SourceLocation loc; // for diagnostics
28public:
29 WeakInfo() = default;
31 : alias(Alias), loc(Loc) {}
32 inline const IdentifierInfo *getAlias() const { return alias; }
33 inline SourceLocation getLocation() const { return loc; }
34 bool operator==(WeakInfo RHS) const = delete;
35 bool operator!=(WeakInfo RHS) const = delete;
36
38 : private llvm::DenseMapInfo<const IdentifierInfo *> {
39 static inline WeakInfo getEmptyKey() {
40 return WeakInfo(DenseMapInfo::getEmptyKey(), SourceLocation());
41 }
42 static inline WeakInfo getTombstoneKey() {
43 return WeakInfo(DenseMapInfo::getTombstoneKey(), SourceLocation());
44 }
45 static unsigned getHashValue(const WeakInfo &W) {
46 return DenseMapInfo::getHashValue(W.getAlias());
47 }
48 static bool isEqual(const WeakInfo &LHS, const WeakInfo &RHS) {
49 return DenseMapInfo::isEqual(LHS.getAlias(), RHS.getAlias());
50 }
51 };
52};
53
54} // end namespace clang
55
56#endif // LLVM_CLANG_SEMA_WEAK_H
Defines the clang::SourceLocation class and associated facilities.
One of these records is kept for each identifier that is lexed.
Encodes a location in the source.
Captures information about a #pragma weak directive.
Definition: Weak.h:25
bool operator!=(WeakInfo RHS) const =delete
WeakInfo()=default
const IdentifierInfo * getAlias() const
Definition: Weak.h:32
bool operator==(WeakInfo RHS) const =delete
SourceLocation getLocation() const
Definition: Weak.h:33
WeakInfo(const IdentifierInfo *Alias, SourceLocation Loc)
Definition: Weak.h:30
The JSON file list parser is used to communicate input to InstallAPI.
static bool isEqual(const WeakInfo &LHS, const WeakInfo &RHS)
Definition: Weak.h:48
static WeakInfo getTombstoneKey()
Definition: Weak.h:42
static unsigned getHashValue(const WeakInfo &W)
Definition: Weak.h:45