annotate projects/compiler-rt/test/fuzzer/FlagsTest.cpp @ 181:df311c476dd5

CreateIdentifierInfo in ParseCbC (not yet worked)
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 31 May 2020 12:30:11 +0900
parents f476a9ba4795
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
131
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
1 // This file is distributed under the University of Illinois Open Source
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
2 // License. See LICENSE.TXT for details.
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
3
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
4 // Parse some flags
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
5 #include <string>
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
6 #include <vector>
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
7
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
8 static std::vector<std::string> Flags;
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
9
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
10 extern "C" int LLVMFuzzerInitialize(int *Argc, char ***Argv) {
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
11 // Parse --flags and anything after -ignore_remaining_args=1 is passed.
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
12 int I = 1;
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
13 while (I < *Argc) {
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
14 std::string S((*Argv)[I++]);
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
15 if (S == "-ignore_remaining_args=1")
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
16 break;
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
17 if (S.substr(0, 2) == "--")
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
18 Flags.push_back(S);
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
19 }
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
20 while (I < *Argc)
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
21 Flags.push_back(std::string((*Argv)[I++]));
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
22
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
23 return 0;
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
24 }
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
25
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
26 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
27 fprintf(stderr, "BINGO ");
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
28 for (auto Flag : Flags)
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
29 fprintf(stderr, "%s ", Flag.c_str());
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
30 fprintf(stderr, "\n");
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
31 return 0;
f476a9ba4795 http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mir3636
parents:
diff changeset
32 }