<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">I'm currently working on the TableGen definitions of Clang command-line options.</div><div class=""><br class=""></div><div class="">One place where an assertion would be handy is the multiclass that generates the positive and negative flag from a base string, e.g.: "access-control" => "-faccess-control", "-fno-access-control". Users of the multiclass may get confused about the semantics and accidentally pass base string that already contains the "no-" prefix, resulting in incorrect flag names: "no-access-control" => "-fno-access-control", "-fno-no-access-control". This actually happens: <<a href="https://reviews.llvm.org/D93104" class="">https://reviews.llvm.org/D93104</a>>. If we could do something like "assert !not(!strstartswith(name, "no-"));", we could prevent these types of bugs.</div><div class=""><br class=""></div><div class="">Another place this would be useful is in the BoolOptionBase multiclass (clang/include/clang/Driver/Options.td). The use-cases are decribed in TODOs.</div><div class=""><br class=""></div><div>I'm not sure how to implement something like this. So far, I've looked into the implementation of conditions, which might be a good starting point <<a href="https://reviews.llvm.org/D71474" class="">https://reviews.llvm.org/D71474</a>>.</div><div><br class=""><blockquote type="cite" class=""><div class="">On Dec 15, 2020, at 3:15 PM, Paul C. Anagnostopoulos via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">I have been thinking about an assertion feature, but it is difficult to figure out when assertions can be performed. Can you give me one or two specific examples of what you want to check?<br class=""><br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></div></blockquote></div><br class=""></body></html>