Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 1 | //===-- cxx_loop_proto.proto - Protobuf description of C++ with for loops -===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | /// |
| 10 | /// \file |
| 11 | /// This file describes a subset of C++ as a protobuf. It is used to |
| 12 | /// more easily find interesting inputs for fuzzing Clang. This subset |
Matt Morehouse | 1dc1ff8 | 2018-06-08 00:33:35 +0000 | [diff] [blame^] | 13 | /// differs from the one defined in cxx_proto.proto by eliminating while |
| 14 | /// loops and Lvalues. The goal is that the C++ code generated will be |
| 15 | /// more likely to stress the LLVM loop vectorizer. |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 16 | /// |
| 17 | //===----------------------------------------------------------------------===// |
| 18 | |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 19 | syntax = "proto2"; |
| 20 | |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 21 | message Const { |
| 22 | required int32 val = 1; |
| 23 | } |
| 24 | |
| 25 | message BinaryOp { |
| 26 | enum Op { |
| 27 | PLUS = 0; |
| 28 | MINUS = 1; |
| 29 | MUL = 2; |
| 30 | DIV = 3; |
| 31 | MOD = 4; |
| 32 | XOR = 5; |
| 33 | AND = 6; |
| 34 | OR = 7; |
| 35 | EQ = 8; |
| 36 | NE = 9; |
| 37 | LE = 10; |
| 38 | GE = 11; |
| 39 | LT = 12; |
| 40 | GT = 13; |
| 41 | }; |
| 42 | required Op op = 1; |
| 43 | required Rvalue left = 2; |
| 44 | required Rvalue right = 3; |
| 45 | } |
| 46 | |
| 47 | message Rvalue { |
| 48 | oneof rvalue_oneof { |
Matt Morehouse | 1dc1ff8 | 2018-06-08 00:33:35 +0000 | [diff] [blame^] | 49 | Const cons = 1; |
| 50 | BinaryOp binop = 2; |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 51 | } |
| 52 | } |
| 53 | |
| 54 | message AssignmentStatement { |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 55 | required Rvalue rvalue = 2; |
| 56 | } |
| 57 | |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 58 | message IfElse { |
| 59 | required Rvalue cond = 1; |
| 60 | required StatementSeq if_body = 2; |
| 61 | required StatementSeq else_body = 3; |
| 62 | } |
| 63 | |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 64 | message Statement { |
| 65 | oneof stmt_oneof { |
| 66 | AssignmentStatement assignment = 1; |
| 67 | IfElse ifelse = 2; |
Vitaly Buka | 410a6b2 | 2018-06-07 19:17:46 +0000 | [diff] [blame] | 68 | } |
| 69 | } |
| 70 | |
| 71 | message StatementSeq { |
| 72 | repeated Statement statements = 1; |
| 73 | } |
| 74 | |
| 75 | message LoopFunction { |
| 76 | required StatementSeq statements = 1; |
| 77 | } |
| 78 | |
| 79 | package clang_fuzzer; |