131e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor//===-- UnresolvedSet.h - Unresolved sets of declarations  ------*- C++ -*-===//
231e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor//
331e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor//                     The LLVM Compiler Infrastructure
431e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor//
531e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor// This file is distributed under the University of Illinois Open Source
631e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor// License. See LICENSE.TXT for details.
731e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor//
831e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor//===----------------------------------------------------------------------===//
931e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor//
1031e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor//  This file defines the WeakInfo class, which is used to store
1131e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor//  information about the target of a #pragma weak directive.
1231e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor//
1331e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor//===----------------------------------------------------------------------===//
1431e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor
1531e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor#ifndef LLVM_CLANG_SEMA_WEAK_H
1631e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor#define LLVM_CLANG_SEMA_WEAK_H
1731e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor
1831e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor#include "clang/Basic/SourceLocation.h"
1931e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor
2031e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregornamespace clang {
2131e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor
2231e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregorclass IdentifierInfo;
2331e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor
24809d1be9820039b4cf6efa48246a0d70ffa13394James Dennett/// \brief Captures information about a \#pragma weak directive.
2531e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregorclass WeakInfo {
2631e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor  IdentifierInfo *alias;  // alias (optional)
2731e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor  SourceLocation loc;     // for diagnostics
2831e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor  bool used;              // identifier later declared?
2931e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregorpublic:
3031e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor  WeakInfo()
316bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines    : alias(nullptr), loc(SourceLocation()), used(false) {}
3231e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor  WeakInfo(IdentifierInfo *Alias, SourceLocation Loc)
3331e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor    : alias(Alias), loc(Loc), used(false) {}
3431e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor  inline IdentifierInfo * getAlias() const { return alias; }
3531e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor  inline SourceLocation getLocation() const { return loc; }
3631e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor  void setUsed(bool Used=true) { used = Used; }
3731e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor  inline bool getUsed() { return used; }
3831e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor  bool operator==(WeakInfo RHS) const {
3931e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor    return alias == RHS.getAlias() && loc == RHS.getLocation();
4031e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor  }
4131e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor  bool operator!=(WeakInfo RHS) const { return !(*this == RHS); }
4231e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor};
4331e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor
4431e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor} // end namespace clang
4531e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor
4631e37b2d7b4815fdea6a35d49f33005562f0d494Douglas Gregor#endif // LLVM_CLANG_SEMA_WEAK_H
47