[PATCH] D30156: llvm-mc-fuzzer: add support for assembly
Kostya Serebryany via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 19 20:25:32 PST 2017
kcc added a comment.
The code mostly looks good, but I am not an expert in the used APIs, hopefully someone else chimes in.
================
Comment at: tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp:92
+ virtual BufferKind getBufferKind() const {
+ return MemoryBuffer_Malloc /* it's not disk-backed so I think that's
+ ** the intent ... though AFAIK it
----------------
Why C-style comments?
================
Comment at: tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp:99
+ private:
+ const char *data;
+ size_t size;
----------------
LLVM coding style wants 'Data' and 'Size'
================
Comment at: tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp:121
+
+ return 1;
+ }
----------------
hm? need a return?
================
Comment at: tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp:126
+
+ int Res = Parser->Run(NoInitialTextSection);
+
----------------
merge with the return?
================
Comment at: tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp:172
+
+ static const bool use_pic = false;
+ static const CodeModel::Model CMModel = CodeModel::Default;
----------------
coding style...
================
Comment at: tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp:244
if (Action == AC_Assemble)
- errs() << "error: -assemble is not implemented\n";
+ return AssembleOneInput(Data, Size);
else if (Action == AC_Disassemble)
----------------
I strongly suggest to make this a separate fuzz target instead of using flags.
Otherwise it'll be harder to automate running this target.
Repository:
rL LLVM
https://reviews.llvm.org/D30156
More information about the llvm-commits
mailing list