Author: d0k
Date: Thu Apr 12 03:35:24 2018
New Revision: 329894

URL: http://llvm.org/viewvc/llvm-project?rev=329894&view=rev
Log:
[clang-apply-replacements] Always initialize FormatStyle.

The cleanup logic reads from this for cleanups even if reformatting is
not requested.

Found by msan.

Modified:
    
clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp

Modified: 
clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp?rev=329894&r1=329893&r2=329894&view=diff
==============================================================================
--- 
clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
 (original)
+++ 
clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
 Thu Apr 12 03:35:24 2018
@@ -97,16 +97,13 @@ int main(int argc, char **argv) {
       IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts.get());
 
   // Determine a formatting style from options.
-  format::FormatStyle FormatStyle;
-  if (DoFormat) {
-    auto FormatStyleOrError =
-        format::getStyle(FormatStyleOpt, FormatStyleConfig, "LLVM");
-    if (!FormatStyleOrError) {
-      llvm::errs() << llvm::toString(FormatStyleOrError.takeError()) << "\n";
-      return 1;
-    }
-    FormatStyle = *FormatStyleOrError;
+  auto FormatStyleOrError =
+      format::getStyle(FormatStyleOpt, FormatStyleConfig, "LLVM");
+  if (!FormatStyleOrError) {
+    llvm::errs() << llvm::toString(FormatStyleOrError.takeError()) << "\n";
+    return 1;
   }
+  format::FormatStyle FormatStyle = std::move(*FormatStyleOrError);
 
   TUReplacements TURs;
   TUReplacementFiles TUFiles;


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to