<div dir="ltr">My example is a bit flawed, so it could look like this:<div><br></div><div><div>1) </div><div>[[clang::csa("supress.somecheck.somefunctionality")]] void foo();<br></div><div><br></div><div>2)</div><div>[[clang::csa("summary.BufferSize.Buffer(0).BufSize(1).BufSizeMultiplier(2)")]]<br></div><div>std::size_t fread( void* buffer, std::size_t size, std::size_t count, std::FILE* stream );<br></div><div><br></div><div>3) </div><div>namespace myNamespace {</div><div>[[clang::csa("taint.sink")]]</div></div><div>void mySink(int x);</div><div>} // myNamespace</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 20, 2020 at 5:34 PM Gábor Márton <<a href="mailto:martongabesz@gmail.com">martongabesz@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<br><div><br></div><div>There is an evolving need to configure the Clang Static Analyzer within the analyzed source code itself. We'd like to</div><div>1) suppress specific checkers (we already have an ongoing discussion at <a href="https://reviews.llvm.org/D89638" target="_blank">D89638</a>)</div><div>2) express summaries (mainly argument constraints)</div><div>3) express taint propagation rules for functions (or for global variables like std::cin)</div><div><br></div><div>What if we had one attribute for CSA with a StringArgument?<br>(Actually, we already have that with the `annotate` attribute.)<br></div><div><br></div><div>So we'd have something like this:</div><div>1) [[clang::csa("supress.somecheck.somefunctionality")]]</div><div>2) [[clang::csa("summary.std::fread.BufferSize.Buffer(0).BufSize(1).BufSizeMultiplier(2)")]]<br></div><div>3) [[clang::csa("taint.sink.myNamespace::mySink")]]</div><div><br></div><div>Disadvantages: we must process strings whenever a node has the 'csa' attr attached, we have to come up with a "DSL".<br>Advantages: total flexibility.<br></div><div><br></div><div>I'd like to explore the possible approaches that we could have. For example, Aaron suggested alternatively for the suppression:</div><div>[[clang::suppress("analyzer.somecheck.somefunctionality")]]<br>[[clang::suppress("compiler.warning.12345")]]<br>[[clang::suppress("tidy.check-name.whatever")]]<br></div><div><br></div><div>Thanks,</div><div>Gabor</div></div>
</blockquote></div>