[PATCH] D19155: Introduce LIT_SITE_CFG_IN_HEADER

Alex Denisov via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 15 04:24:16 PDT 2016


AlexDenisov created this revision.
AlexDenisov added a reviewer: chandlerc.
AlexDenisov added subscribers: llvm-commits, joker.eph.

At the moment almost every `lit.site.cfg.in` contains two lines comment:

```
## Autogenerated by LLVM/Clang configuration.
# Do not edit!
```

It took me several days and a few attempts to realise that these are not for this file itself, but for files that are generated from this template.

The patch adds variable LIT_SITE_CFG_IN_HEADER, that is replaced from `configure_lit_site_cfg` with the note and some useful information.

Assigning to Chandler Carruth as `CODE_OWNERS.txt` states.

If everybody happy with the patch, then I will apply the change to other projects as well (clang/ compiler-rt, lld, and so on).

P.S. Credits for idea go to Mehdi Amini:

```
[08:05:19] AlexDenisov:	does anybody know how lit.site.cfg.in's are generated?
[08:06:27] joker-eph:	AlexDenisov: the .in file is in the repo the .cfg is generated, is that what you're asking about ?
[08:06:59] AlexDenisov:	@joker-eph I see there "## Autogenerated by LLVM/Clang configuration."
[08:07:21] AlexDenisov:	which probably a part of the template
[08:07:53] joker-eph:	AlexDenisov: I don't know, I modified this file by hand I think
[08:08:06] AlexDenisov:	yepp, that's a bit confusing
[08:08:29] joker-eph:	AlexDenisov: I think it is so that the comment is in the .cfg file in the end
[08:08:33] AlexDenisov:	I think this note intended to be in the output file
[08:08:34] joker-eph:	not nice though.
[08:08:41] joker-eph:	agree
[08:09:51] AlexDenisov:	ok, at least it's a bit clearer now
[08:10:06] AlexDenisov:	need to be documented or noted somehow somewhere
[08:10:47] joker-eph:	I'd rather have the configure_lit_site_cfg() function prepending the comment
[08:11:05] joker-eph:	 But I did my share of cleanup this week, I have real work to do :)
[08:20:41] AlexDenisov:	joker-eph I will try to send patch soon, thank you very much for help :)
```

http://reviews.llvm.org/D19155

Files:
  cmake/modules/AddLLVM.cmake
  test/Unit/lit.site.cfg.in
  test/lit.site.cfg.in

Index: test/lit.site.cfg.in
===================================================================
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -1,7 +1,7 @@
+ at LIT_SITE_CFG_IN_HEADER@
+
 import sys
 
-## Autogenerated by LLVM/Clang configuration.
-# Do not edit!
 config.host_triple = "@LLVM_HOST_TRIPLE@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
Index: test/Unit/lit.site.cfg.in
===================================================================
--- test/Unit/lit.site.cfg.in
+++ test/Unit/lit.site.cfg.in
@@ -1,7 +1,7 @@
+ at LIT_SITE_CFG_IN_HEADER@
+
 import sys
 
-## Autogenerated by LLVM/Clang configuration.
-# Do not edit!
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
Index: cmake/modules/AddLLVM.cmake
===================================================================
--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -983,6 +983,8 @@
   set(HOST_CXX "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}")
   set(HOST_LDFLAGS "${CMAKE_EXE_LINKER_FLAGS}")
 
+  set(LIT_SITE_CFG_IN_HEADER  "## Autogenerated from ${input}\n## Do not edit!")
+
   configure_file(${input} ${output} @ONLY)
 endfunction()
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19155.53872.patch
Type: text/x-patch
Size: 1261 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160415/4d6f2bbe/attachment.bin>


More information about the llvm-commits mailing list