<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Yup, querying LangOpts in the registerYourChecker() is the current
solution. I don't think it's well-thought, but it works and there
aren't any known problems with it.<br>
<br>
You can't do much more than that in this point (eg., query AST for
presence of STL declarations) because AST is not constructed yet.
I'm not sure if we want to keep it this way, vs. delay checker
registration until end of AST construction, but it might turn out to
be useful if we want to make, say, preprocessor checkers.<br>
<br>
<div class="moz-cite-prefix">On 9/17/18 2:04 AM, Endre Fulop via
cfe-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAPhL7xDrsE2qx+L1gnqrf8M9LFLOX1n+-p-sEpFXOj8sWB=VAA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Hi,
<div><br>
<div>I am maintaining some SA checkers, which are only
relevant to specific languages (C++), and crash when called
on irrelevant sources (C).</div>
<div><br>
<div>Are there any best practices, or guidelines regarding
the language assessment of the current translation unit?</div>
</div>
<div><br>
</div>
<div>I am aware that GTestChecker uses its register method to
check LangOpts to only register in case the current TU is
C++. I have also encountered sporadic LangOpts checks inside
the checker callback methods. We could also query the build
system to map TU-s to language categories, however, inside
the clang framework, a more cognizant decision could be
made.</div>
<div><br>
</div>
<div>I would like to have your suggestions on this matter.</div>
<div><br>
</div>
<div>Regards,</div>
<div>Endre</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
cfe-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>