LLDB  mainline
ClangUtil.h
Go to the documentation of this file.
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_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGUTIL_H
12 #define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGUTIL_H
13 
14 #include "clang/AST/DeclBase.h"
15 #include "clang/AST/Type.h"
16 
18 
19 namespace clang {
20 class TagDecl;
21 }
22 
23 namespace lldb_private {
24 struct ClangUtil {
25  static bool IsClangType(const CompilerType &ct);
26 
27  /// Returns the clang::Decl of the given CompilerDecl.
28  /// CompilerDecl has to be valid and represent a clang::Decl.
29  static clang::Decl *GetDecl(const CompilerDecl &decl);
30 
31  static clang::QualType GetQualType(const CompilerType &ct);
32 
33  static clang::QualType GetCanonicalQualType(const CompilerType &ct);
34 
36 
37  static clang::TagDecl *GetAsTagDecl(const CompilerType &type);
38 
39  /// Returns a textual representation of the given Decl's AST. Does not
40  /// deserialize any child nodes.
41  static std::string DumpDecl(const clang::Decl *d);
42  /// Returns a textual representation of the given type.
43  static std::string ToString(const clang::Type *t);
44  /// Returns a textual representation of the given CompilerType (assuming
45  /// its underlying type is a Clang type).
46  static std::string ToString(const CompilerType &c);
47 };
48 }
49 
50 #endif
lldb_private::ClangUtil::ToString
static std::string ToString(const clang::Type *t)
Returns a textual representation of the given type.
Definition: ClangUtil.cpp:81
lldb_private::ClangUtil::GetCanonicalQualType
static clang::QualType GetCanonicalQualType(const CompilerType &ct)
Definition: ClangUtil.cpp:44
lldb_private::CompilerDecl
Represents a generic declaration such as a function declaration.
Definition: CompilerDecl.h:28
lldb_private::ClangUtil::RemoveFastQualifiers
static CompilerType RemoveFastQualifiers(const CompilerType &ct)
Definition: ClangUtil.cpp:51
lldb_private::ClangUtil::IsClangType
static bool IsClangType(const CompilerType &ct)
Definition: ClangUtil.cpp:17
lldb_private::ClangUtil::GetQualType
static clang::QualType GetQualType(const CompilerType &ct)
Definition: ClangUtil.cpp:36
lldb_private::ClangUtil::GetAsTagDecl
static clang::TagDecl * GetAsTagDecl(const CompilerType &type)
Definition: ClangUtil.cpp:60
lldb_private::ClangUtil::DumpDecl
static std::string DumpDecl(const clang::Decl *d)
Returns a textual representation of the given Decl's AST.
Definition: ClangUtil.cpp:68
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
CompilerType.h
lldb_private::ClangUtil::GetDecl
static clang::Decl * GetDecl(const CompilerDecl &decl)
Returns the clang::Decl of the given CompilerDecl.
Definition: ClangUtil.cpp:31
lldb_private::ClangUtil
Definition: ClangUtil.h:24
clang
Definition: ASTResultSynthesizer.h:15
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16