r307147 - [clang-format] Fix an uninitialized memory access

Krasimir Georgiev via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 5 05:24:01 PDT 2017


Author: krasimir
Date: Wed Jul  5 05:24:01 2017
New Revision: 307147

URL: http://llvm.org/viewvc/llvm-project?rev=307147&view=rev
Log:
[clang-format] Fix an uninitialized memory access

Modified:
    cfe/trunk/lib/Format/FormatToken.h

Modified: cfe/trunk/lib/Format/FormatToken.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/FormatToken.h?rev=307147&r1=307146&r2=307147&view=diff
==============================================================================
--- cfe/trunk/lib/Format/FormatToken.h (original)
+++ cfe/trunk/lib/Format/FormatToken.h Wed Jul  5 05:24:01 2017
@@ -646,13 +646,6 @@ struct AdditionalKeywords {
     kw_var = &IdentTable.get("var");
     kw_yield = &IdentTable.get("yield");
 
-    JsExtraKeywords = std::unordered_set<IdentifierInfo *>(
-        {kw_as, kw_async, kw_await, kw_declare, kw_finally, kw_from,
-         kw_function, kw_get, kw_import, kw_is, kw_let, kw_module, kw_set,
-         kw_type, kw_var, kw_yield,
-         // Keywords from the Java section.
-         kw_abstract, kw_extends, kw_implements, kw_instanceof, kw_interface});
-
     kw_abstract = &IdentTable.get("abstract");
     kw_assert = &IdentTable.get("assert");
     kw_extends = &IdentTable.get("extends");
@@ -680,6 +673,15 @@ struct AdditionalKeywords {
     kw_qsignals = &IdentTable.get("Q_SIGNALS");
     kw_slots = &IdentTable.get("slots");
     kw_qslots = &IdentTable.get("Q_SLOTS");
+
+    // Keep this at the end of the constructor to make sure everything here is
+    // already initialized.
+    JsExtraKeywords = std::unordered_set<IdentifierInfo *>(
+        {kw_as, kw_async, kw_await, kw_declare, kw_finally, kw_from,
+         kw_function, kw_get, kw_import, kw_is, kw_let, kw_module, kw_set,
+         kw_type, kw_var, kw_yield,
+         // Keywords from the Java section.
+         kw_abstract, kw_extends, kw_implements, kw_instanceof, kw_interface});
   }
 
   // Context sensitive keywords.




More information about the cfe-commits mailing list