[libcxx] [llvm] [clang] [clang-tools-extra] [libc++] Allow running the test suite with optimizations (PR #68753)

Alexander Richardson via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 1 16:37:53 PDT 2023


================
@@ -87,6 +87,21 @@ def getStdFlag(cfg, std):
         return "-std=" + fallbacks[std]
     return None
 
+def getSpeedOptimizationFlag(cfg):
+    if _isClang(cfg) or _isAppleClang(cfg) or _isGCC(cfg):
+        return "-O3"
+    elif _isMSVC(cfg):
+        return "/O2"
+    else:
+        raise RuntimeError("Can't figure out what compiler is used in the configuration")
+
+def getSizeOptimizationFlag(cfg):
+    if _isClang(cfg) or _isAppleClang(cfg) or _isGCC(cfg):
+        return "-Os"
+    elif _isMSVC(cfg):
+        return "/O1"
+    else:
+        raise RuntimeError("Can't figure out what compiler is used in the configuration")
----------------
arichardson wrote:

`black` is unhappy with this formatting: https://github.com/llvm/llvm-project/pull/68753#issuecomment-1756472184

Personally, I'm not massively keen on the `black` coding style but it probably makes sense to keep it to something enforceable by a tool.

I do wonder if it would make sense to install it as a pre-commit hook to ensure the formatting stays consistent: https://github.com/akaihola/darker#using-as-a-pre-commit-hook

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


More information about the cfe-commits mailing list