Built-in instances

Clang

class infra.instances.Clang(llvm, *, optlevel=2, lto=False, alloc='system')[source]

Sets clang as the compiler. The version of clang used is determined by the LLVM package passed to the constructor.

By default, -O2 optimization is set in CFLAGS and CXXFLAGS. This can be customized by setting optlevel to 0/1/2/3/s.

alloc can be system (the default) or tcmalloc. For custom tcmalloc hackery, overwrite the gperftools property of this package with a custom Gperftools object.

Name:

clang[-O<optlevel>][-lto][-tcmalloc]

Parameters:
  • llvm (packages.LLVM) – an LLVM package containing the relevant clang version
  • optlevel (int or str) – optimization level for -O (default: 2)
  • lto (bool) – whether to apply link-time optimizations
  • alloc (str) – which allocator to use (default: system)

AddressSanitizer

class infra.instances.ASan(llvm, temporal=True, stack=True, glob=True, check_writes=True, check_reads=True, redzone=None, optlevel=2, lto=False)[source]

AddressSanitizer instance. Added -fsanitize=address plus any configuration options at compile time and link time, and sets ASAN_OPTIONS at runtime.

Runtime options are currently hard-coded to the following:

  • alloc_dealloc_mismatch=0
  • detect_odr_violation=0
  • detect_leaks=0
Name:

asan[-heap|-nostack|-noglob][-wo][-lto]

Parameters:
  • llvm (packages.LLVM) – an LLVM package with compiler-rt included
  • stack (bool) – toggle stack instrumentation
  • temporal (bool) – toggle temporal safety (False sets quarantine size to 0)
  • glob (bool) – toggle globals instrumentation
  • check_writes (bool) – toggle checks on stores
  • check_reads (bool) – toggle checks on loads
  • lto (bool) – perform link-time optimizations
  • redzone (int or None) – minimum heap redzone size (default 16, always 32 for stack)
Return type:

None