Path: blob/main/contrib/llvm-project/clang/lib/AST/Interp/InterpShared.cpp
35291 views
//===--- InterpShared.cpp ---------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "InterpShared.h"9#include "clang/AST/Attr.h"10#include "llvm/ADT/BitVector.h"1112namespace clang {13namespace interp {1415llvm::BitVector collectNonNullArgs(const FunctionDecl *F,16const llvm::ArrayRef<const Expr *> &Args) {17llvm::BitVector NonNullArgs;18if (!F)19return NonNullArgs;2021assert(F);22NonNullArgs.resize(Args.size());2324for (const auto *Attr : F->specific_attrs<NonNullAttr>()) {25if (!Attr->args_size()) {26NonNullArgs.set();27break;28} else29for (auto Idx : Attr->args()) {30unsigned ASTIdx = Idx.getASTIndex();31if (ASTIdx >= Args.size())32continue;33NonNullArgs[ASTIdx] = true;34}35}3637return NonNullArgs;38}3940} // namespace interp41} // namespace clang424344