[cfe-commits] [Patch] -Wduplicate-enum which fixes PR6343

Ted Kremenek kremenek at apple.com
Tue Aug 14 21:38:05 PDT 2012


On Aug 14, 2012, at 2:32 PM, Richard Trieu <rtrieu at google.com> wrote:

>  If you are worried about the malloc() traffic, you could always keep a DenseMap around in Sema just for this warning, and clear it out whenever entering CheckForDuplicateEnumValues().  You then pay the malloc() cost when you need a bigger map, which will quickly amortize the cost.
> Seems a little strange to keep around a data structure in Sema for a non-default diagnostic.
> 

The DenseMap could be lazily allocated when the warning is triggered.  You then pay the cost only when the warning is on.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120814/497f0231/attachment.html>


More information about the cfe-commits mailing list