[PATCH] D118008: [demangler] write-protect non-canonical source

Nathan Sidwell via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 23 14:17:48 PST 2022


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

To try and void undesired changes to the non-canonical demangler sources, change the cp-to-llvm script to (a) write-protect the target files and (b) prepend 'do not edit' comments that are significant to emacs[*], and hopefully humans.

[X] bite me :)


https://reviews.llvm.org/D118008

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,3 +1,5 @@
+// Do not edit! -*- read-only -*-
+// See README.txt for instructions
 //===--- Utility.h ----------------------------------------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Index: llvm/include/llvm/Demangle/StringView.h
===================================================================
--- llvm/include/llvm/Demangle/StringView.h
+++ llvm/include/llvm/Demangle/StringView.h
@@ -1,3 +1,5 @@
+// Do not edit! -*- read-only -*-
+// See README.txt for instructions
 //===--- StringView.h -------------------------------------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Index: llvm/include/llvm/Demangle/ItaniumDemangle.h
===================================================================
--- llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -1,3 +1,5 @@
+// Do not edit! -*- read-only -*-
+// See README.txt for instructions
 //===------------------------- ItaniumDemangle.h ----------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Index: libcxxabi/src/demangle/cp-to-llvm.sh
===================================================================
--- libcxxabi/src/demangle/cp-to-llvm.sh
+++ libcxxabi/src/demangle/cp-to-llvm.sh
@@ -5,7 +5,8 @@
 
 set -e
 
-FILES="ItaniumDemangle.h StringView.h Utility.h README.txt"
+cd $(dirname $0)
+HDRS="ItaniumDemangle.h StringView.h Utility.h"
 LLVM_DEMANGLE_DIR=$1
 
 if [[ -z "$LLVM_DEMANGLE_DIR" ]]; then
@@ -21,7 +22,15 @@
 echo
 
 if [[ $ANSWER =~ ^[Yy]$ ]]; then
-    for I in $FILES ; do
-        cp $I $LLVM_DEMANGLE_DIR/$I
+    cp -f README.txt $LLVM_DEMANGLE_DIR
+    chmod -w $LLVM_DEMANGLE_DIR/README.txt
+    for I in $HDRS ; do
+	rm -f $LLVM_DEMANGLE_DIR/$I
+	cat >$LLVM_DEMANGLE_DIR/$I <<EOF
+// Do not edit! -*- read-only -*-
+// See README.txt for instructions
+EOF
+        cat $I >>$LLVM_DEMANGLE_DIR/$I
+	chmod -w $LLVM_DEMANGLE_DIR/$I
     done
 fi


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118008.402371.patch
Type: text/x-patch
Size: 2256 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220123/3f293f25/attachment.bin>


More information about the llvm-commits mailing list