[Bazel] Reduce quote escaping

There's a lot of unnecessary backslashes here that we can avoid to
reduce confusion.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D108495
This commit is contained in:
Geoffrey Martin-Noble 2021-08-20 15:58:49 -07:00
parent 973cb2c326
commit 2bd7c30e5a
3 changed files with 16 additions and 15 deletions

View File

@ -343,12 +343,13 @@ exports_files(
genrule(
name = "basic_version_gen",
outs = ["include/clang/Basic/Version.inc"],
cmd = ("printf " +
"\"#define CLANG_VERSION 12.0\n\"" +
"\"#define CLANG_VERSION_MAJOR 12\n\"" +
"\"#define CLANG_VERSION_MINOR 0\n\"" +
"\"#define CLANG_VERSION_PATCHLEVEL 0\n\"" +
"\"#define CLANG_VERSION_STRING \\\"git\\\"\n\" > $@"),
cmd = (
"echo '#define CLANG_VERSION 12.0' >> $@\n" +
"echo '#define CLANG_VERSION_MAJOR 12' >> $@\n" +
"echo '#define CLANG_VERSION_MINOR 0' >> $@\n" +
"echo '#define CLANG_VERSION_PATCHLEVEL 0' >> $@\n" +
"echo '#define CLANG_VERSION_STRING \"git\"' >> $@\n"
),
)
cc_library(
@ -372,7 +373,7 @@ genrule(
# are passed through bazel, it's easier to drop generated files next to
# the other includes.
outs = ["include/VCSVersion.inc"],
cmd = "echo \"#define CLANG_REVISION \\\"git\\\"\" > $@",
cmd = "echo '#define CLANG_REVISION \"git\"' > $@",
)
# A hacky library to expose some internal headers of the `basic` library to its

View File

@ -98,7 +98,7 @@ enum_targets_gen(
genrule(
name = "version_info_gen",
outs = ["include/llvm/Config/VersionInfo.h"],
cmd = "echo \"#define LLVM_VERSION_INFO \\\"git\\\"\" > $@",
cmd = "echo '#define LLVM_VERSION_INFO \"git\"' > $@",
)
template_rule(

View File

@ -6,7 +6,7 @@
def native_arch_defines(arch, triple):
return [
"LLVM_NATIVE_ARCH=\\\"{}\\\"".format(arch),
r'LLVM_NATIVE_ARCH=\"{}\"'.format(arch),
"LLVM_NATIVE_ASMPARSER=LLVMInitialize{}AsmParser".format(arch),
"LLVM_NATIVE_ASMPRINTER=LLVMInitialize{}AsmPrinter".format(arch),
"LLVM_NATIVE_DISASSEMBLER=LLVMInitialize{}Disassembler".format(arch),
@ -14,16 +14,16 @@ def native_arch_defines(arch, triple):
"LLVM_NATIVE_TARGETINFO=LLVMInitialize{}TargetInfo".format(arch),
"LLVM_NATIVE_TARGETMC=LLVMInitialize{}TargetMC".format(arch),
"LLVM_NATIVE_TARGETMCA=LLVMInitialize{}TargetMCA".format(arch),
"LLVM_HOST_TRIPLE=\\\"{}\\\"".format(triple),
"LLVM_DEFAULT_TARGET_TRIPLE=\\\"{}\\\"".format(triple),
r'LLVM_HOST_TRIPLE=\"{}\"'.format(triple),
r'LLVM_DEFAULT_TARGET_TRIPLE=\"{}\"'.format(triple),
]
posix_defines = [
"LLVM_ON_UNIX=1",
"HAVE_BACKTRACE=1",
"BACKTRACE_HEADER=<execinfo.h>",
"LTDL_SHLIB_EXT=\\\".so\\\"",
"LLVM_PLUGIN_EXT=\\\".so\\\"",
r'LTDL_SHLIB_EXT=\".so\"',
r'LLVM_PLUGIN_EXT=\".so\"',
"LLVM_ENABLE_THREADS=1",
"HAVE_SYSEXITS_H=1",
"HAVE_UNISTD_H=1",
@ -60,8 +60,8 @@ win32_defines = [
"strdup=_strdup",
# LLVM features
"LTDL_SHLIB_EXT=\\\".dll\\\"",
"LLVM_PLUGIN_EXT=\\\".dll\\\"",
r'LTDL_SHLIB_EXT=\".dll\"',
r'LLVM_PLUGIN_EXT=\".dll\"',
]
# TODO: We should switch to platforms-based config settings to make this easier