-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathcpp_return_statement.h
More file actions
50 lines (39 loc) · 936 Bytes
/
Copy pathcpp_return_statement.h
File metadata and controls
50 lines (39 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (C) 2022 Satya Das and CppParser contributors
// SPDX-License-Identifier: MIT
#ifndef A0CFB388_7CA2_495B_BD3B_414E92AF16F5
#define A0CFB388_7CA2_495B_BD3B_414E92AF16F5
#include "cppast/cpp_entity.h"
#include "cppast/cpp_expression.h"
#include <memory>
namespace cppast {
class CppReturnStatement : public CppEntity
{
public:
static constexpr auto EntityType()
{
return CppEntityType::RETURN_STATEMENT;
}
public:
CppReturnStatement(std::unique_ptr<CppExpression> expr)
: CppEntity(EntityType())
, expr_(std::move(expr))
{
}
CppReturnStatement()
: CppReturnStatement(std::unique_ptr<CppExpression>())
{
}
public:
bool hasReturnValue() const
{
return expr_.get() != nullptr;
}
const CppExpression& returnValue() const
{
return *expr_;
}
private:
std::unique_ptr<CppExpression> expr_;
};
} // namespace cppast
#endif /* A0CFB388_7CA2_495B_BD3B_414E92AF16F5 */