-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CIR] Fix some clang-tidy problems in CIR #125128
base: main
Are you sure you want to change the base?
Conversation
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.
@llvm/pr-subscribers-clangir @llvm/pr-subscribers-clang Author: Andy Kaylor (andykaylor) ChangesThis 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. Full diff: https://github.com/llvm/llvm-project/pull/125128.diff 4 Files Affected:
diff --git a/clang/include/clang/CIRFrontendAction/.clang-tidy b/clang/include/clang/CIR/FrontendAction/.clang-tidy
similarity index 75%
rename from clang/include/clang/CIRFrontendAction/.clang-tidy
rename to clang/include/clang/CIR/FrontendAction/.clang-tidy
index ef88dbcec488c8..1a5dfe14180630 100644
--- a/clang/include/clang/CIRFrontendAction/.clang-tidy
+++ b/clang/include/clang/CIR/FrontendAction/.clang-tidy
@@ -51,3 +51,18 @@ Checks: >
readability-simplify-boolean-expr,
readability-simplify-subscript-expr,
readability-use-anyofallof
+CheckOptions:
+ - key: readability-identifier-naming.ClassCase
+ value: CamelCase
+ - key: readability-identifier-naming.EnumCase
+ value: CamelCase
+ - key: readability-identifier-naming.FunctionCase
+ value: camelBack
+ - 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
diff --git a/clang/include/clang/CIR/LowerToLLVM.h b/clang/include/clang/CIR/LowerToLLVM.h
index 9fd0706a91a5a0..afa1c1923ed516 100644
--- a/clang/include/clang/CIR/LowerToLLVM.h
+++ b/clang/include/clang/CIR/LowerToLLVM.h
@@ -29,7 +29,8 @@ namespace cir {
namespace direct {
std::unique_ptr<llvm::Module>
-lowerDirectlyFromCIRToLLVMIR(mlir::ModuleOp M, llvm::LLVMContext &Ctx);
+lowerDirectlyFromCIRToLLVMIR(mlir::ModuleOp mlirModule,
+ llvm::LLVMContext &llvmCtx);
} // namespace direct
} // namespace cir
diff --git a/clang/lib/CIR/FrontendAction/.clang-tidy b/clang/lib/CIR/FrontendAction/.clang-tidy
new file mode 100644
index 00000000000000..cfb5bdb4bd1fe1
--- /dev/null
+++ b/clang/lib/CIR/FrontendAction/.clang-tidy
@@ -0,0 +1,16 @@
+InheritParentConfig: true
+CheckOptions:
+ - key: readability-identifier-naming.ClassCase
+ value: CamelCase
+ - key: readability-identifier-naming.EnumCase
+ value: CamelCase
+ - key: readability-identifier-naming.FunctionCase
+ value: camelBack
+ - 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
diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
index 3687e482fa9bbc..63d2b51b428357 100644
--- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
@@ -23,17 +23,17 @@ namespace cir {
namespace direct {
std::unique_ptr<llvm::Module>
-lowerDirectlyFromCIRToLLVMIR(mlir::ModuleOp MOp, LLVMContext &LLVMCtx) {
+lowerDirectlyFromCIRToLLVMIR(mlir::ModuleOp mlirModule, LLVMContext &llvmCtx) {
llvm::TimeTraceScope scope("lower from CIR to LLVM directly");
- std::optional<StringRef> ModuleName = MOp.getName();
- auto M = std::make_unique<llvm::Module>(
- ModuleName ? *ModuleName : "CIRToLLVMModule", LLVMCtx);
+ std::optional<StringRef> moduleName = mlirModule.getName();
+ auto llvmModule = std::make_unique<llvm::Module>(
+ moduleName ? *moduleName : "CIRToLLVMModule", llvmCtx);
- if (!M)
+ if (!llvmModule)
report_fatal_error("Lowering from LLVMIR dialect to llvm IR failed!");
- return M;
+ return llvmModule;
}
} // namespace direct
} // namespace cir
|
LGTM! Thanks! |
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.