[cfe-commits] PATCH: wide strings alignment fix in clang

John McCall rjmccall at apple.com
Wed Aug 3 15:42:55 PDT 2011


On Aug 3, 2011, at 11:59 AM, Sundeep wrote:

> Hi Craig,
> 
> I liked your idea. I verified that it fixes my test case. I also improved
> your original patch as follows:
> 
> 1. Updated 'GetAddrOfConstantString' and 'GetAddrOfConstantCString' APIs to
> default assign Alignment to 1.
> 2. Undid your changes to all call sites calling those APIs with alignment of
> 1.
> 
> The new patch is attached. John, please let me know if the new patch looks
> ok.

This looks good, but I'd be slightly happier if you didn't need that
dyn_cast<GlobalVariable> — we really don't ever want this to fail,
because when it fails, we might not be getting the alignment right.
Fortunately, it looks like the entries are always GlobalVariables.
Please change ConstantStringMap's type to encode this
assumption, and then you shouldn't need the dyn_cast.

With that, this is ready to go in, thanks!

John.



More information about the cfe-commits mailing list