Author: Jan Svoboda
Date: 2023-08-09T09:55:07-07:00
New Revision: acf57858c1acb4ff776a1d734b86e1c05303132a

URL: 
https://github.com/llvm/llvm-project/commit/acf57858c1acb4ff776a1d734b86e1c05303132a
DIFF: 
https://github.com/llvm/llvm-project/commit/acf57858c1acb4ff776a1d734b86e1c05303132a.diff

LOG: [clang] NFC: Use compile-time option spelling when generating command line

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.

Reviewed By: benlangmuir, MaskRay

Differential Revision: https://reviews.llvm.org/D157054

Added: 
    

Modified: 
    clang/lib/Frontend/CompilerInvocation.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index c4082db0090733..87190093767b05 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -615,7 +615,7 @@ static unsigned getOptimizationLevelSize(ArgList &Args) {
 static void GenerateArg(ArgumentConsumer Consumer,
                         llvm::opt::OptSpecifier OptSpecifier) {
   Option Opt = getDriverOptTable().getOption(OptSpecifier);
-  denormalizeSimpleFlag(Consumer, Opt.getPrefix() + Opt.getName(),
+  denormalizeSimpleFlag(Consumer, Opt.getPrefixedName(),
                         Option::OptionClass::FlagClass, 0);
 }
 
@@ -623,8 +623,7 @@ static void GenerateArg(ArgumentConsumer Consumer,
                         llvm::opt::OptSpecifier OptSpecifier,
                         const Twine &Value) {
   Option Opt = getDriverOptTable().getOption(OptSpecifier);
-  denormalizeString(Consumer, Opt.getPrefix() + Opt.getName(), Opt.getKind(), 
0,
-                    Value);
+  denormalizeString(Consumer, Opt.getPrefixedName(), 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

Reply via email to