1 //===- Nodes.cpp ----------------------------------------------*- C++ -*-=====//
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
7 //===----------------------------------------------------------------------===//
8 #include "clang/Tooling/Syntax/Nodes.h"
9 #include "clang/Basic/TokenKinds.h"
11 using namespace clang;
13 llvm::raw_ostream &syntax::operator<<(llvm::raw_ostream &OS, NodeKind K) {
17 case NodeKind::TranslationUnit:
18 return OS << "TranslationUnit";
19 case NodeKind::TopLevelDeclaration:
20 return OS << "TopLevelDeclaration";
21 case NodeKind::CompoundStatement:
22 return OS << "CompoundStatement";
24 llvm_unreachable("unknown node kind");
27 syntax::Leaf *syntax::CompoundStatement::lbrace() {
28 return llvm::cast_or_null<syntax::Leaf>(
29 findChild(NodeRole::CompoundStatement_lbrace));
32 syntax::Leaf *syntax::CompoundStatement::rbrace() {
33 return llvm::cast_or_null<syntax::Leaf>(
34 findChild(NodeRole::CompoundStatement_rbrace));