clang API Documentation

Weak.h
Go to the documentation of this file.
00001 //===-- UnresolvedSet.h - Unresolved sets of declarations  ------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 //  This file defines the WeakInfo class, which is used to store
00011 //  information about the target of a #pragma weak directive.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_CLANG_SEMA_WEAK_H
00016 #define LLVM_CLANG_SEMA_WEAK_H
00017 
00018 #include "clang/Basic/SourceLocation.h"
00019 
00020 namespace clang {
00021 
00022 class IdentifierInfo;
00023 
00024 /// \brief Captures information about a \#pragma weak directive.
00025 class WeakInfo {
00026   IdentifierInfo *alias;  // alias (optional)
00027   SourceLocation loc;     // for diagnostics
00028   bool used;              // identifier later declared?
00029 public:
00030   WeakInfo()
00031     : alias(nullptr), loc(SourceLocation()), used(false) {}
00032   WeakInfo(IdentifierInfo *Alias, SourceLocation Loc)
00033     : alias(Alias), loc(Loc), used(false) {}
00034   inline IdentifierInfo * getAlias() const { return alias; }
00035   inline SourceLocation getLocation() const { return loc; }
00036   void setUsed(bool Used=true) { used = Used; }
00037   inline bool getUsed() { return used; }
00038   bool operator==(WeakInfo RHS) const {
00039     return alias == RHS.getAlias() && loc == RHS.getLocation();
00040   }
00041   bool operator!=(WeakInfo RHS) const { return !(*this == RHS); }
00042 };
00043 
00044 } // end namespace clang
00045 
00046 #endif // LLVM_CLANG_SEMA_WEAK_H