Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:37:05

0001 //===-- UnresolvedSet.h - Unresolved sets of declarations  ------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 //  This file defines the WeakInfo class, which is used to store
0010 //  information about the target of a #pragma weak directive.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_CLANG_SEMA_WEAK_H
0015 #define LLVM_CLANG_SEMA_WEAK_H
0016 
0017 #include "clang/Basic/SourceLocation.h"
0018 #include "llvm/ADT/DenseMapInfo.h"
0019 
0020 namespace clang {
0021 
0022 class IdentifierInfo;
0023 
0024 /// Captures information about a \#pragma weak directive.
0025 class WeakInfo {
0026   const IdentifierInfo *alias = nullptr; // alias (optional)
0027   SourceLocation loc;                    // for diagnostics
0028 public:
0029   WeakInfo() = default;
0030   WeakInfo(const IdentifierInfo *Alias, SourceLocation Loc)
0031       : alias(Alias), loc(Loc) {}
0032   inline const IdentifierInfo *getAlias() const { return alias; }
0033   inline SourceLocation getLocation() const { return loc; }
0034   bool operator==(WeakInfo RHS) const = delete;
0035   bool operator!=(WeakInfo RHS) const = delete;
0036 
0037   struct DenseMapInfoByAliasOnly
0038       : private llvm::DenseMapInfo<const IdentifierInfo *> {
0039     static inline WeakInfo getEmptyKey() {
0040       return WeakInfo(DenseMapInfo::getEmptyKey(), SourceLocation());
0041     }
0042     static inline WeakInfo getTombstoneKey() {
0043       return WeakInfo(DenseMapInfo::getTombstoneKey(), SourceLocation());
0044     }
0045     static unsigned getHashValue(const WeakInfo &W) {
0046       return DenseMapInfo::getHashValue(W.getAlias());
0047     }
0048     static bool isEqual(const WeakInfo &LHS, const WeakInfo &RHS) {
0049       return DenseMapInfo::isEqual(LHS.getAlias(), RHS.getAlias());
0050     }
0051   };
0052 };
0053 
0054 } // end namespace clang
0055 
0056 #endif // LLVM_CLANG_SEMA_WEAK_H