[PATCH] Fix prefixes list initialization in driver::OptTable ctor

Mehdi AMINI mehdi.amini at silkan.com
Fri Apr 5 20:46:01 PDT 2013


Hi,

Please find attached a little bugfix for OptTable initialization of 
prefixes. The loop initializing the list of prefixes from the options 
list stops before the last entry. If the last entry in the options table 
uses a unique prefix, then it won't be parsed.

Thanks,

Mehdi
-------------- next part --------------
diff --git a/lib/Driver/OptTable.cpp b/lib/Driver/OptTable.cpp
index 20214a6..a8ebfa1 100644
--- a/lib/Driver/OptTable.cpp
+++ b/lib/Driver/OptTable.cpp
@@ -132,8 +132,8 @@ OptTable::OptTable(const Info *_OptionInfos, unsigned _NumOptionInfos)
 #endif
 
   // Build prefixes.
-  for (unsigned i = FirstSearchableIndex+1, e = getNumOptions(); i != e; ++i) {
-    if (const char *const *P = getInfo(i).Prefixes) {
+  for (unsigned i = FirstSearchableIndex, e = getNumOptions(); i != e; ++i) {
+    if (const char *const *P = getInfo(i+1).Prefixes) {
       for (; *P != 0; ++P) {
         PrefixesUnion.insert(*P);
       }


More information about the cfe-commits mailing list