A lot of comments in LLDB are surrounded by an ASCII line to delimit the begging and end of the comment. Its use is not really consistent across the code base, sometimes the lines are longer, sometimes they are shorter and sometimes they are omitted. Furthermore, it looks kind of weird with the 80 column limit, where the comment actually extends past the line, but not by much. Furthermore, when /// is used for Doxygen comments, it looks particularly odd. And when // is used, it incorrectly gives the impression that it's actually a Doxygen comment. I assume these lines were added to improve distinguishing between comments and code. However, given that todays editors and IDEs do a great job at highlighting comments, I think it's worth to drop this for the sake of consistency. The alternative is fixing all the inconsistencies, which would create a lot more churn. Differential revision: https://reviews.llvm.org/D60508 llvm-svn: 358135
82 lines
2.8 KiB
C++
82 lines
2.8 KiB
C++
//===-- ClangPersistentVariables.h ------------------------------*- 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef liblldb_ClangPersistentVariables_h_
|
|
#define liblldb_ClangPersistentVariables_h_
|
|
|
|
#include "llvm/ADT/DenseMap.h"
|
|
|
|
#include "ClangExpressionVariable.h"
|
|
#include "ClangModulesDeclVendor.h"
|
|
|
|
#include "lldb/Expression/ExpressionVariable.h"
|
|
|
|
namespace lldb_private {
|
|
|
|
/// \class ClangPersistentVariables ClangPersistentVariables.h
|
|
/// "lldb/Expression/ClangPersistentVariables.h" Manages persistent values
|
|
/// that need to be preserved between expression invocations.
|
|
///
|
|
/// A list of variables that can be accessed and updated by any expression. See
|
|
/// ClangPersistentVariable for more discussion. Also provides an increasing,
|
|
/// 0-based counter for naming result variables.
|
|
class ClangPersistentVariables : public PersistentExpressionState {
|
|
public:
|
|
ClangPersistentVariables();
|
|
|
|
~ClangPersistentVariables() override = default;
|
|
|
|
// llvm casting support
|
|
static bool classof(const PersistentExpressionState *pv) {
|
|
return pv->getKind() == PersistentExpressionState::eKindClang;
|
|
}
|
|
|
|
lldb::ExpressionVariableSP
|
|
CreatePersistentVariable(const lldb::ValueObjectSP &valobj_sp) override;
|
|
|
|
lldb::ExpressionVariableSP CreatePersistentVariable(
|
|
ExecutionContextScope *exe_scope, ConstString name,
|
|
const CompilerType &compiler_type, lldb::ByteOrder byte_order,
|
|
uint32_t addr_byte_size) override;
|
|
|
|
void RemovePersistentVariable(lldb::ExpressionVariableSP variable) override;
|
|
llvm::StringRef
|
|
GetPersistentVariablePrefix(bool is_error) const override {
|
|
return "$";
|
|
}
|
|
|
|
void RegisterPersistentDecl(ConstString name, clang::NamedDecl *decl);
|
|
|
|
clang::NamedDecl *GetPersistentDecl(ConstString name);
|
|
|
|
void AddHandLoadedClangModule(ClangModulesDeclVendor::ModuleID module) {
|
|
m_hand_loaded_clang_modules.push_back(module);
|
|
}
|
|
|
|
const ClangModulesDeclVendor::ModuleVector &GetHandLoadedClangModules() {
|
|
return m_hand_loaded_clang_modules;
|
|
}
|
|
|
|
private:
|
|
uint32_t m_next_persistent_variable_id; ///< The counter used by
|
|
///GetNextResultName().
|
|
|
|
typedef llvm::DenseMap<const char *, clang::NamedDecl *> PersistentDeclMap;
|
|
PersistentDeclMap
|
|
m_persistent_decls; ///< Persistent entities declared by the user.
|
|
|
|
ClangModulesDeclVendor::ModuleVector
|
|
m_hand_loaded_clang_modules; ///< These are Clang modules we hand-loaded;
|
|
///these are the highest-
|
|
///< priority source for macros.
|
|
};
|
|
|
|
} // namespace lldb_private
|
|
|
|
#endif // liblldb_ClangPersistentVariables_h_
|