[PATCH] Standardize usage of CodeGenModule::getContext().getTargetInfo()

John McCall rjmccall at apple.com
Wed Apr 10 12:34:10 PDT 2013

On Apr 10, 2013, at 6:49 AM, Stephen Lin <swlin at post.harvard.edu> wrote:

> Ok, this revised patch standardizes it the other way, wherever the
> getContext().getTargetInfo() pattern is used (not just CodeGenModule).
> A lot of lines are different length now now so I reformatted the
> containing statements to standard line wrap style.
> I decided to go ahead and cache Target everywhere this pattern is
> used; it was already being cached at CodeGenFunction and CodeGenTypes,
> but the cache was not being used consistently (sometimes the cache
> would be used directly, sometimes it would be be used through an
> accessor  and sometimes it wouldn't be used at all). I standardized
> all usage to use the accessor, since Target was being shadowed by
> local variables sometimes, and to make the code more grepable.
> Also, I noticed that TargetOptions is not being used by CodeGenModule
> (it seems like all the information it could be used for is
> encapsulated in ASTContext already), so I removed it from its
> constructor's parameters as well as the parameters of its callers,
> recursively, that were defined within the "lib" tree. I didn't remove
> it from CreateLLVMCodeGen in "include/clang/CodeGen/ModuleBuilder.h",
> since that's apparently part of the public interface of the CodeGen
> library. I also put this in an separate patch in case there's some
> reason it shouldn't be removed, but this patch should only be applied
> on top of the previous one.
> Let me know if this looks OK.

Yes, they both look fine, thanks!


More information about the cfe-commits mailing list