[cfe-commits] r57081 - in /cfe/trunk/test/Coverage: ast-printing.c ast-printing.m c-language-features.inc codegen.c codegen.m html-print.c objc-language-features.inc parse-callbacks.c parse-callbacks.m serialize.c serialize.m

Daniel Dunbar daniel at zuster.org
Sat Oct 4 16:47:28 PDT 2008


Author: ddunbar
Date: Sat Oct  4 18:47:28 2008
New Revision: 57081

URL: http://llvm.org/viewvc/llvm-project?rev=57081&view=rev
Log:
Add coverage tests of C and Obj-C language features.
 - AST printing, dumping, serialization, codegen.
 - HTML printing.
 - Parser callbacks.

Several of these are XFAIL because they trigger unimplemented code.

Added:
    cfe/trunk/test/Coverage/ast-printing.c
    cfe/trunk/test/Coverage/ast-printing.m
    cfe/trunk/test/Coverage/c-language-features.inc
    cfe/trunk/test/Coverage/codegen.c
    cfe/trunk/test/Coverage/codegen.m
    cfe/trunk/test/Coverage/html-print.c
    cfe/trunk/test/Coverage/objc-language-features.inc
    cfe/trunk/test/Coverage/parse-callbacks.c
    cfe/trunk/test/Coverage/parse-callbacks.m
    cfe/trunk/test/Coverage/serialize.c
    cfe/trunk/test/Coverage/serialize.m

Added: cfe/trunk/test/Coverage/ast-printing.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Coverage/ast-printing.c?rev=57081&view=auto

==============================================================================
--- cfe/trunk/test/Coverage/ast-printing.c (added)
+++ cfe/trunk/test/Coverage/ast-printing.c Sat Oct  4 18:47:28 2008
@@ -0,0 +1,5 @@
+// RUN: clang --fsyntax-only %s &&
+// RUN: clang --ast-print %s &&
+// RUN: clang --ast-dump %s
+
+#include "c-language-features.inc"

Added: cfe/trunk/test/Coverage/ast-printing.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Coverage/ast-printing.m?rev=57081&view=auto

==============================================================================
--- cfe/trunk/test/Coverage/ast-printing.m (added)
+++ cfe/trunk/test/Coverage/ast-printing.m Sat Oct  4 18:47:28 2008
@@ -0,0 +1,5 @@
+// RUN: clang --fsyntax-only %s &&
+// RUN: clang --ast-print %s &&
+// RUN: clang --ast-dump %s
+
+#include "objc-language-features.inc"

Added: cfe/trunk/test/Coverage/c-language-features.inc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Coverage/c-language-features.inc?rev=57081&view=auto

==============================================================================
--- cfe/trunk/test/Coverage/c-language-features.inc (added)
+++ cfe/trunk/test/Coverage/c-language-features.inc Sat Oct  4 18:47:28 2008
@@ -0,0 +1,104 @@
+//-*- C -*-
+
+/* This is a 
+   multiline comment */
+
+// Intended to exercise all syntactic parts of the C language.
+
+int g0;
+int g1, g2;
+
+struct s0;
+
+struct s0 {
+  int x;
+};
+
+int g3 = 10;
+
+__asm("");
+
+typedef int td0;
+
+td0 g4;
+
+enum e0 {
+  ec0
+};
+
+static void f0(int x) {
+}
+
+inline void f0_0(int x) {
+  ;
+}
+
+extern void f0_1(int x) {
+}
+
+void f1(int, ...);
+
+// Statements.
+void f2() {
+  for (;;) {
+    break;
+    continue;
+  }
+
+  while (0) {
+  }
+
+  do {
+  } while (0);
+
+  void *label = &&theif;
+  goto *label;
+
+  goto theif;
+theif:
+  if (0) {
+    ;
+  } else if (0) {
+  } else {
+  }
+
+  switch(0) {
+  case 0:
+  case 1 ... 2:
+    break;
+  default:
+    break;
+  }
+
+  asm ("nop");
+
+  return;
+}
+
+// Expressions.
+
+#include <stdarg.h>
+
+typedef struct ipair {
+  int first, second;
+} ipair;
+
+void f4(int a0, int a1, int a2, va_list ap) {
+  int t0 = a0 ? a1 : a2;
+  float t1 = (float) a0;
+  ipair t2 = {1, 2};
+  int t3 = sizeof(ipair);
+  ipair t4;
+  t4 = (ipair) {1, 2};
+  extern int g(int);
+  int t5 = g(a0);
+  int t6 = t4.first;
+  int t7[10];
+  int t8 = t7[a0];
+  t8++;
+  const char *t9 = __FUNCTION__;
+  char t10 = 'x';
+  int t11 = __builtin_offsetof(ipair, first);
+  int t12 = __builtin_types_compatible_p(ipair, int);  
+  int t13 = va_arg(ap, int);
+}

Added: cfe/trunk/test/Coverage/codegen.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Coverage/codegen.c?rev=57081&view=auto

==============================================================================
--- cfe/trunk/test/Coverage/codegen.c (added)
+++ cfe/trunk/test/Coverage/codegen.c Sat Oct  4 18:47:28 2008
@@ -0,0 +1,4 @@
+// RUN: clang -emit-llvm -o %t %s
+// RUN: clang -emit-llvm-bc -o %t %s
+
+#include "c-language-features.inc"

Added: cfe/trunk/test/Coverage/codegen.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Coverage/codegen.m?rev=57081&view=auto

==============================================================================
--- cfe/trunk/test/Coverage/codegen.m (added)
+++ cfe/trunk/test/Coverage/codegen.m Sat Oct  4 18:47:28 2008
@@ -0,0 +1,5 @@
+// RUN: clang -fnext-runtime -emit-llvm -o %t %s
+// RUN: clang -fnext-runtime -emit-llvm-bc -o %t %s
+// XFAIL
+
+#include "objc-language-features.inc"

Added: cfe/trunk/test/Coverage/html-print.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Coverage/html-print.c?rev=57081&view=auto

==============================================================================
--- cfe/trunk/test/Coverage/html-print.c (added)
+++ cfe/trunk/test/Coverage/html-print.c Sat Oct  4 18:47:28 2008
@@ -0,0 +1,3 @@
+// RUN: clang -emit-html -o %t %s
+
+#include "c-language-features.inc"

Added: cfe/trunk/test/Coverage/objc-language-features.inc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Coverage/objc-language-features.inc?rev=57081&view=auto

==============================================================================
--- cfe/trunk/test/Coverage/objc-language-features.inc (added)
+++ cfe/trunk/test/Coverage/objc-language-features.inc Sat Oct  4 18:47:28 2008
@@ -0,0 +1,69 @@
+//-*- ObjC -*-
+
+ at protocol P0;
+
+ at protocol P1 
+-(void) fm0;
+ at end
+
+ at class B;
+
+ at interface Root
+ at end
+
+ at interface A : Root <P1> {
+  int iv0;
+  B *iv1;
+}
+
+ at property(assign,readonly) int p0;
+ at property(assign,nonatomic,readwrite) int p1;
+ at property(copy) id p2;
+ at property(retain) id p3;
+ at property(assign, getter=getme, setter=setme:) id p4;
+ at end
+
+ at implementation A
+ at dynamic p0;
+ at synthesize p1 = iv0;
++(void) fm0 {
+  [super fm0];
+}
+-(void) im0 {
+  [super im0];
+}
+-(void) im1: (int) x, ... {
+}
+ at end
+
+ at implementation C : A
+ at end
+
+#if 0
+ at interface A (Cat)
+ at end
+
+ at implementation A (Cat)
+ at end
+#endif
+
+int f0(id x) {
+  @synchronized(x) {
+  }
+
+  @try {
+    @throw x;
+  } @catch(A *e) {
+    @throw;
+  } @finally {
+    ;
+  }
+
+  for (id y in x) {
+    break;
+  }
+}
+
+struct s0 {
+  @defs(A);
+};

Added: cfe/trunk/test/Coverage/parse-callbacks.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Coverage/parse-callbacks.c?rev=57081&view=auto

==============================================================================
--- cfe/trunk/test/Coverage/parse-callbacks.c (added)
+++ cfe/trunk/test/Coverage/parse-callbacks.c Sat Oct  4 18:47:28 2008
@@ -0,0 +1,4 @@
+// RUN: clang --parse-noop %s &&
+// RUN: clang --parse-print-callbacks %s
+
+#include "c-language-features.inc"

Added: cfe/trunk/test/Coverage/parse-callbacks.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Coverage/parse-callbacks.m?rev=57081&view=auto

==============================================================================
--- cfe/trunk/test/Coverage/parse-callbacks.m (added)
+++ cfe/trunk/test/Coverage/parse-callbacks.m Sat Oct  4 18:47:28 2008
@@ -0,0 +1,4 @@
+// RUN: clang --parse-noop %s &&
+// RUN: clang --parse-print-callbacks %s
+
+#include "objc-language-features.inc"

Added: cfe/trunk/test/Coverage/serialize.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Coverage/serialize.c?rev=57081&view=auto

==============================================================================
--- cfe/trunk/test/Coverage/serialize.c (added)
+++ cfe/trunk/test/Coverage/serialize.c Sat Oct  4 18:47:28 2008
@@ -0,0 +1,4 @@
+// RUN: clang -fsyntax-only --serialize %s
+// XFAIL
+
+#include "c-language-features.inc"

Added: cfe/trunk/test/Coverage/serialize.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Coverage/serialize.m?rev=57081&view=auto

==============================================================================
--- cfe/trunk/test/Coverage/serialize.m (added)
+++ cfe/trunk/test/Coverage/serialize.m Sat Oct  4 18:47:28 2008
@@ -0,0 +1,4 @@
+// RUN: clang -fsyntax-only --serialize %s
+// XFAIL
+
+#include "objc-language-features.inc"





More information about the cfe-commits mailing list