diff --git a/include/revng/ABI/Definition.h b/include/revng/ABI/Definition.h index cfb33239f..f16851666 100644 --- a/include/revng/ABI/Definition.h +++ b/include/revng/ABI/Definition.h @@ -174,8 +174,8 @@ private: return Result; } - template + template void assertSortingWasSuccessful(llvm::StringRef RegisterType, const InputContainer &Input, const OutputContainer &Output) const { @@ -206,7 +206,7 @@ private: } public: - template + template llvm::SmallVector sortArguments(const Container &Registers) const { SortedVector Lookup; @@ -225,7 +225,7 @@ public: return Result; } - template + template llvm::SmallVector sortReturnValues(const Container &Registers) const { SortedVector Lookup; diff --git a/include/revng/ABI/FunctionType/Support.h b/include/revng/ABI/FunctionType/Support.h index 2a39dbf43..fb47259d6 100644 --- a/include/revng/ABI/FunctionType/Support.h +++ b/include/revng/ABI/FunctionType/Support.h @@ -70,7 +70,7 @@ inline constexpr uint64_t paddedSizeOnStack(uint64_t RealSize, /// \tparam DerivedType The desired type to filter based on /// \param Types The list of types to filter /// \return filtered list -template DerivedType, +template DerivedType, RangeOf OwningRange, RangeOf ViewRange = std::vector> diff --git a/include/revng/ADT/ZipMapIterator.h b/include/revng/ADT/ZipMapIterator.h index e8ad6ad72..dc9907e06 100644 --- a/include/revng/ADT/ZipMapIterator.h +++ b/include/revng/ADT/ZipMapIterator.h @@ -43,12 +43,10 @@ concept VectorOfPairs = std::is_same_v>>, ""); -static_assert(VectorOfPairs>>, ""); -static_assert(not VectorOfPairs>>, ""); -static_assert(not VectorOfPairs>>, ""); +static_assert(VectorOfPairs>>, ""); +static_assert(VectorOfPairs>>, ""); +static_assert(not VectorOfPairs>>, ""); +static_assert(not VectorOfPairs>>, ""); } // namespace diff --git a/include/revng/EarlyFunctionAnalysis/CFGHelpers.h b/include/revng/EarlyFunctionAnalysis/CFGHelpers.h index 208325fb2..274115529 100644 --- a/include/revng/EarlyFunctionAnalysis/CFGHelpers.h +++ b/include/revng/EarlyFunctionAnalysis/CFGHelpers.h @@ -20,8 +20,8 @@ using SuccessorContainer = SortedVector>; template concept SpecializationOfBasicBlock = requires(T Instance) { - { Instance.ID() } -> convertible_to; - { Instance.End() } -> convertible_to; + { Instance.ID() } -> std::convertible_to; + { Instance.End() } -> std::convertible_to; }; struct ParsedSuccessor { diff --git a/include/revng/Model/Binary.h b/include/revng/Model/Binary.h index 39b501695..0b6a59391 100644 --- a/include/revng/Model/Binary.h +++ b/include/revng/Model/Binary.h @@ -59,7 +59,7 @@ public: /// - the reference to the newly made definition which can be used /// to modify it right away, /// - the corresponding defined type ready to be attached to others. - template NewType, + template NewType, typename... ArgumentTypes> [[nodiscard]] std::pair makeTypeDefinition(ArgumentTypes &&...Arguments) { diff --git a/include/revng/Model/ProgramCounterHandler.h b/include/revng/Model/ProgramCounterHandler.h index c282ebaa8..7f5893f47 100644 --- a/include/revng/Model/ProgramCounterHandler.h +++ b/include/revng/Model/ProgramCounterHandler.h @@ -39,19 +39,11 @@ enum Values { }; // namespace PCAffectingCSV -namespace revng::detail { - -using namespace llvm; - -using CSVFactory = std::function< - GlobalVariable *(PCAffectingCSV::Values CSVID)>; - -}; // namespace revng::detail - -using CSVFactory = revng::detail::CSVFactory; - class ProgramCounterHandler { protected: + using CSVFactory = llvm::function_ref< + llvm::GlobalVariable *(PCAffectingCSV::Values CSVID)>; + static constexpr const char *AddressSpaceName = "pc_address_space"; static constexpr const char *EpochName = "pc_epoch"; static constexpr const char *TypeName = "pc_type"; @@ -79,7 +71,7 @@ public: static std::unique_ptr create(model::Architecture::Values Architecture, llvm::Module *M, - const CSVFactory &Factory); + CSVFactory Factory); static std::unique_ptr fromModule(model::Architecture::Values Architecture, llvm::Module *M); diff --git a/include/revng/Pipeline/Container.h b/include/revng/Pipeline/Container.h index 9ec30c861..8d97f5caf 100644 --- a/include/revng/Pipeline/Container.h +++ b/include/revng/Pipeline/Container.h @@ -25,7 +25,7 @@ namespace pipeline { template concept HasID = requires { - { T::ID } -> convertible_to; + { T::ID } -> std::convertible_to; }; class ContainerTypeInfoBase { diff --git a/include/revng/Pipeline/ContainerFactory.h b/include/revng/Pipeline/ContainerFactory.h index 33ca35b54..e690aeecf 100644 --- a/include/revng/Pipeline/ContainerFactory.h +++ b/include/revng/Pipeline/ContainerFactory.h @@ -84,7 +84,8 @@ public: template static ContainerFactory fromGlobal(G &&...Vals) { using Factory = ContainerFactoryWithArgs; - return ContainerFactory(make_unique(std::forward(Vals)...)); + return ContainerFactory(std::make_unique< + Factory>(std::forward(Vals)...)); } ContainerFactory(const ContainerFactory &Other) : diff --git a/include/revng/Pipeline/GenericLLVMPipe.h b/include/revng/Pipeline/GenericLLVMPipe.h index 20c04d93d..e47865d7c 100644 --- a/include/revng/Pipeline/GenericLLVMPipe.h +++ b/include/revng/Pipeline/GenericLLVMPipe.h @@ -37,7 +37,7 @@ public: template concept LLVMPass = requires(T P) { - { T::Name } -> convertible_to; + { T::Name } -> std::convertible_to; { P.registerPasses(std::declval()) }; }; diff --git a/include/revng/Pipeline/Invokable.h b/include/revng/Pipeline/Invokable.h index 0ac5056d9..4bf0b9606 100644 --- a/include/revng/Pipeline/Invokable.h +++ b/include/revng/Pipeline/Invokable.h @@ -33,7 +33,7 @@ namespace pipeline { template concept HasName = requires() { - { T::Name } -> convertible_to; + { T::Name } -> std::convertible_to; }; template @@ -80,7 +80,8 @@ concept ReturnsError = invokableTypeReturnsError(); /// never fails. /// template -concept Invokable = convertible_to> +concept Invokable = std::convertible_to> and HasName; namespace detail { diff --git a/include/revng/Pipeline/Target.h b/include/revng/Pipeline/Target.h index 90af9fa4a..a99ad8e89 100644 --- a/include/revng/Pipeline/Target.h +++ b/include/revng/Pipeline/Target.h @@ -193,7 +193,7 @@ public: void emplace_back(Args &&...A) { Contained.emplace_back(std::forward(A)...); llvm::sort(Contained); - Contained.erase(unique(Contained.begin(), Contained.end()), + Contained.erase(std::unique(Contained.begin(), Contained.end()), Contained.end()); } @@ -202,7 +202,7 @@ public: void push_back(const Target &Target) { Contained.push_back(Target); llvm::sort(Contained); - Contained.erase(unique(Contained.begin(), Contained.end()), + Contained.erase(std::unique(Contained.begin(), Contained.end()), Contained.end()); } @@ -286,7 +286,7 @@ public: using iterator = Map::iterator; using const_iterator = Map::const_iterator; using value_type = Map::value_type; - using key_iterator = decltype(declval().keys()); + using key_iterator = decltype(std::declval().keys()); private: Map Status; diff --git a/include/revng/Pipeline/Target/YAMLTraits.h b/include/revng/Pipeline/Target/YAMLTraits.h index 11123666a..cb7561cd2 100644 --- a/include/revng/Pipeline/Target/YAMLTraits.h +++ b/include/revng/Pipeline/Target/YAMLTraits.h @@ -78,7 +78,7 @@ static_assert(Yamlizable); template concept HasEmpty = requires(T &&V) { - { V.empty() } -> same_as; + { V.empty() } -> std::same_as; }; template diff --git a/include/revng/ValueMaterializer/AdvancedValueInfo.h b/include/revng/ValueMaterializer/AdvancedValueInfo.h index b4fb08689..25d917311 100644 --- a/include/revng/ValueMaterializer/AdvancedValueInfo.h +++ b/include/revng/ValueMaterializer/AdvancedValueInfo.h @@ -67,10 +67,11 @@ static_assert(MFP::MonotoneFrameworkInstance); /// \p DFG the data flow graph containing the instructions we're interested in. /// \p Context the position in the function for the current query. -std::tuple, - ControlFlowEdgesGraph, - map *, - MFP::MFPResult>>> +std::tuple< + std::map, + ControlFlowEdgesGraph, + std::map *, + MFP::MFPResult>>> runAVI(const DataFlowGraph &DFG, llvm::Instruction *Context, const llvm::DominatorTree &DT, diff --git a/include/revng/ValueMaterializer/ValueMaterializer.h b/include/revng/ValueMaterializer/ValueMaterializer.h index 82d501081..a713344bb 100644 --- a/include/revng/ValueMaterializer/ValueMaterializer.h +++ b/include/revng/ValueMaterializer/ValueMaterializer.h @@ -57,8 +57,8 @@ private: // DataFlowGraph DataFlowGraph; ConstraintsMap OracleConstraints; - map *, - MFP::MFPResult>> + std::map *, + MFP::MFPResult>> MFIResults; std::optional Values; ControlFlowEdgesGraph CFEG; diff --git a/lib/ABI/Definition.cpp b/lib/ABI/Definition.cpp index 54aea2b13..5541595ce 100644 --- a/lib/ABI/Definition.cpp +++ b/lib/ABI/Definition.cpp @@ -13,7 +13,7 @@ #include "revng/Support/ResourceFinder.h" #include "revng/Support/YAMLTraits.h" -template +template bool verifyRegisters(const RegisterContainer &Registers, model::Architecture::Values Architecture) { for (const model::Register::Values &Register : Registers) { diff --git a/lib/EarlyFunctionAnalysis/DetectABI.cpp b/lib/EarlyFunctionAnalysis/DetectABI.cpp index 59862a5d1..ac1ea133f 100644 --- a/lib/EarlyFunctionAnalysis/DetectABI.cpp +++ b/lib/EarlyFunctionAnalysis/DetectABI.cpp @@ -457,7 +457,8 @@ void DetectABI::analyzeABI() { Task.advance("Create temporary functions"); for (model::Function &Function : Binary->Functions()) { const MetaAddress &Entry = Function.Entry(); - auto NewFunction = make_unique(Analyzer.outline(Entry)); + auto NewFunction = std::make_unique(Analyzer + .outline(Entry)); Functions[Function.Entry()] = std::move(NewFunction); } diff --git a/lib/FunctionIsolation/InvokeIsolatedFunctions.cpp b/lib/FunctionIsolation/InvokeIsolatedFunctions.cpp index 8d9cc454c..538715cc9 100644 --- a/lib/FunctionIsolation/InvokeIsolatedFunctions.cpp +++ b/lib/FunctionIsolation/InvokeIsolatedFunctions.cpp @@ -24,6 +24,7 @@ #include "revng/Pipes/TaggedFunctionKind.h" using namespace llvm; +using std::tuple; class InvokeIsolatedFunctionsImpl { private: diff --git a/lib/HeadersGeneration/ModelToHeader.cpp b/lib/HeadersGeneration/ModelToHeader.cpp index 73448fa67..7a7a1a9af 100644 --- a/lib/HeadersGeneration/ModelToHeader.cpp +++ b/lib/HeadersGeneration/ModelToHeader.cpp @@ -39,7 +39,7 @@ bool ptml::HeaderBuilder::printModelHeader() { B.append(std::move(Includes)); if (not Configuration.PostIncludeSnippet.empty()) - B.append(Configuration.PostIncludeSnippet + "\n"s); + B.append(Configuration.PostIncludeSnippet + '\n'); std::string Defines = B.getDirective(CBuilder::Directive::IfNotDef) + " " + B.getNullTag() + "\n" diff --git a/lib/Model/Importer/Binary/ELFImporter.cpp b/lib/Model/Importer/Binary/ELFImporter.cpp index 096ce42d8..588460a8e 100644 --- a/lib/Model/Importer/Binary/ELFImporter.cpp +++ b/lib/Model/Importer/Binary/ELFImporter.cpp @@ -928,8 +928,9 @@ ELFImporter::ehFrameFromEhFrameHdr() { template void ELFImporter::parseEHFrame(MetaAddress EHFrameAddress, - optional FDEsCount, - optional EHFrameSize) { + std::optional FDEsCount, + std::optional + EHFrameSize) { if (not FDEsCount and not EHFrameSize) { revng_log(ELFImporterLog, "Neither FDE count and .eh_frame size available"); return; diff --git a/lib/Model/NameBuilder.cpp b/lib/Model/NameBuilder.cpp index 517f9fb06..d7efc56da 100644 --- a/lib/Model/NameBuilder.cpp +++ b/lib/Model/NameBuilder.cpp @@ -436,7 +436,8 @@ llvm::Error model::CNameBuilder::isNameReserved(llvm::StringRef Name) const { } if (std::isdigit(Name[0])) - return revng::createError("it starts with a digit: `"s + Name[0] + '`'); + return revng::createError(std::string{ "it starts with a digit: `" } + + Name[0] + '`'); // Filter out primitive names we use - we don't want collisions with those if (model::PrimitiveType::isCName(Name)) @@ -584,7 +585,8 @@ model::AssemblyNameBuilder::isNameReserved(llvm::StringRef Name) const { } if (std::isdigit(Name[0])) - return revng::createError("it starts with a digit: `"s + Name[0] + '`'); + return revng::createError(std::string{ "it starts with a digit: `" } + + Name[0] + '`'); if (Configuration.ReserveNamesStartingWithUnderscore()) if (Name[0] == '_') diff --git a/lib/Model/ProgramCounterHandler.cpp b/lib/Model/ProgramCounterHandler.cpp index 17802e9c2..fc1d2dd29 100644 --- a/lib/Model/ProgramCounterHandler.cpp +++ b/lib/Model/ProgramCounterHandler.cpp @@ -901,7 +901,7 @@ getMinimumPCAlignment(model::Architecture::Values Architecture) { std::unique_ptr PCH::create(model::Architecture::Values Architecture, Module *M, - const CSVFactory &Factory) { + CSVFactory Factory) { auto Alignment = getMinimumPCAlignment(Architecture); switch (Architecture) { diff --git a/lib/PipelineC/Tracing/Runner.cpp b/lib/PipelineC/Tracing/Runner.cpp index b57ef6fdf..c033ce14f 100644 --- a/lib/PipelineC/Tracing/Runner.cpp +++ b/lib/PipelineC/Tracing/Runner.cpp @@ -333,7 +333,7 @@ static void runnerImplementation(std::function Function, "function's prototype"); auto Sequence = std::make_index_sequence(); - if constexpr (is_same_v) { + if constexpr (std::is_same_v) { runCommand(Function, Arguments, Context, Sequence); return; } else { diff --git a/lib/Pipes/PipelineManager.cpp b/lib/Pipes/PipelineManager.cpp index 2bbe8c145..6ac600552 100644 --- a/lib/Pipes/PipelineManager.cpp +++ b/lib/Pipes/PipelineManager.cpp @@ -357,10 +357,10 @@ PipelineManager::PipelineManager(llvm::ArrayRef EnablingFlags, ExecutionDirectory(StorageClient.get(), "") { LLVMContext = std::make_unique(); auto Context = setUpContext(*LLVMContext); - PipelineContext = make_unique(std::move(Context)); + PipelineContext = std::make_unique(std::move(Context)); auto Loader = setupLoader(*PipelineContext, EnablingFlags); - this->Loader = make_unique(std::move(Loader)); + this->Loader = std::make_unique(std::move(Loader)); } llvm::Expected diff --git a/lib/PromoteStackPointer/SegregateStackAccessesPass.cpp b/lib/PromoteStackPointer/SegregateStackAccessesPass.cpp index 56562ff52..be0f17358 100644 --- a/lib/PromoteStackPointer/SegregateStackAccessesPass.cpp +++ b/lib/PromoteStackPointer/SegregateStackAccessesPass.cpp @@ -34,6 +34,7 @@ #include "Helpers.h" using namespace llvm; +using std::tie; static Logger Log("segregate-stack-accesses"); diff --git a/lib/ValueMaterializer/AdvancedValueInfo.cpp b/lib/ValueMaterializer/AdvancedValueInfo.cpp index af347d218..0dc65b6d8 100644 --- a/lib/ValueMaterializer/AdvancedValueInfo.cpp +++ b/lib/ValueMaterializer/AdvancedValueInfo.cpp @@ -37,6 +37,7 @@ #include "revng/ValueMaterializer/Helpers.h" using namespace llvm; +using std::map; static Logger AVILogger("avi"); diff --git a/lib/Yield/Assembly/LLVMTagsToPTML.cpp b/lib/Yield/Assembly/LLVMTagsToPTML.cpp index 2001d155c..699bd0805 100644 --- a/lib/Yield/Assembly/LLVMTagsToPTML.cpp +++ b/lib/Yield/Assembly/LLVMTagsToPTML.cpp @@ -403,14 +403,14 @@ handleSpecialCases(SortedVector &&Input, Instruction); uint64_t CurrentIndex = ++Iterator->Index() - 1; - Result.emplace(CurrentIndex, yield::TagType::Helper, "offset_to("s); + Result.emplace(CurrentIndex, yield::TagType::Helper, "offset_to("); Result.emplace(emitAddress(std::move(*Iterator), Address, BasicBlock, Function, Binary, NameBuilder)); - Result.emplace(CurrentIndex + 2, yield::TagType::Helper, ")"s); + Result.emplace(CurrentIndex + 2, yield::TagType::Helper, ")"); IndexOffset += 2; } else { // TODO: handle other interesting tag types. diff --git a/lib/Yield/SVG.cpp b/lib/Yield/SVG.cpp index 169f7caa9..4267a2874 100644 --- a/lib/Yield/SVG.cpp +++ b/lib/Yield/SVG.cpp @@ -273,7 +273,7 @@ constexpr bool isVertical(yield::layout::sugiyama::Orientation Orientation) { template concept NodeExporter = requires(CallableType &&Callable, const NodeType &Node) { - { Callable(Node) } -> convertible_to; + { Callable(Node) } -> std::convertible_to; }; template { } }; template<> -struct hash : hash {}; +struct std::hash : std::hash {}; /** endif **/ /*# --- UpcastablePointer stuff --- #*/ diff --git a/share/revng/rcc-config.yml b/share/revng/rcc-config.yml index ab3938552..32fff2269 100644 --- a/share/revng/rcc-config.yml +++ b/share/revng/rcc-config.yml @@ -169,6 +169,12 @@ read_passes: matcher: type: regexes_matcher regexes: ['^static\s'] + - name: Headers should not clobber namespaces + matcher: + type: regexes_matcher + regexes: + - '^using namespace \w+;' + - '^namespace \w+ = [\w:]+;' - type: WhitespaceCheckPass - type: SingleCommandPass name: codespell diff --git a/tests/unit/Alignment.cpp b/tests/unit/Alignment.cpp index b2ca51e44..3ca2559f2 100644 --- a/tests/unit/Alignment.cpp +++ b/tests/unit/Alignment.cpp @@ -25,7 +25,7 @@ struct Expected { }; template - requires(same_as && ...) + requires(std::same_as && ...) void testAlignment(model::UpcastableType &&Type, const Types &...TestCases) { for (auto &&[ABI, Expected] : std::array{ TestCases... }) { std::optional TestResult = ABI.alignment(*Type); diff --git a/tests/unit/ZipMapIterator.cpp b/tests/unit/ZipMapIterator.cpp index e5b1209a3..3c1070bd9 100644 --- a/tests/unit/ZipMapIterator.cpp +++ b/tests/unit/ZipMapIterator.cpp @@ -91,7 +91,8 @@ template static void compare(LeftType &Left, RightType &Right, - std::vector, optional>> &&Expected) { + std::vector, std::optional>> + &&Expected) { using LeftKE = KeyContainer; using RightKE = KeyContainer; using left_pointer = element_pointer_t; diff --git a/tools/pipeline/artifact/Main.cpp b/tools/pipeline/artifact/Main.cpp index b0017c4c3..5735fa6cd 100644 --- a/tools/pipeline/artifact/Main.cpp +++ b/tools/pipeline/artifact/Main.cpp @@ -54,9 +54,10 @@ static cl::opt ListArtifacts("list", cl::cat(MainCategory), cl::init(false)); -static cl::opt Analyses("analyses", - cl::desc("Analyses to run, comma separated"), - cl::cat(MainCategory)); +static cl::opt Analyses("analyses", + cl::desc("Analyses to run, comma " + "separated"), + cl::cat(MainCategory)); static cl::opt Analyze("analyze", cl::desc("Run revng-initial-auto-analysis"), diff --git a/tools/pipeline/pipe/Main.cpp b/tools/pipeline/pipe/Main.cpp index 32fd11a35..5a99b6dfa 100644 --- a/tools/pipeline/pipe/Main.cpp +++ b/tools/pipeline/pipe/Main.cpp @@ -85,7 +85,8 @@ int main(int argc, char *argv[]) { llvm::StringRef PipeArgument = Arguments[0]; llvm::StringRef ModelArgument = Arguments[1]; - auto ContainerArguments = llvm::ArrayRef(Arguments).drop_front(2); + auto ContainerArguments = llvm::ArrayRef(Arguments) + .drop_front(2); const auto &Name = ModelGlobalName; auto *Model(cantFail(Manager.context().getGlobal(Name)));