[cfe-commits] r161345 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/uninitialized.cpp

Richard Trieu rtrieu at google.com
Tue Aug 14 16:52:05 PDT 2012


On Mon, Aug 6, 2012 at 6:27 PM, Richard Trieu <rtrieu at google.com> wrote:

> On Mon, Aug 6, 2012 at 4:12 PM, Richard Smith <richard at metafoo.co.uk>wrote:
>
>> On Mon, Aug 6, 2012 at 2:09 PM, Richard Trieu <rtrieu at google.com> wrote:
>>
>>> Author: rtrieu
>>> Date: Mon Aug  6 16:09:23 2012
>>> New Revision: 161345
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=161345&view=rev
>>> Log:
>>> For global record types, the self reference checker was called twice,
>>> resulting
>>> in duplicate -Wuninitialized warnings.  Change so that only the check in
>>> TryConstructorInitialization() will be used and a single warning be
>>> emitted.
>>>
>>> Modified:
>>>     cfe/trunk/lib/Sema/SemaDecl.cpp
>>>     cfe/trunk/test/SemaCXX/uninitialized.cpp
>>>
>>> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=161345&r1=161344&r2=161345&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
>>> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Aug  6 16:09:23 2012
>>> @@ -6310,7 +6310,10 @@
>>>    // Check for self-references within variable initializers.
>>>    // Variables declared within a function/method body are handled
>>>    // by a dataflow analysis.
>>> -  if (!VDecl->hasLocalStorage() && !VDecl->isStaticLocal())
>>> +  // Record types initialized by initializer list are handled here.
>>> +  // Initialization by constructors are handled in
>>> TryConstructorInitialization.
>>> +  if (!VDecl->hasLocalStorage() && !VDecl->isStaticLocal() &&
>>>
>>
>> (Not changed by your patch, but...) This isStaticLocal() check looks
>> suspicious. The CFG-based uninitialized values warning doesn't do anything
>> for static locals, so presumably we don't check them anywhere?
>>
> Testing says local statics aren't checked.  I'll go yank out the check and
> add some test cases for local statics.

Local static checked enabled in r161909.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120814/b740ef48/attachment.html>


More information about the cfe-commits mailing list