[cfe-commits] r145697 - in /cfe/trunk: include/clang/Analysis/Analyses/FormatString.h lib/Analysis/FormatString.cpp lib/Analysis/PrintfFormatString.cpp lib/Sema/SemaChecking.cpp test/Sema/format-strings-int-typedefs.c

Douglas Gregor dgregor at apple.com
Sat Dec 3 10:14:24 PST 2011


On Dec 3, 2011, at 8:24 AM, Hans Wennborg wrote:

> On Fri, Dec 2, 2011 at 11:15 PM, Nick Lewycky <nlewycky at google.com> wrote:
>>>  #include "clang/Analysis/Analyses/FormatString.h"
>>> +#include "clang/Sema/Sema.h"
>> 
>> Hi Hans,
>> 
>> This introduces a dependency on Sema, which is cyclic because Sema
>> already depends on Analysis.
>> 
>> I'm going to revert this patch for the time being. Please reapply once
>> you figure out the dependency (basically, you can use the AST but not
>> Sema here). You can get an ASTContext from any Decl, which should
>> solve part of the problem, but I don't know what to do about the name
>> lookup.
> 
> Hi Nick,
> 
> Thanks for reverting; sorry I wasn't around to do it myself.
> 
> Is there something within the build system or otherwise that would
> allow me to catch the introduction of a bad dependency like this? Or
> is it down to manual inspection?
> 
> I'm thinking lookup might not be really necessary here. The warning
> doesn't really need to find the typedef, it can just refer to e.g.
> "size_t" by name. I'll get a new patch out for review next week.

The warning does need to find the typedef, because it shouldn't suggest 'size_t' if no 'size_t' is visible. However, you can just perform lookup into the translation unit (using DeclContext's lookup) to find an appropriately-typed 'size_t' typedef.

	- Doug



More information about the cfe-commits mailing list