Bug Summary

File:projects/compiler-rt/lib/sanitizer_common/sanitizer_flags.h
Warning:line 27, column 8
Excessive padding in 'struct __sanitizer::CommonFlags' (52 padding bytes, where 4 is optimal). Optimal fields order: external_symbolizer_path, strip_path_prefix, log_path, clear_shadow_mmap_threshold, color, mmap_limit_mb, hard_rss_limit_mb, soft_rss_limit_mb, coverage_dir, stack_trace_format, sancov_path, malloc_context_size, verbosity, print_module_map, handle_segv, handle_sigbus, handle_abort, handle_sigill, handle_sigtrap, handle_sigfpe, allocator_release_to_os_interval_ms, dedup_token_length, exitcode, symbolize, allow_addr2line, fast_unwind_on_check, fast_unwind_on_fatal, fast_unwind_on_malloc, handle_ioctl, log_exe_name, log_to_syslog, strip_env, detect_leaks, leak_check_at_exit, allocator_may_return_null, print_summary, check_printf, allow_user_segv_handler, use_sigaltstack, detect_deadlocks, legacy_pthread_cond, intercept_tls_get_addr, help, heap_profile, can_use_proc_maps_statm, coverage, full_address_space, print_suppressions, disable_coredump, use_madv_dontdump, symbolize_inline_frames, symbolize_vs_style, no_huge_pages_for_shadow, strict_string_checks, intercept_strstr, intercept_strspn, intercept_strtok, intercept_strpbrk, intercept_strlen, intercept_strndup, intercept_strchr, intercept_memcmp, strict_memcmp, intercept_memmem, intercept_intrin, intercept_stat, intercept_send, decorate_proc_maps, abort_on_error, suppress_equal_pcs, print_cmdline, html_cov_report, dump_instruction_bytes, dump_registers, detect_write_exec, consider reordering the fields or adding explicit padding members

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name sanitizer_symbolizer_libcdep.cc -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-eagerly-assume -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -ffunction-sections -fdata-sections -resource-dir /usr/lib/llvm-7/lib/clang/7.0.0 -D HAVE_RPC_XDR_H=0 -D HAVE_TIRPC_RPC_XDR_H=0 -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -I /build/llvm-toolchain-snapshot-7~svn329677/build-llvm/projects/compiler-rt/lib/sanitizer_common -I /build/llvm-toolchain-snapshot-7~svn329677/projects/compiler-rt/lib/sanitizer_common -I /build/llvm-toolchain-snapshot-7~svn329677/build-llvm/include -I /build/llvm-toolchain-snapshot-7~svn329677/include -I /build/llvm-toolchain-snapshot-7~svn329677/projects/compiler-rt/lib/sanitizer_common/.. -U NDEBUG -D SANITIZER_SUPPORTS_WEAK_HOOKS=0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/x86_64-linux-gnu/c++/7.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/x86_64-linux-gnu/c++/7.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/backward -internal-isystem /usr/include/clang/7.0.0/include/ -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-7/lib/clang/7.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -Wno-unused-parameter -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -Wno-unused-parameter -Wno-variadic-macros -Wno-non-virtual-dtor -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /build/llvm-toolchain-snapshot-7~svn329677/build-llvm/projects/compiler-rt/lib/sanitizer_common -ferror-limit 19 -fmessage-length 0 -fvisibility hidden -fvisibility-inlines-hidden -fno-builtin -fno-rtti -fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-loops -vectorize-slp -analyzer-checker optin.performance.Padding -analyzer-output=html -analyzer-config stable-report-filename=true -o /tmp/scan-build-2018-04-11-031539-24776-1 -x c++ /build/llvm-toolchain-snapshot-7~svn329677/projects/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
1//===-- sanitizer_flags.h ---------------------------------------*- C++ -*-===//
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// This file is a part of ThreadSanitizer/AddressSanitizer runtime.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef SANITIZER_FLAGS_H
15#define SANITIZER_FLAGS_H
16
17#include "sanitizer_internal_defs.h"
18
19namespace __sanitizer {
20
21enum HandleSignalMode {
22 kHandleSignalNo,
23 kHandleSignalYes,
24 kHandleSignalExclusive,
25};
26
27struct CommonFlags {
Excessive padding in 'struct __sanitizer::CommonFlags' (52 padding bytes, where 4 is optimal). Optimal fields order: external_symbolizer_path, strip_path_prefix, log_path, clear_shadow_mmap_threshold, color, mmap_limit_mb, hard_rss_limit_mb, soft_rss_limit_mb, coverage_dir, stack_trace_format, sancov_path, malloc_context_size, verbosity, print_module_map, handle_segv, handle_sigbus, handle_abort, handle_sigill, handle_sigtrap, handle_sigfpe, allocator_release_to_os_interval_ms, dedup_token_length, exitcode, symbolize, allow_addr2line, fast_unwind_on_check, fast_unwind_on_fatal, fast_unwind_on_malloc, handle_ioctl, log_exe_name, log_to_syslog, strip_env, detect_leaks, leak_check_at_exit, allocator_may_return_null, print_summary, check_printf, allow_user_segv_handler, use_sigaltstack, detect_deadlocks, legacy_pthread_cond, intercept_tls_get_addr, help, heap_profile, can_use_proc_maps_statm, coverage, full_address_space, print_suppressions, disable_coredump, use_madv_dontdump, symbolize_inline_frames, symbolize_vs_style, no_huge_pages_for_shadow, strict_string_checks, intercept_strstr, intercept_strspn, intercept_strtok, intercept_strpbrk, intercept_strlen, intercept_strndup, intercept_strchr, intercept_memcmp, strict_memcmp, intercept_memmem, intercept_intrin, intercept_stat, intercept_send, decorate_proc_maps, abort_on_error, suppress_equal_pcs, print_cmdline, html_cov_report, dump_instruction_bytes, dump_registers, detect_write_exec, consider reordering the fields or adding explicit padding members
28#define COMMON_FLAG(Type, Name, DefaultValue, Description) Type Name;
29#include "sanitizer_flags.inc"
30#undef COMMON_FLAG
31
32 void SetDefaults();
33 void CopyFrom(const CommonFlags &other);
34};
35
36// Functions to get/set global CommonFlags shared by all sanitizer runtimes:
37extern CommonFlags common_flags_dont_use;
38inline const CommonFlags *common_flags() {
39 return &common_flags_dont_use;
40}
41
42inline void SetCommonFlagsDefaults() {
43 common_flags_dont_use.SetDefaults();
44}
45
46// This function can only be used to setup tool-specific overrides for
47// CommonFlags defaults. Generally, it should only be used right after
48// SetCommonFlagsDefaults(), but before ParseCommonFlagsFromString(), and
49// only during the flags initialization (i.e. before they are used for
50// the first time).
51inline void OverrideCommonFlags(const CommonFlags &cf) {
52 common_flags_dont_use.CopyFrom(cf);
53}
54
55void SubstituteForFlagValue(const char *s, char *out, uptr out_size);
56
57class FlagParser;
58void RegisterCommonFlags(FlagParser *parser,
59 CommonFlags *cf = &common_flags_dont_use);
60void RegisterIncludeFlags(FlagParser *parser, CommonFlags *cf);
61
62// Should be called after parsing all flags. Sets up common flag values
63// and perform initializations common to all sanitizers (e.g. setting
64// verbosity).
65void InitializeCommonFlags(CommonFlags *cf = &common_flags_dont_use);
66} // namespace __sanitizer
67
68#endif // SANITIZER_FLAGS_H