Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Plugins / ExpressionParser / Clang / ClangUtil.h
blob50cae42bc7c2113f6b7572fd5387ab74bf6422d6
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 //===----------------------------------------------------------------------===//
11 #ifndef LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGUTIL_H
12 #define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGUTIL_H
14 #include "clang/AST/DeclBase.h"
15 #include "clang/AST/Type.h"
17 #include "lldb/Symbol/CompilerType.h"
19 namespace clang {
20 class TagDecl;
23 namespace lldb_private {
24 struct ClangUtil {
25 static bool IsClangType(const CompilerType &ct);
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);
31 static clang::QualType GetQualType(const CompilerType &ct);
33 static clang::QualType GetCanonicalQualType(const CompilerType &ct);
35 static CompilerType RemoveFastQualifiers(const CompilerType &ct);
37 static clang::TagDecl *GetAsTagDecl(const CompilerType &type);
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);
50 #endif