clang  6.0.0svn
Weak.h
Go to the documentation of this file.
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 
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:
31  : alias(nullptr), loc(SourceLocation()), used(false) {}
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
IdentifierInfo * getAlias() const
Definition: Weak.h:34
One of these records is kept for each identifier that is lexed.
bool operator==(WeakInfo RHS) const
Definition: Weak.h:38
Captures information about a #pragma weak directive.
Definition: Weak.h:25
SourceLocation getLocation() const
Definition: Weak.h:35
#define false
Definition: stdbool.h:33
Encodes a location in the source.
void setUsed(bool Used=true)
Definition: Weak.h:36
Dataflow Directional Tag Classes.
WeakInfo(IdentifierInfo *Alias, SourceLocation Loc)
Definition: Weak.h:32
bool getUsed()
Definition: Weak.h:37
Defines the clang::SourceLocation class and associated facilities.
bool operator!=(WeakInfo RHS) const
Definition: Weak.h:41