clang -cc1 -cc1 -triple amd64-unknown-openbsd7.0 -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name WasmDump.cpp -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -relaxed-aliasing -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/usr/src/gnu/usr.bin/clang/llvm-objdump/obj -resource-dir /usr/local/lib/clang/13.0.0 -I /usr/src/gnu/usr.bin/clang/llvm-objdump/obj/../include/llvm-objdump -I /usr/src/gnu/usr.bin/clang/llvm-objdump/../../../llvm/llvm/include -I /usr/src/gnu/usr.bin/clang/llvm-objdump/../include -I /usr/src/gnu/usr.bin/clang/llvm-objdump/obj -I /usr/src/gnu/usr.bin/clang/llvm-objdump/obj/../include -D NDEBUG -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D LLVM_PREFIX="/usr" -internal-isystem /usr/include/c++/v1 -internal-isystem /usr/local/lib/clang/13.0.0/include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wno-comment -std=c++14 -fdeprecated-macro -fdebug-compilation-dir=/usr/src/gnu/usr.bin/clang/llvm-objdump/obj -ferror-limit 19 -fvisibility-inlines-hidden -fwrapv -stack-protector 2 -fno-rtti -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-valloc -fno-builtin-free -fno-builtin-strdup -fno-builtin-strndup -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/ben/Projects/vmm/scan-build/2022-01-12-194120-40624-1 -x c++ /usr/src/gnu/usr.bin/clang/llvm-objdump/../../../llvm/llvm/tools/llvm-objdump/WasmDump.cpp
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | #include "WasmDump.h" |
15 | |
16 | #include "llvm-objdump.h" |
17 | #include "llvm/Object/Wasm.h" |
18 | |
19 | using namespace llvm; |
20 | using namespace llvm::object; |
21 | |
22 | void objdump::printWasmFileHeader(const object::ObjectFile *Obj) { |
23 | const auto *File = dyn_cast<const WasmObjectFile>(Obj); |
| 1 | Assuming 'Obj' is not a 'WasmObjectFile' | |
|
| 2 | | 'File' initialized to a null pointer value | |
|
24 | |
25 | outs() << "Program Header:\n"; |
26 | outs() << "Version: 0x"; |
27 | outs().write_hex(File->getHeader().Version); |
| 3 | | Called C++ object pointer is null |
|
28 | outs() << "\n"; |
29 | } |
30 | |
31 | Error objdump::getWasmRelocationValueString(const WasmObjectFile *Obj, |
32 | const RelocationRef &RelRef, |
33 | SmallVectorImpl<char> &Result) { |
34 | const wasm::WasmRelocation &Rel = Obj->getWasmRelocation(RelRef); |
35 | symbol_iterator SI = RelRef.getSymbol(); |
36 | std::string FmtBuf; |
37 | raw_string_ostream Fmt(FmtBuf); |
38 | if (SI == Obj->symbol_end()) { |
39 | |
40 | |
41 | Fmt << Rel.Index; |
42 | } else { |
43 | Expected<StringRef> SymNameOrErr = SI->getName(); |
44 | if (!SymNameOrErr) |
45 | return SymNameOrErr.takeError(); |
46 | StringRef SymName = *SymNameOrErr; |
47 | Result.append(SymName.begin(), SymName.end()); |
48 | } |
49 | Fmt << (Rel.Addend < 0 ? "" : "+") << Rel.Addend; |
50 | Fmt.flush(); |
51 | Result.append(FmtBuf.begin(), FmtBuf.end()); |
52 | return Error::success(); |
53 | } |