Skip to content

Commit caaf9bb

Browse files
committed
clean(conan): fix pre-commit
1 parent 6e775b4 commit caaf9bb

File tree

8 files changed

+56
-60
lines changed

8 files changed

+56
-60
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ repos:
55
rev: v4.3.0
66
hooks:
77
- id: trailing-whitespace
8+
exclude: "^.*\\.patch$"
89
- id: end-of-file-fixer
10+
exclude: "^.*\\.patch$"
911
- id: check-yaml
1012
- id: check-added-large-files
1113
- id: requirements-txt-fixer

cmake/phasar_macros.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@ function(generate_ll_file)
6868
message(STATUS "HINTS to find clang/clang++/opt: ${binary_hint_paths}")
6969

7070
if ("${CMAKE_VERSION}" VERSION_LESS "3.25") # VALIDATOR requires it
71-
71+
7272
find_program(clang REQUIRED
7373
NAMES clang-14 clang
7474
HINTS ${binary_hint_paths})
7575
find_program(clangcpp REQUIRED
76-
NAMES clang++
76+
NAMES clang++
7777
HINTS ${binary_hint_paths})
7878
find_program(opt REQUIRED
7979
NAMES opt
8080
HINTS ${binary_hint_paths})
81-
81+
8282
set(IS_VALID_VERSION "")
8383
validate_binary_version("IS_VALID_VERSION" "${clang}")
8484
if (NOT "${IS_VALID_VERSION}")
@@ -99,8 +99,8 @@ function(generate_ll_file)
9999
VALIDATOR validate_binary_version)
100100
message(STATUS "found clang binary in \"${clang}\"")
101101
find_program(clangcpp REQUIRED
102-
NAMES clang++
103-
HINTS ${binary_hint_paths}
102+
NAMES clang++
103+
HINTS ${binary_hint_paths}
104104
VALIDATOR validate_binary_version)
105105
message(STATUS "found clang binary in \"${clangpp}\"")
106106
find_program(opt REQUIRED

conanfile.py

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,14 @@ class PhasarRecipe(ConanFile):
118118
# Binary configuration
119119
settings = "os", "compiler", "build_type", "arch"
120120
options = {
121-
"with_z3": [True, False],
122-
"shared": [True, False],
121+
"with_z3": [True, False],
122+
"shared": [True, False],
123123
"fPIC": [True, False],
124124
"tests": [True, False],
125125
}
126126
default_options = {
127-
"with_z3": True,
128-
"shared": False,
127+
"with_z3": True,
128+
"shared": False,
129129
"fPIC": True,
130130
"tests": False,
131131
}
@@ -141,7 +141,7 @@ def _parse_gitignore(self, folder, additional_exclusions = [], invert=False):
141141
inclusions = f"!{exc}"
142142
else:
143143
exclusions = additional_exclusions
144-
144+
145145
with open(f'{folder}/.gitignore', 'r') as file:
146146
for line in file:
147147
line = line.strip()
@@ -154,18 +154,18 @@ def _parse_gitignore(self, folder, additional_exclusions = [], invert=False):
154154
inclusions.append("!" + line)
155155
else:
156156
exclusions.append(line)
157-
157+
158158
if invert:
159159
return inclusions
160160
else:
161161
return exclusions
162162

163163
def export_sources(self):
164164
exclusions = self._parse_gitignore(".", [
165-
"test_package",
166-
"utils",
167-
"img",
168-
"githooks",
165+
"test_package",
166+
"utils",
167+
"img",
168+
"githooks",
169169
"external"
170170
])
171171

@@ -185,7 +185,7 @@ def _info_file(self):
185185
if self.export_folder is None:
186186
return None
187187
return PurePosixPath(self.export_folder) / "info.json"
188-
188+
189189
def _read_info(self):
190190
if self._info_file is not None and exists(self._info_file):
191191
with open(self._info_file, encoding="utf-8") as fp:
@@ -194,12 +194,12 @@ def _read_info(self):
194194
return {
195195
"version": None,
196196
}
197-
197+
198198
def _write_info(self, info):
199199
if self._info_file is not None:
200200
with open(self._info_file, "w", encoding="utf-8") as fp:
201201
json.dump(info, fp, indent=2)
202-
202+
203203
def set_version(self):
204204
if self.version is not None:
205205
return
@@ -240,14 +240,14 @@ def requirements(self):
240240
self.requires("z3/[>=4.7.1 <5]")
241241
llvm_options["with_z3"] = True
242242
self.requires("llvm-core/14.0.6@secure-software-engineering", transitive_libs=True, transitive_headers=True, options=llvm_options)
243-
243+
244244
def build_requirements(self):
245245
self.tool_requires("cmake/[>=3.25.0 <4.0.0]") # find_program validator
246246
self.tool_requires("ninja/[>=1.9.0 <2.0.0]")
247247
if self.options.tests:
248248
self.test_requires("openssl/[>2 <4]")
249249
self.test_requires("gtest/1.14.0")
250-
250+
251251
def configure(self):
252252
if self.options.shared:
253253
self.options.rm_safe("fPIC")
@@ -282,7 +282,7 @@ def _cmake_configure(self):
282282
]
283283
)
284284
return cmake
285-
285+
286286
def _handle_graphviz(self):
287287
exclude_patterns = [
288288
"LLVMTableGenGlobalISel.*",
@@ -322,7 +322,7 @@ def _write_build_info(self):
322322
# maybe process original config
323323
cmake_config = Path(self.package_folder / self._cmake_module_path / "phasarConfig.cmake").read_text("utf-8")
324324
components = components_from_dotfile(load(self, self._graphviz_file))
325-
325+
326326
build_info = {
327327
"components": components,
328328
}
@@ -341,7 +341,7 @@ def package_id(self):
341341

342342
def package(self):
343343
copy(self, "LICENSE.txt", self.source_folder, join(self.package_folder, "licenses"))
344-
344+
345345
cmake = self._cmake_configure()
346346
cmake.install()
347347
rm(self, "phasarConfig*.cmake", join("lib", "cmake", "phasar"))
@@ -359,7 +359,6 @@ def package_info(self):
359359

360360
for component_name, data in components.items():
361361
self.cpp_info.components[component_name].set_property("cmake_target_name", component_name)
362-
self.cpp_info.components[component_name].libs = [component_name] if component_name not in interfaces else []
362+
self.cpp_info.components[component_name].libs = [component_name] if component_name not in interfaces else []
363363
self.cpp_info.components[component_name].requires = data["requires"]
364364
self.cpp_info.components[component_name].system_libs = data["system_libs"]
365-

utils/conan/clang/conanfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _compilers_minimum_version(self):
6060
"msvc": "191",
6161
"Visual Studio": "15",
6262
}
63-
63+
6464
def export_sources(self):
6565
export_conandata_patches(self)
6666

utils/conan/clang/test_package/test_package.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// A basic clang libtooling example from https://clang.llvm.org/docs/LibTooling.html
1+
// A basic clang libtooling example from
2+
// https://clang.llvm.org/docs/LibTooling.html
23

34
// Declares clang::SyntaxOnlyAction.
45
#include "clang/Frontend/FrontendActions.h"
@@ -28,7 +29,7 @@ int main(int argc, const char **argv) {
2829
llvm::errs() << ExpectedParser.takeError();
2930
return 1;
3031
}
31-
CommonOptionsParser& OptionsParser = ExpectedParser.get();
32+
CommonOptionsParser &OptionsParser = ExpectedParser.get();
3233
ClangTool Tool(OptionsParser.getCompilations(),
3334
OptionsParser.getSourcePathList());
3435
return Tool.run(newFrontendActionFactory<clang::SyntaxOnlyAction>().get());

utils/conan/llvm-core/conanfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def _compilers_minimum_version(self):
131131
"msvc": "191",
132132
"Visual Studio": "15",
133133
}
134-
134+
135135
def export_sources(self):
136136
export_conandata_patches(self)
137137

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,32 @@
1-
#include <llvm/ExecutionEngine/Interpreter.h>
2-
#include <llvm/ExecutionEngine/GenericValue.h>
1+
#include <memory>
2+
33
#include <llvm/ExecutionEngine/ExecutionEngine.h>
4-
#include <llvm/IRReader/IRReader.h>
4+
#include <llvm/ExecutionEngine/GenericValue.h>
5+
#include <llvm/ExecutionEngine/Interpreter.h>
56
#include <llvm/IR/LLVMContext.h>
6-
#include <llvm/Support/TargetSelect.h>
7+
#include <llvm/IRReader/IRReader.h>
78
#include <llvm/Support/SourceMgr.h>
9+
#include <llvm/Support/TargetSelect.h>
810

9-
#include <memory>
10-
11-
12-
int main(int argc, char const* argv[]) {
13-
if (argc < 2)
14-
return 0;
11+
int main(int argc, char const *argv[]) {
12+
if (argc < 2)
13+
return 0;
1514

16-
llvm::InitializeNativeTarget();
17-
llvm::SMDiagnostic smd;
18-
llvm::LLVMContext context;
19-
std::string error;
15+
llvm::InitializeNativeTarget();
16+
llvm::SMDiagnostic smd;
17+
llvm::LLVMContext context;
18+
std::string error;
2019

21-
llvm::EngineBuilder engine_builder{
22-
llvm::parseIRFile(argv[1], smd, context)
23-
};
24-
engine_builder.setEngineKind(llvm::EngineKind::Interpreter);
25-
engine_builder.setErrorStr(&error);
20+
llvm::EngineBuilder engine_builder{llvm::parseIRFile(argv[1], smd, context)};
21+
engine_builder.setEngineKind(llvm::EngineKind::Interpreter);
22+
engine_builder.setErrorStr(&error);
2623

27-
auto execution_engine = std::unique_ptr<llvm::ExecutionEngine>(
28-
engine_builder.create()
29-
);
30-
execution_engine->runStaticConstructorsDestructors(false);
24+
auto execution_engine =
25+
std::unique_ptr<llvm::ExecutionEngine>(engine_builder.create());
26+
execution_engine->runStaticConstructorsDestructors(false);
3127

32-
auto test_function = execution_engine->FindFunctionNamed("test");
33-
auto result = execution_engine->runFunction(
34-
test_function,
35-
llvm::ArrayRef<llvm::GenericValue>()
36-
);
37-
return result.IntVal.getSExtValue();
28+
auto test_function = execution_engine->FindFunctionNamed("test");
29+
auto result = execution_engine->runFunction(
30+
test_function, llvm::ArrayRef<llvm::GenericValue>());
31+
return result.IntVal.getSExtValue();
3832
}

utils/conan/test_conan_build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ set -euo pipefail
55
(
66
cd "$(dirname "$0")"
77
cd ../..
8-
conan create . --version dev --build=missing -s build_type=RelWithDebInfo
8+
conan create . --version dev --build=missing -s build_type=RelWithDebInfo
99
cd test_package/build/
1010
mkdir -p Debug/generators
1111
cd Debug/generators
1212
conan install -of . --requires phasar/dev --build=missing -s build_type=Release -g VirtualRunEnv -g CMakeDeps
1313
conan install -of . --requires phasar/dev --build=missing -s build_type=Debug -g VirtualRunEnv -g CMakeDeps
14-
)
14+
)

0 commit comments

Comments
 (0)