teemperor added inline comments.

================
Comment at: clang/lib/Driver/DriverOptions.cpp:14
 #include "llvm/Option/Option.h"
+#include <assert.h>
 
----------------
I think the C++ version of the assert header is more consistent: `#include 
<cassert>`


================
Comment at: llvm/utils/TableGen/OptParserEmitter.cpp:313
+      for (const std::string &Pref : R.getValueAsListOfStrings("Prefixes")) {
+        OS << "assert(";
+        OS << "Opt.addValues(";
----------------
Don't call this inside an assert itself. The call would be removed on release 
builds (where assert is a no-op) and we wouldn't do the `addValues` anymore 
which breaks everything silently in release builds. Try something like this:

```
  bool ValuesWereAdded = Opt.addValues(...);
  (void)ValuesWereAdded; // Prevents unused variable warnings
  assert(ValuesWereAdded && "Couldn't add values to OptTable!");
```


https://reviews.llvm.org/D36782



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

Reply via email to