CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
108 lines
3.3 KiB
C++
108 lines
3.3 KiB
C++
//===-- RPCCommon.h -------------------------------------------------------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLDB_RPC_GEN_RPCCOMMON_H
|
|
#define LLDB_RPC_GEN_RPCCOMMON_H
|
|
|
|
#include "clang/AST/AST.h"
|
|
#include "clang/AST/ASTContext.h"
|
|
#include "clang/AST/DeclCXX.h"
|
|
#include "llvm/Support/ToolOutputFile.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
#include <string>
|
|
|
|
using namespace clang;
|
|
|
|
namespace lldb_rpc_gen {
|
|
QualType GetUnderlyingType(QualType T);
|
|
QualType GetUnqualifiedUnderlyingType(QualType T);
|
|
std::string GetMangledName(ASTContext &Context, CXXMethodDecl *MDecl);
|
|
|
|
bool TypeIsFromLLDBPrivate(QualType T);
|
|
bool TypeIsSBClass(QualType T);
|
|
bool TypeIsConstCharPtr(QualType T);
|
|
bool TypeIsConstCharPtrPtr(QualType T);
|
|
bool TypeIsDisallowedClass(QualType T);
|
|
bool TypeIsCallbackFunctionPointer(QualType T);
|
|
|
|
bool MethodIsDisallowed(ASTContext &Context, CXXMethodDecl *MDecl);
|
|
|
|
std::string ReplaceLLDBNamespaceWithRPCNamespace(std::string Name);
|
|
std::string StripLLDBNamespace(std::string Name);
|
|
bool SBClassRequiresDefaultCtor(const std::string &ClassName);
|
|
bool SBClassRequiresCopyCtorAssign(const std::string &ClassName);
|
|
bool SBClassInheritsFromObjectRef(const std::string &ClassName);
|
|
std::string GetSBClassNameFromType(QualType T);
|
|
struct Param {
|
|
std::string Name;
|
|
QualType Type;
|
|
std::string DefaultValueText;
|
|
bool IsFollowedByLen;
|
|
};
|
|
|
|
enum GenerationKind : bool { eServer, eLibrary };
|
|
|
|
struct Method {
|
|
enum Type { eOther, eConstructor, eDestructor };
|
|
|
|
Method(CXXMethodDecl *MDecl, const PrintingPolicy &Policy,
|
|
ASTContext &Context);
|
|
|
|
// Adding a '<' allows us to use Methods in ordered containers.
|
|
// The ordering is on memory addresses.
|
|
bool operator<(const lldb_rpc_gen::Method &rhs) const;
|
|
const PrintingPolicy &Policy;
|
|
const ASTContext &Context;
|
|
std::string QualifiedName;
|
|
std::string BaseName;
|
|
std::string MangledName;
|
|
QualType ReturnType;
|
|
QualType ThisType;
|
|
std::vector<Param> Params;
|
|
bool IsConst = false;
|
|
bool IsInstance = false;
|
|
bool IsCtor = false;
|
|
bool IsCopyCtor = false;
|
|
bool IsCopyAssign = false;
|
|
bool IsMoveCtor = false;
|
|
bool IsMoveAssign = false;
|
|
bool IsDtor = false;
|
|
bool IsConversionMethod = false;
|
|
bool IsExplicitCtorOrConversionMethod = false;
|
|
bool ContainsFunctionPointerParameter = false;
|
|
|
|
std::string CreateParamListAsString(GenerationKind Generation,
|
|
bool IncludeDefaultValue = false) const;
|
|
|
|
bool RequiresConnectionParameter() const;
|
|
};
|
|
|
|
std::string
|
|
GetDefaultArgumentsForConstructor(std::string ClassName,
|
|
const lldb_rpc_gen::Method &method);
|
|
|
|
class FileEmitter {
|
|
protected:
|
|
FileEmitter(std::unique_ptr<llvm::ToolOutputFile> &&OutputFile)
|
|
: OutputFile(std::move(OutputFile)), IndentLevel(0) {}
|
|
void EmitLine(const std::string &line) {
|
|
for (auto i = 0; i < IndentLevel; i++)
|
|
OutputFile->os() << " ";
|
|
|
|
OutputFile->os() << line << "\n";
|
|
}
|
|
|
|
void EmitNewLine() { OutputFile->os() << "\n"; }
|
|
|
|
std::unique_ptr<llvm::ToolOutputFile> OutputFile;
|
|
uint8_t IndentLevel;
|
|
};
|
|
} // namespace lldb_rpc_gen
|
|
#endif // LLDB_RPC_GEN_RPCCOMMON_H
|