Home | History | Annotate | Download | only in Sema
      1 //===-- UnresolvedSet.h - Unresolved sets of declarations  ------*- 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 file defines the WeakInfo class, which is used to store
     11 //  information about the target of a #pragma weak directive.
     12 //
     13 //===----------------------------------------------------------------------===//
     14 
     15 #ifndef LLVM_CLANG_SEMA_WEAK_H
     16 #define LLVM_CLANG_SEMA_WEAK_H
     17 
     18 #include "clang/Basic/SourceLocation.h"
     19 
     20 namespace clang {
     21 
     22 class IdentifierInfo;
     23 
     24 /// \brief Captures information about a \#pragma weak directive.
     25 class WeakInfo {
     26   IdentifierInfo *alias;  // alias (optional)
     27   SourceLocation loc;     // for diagnostics
     28   bool used;              // identifier later declared?
     29 public:
     30   WeakInfo()
     31     : alias(nullptr), loc(SourceLocation()), used(false) {}
     32   WeakInfo(IdentifierInfo *Alias, SourceLocation Loc)
     33     : alias(Alias), loc(Loc), used(false) {}
     34   inline IdentifierInfo * getAlias() const { return alias; }
     35   inline SourceLocation getLocation() const { return loc; }
     36   void setUsed(bool Used=true) { used = Used; }
     37   inline bool getUsed() { return used; }
     38   bool operator==(WeakInfo RHS) const {
     39     return alias == RHS.getAlias() && loc == RHS.getLocation();
     40   }
     41   bool operator!=(WeakInfo RHS) const { return !(*this == RHS); }
     42 };
     43 
     44 } // end namespace clang
     45 
     46 #endif // LLVM_CLANG_SEMA_WEAK_H
     47