clang 10.0.0git

ObjCMethodList.h
Go to the documentation of this file.
1 //===--- ObjCMethodList.h - A singly linked list of methods -----*- 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 ObjCMethodList, a singly-linked list of methods.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #ifndef LLVM_CLANG_SEMA_OBJCMETHODLIST_H
14 #define LLVM_CLANG_SEMA_OBJCMETHODLIST_H
15
16 #include "clang/AST/DeclObjC.h"
17 #include "llvm/ADT/PointerIntPair.h"
18
19 namespace clang {
20
21 class ObjCMethodDecl;
22
23 /// a linked list of methods with the same selector name but different
24 /// signatures.
25 struct ObjCMethodList {
26 // NOTE: If you add any members to this struct, make sure to serialize them.
27 /// If there is more than one decl with this signature.
28 llvm::PointerIntPair<ObjCMethodDecl *, 1> MethodAndHasMoreThanOneDecl;
29 /// The next list object and 2 bits for extra info.
30 llvm::PointerIntPair<ObjCMethodList *, 2> NextAndExtraBits;
31
32 ObjCMethodList() { }
33 ObjCMethodList(ObjCMethodDecl *M)
34 : MethodAndHasMoreThanOneDecl(M, 0) {}
35 ObjCMethodList(const ObjCMethodList &L)
36 : MethodAndHasMoreThanOneDecl(L.MethodAndHasMoreThanOneDecl),
37 NextAndExtraBits(L.NextAndExtraBits) {}
38
39 ObjCMethodList &operator=(const ObjCMethodList &L) {
40 MethodAndHasMoreThanOneDecl = L.MethodAndHasMoreThanOneDecl;
41 NextAndExtraBits = L.NextAndExtraBits;
42 return *this;
43 }
44
45 ObjCMethodList *getNext() const { return NextAndExtraBits.getPointer(); }
46 unsigned getBits() const { return NextAndExtraBits.getInt(); }
47 void setNext(ObjCMethodList *L) { NextAndExtraBits.setPointer(L); }
48 void setBits(unsigned B) { NextAndExtraBits.setInt(B); }
49
50 ObjCMethodDecl *getMethod() const {
51 return MethodAndHasMoreThanOneDecl.getPointer();
52 }
53 void setMethod(ObjCMethodDecl *M) {
54 return MethodAndHasMoreThanOneDecl.setPointer(M);
55 }
56
57 bool hasMoreThanOneDecl() const {
58 return MethodAndHasMoreThanOneDecl.getInt();
59 }
60 void setHasMoreThanOneDecl(bool B) {
61 return MethodAndHasMoreThanOneDecl.setInt(B);
62 }
63 };
64
65 }
66
67 #endif
clang::ObjCMethodList::ObjCMethodList
ObjCMethodList(const ObjCMethodList &L)
Definition: ObjCMethodList.h:35
clang::ObjCMethodList::getBits
unsigned getBits() const
Definition: ObjCMethodList.h:46
clang::ObjCMethodList::setHasMoreThanOneDecl
void setHasMoreThanOneDecl(bool B)
Definition: ObjCMethodList.h:60
DeclObjC.h
clang::ObjCMethodList::getMethod
ObjCMethodDecl * getMethod() const
Definition: ObjCMethodList.h:50
clang::ObjCMethodDecl
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:138
clang::ObjCMethodList::ObjCMethodList
ObjCMethodList(ObjCMethodDecl *M)
Definition: ObjCMethodList.h:33
clang::ObjCMethodList::setMethod
void setMethod(ObjCMethodDecl *M)
Definition: ObjCMethodList.h:53
clang::ObjCMethodList::ObjCMethodList
ObjCMethodList()
Definition: ObjCMethodList.h:32
clang::ObjCMethodList::NextAndExtraBits
llvm::PointerIntPair< ObjCMethodList *, 2 > NextAndExtraBits
The next list object and 2 bits for extra info.
Definition: ObjCMethodList.h:30
clang::ObjCMethodList::getNext
ObjCMethodList * getNext() const
Definition: ObjCMethodList.h:45
clang::ObjCMethodList::MethodAndHasMoreThanOneDecl
llvm::PointerIntPair< ObjCMethodDecl *, 1 > MethodAndHasMoreThanOneDecl
If there is more than one decl with this signature.
Definition: ObjCMethodList.h:28
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
clang::ObjCMethodList::setNext
void setNext(ObjCMethodList *L)
Definition: ObjCMethodList.h:47
clang::ObjCMethodList::setBits
void setBits(unsigned B)
Definition: ObjCMethodList.h:48
clang::ObjCMethodList::hasMoreThanOneDecl
bool hasMoreThanOneDecl() const
Definition: ObjCMethodList.h:57
clang::ObjCMethodList
a linked list of methods with the same selector name but different signatures.
Definition: ObjCMethodList.h:25
clang::ObjCMethodList::operator=
ObjCMethodList & operator=(const ObjCMethodList &L)
Definition: ObjCMethodList.h:39