summaryrefslogtreecommitdiffstats
path: root/llvm/test/Bitcode
diff options
context:
space:
mode:
authorBrian Gesiak <modocache@gmail.com>2018-04-21 23:52:04 +0000
committerBrian Gesiak <modocache@gmail.com>2018-04-21 23:52:04 +0000
commitb13588982fc3cd859e0acd20dd606be634dcdb51 (patch)
tree6ecc309778cfcd33ee5bb42c8107a079ff13e995 /llvm/test/Bitcode
parente6bfb2c71deccc27cd209536189a3b4410b74f6b (diff)
downloadbcm5719-llvm-b13588982fc3cd859e0acd20dd606be634dcdb51.tar.gz
bcm5719-llvm-b13588982fc3cd859e0acd20dd606be634dcdb51.zip
[bcanalyzer] Recognize more stream types
Summary: `llvm-bcanalyzer` prints out the stream type of the file it is analyzing. If the file begins with the LLVM IR magic number, it reports a stream type of "LLVM IR". However, any other bitstream format is reported as "unknown". Add some checks for two other common bitstream formats: Clang AST files, which begin with 'CPCH', and Clang serialized diagnostics, which begin with 'DIAG'. Test Plan: `check-llvm` Reviewers: pcc, aprantl, mehdi_amini, davide, george.karpenkov, JDevlieghere Reviewed By: JDevlieghere Subscribers: JDevlieghere, bruno, davide, llvm-commits Differential Revision: https://reviews.llvm.org/D41979 llvm-svn: 330529
Diffstat (limited to 'llvm/test/Bitcode')
-rw-r--r--llvm/test/Bitcode/stream-types.c12
-rw-r--r--llvm/test/Bitcode/stream-types.c.ast1
-rw-r--r--llvm/test/Bitcode/stream-types.c.ast.incomplete1
-rw-r--r--llvm/test/Bitcode/stream-types.c.dia1
-rw-r--r--llvm/test/Bitcode/stream-types.c.dia.incomplete1
5 files changed, 16 insertions, 0 deletions
diff --git a/llvm/test/Bitcode/stream-types.c b/llvm/test/Bitcode/stream-types.c
new file mode 100644
index 00000000000..cc547f2f2d7
--- /dev/null
+++ b/llvm/test/Bitcode/stream-types.c
@@ -0,0 +1,12 @@
+// Tests that llvm-bcanalyzer recognizes the correct "stream type" for various
+// common bitstream formats.
+
+// RUN: llvm-bcanalyzer -dump %s.ast | FileCheck %s -check-prefix=CHECK-AST
+// CHECK-AST: Stream type: Clang Serialized AST
+
+// RUN: llvm-bcanalyzer -dump %s.dia | FileCheck %s -check-prefix=CHECK-DIAG
+// CHECK-DIAG: Stream type: Clang Serialized Diagnostics
+
+// RUN: not llvm-bcanalyzer -dump %s.ast.incomplete 2>&1 | FileCheck %s -check-prefix=CHECK-INCOMPLETE
+// RUN: not llvm-bcanalyzer -dump %s.dia.incomplete 2>&1 | FileCheck %s -check-prefix=CHECK-INCOMPLETE
+// CHECK-INCOMPLETE: Bitcode stream should be a multiple of 4 bytes in length
diff --git a/llvm/test/Bitcode/stream-types.c.ast b/llvm/test/Bitcode/stream-types.c.ast
new file mode 100644
index 00000000000..1c0169afc5e
--- /dev/null
+++ b/llvm/test/Bitcode/stream-types.c.ast
@@ -0,0 +1 @@
+CPCH \ No newline at end of file
diff --git a/llvm/test/Bitcode/stream-types.c.ast.incomplete b/llvm/test/Bitcode/stream-types.c.ast.incomplete
new file mode 100644
index 00000000000..255f3bcd43a
--- /dev/null
+++ b/llvm/test/Bitcode/stream-types.c.ast.incomplete
@@ -0,0 +1 @@
+CP \ No newline at end of file
diff --git a/llvm/test/Bitcode/stream-types.c.dia b/llvm/test/Bitcode/stream-types.c.dia
new file mode 100644
index 00000000000..af5962ab8ad
--- /dev/null
+++ b/llvm/test/Bitcode/stream-types.c.dia
@@ -0,0 +1 @@
+DIAG \ No newline at end of file
diff --git a/llvm/test/Bitcode/stream-types.c.dia.incomplete b/llvm/test/Bitcode/stream-types.c.dia.incomplete
new file mode 100644
index 00000000000..063271327ec
--- /dev/null
+++ b/llvm/test/Bitcode/stream-types.c.dia.incomplete
@@ -0,0 +1 @@
+DIA \ No newline at end of file
OpenPOWER on IntegriCloud