Skip to content

Commit fbf544c

Browse files
authored
[CIR] Fix some clang-tidy problems in CIR (llvm#125128)
This adds a .clang-tidy file to the clang/lib/CIR/FrontendAction directory, moves and updates the incorrectly located include/clang/CIR/FrontendAction .clang-tidy file, and updates two files from a recent commit to bring them into conformance with previously agreed upon rules for where to use LLVM naming conventions and where to use MLIR naming conventions.
1 parent e2301d6 commit fbf544c

File tree

4 files changed

+39
-7
lines changed

4 files changed

+39
-7
lines changed

clang/include/clang/CIRFrontendAction/.clang-tidy renamed to clang/include/clang/CIR/FrontendAction/.clang-tidy

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,18 @@ Checks: >
5151
readability-simplify-boolean-expr,
5252
readability-simplify-subscript-expr,
5353
readability-use-anyofallof
54+
CheckOptions:
55+
- key: readability-identifier-naming.ClassCase
56+
value: CamelCase
57+
- key: readability-identifier-naming.EnumCase
58+
value: CamelCase
59+
- key: readability-identifier-naming.FunctionCase
60+
value: camelBack
61+
- key: readability-identifier-naming.MemberCase
62+
value: CamelCase
63+
- key: readability-identifier-naming.ParameterCase
64+
value: CamelCase
65+
- key: readability-identifier-naming.UnionCase
66+
value: CamelCase
67+
- key: readability-identifier-naming.VariableCase
68+
value: CamelCase

clang/include/clang/CIR/LowerToLLVM.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ namespace cir {
2929

3030
namespace direct {
3131
std::unique_ptr<llvm::Module>
32-
lowerDirectlyFromCIRToLLVMIR(mlir::ModuleOp M, llvm::LLVMContext &Ctx);
32+
lowerDirectlyFromCIRToLLVMIR(mlir::ModuleOp mlirModule,
33+
llvm::LLVMContext &llvmCtx);
3334
} // namespace direct
3435
} // namespace cir
3536

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
InheritParentConfig: true
2+
CheckOptions:
3+
- key: readability-identifier-naming.ClassCase
4+
value: CamelCase
5+
- key: readability-identifier-naming.EnumCase
6+
value: CamelCase
7+
- key: readability-identifier-naming.FunctionCase
8+
value: camelBack
9+
- key: readability-identifier-naming.MemberCase
10+
value: CamelCase
11+
- key: readability-identifier-naming.ParameterCase
12+
value: CamelCase
13+
- key: readability-identifier-naming.UnionCase
14+
value: CamelCase
15+
- key: readability-identifier-naming.VariableCase
16+
value: CamelCase

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ namespace cir {
2323
namespace direct {
2424

2525
std::unique_ptr<llvm::Module>
26-
lowerDirectlyFromCIRToLLVMIR(mlir::ModuleOp MOp, LLVMContext &LLVMCtx) {
26+
lowerDirectlyFromCIRToLLVMIR(mlir::ModuleOp mlirModule, LLVMContext &llvmCtx) {
2727
llvm::TimeTraceScope scope("lower from CIR to LLVM directly");
2828

29-
std::optional<StringRef> ModuleName = MOp.getName();
30-
auto M = std::make_unique<llvm::Module>(
31-
ModuleName ? *ModuleName : "CIRToLLVMModule", LLVMCtx);
29+
std::optional<StringRef> moduleName = mlirModule.getName();
30+
auto llvmModule = std::make_unique<llvm::Module>(
31+
moduleName ? *moduleName : "CIRToLLVMModule", llvmCtx);
3232

33-
if (!M)
33+
if (!llvmModule)
3434
report_fatal_error("Lowering from LLVMIR dialect to llvm IR failed!");
3535

36-
return M;
36+
return llvmModule;
3737
}
3838
} // namespace direct
3939
} // namespace cir

0 commit comments

Comments
 (0)