r290424 - Use after move bug fixes
Piotr Padlewski via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 23 03:40:45 PST 2016
Author: prazek
Date: Fri Dec 23 05:40:44 2016
New Revision: 290424
URL: http://llvm.org/viewvc/llvm-project?rev=290424&view=rev
Log:
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
Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/lib/Format/SortJavaScriptImports.cpp
cfe/trunk/lib/Format/WhitespaceManager.cpp
cfe/trunk/lib/Lex/ModuleMap.cpp
cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=290424&r1=290423&r2=290424&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Fri Dec 23 05:40:44 2016
@@ -844,9 +844,10 @@ private:
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 @@ private:
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 @@ static void sortCppIncludes(const Format
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 {
Modified: cfe/trunk/lib/Format/SortJavaScriptImports.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/SortJavaScriptImports.cpp?rev=290424&r1=290423&r2=290424&view=diff
==============================================================================
--- cfe/trunk/lib/Format/SortJavaScriptImports.cpp (original)
+++ cfe/trunk/lib/Format/SortJavaScriptImports.cpp Fri Dec 23 05:40:44 2016
@@ -197,9 +197,10 @@ public:
ReferencesText));
// FIXME: better error handling. For now, just print error message and skip
// the replacement for the release version.
- if (Err)
+ if (Err) {
llvm::errs() << llvm::toString(std::move(Err)) << "\n";
- assert(!Err);
+ assert(false);
+ }
return Result;
}
Modified: cfe/trunk/lib/Format/WhitespaceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/WhitespaceManager.cpp?rev=290424&r1=290423&r2=290424&view=diff
==============================================================================
--- cfe/trunk/lib/Format/WhitespaceManager.cpp (original)
+++ cfe/trunk/lib/Format/WhitespaceManager.cpp Fri Dec 23 05:40:44 2016
@@ -501,9 +501,10 @@ void WhitespaceManager::storeReplacement
SourceMgr, CharSourceRange::getCharRange(Range), Text));
// FIXME: better error handling. For now, just print an error message in the
// release version.
- if (Err)
+ if (Err) {
llvm::errs() << llvm::toString(std::move(Err)) << "\n";
- assert(!Err);
+ assert(false);
+ }
}
void WhitespaceManager::appendNewlineText(std::string &Text,
Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=290424&r1=290423&r2=290424&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Fri Dec 23 05:40:44 2016
@@ -827,7 +827,7 @@ void ModuleMap::addHeader(Module *Mod, M
return;
HeaderList.push_back(KH);
- Mod->Headers[headerRoleToKind(Role)].push_back(std::move(Header));
+ Mod->Headers[headerRoleToKind(Role)].push_back(Header);
bool isCompilingModuleHeader =
LangOpts.isCompilingModule() && Mod->getTopLevelModule() == SourceModule;
Modified: cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp?rev=290424&r1=290423&r2=290424&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp (original)
+++ cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp Fri Dec 23 05:40:44 2016
@@ -45,9 +45,10 @@ void ReplaceStmtWithText::run(
CharSourceRange::getTokenRange(FromMatch->getSourceRange()), ToText));
// FIXME: better error handling. For now, just print error message in the
// release version.
- if (Err)
+ if (Err) {
llvm::errs() << llvm::toString(std::move(Err)) << "\n";
- assert(!Err);
+ assert(false);
+ }
}
}
@@ -63,9 +64,10 @@ void ReplaceStmtWithStmt::run(
replaceStmtWithStmt(*Result.SourceManager, *FromMatch, *ToMatch));
// FIXME: better error handling. For now, just print error message in the
// release version.
- if (Err)
+ if (Err) {
llvm::errs() << llvm::toString(std::move(Err)) << "\n";
- assert(!Err);
+ assert(false);
+ }
}
}
@@ -82,9 +84,10 @@ void ReplaceIfStmtWithItsBody::run(
Replace.add(replaceStmtWithStmt(*Result.SourceManager, *Node, *Body));
// FIXME: better error handling. For now, just print error message in the
// release version.
- if (Err)
+ if (Err) {
llvm::errs() << llvm::toString(std::move(Err)) << "\n";
- assert(!Err);
+ assert(false);
+ }
} else if (!PickTrueBranch) {
// If we want to use the 'else'-branch, but it doesn't exist, delete
// the whole 'if'.
@@ -92,9 +95,10 @@ void ReplaceIfStmtWithItsBody::run(
Replace.add(replaceStmtWithText(*Result.SourceManager, *Node, ""));
// FIXME: better error handling. For now, just print error message in the
// release version.
- if (Err)
+ if (Err) {
llvm::errs() << llvm::toString(std::move(Err)) << "\n";
- assert(!Err);
+ assert(false);
+ }
}
}
}
More information about the cfe-commits
mailing list