[PATCH] Using an invalid -O falls back on -O3 instead of an error

Renato Golin renato.golin at linaro.org
Fri Nov 8 11:20:43 PST 2013



================
Comment at: lib/Frontend/CompilerInvocation.cpp:307
@@ -308,1 +306,3 @@
+        << Args.getLastArg(OPT_O)->getAsString(Args) << OptLevel << DefaultOptLevel;
+    OptLevel = DefaultOptLevel;
   }
----------------
This seems slightly redundant. Either you use literal 3 all over, or set the DefaultOptLevel on a higher place. Also, this is not the "default" level, but the fall-back level for high levels, maybe a better word would be "MaxOptLevel", if there isn't one already (I don't know).

If there isn't, than maybe you could create a MaxOptLevel on a higher level and change all comparisons "OptLevel > 3" for "OptLevel > MaxOptLevel".



http://llvm-reviews.chandlerc.com/D2125



More information about the cfe-commits mailing list