clang
20.0.0git
include
clang
AST
AbstractBasicReader.h
Go to the documentation of this file.
1
//==--- AbstractBasiceReader.h - Abstract basic value deserialization -----===//
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
#ifndef LLVM_CLANG_AST_ABSTRACTBASICREADER_H
10
#define LLVM_CLANG_AST_ABSTRACTBASICREADER_H
11
12
#include "
clang/AST/DeclTemplate.h
"
13
#include <optional>
14
15
namespace
clang
{
16
namespace
serialization {
17
18
template
<
class
T>
19
inline
T
makeNullableFromOptional
(
const
std::optional<T> &value) {
20
return
(value ? *value :
T
());
21
}
22
23
template
<
class
T>
inline
T
*
makePointerFromOptional
(std::optional<T *> value) {
24
return
value.value_or(
nullptr
);
25
}
26
27
// PropertyReader is a class concept that requires the following method:
28
// BasicReader find(llvm::StringRef propertyName);
29
// where BasicReader is some class conforming to the BasicReader concept.
30
// An abstract AST-node reader is created with a PropertyReader and