summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-05-06 23:51:28 +0000
committerKostya Serebryany <kcc@google.com>2016-05-06 23:51:28 +0000
commitceca476b233970b7e42077256dabc5f47284e0ce (patch)
tree3ea4c312f0ed5771cc7efce942296175a95d46db
parent9b8eb155d8a47344fd2b60d4a74bb427703d8ab8 (diff)
downloadbcm5719-llvm-ceca476b233970b7e42077256dabc5f47284e0ce.tar.gz
bcm5719-llvm-ceca476b233970b7e42077256dabc5f47284e0ce.zip
[libFuzzer] modify the docs for startup/init
llvm-svn: 268824
-rw-r--r--llvm/docs/LibFuzzer.rst10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/docs/LibFuzzer.rst b/llvm/docs/LibFuzzer.rst
index 4d6a0847bea..4047d104c84 100644
--- a/llvm/docs/LibFuzzer.rst
+++ b/llvm/docs/LibFuzzer.rst
@@ -624,14 +624,18 @@ Startup initialization
----------------------
If the library being tested needs to be initialized, there are several options.
-The simplest way is to have a statically initialized global object:
+The simplest way is to have a statically initialized global object inside
+`LLVMFuzzerTestOneInput` (or in global scope if that works for you):
.. code-block:: c++
- static bool Initialized = DoInitialization();
+ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ static bool Initialized = DoInitialization();
+ ...
Alternatively, you may define an optional init function and it will receive
-the program arguments that you can read and modify:
+the program arguments that you can read and modify. Do this **only** if you
+realy need to access ``argv``/``argc``.
.. code-block:: c++
OpenPOWER on IntegriCloud