Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:37:00

0001 //===--- ObjCMethodList.h - A singly linked list of methods -----*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file defines ObjCMethodList, a singly-linked list of methods.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_CLANG_SEMA_OBJCMETHODLIST_H
0014 #define LLVM_CLANG_SEMA_OBJCMETHODLIST_H
0015 
0016 #include "clang/AST/DeclObjC.h"
0017 #include "llvm/ADT/PointerIntPair.h"
0018 
0019 namespace clang {
0020 
0021 class ObjCMethodDecl;
0022 
0023 /// a linked list of methods with the same selector name but different
0024 /// signatures.
0025 struct ObjCMethodList {
0026   // NOTE: If you add any members to this struct, make sure to serialize them.
0027   /// If there is more than one decl with this signature.
0028   llvm::PointerIntPair<ObjCMethodDecl *, 1> MethodAndHasMoreThanOneDecl;
0029   /// The next list object and 2 bits for extra info.
0030   llvm::PointerIntPair<ObjCMethodList *, 2> NextAndExtraBits;
0031 
0032   ObjCMethodList() { }
0033   ObjCMethodList(ObjCMethodDecl *M)
0034       : MethodAndHasMoreThanOneDecl(M, 0) {}
0035   ObjCMethodList(const ObjCMethodList &L)
0036       : MethodAndHasMoreThanOneDecl(L.MethodAndHasMoreThanOneDecl),
0037         NextAndExtraBits(L.NextAndExtraBits) {}
0038 
0039   ObjCMethodList &operator=(const ObjCMethodList &L) {
0040     MethodAndHasMoreThanOneDecl = L.MethodAndHasMoreThanOneDecl;
0041     NextAndExtraBits = L.NextAndExtraBits;
0042     return *this;
0043   }
0044 
0045   ObjCMethodList *getNext() const { return NextAndExtraBits.getPointer(); }
0046   unsigned getBits() const { return NextAndExtraBits.getInt(); }
0047   void setNext(ObjCMethodList *L) { NextAndExtraBits.setPointer(L); }
0048   void setBits(unsigned B) { NextAndExtraBits.setInt(B); }
0049 
0050   ObjCMethodDecl *getMethod() const {
0051     return MethodAndHasMoreThanOneDecl.getPointer();
0052   }
0053   void setMethod(ObjCMethodDecl *M) {
0054     return MethodAndHasMoreThanOneDecl.setPointer(M);
0055   }
0056 
0057   bool hasMoreThanOneDecl() const {
0058     return MethodAndHasMoreThanOneDecl.getInt();
0059   }
0060   void setHasMoreThanOneDecl(bool B) {
0061     return MethodAndHasMoreThanOneDecl.setInt(B);
0062   }
0063 };
0064 
0065 }
0066 
0067 #endif