[llvm] 87dbdd2 - [FileCheck] Default --allow-unused-prefixes to false

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 8 13:37:14 PST 2021


Author: Fangrui Song
Date: 2021-02-08T13:37:04-08:00
New Revision: 87dbdd2e3bb63b681f8cc3179ef5c2d5929bbf61

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

LOG: [FileCheck] Default --allow-unused-prefixes to false

Link: https://lists.llvm.org/pipermail/llvm-dev/2020-October/146162.html "[RFC] FileCheck: (dis)allowing unused prefixes"

If a downstream project using lit needs time for transition,
add the following to `lit.local.cfg`:

```
from lit.llvm.subst import ToolSubst

fc = ToolSubst('FileCheck', unresolved='fatal')
config.substitutions.insert(0, (fc.regex, 'FileCheck --allow-unused-prefixes'))
```

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

Added: 
    

Modified: 
    clang/test/Driver/crash-report-null.test
    clang/test/OpenMP/lit.local.cfg
    clang/test/lit.cfg.py
    llvm/test/FileCheck/allow-unused-prefixes.txt
    llvm/test/FileCheck/lit.local.cfg
    llvm/test/Other/opt-bisect-legacy-pass-manager.ll
    llvm/test/Transforms/Attributor/lit.local.cfg
    llvm/test/lit.cfg.py
    llvm/utils/FileCheck/FileCheck.cpp

Removed: 
    llvm/test/Reduce/lit.local.cfg


################################################################################
diff  --git a/clang/test/Driver/crash-report-null.test b/clang/test/Driver/crash-report-null.test
index 05309bf63f27..c5e3b3b0fc9c 100644
--- a/clang/test/Driver/crash-report-null.test
+++ b/clang/test/Driver/crash-report-null.test
@@ -1,7 +1,7 @@
 // RUN: env FORCE_CLANG_DIAGNOSTICS_CRASH=1 not %clang -fsyntax-only -x c /dev/null -lstdc++ 2>&1 | FileCheck %s
 
 // FIXME: Investigating. "fatal error: file 'nul' modified since it was first processed"
-// XFAIL: windows-gnu
+// UNSUPPORTED: system-windows
 
 // CHECK: PLEASE submit a bug report to {{.*}} and include the crash backtrace, preprocessed source, and associated run script.
 // CHECK: Preprocessed source(s) and associated run script(s) are located at:

diff  --git a/clang/test/OpenMP/lit.local.cfg b/clang/test/OpenMP/lit.local.cfg
index ac72c2de9777..c114693dd7ed 100644
--- a/clang/test/OpenMP/lit.local.cfg
+++ b/clang/test/OpenMP/lit.local.cfg
@@ -2,9 +2,4 @@
 from lit.llvm.subst import ToolSubst
 
 fc = ToolSubst('FileCheck', unresolved='fatal')
-# the parent introduced the opposite rule, so we replace it if we see it.
-if len(config.substitutions) > 0 and config.substitutions[0] == (fc.regex, 'FileCheck --allow-unused-prefixes=false'):
-    config.substitutions[0] = (
-        fc.regex, 'FileCheck --allow-unused-prefixes=true')
-else:
-    config.substitutions.insert(0, (fc.regex, 'FileCheck --allow-unused-prefixes=true'))
+config.substitutions.insert(0, (fc.regex, 'FileCheck --allow-unused-prefixes'))

diff  --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index a47ebe74ddba..863ab444fb02 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -43,14 +43,6 @@
 
 llvm_config.use_clang()
 
-# FIXME: remove this when we flip the default value for --allow-unused-prefixes
-# to false.
-fc = ToolSubst('FileCheck', unresolved='fatal')
-# Insert this first. Then, we'll first update the blank FileCheck command; then,
-# the default substitution of FileCheck will replace it to its full path.
-config.substitutions.insert(0, (fc.regex,
-    'FileCheck --allow-unused-prefixes=false'))
-
 config.substitutions.append(
     ('%src_include_dir', config.clang_src_dir + '/include'))
 

diff  --git a/llvm/test/FileCheck/allow-unused-prefixes.txt b/llvm/test/FileCheck/allow-unused-prefixes.txt
index 6903b0452882..6b15dc29273b 100644
--- a/llvm/test/FileCheck/allow-unused-prefixes.txt
+++ b/llvm/test/FileCheck/allow-unused-prefixes.txt
@@ -2,10 +2,7 @@
 ; RUN: %ProtectFileCheckOutput not FileCheck --allow-unused-prefixes=false --check-prefixes=P1,P2,P3 --input-file %S/Inputs/one-check.txt %S/Inputs/one-check.txt 2>&1 | FileCheck --check-prefix=MISSING-MORE %s
 ; RUN: FileCheck --allow-unused-prefixes=true  --check-prefixes=P1,P2 --input-file %S/Inputs/one-check.txt %S/Inputs/one-check.txt 
 ; RUN: FileCheck --allow-unused-prefixes=false --allow-unused-prefixes=true --check-prefixes=P1,P2 --input-file %S/Inputs/one-check.txt %S/Inputs/one-check.txt
-
-;; Note: the default will be changed to 'false', at which time this run line
-;; should be changed accordingly.
-; RUN: FileCheck --check-prefixes=P1,P2 --input-file %S/Inputs/one-check.txt %S/Inputs/one-check.txt 
+; RUN: not FileCheck --check-prefixes=P1,P2 --input-file %S/Inputs/one-check.txt %S/Inputs/one-check.txt
 
 ; MISSING-ONE: error: no check strings found with prefix 'P2:' 
 ; MISSING-MORE: error: no check strings found with prefixes 'P2:', 'P3:'

diff  --git a/llvm/test/FileCheck/lit.local.cfg b/llvm/test/FileCheck/lit.local.cfg
index 74e4d89e416b..9164f683fc1b 100644
--- a/llvm/test/FileCheck/lit.local.cfg
+++ b/llvm/test/FileCheck/lit.local.cfg
@@ -54,12 +54,3 @@ config.test_format = lit.formats.ShTest(execute_external=False)
 # that test results throughout all test suites are affected.
 config.substitutions.append(('%ProtectFileCheckOutput',
     'env -u FILECHECK_OPTS'))
-
-# FIXME: remove this once the default is flipped.
-from lit.llvm.subst import ToolSubst
-
-fc = ToolSubst('FileCheck', unresolved='fatal')
-# the parent introduced the opposite rule, so we replace it if we see it.
-if len(config.substitutions) > 0 and config.substitutions[0] == (fc.regex, 'FileCheck --allow-unused-prefixes=false'):
-    del config.substitutions[0]
-

diff  --git a/llvm/test/Other/opt-bisect-legacy-pass-manager.ll b/llvm/test/Other/opt-bisect-legacy-pass-manager.ll
index decd9db6636f..8d966deeccd7 100644
--- a/llvm/test/Other/opt-bisect-legacy-pass-manager.ll
+++ b/llvm/test/Other/opt-bisect-legacy-pass-manager.ll
@@ -39,7 +39,7 @@
 ; f2() in f3().
 
 ; RUN: %python %S/opt-bisect-helper.py --start=0 --end=256 --optcmd=opt \
-; RUN:         --filecheckcmd=%FileCheckRaw% --test=%s \
+; RUN:         --filecheckcmd=FileCheck --test=%s \
 ; RUN:         --prefix=CHECK-BISECT-INLINE-HELPER \
 ; RUN:         | FileCheck %s --check-prefix=CHECK-BISECT-INLINE-RESULT
 ; The helper script uses this to find the optimization that inlines the call.

diff  --git a/llvm/test/Reduce/lit.local.cfg b/llvm/test/Reduce/lit.local.cfg
deleted file mode 100644
index dcd414b5eaf5..000000000000
--- a/llvm/test/Reduce/lit.local.cfg
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
-# FIXME: remove this file when we flip the default for --allow-unused-prefixes.
-from lit.llvm.subst import ToolSubst
-
-fc = ToolSubst('FileCheck', unresolved='fatal')
-# the parent introduced the opposite rule, so we replace it if we see it.
-if len(config.substitutions) > 0 and config.substitutions[0] == (fc.regex, 'FileCheck --allow-unused-prefixes=false'):
-    del config.substitutions[0]

diff  --git a/llvm/test/Transforms/Attributor/lit.local.cfg b/llvm/test/Transforms/Attributor/lit.local.cfg
index fad1a46e1d0f..c114693dd7ed 100644
--- a/llvm/test/Transforms/Attributor/lit.local.cfg
+++ b/llvm/test/Transforms/Attributor/lit.local.cfg
@@ -2,10 +2,4 @@
 from lit.llvm.subst import ToolSubst
 
 fc = ToolSubst('FileCheck', unresolved='fatal')
-# the parent introduced the opposite rule, so we replace it if we see it.
-if len(config.substitutions) > 0 and config.substitutions[0] == (fc.regex, 'FileCheck --allow-unused-prefixes=false'):
-    config.substitutions[0] = (
-        fc.regex, 'FileCheck --allow-unused-prefixes=true')
-else:
-    config.substitutions.insert(0, (fc.regex, 
-                                    'FileCheck --allow-unused-prefixes=true'))
+config.substitutions.insert(0, (fc.regex, 'FileCheck --allow-unused-prefixes'))

diff  --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index 348ab62c7bb8..f862e62cc17e 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -83,20 +83,6 @@ def get_asan_rtlib():
     return found_dylibs[0]
 
 
-####################################################
-# FIXME: remove this when we flip the default value for --allow-unused-prefixes
-# to false.
-fc = ToolSubst('FileCheck', unresolved='fatal')
-# Insert this first. Then, we'll first update the blank FileCheck command; then,
-# the default substitution of FileCheck will replace it to its full path.
-config.substitutions.insert(0, (fc.regex,
-    'FileCheck --allow-unused-prefixes=false'))
-# When addressing this fixme, replace %FileCheckRaw% with just FileCheck.
-config.substitutions.append(('%FileCheckRaw%', 'FileCheck'))
-# Also remove the lit.local.cfg under llvm/test/Reduce
-# and the pertinent FIXME in llvm/test/FileCheck
-####################################################
-
 llvm_config.use_default_substitutions()
 
 # Add site-specific substitutions.
@@ -162,8 +148,8 @@ def get_asan_rtlib():
 # FIXME: Why do we have both `lli` and `%lli` that do slightly 
diff erent things?
 tools.extend([
     'dsymutil', 'lli', 'lli-child-target', 'llvm-ar', 'llvm-as',
-    'llvm-addr2line', 'llvm-bcanalyzer', 'llvm-bitcode-strip', 'llvm-config', 
-    'llvm-cov', 'llvm-cxxdump', 'llvm-cvtres', 'llvm-
diff ', 'llvm-dis', 
+    'llvm-addr2line', 'llvm-bcanalyzer', 'llvm-bitcode-strip', 'llvm-config',
+    'llvm-cov', 'llvm-cxxdump', 'llvm-cvtres', 'llvm-
diff ', 'llvm-dis',
     'llvm-dwarfdump', 'llvm-dlltool', 'llvm-exegesis', 'llvm-extract',
     'llvm-isel-fuzzer', 'llvm-ifs',
     'llvm-install-name-tool', 'llvm-jitlink', 'llvm-opt-fuzzer', 'llvm-lib',

diff  --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp
index 09d82d3d302b..a509c4d06257 100644
--- a/llvm/utils/FileCheck/FileCheck.cpp
+++ b/llvm/utils/FileCheck/FileCheck.cpp
@@ -78,7 +78,7 @@ static cl::opt<bool> AllowEmptyInput(
              "checks that some error message does not occur, for example."));
 
 static cl::opt<bool> AllowUnusedPrefixes(
-    "allow-unused-prefixes", cl::init(true), cl::ZeroOrMore,
+    "allow-unused-prefixes", cl::init(false), cl::ZeroOrMore,
     cl::desc("Allow prefixes to be specified but not appear in the test."));
 
 static cl::opt<bool> MatchFullLines(


        


More information about the llvm-commits mailing list