[clang] 2fe4909 - clang-format: fix undefined behavior.

Martin Probst via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 14 10:41:24 PDT 2021


Author: Martin Probst
Date: 2021-04-14T19:41:18+02:00
New Revision: 2fe4909748b5f14499e83b0647b7e9ddd0068a15

URL: https://github.com/llvm/llvm-project/commit/2fe4909748b5f14499e83b0647b7e9ddd0068a15
DIFF: https://github.com/llvm/llvm-project/commit/2fe4909748b5f14499e83b0647b7e9ddd0068a15.diff

LOG: clang-format: fix undefined behavior.

The previous change failed to initialize the SymbolsMerged field.

Added: 
    

Modified: 
    clang/lib/Format/SortJavaScriptImports.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/SortJavaScriptImports.cpp b/clang/lib/Format/SortJavaScriptImports.cpp
index fdc2408ec1ec..b7df1a5f1b53 100644
--- a/clang/lib/Format/SortJavaScriptImports.cpp
+++ b/clang/lib/Format/SortJavaScriptImports.cpp
@@ -89,7 +89,7 @@ struct JsModuleReference {
   SmallVector<JsImportedSymbol, 1> Symbols;
   // Whether some symbols were merged into this one. Controls if the module
   // reference needs re-formatting.
-  bool SymbolsMerged;
+  bool SymbolsMerged = false;
   // The source location just after { and just before } in the import.
   // Extracted eagerly to allow modification of Symbols later on.
   SourceLocation SymbolsStart, SymbolsEnd;


        


More information about the cfe-commits mailing list