Use after move bug fixes
Summary: Bunch of fixed bugs in Clang after running misc-use-after-move in clang-tidy.
Reviewers: rsmith, mboehme
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D27752
llvm-svn: 290424
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 61c904c..70b90d6 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -844,9 +844,10 @@
Env.getSourceManager(), Start, Length, ReplacementText));
// FIXME: handle error. For now, print error message and skip the
// replacement for release version.
- if (Err)
+ if (Err) {
llvm::errs() << llvm::toString(std::move(Err)) << "\n";
- assert(!Err);
+ assert(false);
+ }
};
Replace(Start, 1, IsSingle ? "'" : "\"");
Replace(FormatTok->Tok.getEndLoc().getLocWithOffset(-1), 1,
@@ -1193,9 +1194,10 @@
Fixes.add(tooling::Replacement(Env.getSourceManager(), SR, ""));
// FIXME: better error handling. for now just print error message and skip
// for the release version.
- if (Err)
+ if (Err) {
llvm::errs() << llvm::toString(std::move(Err)) << "\n";
- assert(!Err && "Fixes must not conflict!");
+ assert(false && "Fixes must not conflict!");
+ }
Idx = End + 1;
}
@@ -1327,9 +1329,10 @@
FileName, Includes.front().Offset, IncludesBlockSize, result));
// FIXME: better error handling. For now, just skip the replacement for the
// release version.
- if (Err)
+ if (Err) {
llvm::errs() << llvm::toString(std::move(Err)) << "\n";
- assert(!Err);
+ assert(false);
+ }
}
namespace {