clang 19.0.0git
InterpShared.cpp
Go to the documentation of this file.
1//===--- InterpShared.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
9#include "InterpShared.h"
10#include "clang/AST/Attr.h"
11#include "llvm/ADT/BitVector.h"
12
13namespace clang {
14namespace interp {
15
16llvm::BitVector collectNonNullArgs(const FunctionDecl *F,
17 const llvm::ArrayRef<const Expr *> &Args) {
18 llvm::BitVector NonNullArgs;
19 if (!F)
20 return NonNullArgs;
21
22 assert(F);
23 NonNullArgs.resize(Args.size());
24
25 for (const auto *Attr : F->specific_attrs<NonNullAttr>()) {
26 if (!Attr->args_size()) {
27 NonNullArgs.set();
28 break;
29 } else
30 for (auto Idx : Attr->args()) {
31 unsigned ASTIdx = Idx.getASTIndex();
32 if (ASTIdx >= Args.size())
33 continue;
34 NonNullArgs[ASTIdx] = true;
35 }
36 }
37
38 return NonNullArgs;
39}
40
41} // namespace interp
42} // namespace clang
Attr - This represents one attribute.
Definition: Attr.h:42
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
Definition: DeclBase.h:564
Represents a function declaration or definition.
Definition: Decl.h:1971
llvm::BitVector collectNonNullArgs(const FunctionDecl *F, const llvm::ArrayRef< const Expr * > &Args)
The JSON file list parser is used to communicate input to InstallAPI.