Skip to content

Commit dda425f

Browse files
bcardosolopeslanza
authored andcommittedJan 27, 2025
[CIR][ClangTidy][Lifetime] Update to newer dyn_cast usage and update pass pipeline
Unbreaks `ninja check-clang-extra-clang-tidy`
1 parent 90956da commit dda425f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

‎clang-tools-extra/clang-tidy/cir/Lifetime.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -105,25 +105,25 @@ void Lifetime::setupAndRunClangIRLifetimeChecker(ASTContext &astCtx) {
105105

106106
clang::SourceLocation getClangSrcLoc(mlir::Location loc) {
107107
// Direct maps into a clang::SourceLocation.
108-
if (auto fileLoc = loc.dyn_cast<mlir::FileLineColLoc>()) {
108+
if (auto fileLoc = dyn_cast<mlir::FileLineColLoc>(loc)) {
109109
return getClangFromFileLineCol(fileLoc);
110110
}
111111

112112
// FusedLoc needs to be decomposed but the canonical one
113113
// is the first location, we handle source ranges somewhere
114114
// else.
115-
if (auto fileLoc = loc.dyn_cast<mlir::FusedLoc>()) {
115+
if (auto fileLoc = dyn_cast<mlir::FusedLoc>(loc)) {
116116
auto locArray = fileLoc.getLocations();
117117
assert(locArray.size() > 0 && "expected multiple locs");
118118
return getClangFromFileLineCol(
119-
locArray[0].dyn_cast<mlir::FileLineColLoc>());
119+
dyn_cast<mlir::FileLineColLoc>(locArray[0]));
120120
}
121121

122122
// Many loc styles are yet to be handled.
123-
if (auto fileLoc = loc.dyn_cast<mlir::UnknownLoc>()) {
123+
if (auto fileLoc = dyn_cast<mlir::UnknownLoc>(loc)) {
124124
llvm_unreachable("mlir::UnknownLoc not implemented!");
125125
}
126-
if (auto fileLoc = loc.dyn_cast<mlir::CallSiteLoc>()) {
126+
if (auto fileLoc = dyn_cast<mlir::CallSiteLoc>(loc)) {
127127
llvm_unreachable("mlir::CallSiteLoc not implemented!");
128128
}
129129
llvm_unreachable("Unknown location style");
@@ -178,7 +178,7 @@ void Lifetime::setupAndRunClangIRLifetimeChecker(ASTContext &astCtx) {
178178
mlir::PassManager pm(mlirCtx.get());
179179

180180
// Add pre-requisite passes to the pipeline
181-
pm.addPass(mlir::createMergeCleanupsPass());
181+
pm.addPass(mlir::createCIRSimplifyPass());
182182

183183
// Insert the lifetime checker.
184184
pm.addPass(mlir::createLifetimeCheckPass(

0 commit comments

Comments
 (0)
Please sign in to comment.