forked from OSchip/llvm-project
[gen_ast_dump_json_test.py] Copy to binary directory to omit --clang argument
The script will now check if a clang binary exists in the same directory and default to that instead of requiring a --clang argument. The script is copied to the clang build directory using CMake configure_file() with COPYONLY. This ensures that the version in the build directory is updated any time the source version changes. See https://reviews.llvm.org/D70119
This commit is contained in:
parent
90dbb47616
commit
d09e811cb4
|
@ -55,11 +55,19 @@ def filter_json(dict_var, filters, out):
|
|||
for e in v:
|
||||
if isinstance(e, OrderedDict):
|
||||
filter_json(e, filters, out)
|
||||
|
||||
|
||||
|
||||
def default_clang_path():
|
||||
guessed_clang = os.path.join(os.path.dirname(__file__), "clang")
|
||||
if os.path.isfile(guessed_clang):
|
||||
return guessed_clang
|
||||
return None
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--clang", help="The clang binary (could be a relative or absolute path)",
|
||||
action="store", required=True)
|
||||
action="store", default=default_clang_path())
|
||||
parser.add_argument("--source", help="the source file. Command used to generate the json will be of the format <clang> -cc1 -ast-dump=json <opts> <source>",
|
||||
action="store", required=True)
|
||||
parser.add_argument("--filters", help="comma separated list of AST filters. Ex: --filters=TypedefDecl,BuiltinType",
|
||||
|
|
|
@ -136,6 +136,10 @@ if (CLANG_ENABLE_STATIC_ANALYZER)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# Copy gen_ast_dump_json_test.py to the clang build dir. This allows invoking
|
||||
# it without having to pass the --clang= argument
|
||||
configure_file(AST/gen_ast_dump_json_test.py ${LLVM_TOOLS_BINARY_DIR}/gen_ast_dump_json_test.py COPYONLY)
|
||||
|
||||
add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
|
||||
set_target_properties(clang-test-depends PROPERTIES FOLDER "Clang tests")
|
||||
|
||||
|
|
Loading…
Reference in New Issue