This is an archive of the discontinued LLVM Phabricator instance.

Fixed error message printing in write_cmake_config.py
ClosedPublic

Authored by gribozavr on Apr 16 2019, 2:48 AM.

Details

Summary

Previously, write_cmake_config.py would raise an error while printing
the error, because leftovers in "'\n'.join(leftovers)" is a tuple.

Diff Detail

Repository
rL LLVM

Event Timeline

gribozavr created this revision.Apr 16 2019, 2:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 16 2019, 2:48 AM
phosek accepted this revision.Apr 16 2019, 4:13 PM
phosek added a reviewer: thakis.

LGTM

This revision is now accepted and ready to land.Apr 16 2019, 4:13 PM
This revision was automatically updated to reflect the committed changes.
thakis added inline comments.Apr 18 2019, 7:30 AM
llvm/trunk/utils/gn/build/write_cmake_config.py
102

Huh, did you actually hit this? I always thought this branch is effectively dead code after a refactoring: in_lien = var_re.sub(repl, in_line) should call repl() on all matches on each line, and if some pattern doesn't have a value in the values dict, then return values[key] will throw. I always wanted to make that set a bool instead and then print this error based on that bool, and remove the findall call down here (since I thought I shouldn't happen), but didn't get around to it yet.

thakis added inline comments.Apr 25 2019, 6:58 AM
llvm/trunk/utils/gn/build/write_cmake_config.py
102

From IRC, the way to hit this is by invoking a variable whose substitution is a variable reference: llvm/utils/gn/build/write_cmake_config.py -o foo llvm/include/llvm/Config/AsmParsers.def.in 'LLVM_ENUM_ASM_PARSERS=@LLVM_ENUM_ASM_PARSERS@'