Skip to content

Commit 35c5e56

Browse files
committed
Clean up -Wdangling-assignment-gsl in clang and mlir
These are triggering after b037bce.
1 parent 81fc3ad commit 35c5e56

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

clang-tools-extra/include-cleaner/lib/Analysis.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ analyze(llvm::ArrayRef<Decl *> ASTRoots,
8585
const auto MainFile = *SM.getFileEntryRefForID(SM.getMainFileID());
8686
llvm::DenseSet<const Include *> Used;
8787
llvm::StringMap<Header> Missing;
88+
constexpr auto DefaultHeaderFilter = [](llvm::StringRef) { return false; };
8889
if (!HeaderFilter)
89-
HeaderFilter = [](llvm::StringRef) { return false; };
90+
HeaderFilter = DefaultHeaderFilter;
9091
OptionalDirectoryEntryRef ResourceDir =
9192
PP.getHeaderSearchInfo().getModuleMap().getBuiltinDir();
9293
walkUsed(ASTRoots, MacroRefs, PI, PP,

clang/tools/driver/driver.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,12 @@ int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContext) {
355355
if (!SetBackdoorDriverOutputsFromEnvVars(TheDriver))
356356
return 1;
357357

358+
auto ExecuteCC1WithContext =
359+
[&ToolContext](SmallVectorImpl<const char *> &ArgV) {
360+
return ExecuteCC1Tool(ArgV, ToolContext);
361+
};
358362
if (!UseNewCC1Process) {
359-
TheDriver.CC1Main = [ToolContext](SmallVectorImpl<const char *> &ArgV) {
360-
return ExecuteCC1Tool(ArgV, ToolContext);
361-
};
363+
TheDriver.CC1Main = ExecuteCC1WithContext;
362364
// Ensure the CC1Command actually catches cc1 crashes
363365
llvm::CrashRecoveryContext::Enable();
364366
}

mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,8 +919,9 @@ static void generateUnrolledLoop(
919919
// 'forOp'.
920920
auto builder = OpBuilder::atBlockTerminator(loopBodyBlock);
921921

922+
constexpr auto defaultAnnotateFn = [](unsigned, Operation *, OpBuilder) {};
922923
if (!annotateFn)
923-
annotateFn = [](unsigned, Operation *, OpBuilder) {};
924+
annotateFn = defaultAnnotateFn;
924925

925926
// Keep a pointer to the last non-terminator operation in the original block
926927
// so that we know what to clone (since we are doing this in-place).

mlir/lib/Dialect/SCF/Utils/Utils.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,9 @@ static void generateUnrolledLoop(
329329
// 'forOp'.
330330
auto builder = OpBuilder::atBlockTerminator(loopBodyBlock);
331331

332+
constexpr auto defaultAnnotateFn = [](unsigned, Operation *, OpBuilder) {};
332333
if (!annotateFn)
333-
annotateFn = [](unsigned, Operation *, OpBuilder) {};
334+
annotateFn = defaultAnnotateFn;
334335

335336
// Keep a pointer to the last non-terminator operation in the original block
336337
// so that we know what to clone (since we are doing this in-place).

0 commit comments

Comments
 (0)