mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 11:06:07 +00:00

LLVM contains a helpful function for getting the size of a C-style array: `llvm::array_lengthof`. This is useful prior to C++17, but not as helpful for C++17 or later: `std::size` already has support for C-style arrays. Change call sites to use `std::size` instead. Leave the few call sites that use a locally defined `array_lengthof` that are meant to test previous bugs with NTTPs in clang analyzer and SemaTemplate. Differential Revision: https://reviews.llvm.org/D133520
28 lines
863 B
C++
28 lines
863 B
C++
//===--- AttrDocTable.cpp - implements Attr::getDocumentation() -*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file contains out-of-line methods for Attr classes.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "clang/AST/Attr.h"
|
|
#include "llvm/ADT/StringRef.h"
|
|
|
|
#include "AttrDocTable.inc"
|
|
|
|
static const llvm::StringRef AttrDoc[] = {
|
|
#define ATTR(NAME) AttrDoc_##NAME,
|
|
#include "clang/Basic/AttrList.inc"
|
|
};
|
|
|
|
llvm::StringRef clang::Attr::getDocumentation(clang::attr::Kind K) {
|
|
if (K < std::size(AttrDoc))
|
|
return AttrDoc[K];
|
|
return "";
|
|
}
|