ClangUtil.h revision 360784
1//===-- ClangUtil.h ---------------------------------------------*- 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// A collection of helper methods and data structures for manipulating clang
8// types and decls.
9//===----------------------------------------------------------------------===//
10
11#ifndef LLDB_SYMBOL_CLANGUTIL_H
12#define LLDB_SYMBOL_CLANGUTIL_H
13
14#include "clang/AST/DeclBase.h"
15#include "clang/AST/Type.h"
16
17#include "lldb/Symbol/CompilerType.h"
18
19namespace clang {
20class TagDecl;
21}
22
23namespace lldb_private {
24struct ClangUtil {
25  static bool IsClangType(const CompilerType &ct);
26
27  static clang::QualType GetQualType(const CompilerType &ct);
28
29  static clang::QualType GetCanonicalQualType(const CompilerType &ct);
30
31  static CompilerType RemoveFastQualifiers(const CompilerType &ct);
32
33  static clang::TagDecl *GetAsTagDecl(const CompilerType &type);
34
35  /// Returns a textual representation of the given Decl's AST. Does not
36  /// deserialize any child nodes.
37  static std::string DumpDecl(const clang::Decl *d);
38  /// Returns a textual representation of the given type.
39  static std::string ToString(const clang::Type *t);
40  /// Returns a textual representation of the given CompilerType (assuming
41  /// its underlying type is a Clang type).
42  static std::string ToString(const CompilerType &c);
43};
44}
45
46#endif
47