clang 24.0.0git
AttrDocTable.cpp
Go to the documentation of this file.
1//===--- AttrDocTable.cpp - implements Attr::getDocumentation() -*- 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 contains out-of-line methods for Attr classes.
10//
11//===----------------------------------------------------------------------===//
12
13#include "clang/AST/Attr.h"
14#include "llvm/ADT/StringRef.h"
15
17 static constexpr struct {
18#define ATTR_DOC_STR(ATTR, STR) char ATTR[sizeof(STR)];
19#include "AttrDocTable.inc"
20#undef ATTR_DOC_STR
21 } StrTab = {
22#define ATTR_DOC_STR(ATTR, STR) STR,
23#include "AttrDocTable.inc"
24#undef ATTR_DOC_STR
25 };
26
27 static constexpr uint32_t Offsets[] = {
28#define ATTR(NAME) offsetof(decltype(StrTab), NAME),
29#include "clang/Basic/AttrList.inc"
30 };
31
32 if (K < (int)std::size(Offsets))
33 return llvm::StringRef((const char *)&StrTab + Offsets[K]);
34 return "";
35}
static StringRef getDocumentation(attr::Kind)