diff options
| author | joerg <joerg@NetBSD.org> | 2019-11-08 14:28:07 +0000 |
|---|---|---|
| committer | joerg <joerg@NetBSD.org> | 2019-11-08 14:28:07 +0000 |
| commit | 06f32e7ed0e1e34c680117c640fa1a15cb3b1c68 (patch) | |
| tree | a8ccc0d5a51ecf6c13cbe2bc43d4a6b01303d9a1 /external/apache2/llvm/dist/clang/lib/Tooling/Syntax/Nodes.cpp | |
| parent | 9e0c3fe94901b8278eec6ee629bac2a9937b6a84 (diff) | |
Import 01f3a59fb3e2542fce74c768718f594d0debd0da from the LLVM mono-repo:
clang (without test/, unittests/, www/)
llvm (without test/, unittests/)
Diffstat (limited to 'external/apache2/llvm/dist/clang/lib/Tooling/Syntax/Nodes.cpp')
| -rw-r--r-- | external/apache2/llvm/dist/clang/lib/Tooling/Syntax/Nodes.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/external/apache2/llvm/dist/clang/lib/Tooling/Syntax/Nodes.cpp b/external/apache2/llvm/dist/clang/lib/Tooling/Syntax/Nodes.cpp new file mode 100644 index 00000000000..061ed73bbeb --- /dev/null +++ b/external/apache2/llvm/dist/clang/lib/Tooling/Syntax/Nodes.cpp @@ -0,0 +1,35 @@ +//===- Nodes.cpp ----------------------------------------------*- C++ -*-=====// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#include "clang/Tooling/Syntax/Nodes.h" +#include "clang/Basic/TokenKinds.h" + +using namespace clang; + +llvm::raw_ostream &syntax::operator<<(llvm::raw_ostream &OS, NodeKind K) { + switch (K) { + case NodeKind::Leaf: + return OS << "Leaf"; + case NodeKind::TranslationUnit: + return OS << "TranslationUnit"; + case NodeKind::TopLevelDeclaration: + return OS << "TopLevelDeclaration"; + case NodeKind::CompoundStatement: + return OS << "CompoundStatement"; + } + llvm_unreachable("unknown node kind"); +} + +syntax::Leaf *syntax::CompoundStatement::lbrace() { + return llvm::cast_or_null<syntax::Leaf>( + findChild(NodeRole::CompoundStatement_lbrace)); +} + +syntax::Leaf *syntax::CompoundStatement::rbrace() { + return llvm::cast_or_null<syntax::Leaf>( + findChild(NodeRole::CompoundStatement_rbrace)); +} |
