[PATCH] D118135: [demangler] preserve line numbering in copied sources

Nathan Sidwell via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 26 04:55:46 PST 2022


urnathan updated this revision to Diff 403223.
urnathan added a comment.

Perhaps like this?  the 2nd line indentation makes the 'do not edit' text stand out, I think?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118135/new/

https://reviews.llvm.org/D118135

Files:
  libcxxabi/src/demangle/cp-to-llvm.sh
  llvm/include/llvm/Demangle/ItaniumDemangle.h
  llvm/include/llvm/Demangle/StringView.h
  llvm/include/llvm/Demangle/Utility.h


Index: llvm/include/llvm/Demangle/Utility.h
===================================================================
--- llvm/include/llvm/Demangle/Utility.h
+++ llvm/include/llvm/Demangle/Utility.h
@@ -1,7 +1,5 @@
-// Do not edit! -*- read-only -*-
-// See README.txt for instructions
-//===--- Utility.h ----------------------------------------------*- C++ -*-===//
-//
+//===--- Utility.h -------------------*- mode:c++;eval:(read-only-mode) -*-===//
+//	 Do not edit! See README.txt.
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Index: llvm/include/llvm/Demangle/StringView.h
===================================================================
--- llvm/include/llvm/Demangle/StringView.h
+++ llvm/include/llvm/Demangle/StringView.h
@@ -1,7 +1,5 @@
-// Do not edit! -*- read-only -*-
-// See README.txt for instructions
-//===--- StringView.h -------------------------------------------*- C++ -*-===//
-//
+//===--- StringView.h ----------------*- mode:c++;eval:(read-only-mode) -*-===//
+//	 Do not edit! See README.txt.
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Index: llvm/include/llvm/Demangle/ItaniumDemangle.h
===================================================================
--- llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -1,7 +1,5 @@
-// Do not edit! -*- read-only -*-
-// See README.txt for instructions
-//===------------------------- ItaniumDemangle.h ----------------*- C++ -*-===//
-//
+//===--- ItaniumDemangle.h -----------*- mode:c++;eval:(read-only-mode) -*-===//
+//	 Do not edit! See README.txt.
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Index: libcxxabi/src/demangle/cp-to-llvm.sh
===================================================================
--- libcxxabi/src/demangle/cp-to-llvm.sh
+++ libcxxabi/src/demangle/cp-to-llvm.sh
@@ -26,10 +26,11 @@
     chmod -w $LLVM_DEMANGLE_DIR/README.txt
     for I in $HDRS ; do
 	rm -f $LLVM_DEMANGLE_DIR/$I
-	cat - $I >$LLVM_DEMANGLE_DIR/$I <<EOF
-// Do not edit! -*- read-only -*-
-// See README.txt for instructions
-EOF
+	dash=$(echo "$I---------------------------" | cut -c -27 |\
+		   sed 's|[^-]*||')
+	sed -e '1s|^//=*-* .*\.h -*.*=*// *$|//===--- '"$I $dash"'-*- mode:c++;eval:(read-only-mode) -*-===//|' \
+	    -e '2s|^// *$|//	 Do not edit! See README.txt.|' \
+	    $I >$LLVM_DEMANGLE_DIR/$I
 	chmod -w $LLVM_DEMANGLE_DIR/$I
     done
 fi


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118135.403223.patch
Type: text/x-patch
Size: 2852 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220126/aa394a52/attachment.bin>


More information about the llvm-commits mailing list