Coverage Report

Created: 2020-09-19 12:23

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/Sema/ObjCMethodList.h
Line
Count
Source
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
2.47M
  ObjCMethodList() { }
33
  ObjCMethodList(ObjCMethodDecl *M)
34
258k
      : MethodAndHasMoreThanOneDecl(M, 0) {}
35
  ObjCMethodList(const ObjCMethodList &L)
36
      : MethodAndHasMoreThanOneDecl(L.MethodAndHasMoreThanOneDecl),
37
8.50M
        NextAndExtraBits(L.NextAndExtraBits) {}
38
39
85.9k
  ObjCMethodList &operator=(const ObjCMethodList &L) {
40
85.9k
    MethodAndHasMoreThanOneDecl = L.MethodAndHasMoreThanOneDecl;
41
85.9k
    NextAndExtraBits = L.NextAndExtraBits;
42
85.9k
    return *this;
43
85.9k
  }
44
45
2.09M
  ObjCMethodList *getNext() const { return NextAndExtraBits.getPointer(); }
46
760k
  unsigned getBits() const { return NextAndExtraBits.getInt(); }
47
1.47M
  void setNext(ObjCMethodList *L) { NextAndExtraBits.setPointer(L); }
48
323k
  void setBits(unsigned B) { NextAndExtraBits.setInt(B); }
49
50
5.74M
  ObjCMethodDecl *getMethod() const {
51
5.74M
    return MethodAndHasMoreThanOneDecl.getPointer();
52
5.74M
  }
53
1.21M
  void setMethod(ObjCMethodDecl *M) {
54
1.21M
    return MethodAndHasMoreThanOneDecl.setPointer(M);
55
1.21M
  }
56
57
104k
  bool hasMoreThanOneDecl() const {
58
104k
    return MethodAndHasMoreThanOneDecl.getInt();
59
104k
  }
60
1.21M
  void setHasMoreThanOneDecl(bool B) {
61
1.21M
    return MethodAndHasMoreThanOneDecl.setInt(B);
62
1.21M
  }
63
};
64
65
}
66
67
#endif