Files
swift-mirror/test/Misc/you-should-be-using-LLVM_DEBUG.test-sh
Daniel Duan 3dfc40898c [NFC] Remove Python 2 imports from __future__ (#42086)
The `__future__` we relied on is now,  where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):

* absolute_import
* print_function
* unicode_literals
* division

These import statements are no-ops and are no longer necessary.
2022-04-13 14:01:30 -07:00

28 lines
788 B
Python

#! /usr/bin/env python3
# -*- python -*-
# RUN: %{python} %s '%swift_src_root'
import os.path
import subprocess
import sys
if len(sys.argv) < 2:
print('Invalid number of arguments.')
sys.exit(1)
swift_src_root = sys.argv[1]
if not os.path.exists(os.path.join(swift_src_root, '.git')):
# It is fine if the folder doesn't exist
sys.exit(0)
returncode = subprocess.call(
['git', '-C', swift_src_root, 'grep', r'\bDEBUG[(]'])
if returncode == 0: # We found some DEBUG in there.
print("""
*** The {DEBUG}(...) macro is being renamed to LLVM_DEBUG(...);
*** please use that instead.""".format(DEBUG='DEBUG'))
sys.exit(1)
# If you see a failure in this test, that means you introduced a use of the
# DEBUG macro from LLVM, which is being renamed to LLVM_DEBUG.