clang 22.0.0git
InitMap.cpp
Go to the documentation of this file.
1//===----------------------- InitMap.cpp ------------------------*- 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#include "InitMap.h"
9
10using namespace clang;
11using namespace clang::interp;
12
14 : UninitFields(N), Data(std::make_unique<T[]>(numFields(N))) {}
15
16bool InitMap::initializeElement(unsigned I) {
17 unsigned Bucket = I / PER_FIELD;
18 T Mask = T(1) << (I % PER_FIELD);
19 if (!(data()[Bucket] & Mask)) {
20 data()[Bucket] |= Mask;
21 UninitFields -= 1;
22 }
23 return UninitFields == 0;
24}
25
26bool InitMap::isElementInitialized(unsigned I) const {
27 if (UninitFields == 0)
28 return true;
29 unsigned Bucket = I / PER_FIELD;
30 return data()[Bucket] & (T(1) << (I % PER_FIELD));
31}
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
InitMap(unsigned N)
Initializes the map with no fields set.
Definition InitMap.cpp:13