summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorPiotr Padlewski <piotr.padlewski@gmail.com>2016-12-23 11:40:44 +0000
committerPiotr Padlewski <piotr.padlewski@gmail.com>2016-12-23 11:40:44 +0000
commit1ec383c74a1cfc19f413a1a7ce7485fbb3881cc7 (patch)
tree7b211fb8fa60b75fe113a8f629a91c922b61df5c /clang/lib/Format
parent1d6b1a7b79b84a60ab58577de6ec103f19cf532c (diff)
downloadbcm5719-llvm-1ec383c74a1cfc19f413a1a7ce7485fbb3881cc7.tar.gz
bcm5719-llvm-1ec383c74a1cfc19f413a1a7ce7485fbb3881cc7.zip
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
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/Format.cpp15
-rw-r--r--clang/lib/Format/SortJavaScriptImports.cpp5
-rw-r--r--clang/lib/Format/WhitespaceManager.cpp5
3 files changed, 15 insertions, 10 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 61c904cc7fe..70b90d6fa14 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -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 FormatStyle &Style,
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 {
diff --git a/clang/lib/Format/SortJavaScriptImports.cpp b/clang/lib/Format/SortJavaScriptImports.cpp
index d72455bb3d0..e73695ca847 100644
--- a/clang/lib/Format/SortJavaScriptImports.cpp
+++ b/clang/lib/Format/SortJavaScriptImports.cpp
@@ -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;
}
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp
index 6fe477efd76..b64506f3903 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -501,9 +501,10 @@ void WhitespaceManager::storeReplacement(SourceRange Range,
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,
OpenPOWER on IntegriCloud