[lld] [lld][COFF]Expose UnifiedLTO and PassPipeline Options (PR #69904)

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 12:33:56 PDT 2023


================
@@ -126,8 +127,23 @@ BitcodeCompiler::BitcodeCompiler(COFFLinkerContext &c) : ctx(c) {
         llvm::heavyweight_hardware_concurrency(ctx.config.thinLTOJobs));
   }
 
+  lto::LTO::LTOKind Kind = lto::LTO::LTOK_Default;
----------------
rnk wrote:

To simplify this code, please put this switch into a static helper. It's similar in spirit to this guideline about predicate loops: https://llvm.org/docs/CodingStandards.html#turn-predicate-loops-into-predicate-functions

This way, you don't need the break or a local variable:
```
lto::LTO::LTOKind translateLTOKind(LTOKind k) {
  switch (k) {
  case LTOKind::Default:
    return lto::LTO::LTOK_Default;
...
```

Other nit is to prefer lower-cased variables in LLD. That was a style divergence that we never resolved.

https://github.com/llvm/llvm-project/pull/69904


More information about the llvm-commits mailing list