Author: Bruno Ricci
Date: 2020-06-18T13:37:29+01:00
New Revision: c7350a3bab14eb633f39a949f85ac0e690cd9b4d

URL: 
https://github.com/llvm/llvm-project/commit/c7350a3bab14eb633f39a949f85ac0e690cd9b4d
DIFF: 
https://github.com/llvm/llvm-project/commit/c7350a3bab14eb633f39a949f85ac0e690cd9b4d.diff

LOG: [clang][utils] Modify make-ast-dump-check.sh to generate AST serialization 
dump tests

An AST serialization dump test is a test which compares the output of -ast-dump
on the source and of -ast-dump-all on a PCH generated from the source. Modulo
a few differences the outputs should match.

This patch to make-ast-dump-check.sh enables automatically generating
these tests.

Differential Revision: https://reviews.llvm.org/D81786

Reviewed By: aaron.ballman, lebedev.ri

Added: 
    

Modified: 
    clang/utils/make-ast-dump-check.sh

Removed: 
    


################################################################################
diff  --git a/clang/utils/make-ast-dump-check.sh 
b/clang/utils/make-ast-dump-check.sh
index 2a9cf40a884c..578c725f48b1 100755
--- a/clang/utils/make-ast-dump-check.sh
+++ b/clang/utils/make-ast-dump-check.sh
@@ -3,12 +3,21 @@
 # This script is intended as a FileCheck replacement to update the test
 # expectations in a -ast-dump test.
 #
-# Usage:
+# Usage (to generate normal AST dump tests):
 #
 # $ lit -DFileCheck=$PWD/utils/make-ast-dump-check.sh 
test/AST/ast-dump-openmp-*
+#
+# Usage (to generate serialization AST dump tests):
+#
+# $ lit -DFileCheck="generate_serialization_test=1 
$PWD/utils/make-ast-dump-check.sh"
+#     test/AST/ast-dump-openmp-*
 
 prefix=CHECK
 
+if [ -z ${generate_serialization_test+x} ];
+  then generate_serialization_test=0;
+fi
+
 while [[ "$#" -ne 0 ]]; do
   case "$1" in
   --check-prefix)
@@ -54,6 +63,10 @@ BEGIN {
   s = \$0
   gsub("0x[0-9a-fA-F]+", "{{.*}}", s)
   gsub("$testdir/", "{{.*}}", s)
+  if ($generate_serialization_test == 1) {
+    gsub(" imported", "{{( imported)?}}", s)
+    gsub(" <undeserialized declarations>", "{{( <undeserialized 
declarations>)?}}", s)
+  }
 }
 
 matched_last_line == 0 {


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to