clang 10.0.0git

Weak.h
Go to the documentation of this file.
1 //===-- UnresolvedSet.h - Unresolved sets of declarations ------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the WeakInfo class, which is used to store
10 // information about the target of a #pragma weak directive.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_CLANG_SEMA_WEAK_H
15 #define LLVM_CLANG_SEMA_WEAK_H
16
17 #include "clang/Basic/SourceLocation.h"
18
19 namespace clang {
20
21 class IdentifierInfo;
22
23 /// Captures information about a \#pragma weak directive.
24 class WeakInfo {
25 IdentifierInfo *alias; // alias (optional)
26 SourceLocation loc; // for diagnostics
27 bool used; // identifier later declared?
28 public:
29 WeakInfo()
30 : alias(nullptr), loc(SourceLocation()), used(false) {}
31 WeakInfo(IdentifierInfo *Alias, SourceLocation Loc)
32 : alias(Alias), loc(Loc), used(false) {}
33 inline IdentifierInfo * getAlias() const { return alias; }
34 inline SourceLocation getLocation() const { return loc; }
35 void setUsed(bool Used=true) { used = Used; }
36 inline bool getUsed() { return used; }
37 bool operator==(WeakInfo RHS) const {
38 return alias == RHS.getAlias() && loc == RHS.getLocation();
39 }
40 bool operator!=(WeakInfo RHS) const { return !(*this == RHS); }
41 };
42
43 } // end namespace clang
44
45 #endif // LLVM_CLANG_SEMA_WEAK_H
clang::WeakInfo::getAlias
IdentifierInfo * getAlias() const
Definition: Weak.h:33
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:57
clang::WeakInfo::operator==
bool operator==(WeakInfo RHS) const
Definition: Weak.h:37
Used
Definition: ObjCUnusedIVarsChecker.cpp:29
clang::WeakInfo
Captures information about a #pragma weak directive.
Definition: Weak.h:24
clang::WeakInfo::getLocation
SourceLocation getLocation() const
Definition: Weak.h:34
false
#define false
Definition: stdbool.h:17
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::WeakInfo::setUsed
void setUsed(bool Used=true)
Definition: Weak.h:35
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
clang::WeakInfo::WeakInfo
WeakInfo()
Definition: Weak.h:29
clang::WeakInfo::WeakInfo
WeakInfo(IdentifierInfo *Alias, SourceLocation Loc)
Definition: Weak.h:31
clang::WeakInfo::getUsed
bool getUsed()
Definition: Weak.h:36
SourceLocation.h
Defines the clang::SourceLocation class and associated facilities.
clang::WeakInfo::operator!=
bool operator!=(WeakInfo RHS) const
Definition: Weak.h:40