This is an archive of the discontinued LLVM Phabricator instance.

[clang][NFC] Extract Target and AuxTarget creation in CompilerInstance to new function
ClosedPublic

Authored by oToToT on Feb 25 2021, 12:04 PM.

Details

Summary

As @sammccall mentioned in D97109, I've extract the logic of creating Target and AuxTarget into a new function called createTargetAndAuxTarget.

Since there are many similar code in clang or other related tools, consolidating them into a single function may help others to maintain the logic handling target related things.

Diff Detail

Event Timeline

oToToT requested review of this revision.Feb 25 2021, 12:04 PM
oToToT created this revision.
sammccall accepted this revision.Feb 25 2021, 2:25 PM

Thanks, this looks pretty unintrusive and will save a bunch of duplication.

clang/include/clang/Frontend/CompilerInstance.h
385

cuurent -> current

LangOpts seems maybe too narrow, just options?

clang/lib/Frontend/CompilerInstance.cpp
100

I'd suggest just createTarget(), because the aux target is part of the target

135

looks like this comment got mangled

This revision is now accepted and ready to land.Feb 25 2021, 2:25 PM
oToToT updated this revision to Diff 326581.Feb 25 2021, 7:16 PM

Fix typo and rename function to createTarget.

oToToT marked 3 inline comments as done.Feb 25 2021, 7:17 PM

Since I don't have commit access currently, might @sammccall commit this for me with --author="Yu-Hsun Chiang <ty1208chiang@gmail.com>"?