Go to file
Matthias Gehre b785407c28 [clang-tidy] add check cppcoreguidelines-pro-type-union-access
Summary:
This check flags all access to members of unions. Passing unions as a
whole is not flagged.

Reading from a union member assumes that member was the last one
written, and writing to a union member assumes another member with a
nontrivial destructor had its destructor called. This is fragile because
it cannot generally be enforced to be safe in the language and so relies
on programmer discipline to get it right.

This rule is part of the "Type safety" profile of the C++ Core
Guidelines, see
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type7-avoid-accessing-members-of-raw-unions-prefer-variant-instead

Reviewers: alexfh, sbenza, bkramer, aaron.ballman

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D13784

llvm-svn: 250537
2015-10-16 18:46:30 +00:00
clang Teach MyriadToolchain how to find its C++ header paths. 2015-10-16 18:46:26 +00:00
clang-tools-extra [clang-tidy] add check cppcoreguidelines-pro-type-union-access 2015-10-16 18:46:30 +00:00
compiler-rt builtins: Expand out floating point exponents for MSVC 2015-10-15 04:26:19 +00:00
debuginfo-tests New round of fixes for "Always compile debuginfo-tests for the host triple" 2014-10-18 23:47:59 +00:00
libclc integer: remove explicit casts from _MIN definitions 2015-10-06 19:12:12 +00:00
libcxx Fix an unfortunate yet old typo that never got attention before r250507. 2015-10-16 11:26:26 +00:00
libcxxabi Fix LIBCXXABI_HAS_NO_THREADS configuration. 2015-10-14 19:21:38 +00:00
libunwind unwind: Allow the building of libunwind for MIPS. 2015-09-26 18:26:01 +00:00
lld Add a ObjectFile<ELFT>::getSection helper and simplify. NFC. 2015-10-16 15:29:48 +00:00
lldb Make some more of the LLDB/SWIG/Python glue Python 3 aware. 2015-10-16 17:52:32 +00:00
llgo [llgo] irgen: always use TargetMachine's data layout 2015-09-25 06:28:14 +00:00
llvm WebAssembly: fix load/store syntax 2015-10-16 18:24:42 +00:00
openmp [OMPT] Add OMPT events for API locking 2015-10-16 16:52:58 +00:00
polly Add testcase for r250517 2015-10-16 15:17:26 +00:00