mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
Adopt clang-tidy: readability-identifier-naming
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
Checks: '-*,readability-identifier-naming'
|
||||
CheckOptions:
|
||||
- key: readability-identifier-naming.GlobalVariableCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.ConstexprVariableIgnoredRegexp
|
||||
value: '.*_v'
|
||||
- key: readability-identifier-naming.ClassCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.ClassIgnoredRegexp
|
||||
value: 'is_specialization|are_same|is_std_vector|scc_iterator_traits|.*_(false|true)'
|
||||
- key: readability-identifier-naming.EnumCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.FunctionCase
|
||||
value: camelBack
|
||||
- key: readability-identifier-naming.FunctionIgnoredRegexp
|
||||
value: 'cmp|is_forward_node|has_parent|make_range|make_array|contains_any_of|successor_edges|predecessor_edges|is_bidirectional_node|is_generic_graph|lower_bound|upper_bound|vlower_bound|zipmap_.*|insert_or_assign|batch_insert.*|unique_last|emplace_back|push_back|pop_back|make_blacklist|erase_if|isa_with_op|edge_dest|edge_successors|edge_predecessors|revng_check.*|revng_assert.*|revng_do_abort|get_return_object|get_return_object_on_allocation_failure|unhandled_exception|initial_suspend|final_suspend|await_ready|await_suspend|await_resume|__coro_gro|__promise|yield_value|rethrow_if_exception|throw_exception|init_unit_test|.*_[cr]*(begin|end)|.*_(iterator|range|size)|return_value|return_void|await_transform'
|
||||
- key: readability-identifier-naming.MemberCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.ParameterCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.UnionCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.VariableCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.IgnoreMainLikeFunctions
|
||||
value: 1
|
||||
- key: readability-identifier-naming.GlobalVariableIgnoredRegexp
|
||||
value: 'dbg'
|
||||
@@ -4,6 +4,7 @@
|
||||
// This file is distributed under the MIT License. See LICENSE.md for details.
|
||||
//
|
||||
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
template<typename T, typename U>
|
||||
@@ -28,14 +29,14 @@ concept Integral = std::is_integral_v<T>;
|
||||
namespace ranges {
|
||||
|
||||
template<class T>
|
||||
concept range = requires(T & t) {
|
||||
std::begin(t);
|
||||
std::end(t);
|
||||
concept range = requires(T &R) {
|
||||
std::begin(R);
|
||||
std::end(R);
|
||||
};
|
||||
|
||||
template<class T>
|
||||
concept sized_range = ranges::range<T> && requires(T & t) {
|
||||
std::size(t);
|
||||
concept sized_range = ranges::range<T> && requires(T &R) {
|
||||
std::size(R);
|
||||
};
|
||||
|
||||
} // namespace ranges
|
||||
|
||||
@@ -352,6 +352,7 @@ class BidirectionalNode
|
||||
SmallSize,
|
||||
BidirectionalNode>::Result {
|
||||
public:
|
||||
// NOLINTNEXTLINE
|
||||
static const bool is_bidirectional_node = true;
|
||||
|
||||
public:
|
||||
@@ -1179,6 +1180,7 @@ template<typename NodeT, size_t SmallSize, bool HasEntryNode>
|
||||
class GenericGraph
|
||||
: public std::conditional_t<HasEntryNode, EntryNode<NodeT>, Empty> {
|
||||
public:
|
||||
// NOLINTNEXTLINE
|
||||
static const bool is_generic_graph = true;
|
||||
using NodesContainer = llvm::SmallVector<std::unique_ptr<NodeT>, SmallSize>;
|
||||
using Node = NodeT;
|
||||
|
||||
@@ -114,18 +114,18 @@ public:
|
||||
|
||||
private:
|
||||
using concrete_types = concrete_types_traits_t<T>;
|
||||
static constexpr void (*deleter)(T *) = &destroy<T>;
|
||||
using inner_pointer = std::unique_ptr<T, decltype(deleter)>;
|
||||
static constexpr void (*Deleter)(T *) = &destroy<T>;
|
||||
using inner_pointer = std::unique_ptr<T, decltype(Deleter)>;
|
||||
|
||||
public:
|
||||
using pointer = typename inner_pointer::pointer;
|
||||
using element_type = typename inner_pointer::element_type;
|
||||
|
||||
public:
|
||||
constexpr UpcastablePointer() noexcept : Pointer(nullptr, deleter) {}
|
||||
constexpr UpcastablePointer() noexcept : Pointer(nullptr, Deleter) {}
|
||||
constexpr UpcastablePointer(std::nullptr_t P) noexcept :
|
||||
Pointer(P, deleter) {}
|
||||
explicit UpcastablePointer(pointer P) noexcept : Pointer(P, deleter) {}
|
||||
Pointer(P, Deleter) {}
|
||||
explicit UpcastablePointer(pointer P) noexcept : Pointer(P, Deleter) {}
|
||||
|
||||
public:
|
||||
template<DerivesFrom<T> Q, typename... Args>
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
UpcastablePointer &operator=(const UpcastablePointer &Other) {
|
||||
if (&Other != this) {
|
||||
Pointer.reset(clone(Other.Pointer.get()));
|
||||
revng_assert(Pointer.get_deleter() == deleter);
|
||||
revng_assert(Pointer.get_deleter() == Deleter);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
UpcastablePointer &operator=(UpcastablePointer &&Other) {
|
||||
if (&Other != this) {
|
||||
Pointer.reset(Other.Pointer.release());
|
||||
revng_assert(Pointer.get_deleter() == deleter);
|
||||
revng_assert(Pointer.get_deleter() == Deleter);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ public:
|
||||
|
||||
void reset(pointer Other = pointer()) noexcept {
|
||||
Pointer.reset(Other);
|
||||
revng_assert(Pointer.get_deleter() == deleter);
|
||||
revng_assert(Pointer.get_deleter() == Deleter);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -23,6 +23,7 @@ TUPLE-TREE-YAML */
|
||||
|
||||
#include "revng/Model/Generated/Early/RelocationType.h"
|
||||
|
||||
// NOLINTNEXTLINE
|
||||
const unsigned char R_MIPS_IMPLICIT_RELATIVE = 255;
|
||||
|
||||
namespace model::RelocationType {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
namespace pipeline {
|
||||
|
||||
template<typename T>
|
||||
concept HasID = requires(T a) {
|
||||
concept HasID = requires {
|
||||
{ T::ID } -> convertible_to<const char &>;
|
||||
};
|
||||
|
||||
|
||||
@@ -47,9 +47,9 @@ private:
|
||||
KindsRegistry TheKindRegistry;
|
||||
|
||||
private:
|
||||
explicit Context(KindsRegistry registry) :
|
||||
TheKindRegistry(std::move(registry)) {}
|
||||
Context(llvm::ArrayRef<NamedGlobalReference> Globals, KindsRegistry registry);
|
||||
explicit Context(KindsRegistry Registry) :
|
||||
TheKindRegistry(std::move(Registry)) {}
|
||||
Context(llvm::ArrayRef<NamedGlobalReference> Globals, KindsRegistry Registry);
|
||||
|
||||
public:
|
||||
Context();
|
||||
@@ -57,12 +57,12 @@ public:
|
||||
|
||||
public:
|
||||
static Context fromRegistry(llvm::ArrayRef<NamedGlobalReference> Globals,
|
||||
KindsRegistry registry) {
|
||||
return Context(Globals, std::move(registry));
|
||||
KindsRegistry Registry) {
|
||||
return Context(Globals, std::move(Registry));
|
||||
}
|
||||
|
||||
static Context fromRegistry(KindsRegistry registry) {
|
||||
return Context(std::move(registry));
|
||||
static Context fromRegistry(KindsRegistry Registry) {
|
||||
return Context(std::move(Registry));
|
||||
}
|
||||
|
||||
template<typename... T>
|
||||
|
||||
@@ -35,14 +35,14 @@ public:
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
concept LLVMPass = requires(T a) {
|
||||
concept LLVMPass = requires(T P) {
|
||||
{ T::Name } -> convertible_to<const char *>;
|
||||
{ a.registerPasses(std::declval<llvm::legacy::PassManager &>()) };
|
||||
{ P.registerPasses(std::declval<llvm::legacy::PassManager &>()) };
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
concept LLVMPrintablePass = requires(T a) {
|
||||
{ a.print(llvm::outs()) };
|
||||
concept LLVMPrintablePass = requires(T P) {
|
||||
{ P.print(llvm::outs()) };
|
||||
};
|
||||
|
||||
class PureLLVMPassWrapper : public LLVMPassWrapperBase {
|
||||
|
||||
@@ -138,19 +138,19 @@ private:
|
||||
ThisType &ToMerge = Other;
|
||||
auto Composite = std::make_unique<llvm::Module>("llvm-link",
|
||||
Module->getContext());
|
||||
std::set<std::string> globals;
|
||||
std::set<std::string> Globals;
|
||||
|
||||
for (auto &Global : Module->globals()) {
|
||||
if (Global.getLinkage() != llvm::GlobalValue::InternalLinkage)
|
||||
continue;
|
||||
globals.insert(Global.getName().str());
|
||||
Globals.insert(Global.getName().str());
|
||||
Global.setLinkage(llvm::GlobalValue::ExternalLinkage);
|
||||
}
|
||||
|
||||
for (auto &Global : ToMerge.getModule().globals()) {
|
||||
if (Global.getLinkage() != llvm::GlobalValue::InternalLinkage)
|
||||
continue;
|
||||
globals.insert(Global.getName().str());
|
||||
Globals.insert(Global.getName().str());
|
||||
Global.setLinkage(llvm::GlobalValue::ExternalLinkage);
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ private:
|
||||
revng_assert(not Failure, "Linker failed");
|
||||
|
||||
for (auto &Global : Composite->globals()) {
|
||||
if (globals.contains(Global.getName().str()))
|
||||
if (Globals.contains(Global.getName().str()))
|
||||
Global.setLinkage(llvm::GlobalValue::InternalLinkage);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,10 @@ makeLLVMContainerFactory(pipeline::Context &Ctx, llvm::LLVMContext &Context) {
|
||||
&Context);
|
||||
}
|
||||
|
||||
inline auto
|
||||
makeDefaultLLVMContainerFactory = makeLLVMContainerFactory<LLVMContainer>;
|
||||
inline ContainerFactory
|
||||
makeDefaultLLVMContainerFactory(pipeline::Context &Ctx,
|
||||
llvm::LLVMContext &Context) {
|
||||
return makeLLVMContainerFactory<LLVMContainer>(Ctx, Context);
|
||||
}
|
||||
|
||||
} // namespace pipeline
|
||||
|
||||
@@ -166,11 +166,11 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(pipeline::ContainerDeclaration)
|
||||
|
||||
template<>
|
||||
struct llvm::yaml::MappingTraits<pipeline::PipeInvocation> {
|
||||
static void mapping(IO &io, pipeline::PipeInvocation &info) {
|
||||
io.mapRequired("Type", info.Type);
|
||||
io.mapRequired("UsedContainers", info.UsedContainers);
|
||||
io.mapOptional("Passes", info.Passes);
|
||||
io.mapOptional("EnabledWhen", info.EnabledWhen);
|
||||
static void mapping(IO &TheIO, pipeline::PipeInvocation &Info) {
|
||||
TheIO.mapRequired("Type", Info.Type);
|
||||
TheIO.mapRequired("UsedContainers", Info.UsedContainers);
|
||||
TheIO.mapOptional("Passes", Info.Passes);
|
||||
TheIO.mapOptional("EnabledWhen", Info.EnabledWhen);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -178,10 +178,10 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(pipeline::PipeInvocation)
|
||||
|
||||
template<>
|
||||
struct llvm::yaml::MappingTraits<pipeline::StepDeclaration> {
|
||||
static void mapping(IO &io, pipeline::StepDeclaration &info) {
|
||||
io.mapRequired("Name", info.Name);
|
||||
io.mapOptional("Pipes", info.Pipes);
|
||||
io.mapOptional("EnabledWhen", info.EnabledWhen);
|
||||
static void mapping(IO &TheIO, pipeline::StepDeclaration &Info) {
|
||||
TheIO.mapRequired("Name", Info.Name);
|
||||
TheIO.mapOptional("Pipes", Info.Pipes);
|
||||
TheIO.mapOptional("EnabledWhen", Info.EnabledWhen);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -191,9 +191,9 @@ INTROSPECTION_NS(pipeline, PipelineDeclaration, Containers, Steps);
|
||||
template<>
|
||||
struct llvm::yaml::MappingTraits<pipeline::PipelineDeclaration>
|
||||
: public TupleLikeMappingTraits<pipeline::PipelineDeclaration> {
|
||||
static void mapping(IO &io, pipeline::PipelineDeclaration &info) {
|
||||
io.mapOptional("From", info.From);
|
||||
io.mapRequired("Containers", info.Containers);
|
||||
io.mapRequired("Steps", info.Steps);
|
||||
static void mapping(IO &TheIO, pipeline::PipelineDeclaration &Info) {
|
||||
TheIO.mapOptional("From", Info.From);
|
||||
TheIO.mapRequired("Containers", Info.Containers);
|
||||
TheIO.mapRequired("Steps", Info.Steps);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -41,8 +41,8 @@ concept HasName = requires() {
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
concept HasContract = requires(T a) {
|
||||
{ llvm::ArrayRef<ContractGroup>(a.getContract()) };
|
||||
concept HasContract = requires(T P) {
|
||||
{ llvm::ArrayRef<ContractGroup>(P.getContract()) };
|
||||
};
|
||||
|
||||
/// A Pipe is a class with the following characteristics:
|
||||
@@ -135,15 +135,15 @@ public:
|
||||
virtual std::unique_ptr<PipeWrapperBase> clone() const = 0;
|
||||
virtual std::vector<std::string> getRunningContainersNames() const = 0;
|
||||
virtual std::string getName() const = 0;
|
||||
virtual void dump(std::ostream &OS, size_t indents) const = 0;
|
||||
virtual void dump(std::ostream &OS, size_t Indents) const = 0;
|
||||
virtual void
|
||||
print(const Context &Ctx, llvm::raw_ostream &OS, size_t indents) const = 0;
|
||||
print(const Context &Ctx, llvm::raw_ostream &OS, size_t Indents) const = 0;
|
||||
virtual bool areRequirementsMet(const ContainerToTargetsMap &Input) const = 0;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
concept Dumpable = requires(T a) {
|
||||
{ a.dump(dbg, 0) };
|
||||
concept Dumpable = requires(T D) {
|
||||
{ D.dump(dbg, 0) };
|
||||
};
|
||||
|
||||
template<typename PipeType>
|
||||
|
||||
@@ -206,8 +206,8 @@ public:
|
||||
|
||||
public:
|
||||
template<typename... Args>
|
||||
void emplace_back(Args &&...args) {
|
||||
Contained.emplace_back(std::forward<Args>(args)...);
|
||||
void emplace_back(Args &&...A) {
|
||||
Contained.emplace_back(std::forward<Args>(A)...);
|
||||
removeDuplicates();
|
||||
}
|
||||
|
||||
@@ -219,8 +219,8 @@ public:
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
auto erase(Args &&...args) {
|
||||
return Contained.erase(std::forward<Args>(args)...);
|
||||
auto erase(Args &&...A) {
|
||||
return Contained.erase(std::forward<Args>(A)...);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Checks: '-*'
|
||||
@@ -13,7 +13,7 @@
|
||||
namespace revng::detail {
|
||||
|
||||
template<typename T>
|
||||
concept EnumWithCount = requires(std::decay_t<T> t) {
|
||||
concept EnumWithCount = requires {
|
||||
requires std::is_enum<typename std::decay<T>::type>::value;
|
||||
{ std::decay_t<T>::Count } -> convertible_to<size_t>;
|
||||
};
|
||||
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
return make_filter_range(M->functions(), Filter);
|
||||
}
|
||||
|
||||
auto exact_functions(llvm::Module *M) const {
|
||||
auto exactFunctions(llvm::Module *M) const {
|
||||
using namespace llvm;
|
||||
auto Filter = [this](Function &F) { return isExactTagOf(&F); };
|
||||
return make_filter_range(M->functions(), Filter);
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
return make_filter_range(M->globals(), Filter);
|
||||
}
|
||||
|
||||
auto exact_globals(llvm::Module *M) const {
|
||||
auto exactGlobals(llvm::Module *M) const {
|
||||
using namespace llvm;
|
||||
auto Filter = [this](GlobalVariable &G) { return isExactTagOf(&G); };
|
||||
return make_filter_range(M->globals(), Filter);
|
||||
|
||||
@@ -23,4 +23,5 @@ using PTCDestructor = PTCDestructorWrapper<&ptcInstructionListDestructor>;
|
||||
using PTCInstructionListPtr = std::unique_ptr<PTCInstructionList,
|
||||
PTCDestructor>;
|
||||
|
||||
// NOLINTNEXTLINE
|
||||
extern PTCInterface ptc;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Checks: '-*'
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "revng/Support/Assert.h"
|
||||
|
||||
static AbortHook abortHook = nullptr;
|
||||
static AbortHook TheAbortHook = nullptr;
|
||||
|
||||
static void printStackTrace() {
|
||||
llvm::raw_os_ostream Output(std::cerr);
|
||||
@@ -22,14 +22,13 @@ static void printStackTrace() {
|
||||
}
|
||||
|
||||
void setAbortHook(AbortHook Hook) {
|
||||
abortHook = Hook;
|
||||
TheAbortHook = Hook;
|
||||
}
|
||||
|
||||
[[noreturn]] static void terminate(void) {
|
||||
printStackTrace();
|
||||
if (abortHook != nullptr) {
|
||||
abortHook();
|
||||
}
|
||||
if (TheAbortHook != nullptr)
|
||||
TheAbortHook();
|
||||
abort();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,16 +19,18 @@ struct ABIVerificationToolErrorCategory : public std::error_category {
|
||||
return "ABIVerificationToolErrorCategory";
|
||||
}
|
||||
virtual std::error_condition
|
||||
default_error_condition(int code) const noexcept {
|
||||
return std::error_condition(code, *this);
|
||||
default_error_condition(int Code) const noexcept {
|
||||
return std::error_condition(Code, *this);
|
||||
}
|
||||
|
||||
virtual bool
|
||||
equivalent(int code, const std::error_condition &condition) const noexcept {
|
||||
return default_error_condition(code) == condition;
|
||||
equivalent(int Code, const std::error_condition &Condition) const noexcept {
|
||||
return default_error_condition(Code) == Condition;
|
||||
}
|
||||
|
||||
virtual bool
|
||||
equivalent(const std::error_code &code, int condition) const noexcept {
|
||||
return *this == code.category() && code.value() == condition;
|
||||
equivalent(const std::error_code &Code, int Condition) const noexcept {
|
||||
return *this == Code.category() && Code.value() == Condition;
|
||||
}
|
||||
virtual std::string message(int) const { return ""; }
|
||||
};
|
||||
|
||||
+11
-11
@@ -26,7 +26,7 @@ Steps:
|
||||
UsedContainers: [Strings1, Strings2]
|
||||
)";
|
||||
|
||||
static rp_manager *runner;
|
||||
static rp_manager *Runner;
|
||||
|
||||
struct Fixture {
|
||||
public:
|
||||
@@ -37,24 +37,24 @@ public:
|
||||
const char *LibToLoad[] = {};
|
||||
|
||||
rp_initialize(1, Array, 0, LibToLoad);
|
||||
runner = rp_manager_create_from_string(1, PipelineText, 0, {}, "");
|
||||
revng_check(runner != nullptr);
|
||||
Runner = rp_manager_create_from_string(1, PipelineText, 0, {}, "");
|
||||
revng_check(Runner != nullptr);
|
||||
}
|
||||
|
||||
~Fixture() { rp_manager_destroy(runner); }
|
||||
~Fixture() { rp_manager_destroy(Runner); }
|
||||
};
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(PipelineCTestSuite, *boost::unit_test::fixture<Fixture>())
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CAPILoadTest) {
|
||||
BOOST_TEST(rp_manager_steps_count(runner) == 2);
|
||||
auto *FirstStep = rp_manager_get_step(runner, 0);
|
||||
BOOST_TEST(rp_manager_containers_count(runner) == 2);
|
||||
BOOST_TEST(rp_manager_steps_count(Runner) == 2);
|
||||
auto *FirstStep = rp_manager_get_step(Runner, 0);
|
||||
BOOST_TEST(rp_manager_containers_count(Runner) == 2);
|
||||
|
||||
BOOST_TEST(rp_manager_step_name_to_index(runner, "begin") == 0);
|
||||
BOOST_TEST(rp_manager_step_name_to_index(runner, "FirstStep") == 1);
|
||||
BOOST_TEST(rp_manager_get_kind_from_name(runner, "MISSING") == nullptr);
|
||||
BOOST_TEST(rp_manager_get_kind_from_name(runner, "Root") != nullptr);
|
||||
BOOST_TEST(rp_manager_step_name_to_index(Runner, "begin") == 0);
|
||||
BOOST_TEST(rp_manager_step_name_to_index(Runner, "FirstStep") == 1);
|
||||
BOOST_TEST(rp_manager_get_kind_from_name(Runner, "MISSING") == nullptr);
|
||||
BOOST_TEST(rp_manager_get_kind_from_name(Runner, "Root") != nullptr);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
Reference in New Issue
Block a user