BuildTree.h revision 360784
1//===- BuildTree.h - build syntax trees -----------------------*- 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// Functions to construct a syntax tree from an AST.
9//===----------------------------------------------------------------------===//
10#ifndef LLVM_CLANG_TOOLING_SYNTAX_TREE_H
11#define LLVM_CLANG_TOOLING_SYNTAX_TREE_H
12
13#include "clang/AST/Decl.h"
14#include "clang/Basic/TokenKinds.h"
15#include "clang/Tooling/Syntax/Nodes.h"
16#include "clang/Tooling/Syntax/Tree.h"
17
18namespace clang {
19namespace syntax {
20
21/// Build a syntax tree for the main file.
22syntax::TranslationUnit *buildSyntaxTree(Arena &A,
23                                         const clang::TranslationUnitDecl &TU);
24
25// Create syntax trees from subtrees not backed by the source code.
26
27clang::syntax::Leaf *createPunctuation(clang::syntax::Arena &A,
28                                       clang::tok::TokenKind K);
29clang::syntax::EmptyStatement *createEmptyStatement(clang::syntax::Arena &A);
30
31} // namespace syntax
32} // namespace clang
33#endif
34