jansvoboda11 created this revision. jansvoboda11 added a reviewer: benlangmuir. Herald added a subscriber: ributzka. Herald added a project: All. jansvoboda11 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
When generating command lines, use the option spelling generated by TableGen (`StringLiteral`) instead of constructing it at runtime. This saves some needless allocations. Depends on D157029 <https://reviews.llvm.org/D157029>. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D157054 Files: clang/lib/Frontend/CompilerInvocation.cpp Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -628,7 +628,7 @@ llvm::opt::OptSpecifier OptSpecifier, CompilerInvocation::StringAllocator SA) { Option Opt = getDriverOptTable().getOption(OptSpecifier); - denormalizeSimpleFlag(Args, SA(Opt.getPrefix() + Opt.getName()), SA, + denormalizeSimpleFlag(Args, Opt.getSpelling(), SA, Option::OptionClass::FlagClass, 0); } @@ -637,8 +637,7 @@ const Twine &Value, CompilerInvocation::StringAllocator SA) { Option Opt = getDriverOptTable().getOption(OptSpecifier); - denormalizeString(Args, SA(Opt.getPrefix() + Opt.getName()), SA, - Opt.getKind(), 0, Value); + denormalizeString(Args, Opt.getSpelling(), SA, Opt.getKind(), 0, Value); } // Parse command line arguments into CompilerInvocation.
Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -628,7 +628,7 @@ llvm::opt::OptSpecifier OptSpecifier, CompilerInvocation::StringAllocator SA) { Option Opt = getDriverOptTable().getOption(OptSpecifier); - denormalizeSimpleFlag(Args, SA(Opt.getPrefix() + Opt.getName()), SA, + denormalizeSimpleFlag(Args, Opt.getSpelling(), SA, Option::OptionClass::FlagClass, 0); } @@ -637,8 +637,7 @@ const Twine &Value, CompilerInvocation::StringAllocator SA) { Option Opt = getDriverOptTable().getOption(OptSpecifier); - denormalizeString(Args, SA(Opt.getPrefix() + Opt.getName()), SA, - Opt.getKind(), 0, Value); + denormalizeString(Args, Opt.getSpelling(), SA, Opt.getKind(), 0, Value); } // Parse command line arguments into CompilerInvocation.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits