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

Nathan Sidwell via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 25 05:17:29 PST 2022


urnathan created this revision.
urnathan added reviewers: ChuanqiXu, bruno, aaron.ballman.
urnathan requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

While my recent patch to prepend lines to the copied source files is functional, it disturbs the line numbering between the original and the copy.  That makes development more awkward than necessary, as it is the copy that generally gets compiled first and emits compiler errors.

This uses sed to alter the first line, and also emits better emacs mode setting, getting both C++ mode and read-only mode.


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,6 +1,4 @@
-// Do not edit! -*- read-only -*-
-// See README.txt for instructions
-//===--- Utility.h ----------------------------------------------*- C++ -*-===//
+//=== Do not edit! See README.txt. -*- mode:c++; eval:(read-only-mode) -*- ===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
Index: llvm/include/llvm/Demangle/StringView.h
===================================================================
--- llvm/include/llvm/Demangle/StringView.h
+++ llvm/include/llvm/Demangle/StringView.h
@@ -1,6 +1,4 @@
-// Do not edit! -*- read-only -*-
-// See README.txt for instructions
-//===--- StringView.h -------------------------------------------*- C++ -*-===//
+//=== Do not edit! See README.txt. -*- mode:c++; eval:(read-only-mode) -*- ===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
Index: llvm/include/llvm/Demangle/ItaniumDemangle.h
===================================================================
--- llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -1,6 +1,4 @@
-// Do not edit! -*- read-only -*-
-// See README.txt for instructions
-//===------------------------- ItaniumDemangle.h ----------------*- C++ -*-===//
+//=== Do not edit! See README.txt. -*- mode:c++; eval:(read-only-mode) -*- ===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
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,8 @@
     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
+	sed '1s|//=*-* .*\.h .*|//=== Do not edit! See README.txt. -*- mode:c++; eval:(read-only-mode) -*- ===//|' \
+	    $I >$LLVM_DEMANGLE_DIR/$I
 	chmod -w $LLVM_DEMANGLE_DIR/$I
     done
 fi


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118135.402864.patch
Type: text/x-patch
Size: 2430 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220125/5f6554d8/attachment.bin>


More information about the llvm-commits mailing list