Go to file
Stephane Moore b0c1f8c09e [clang-tidy] Add a check for [super self] in initializers 🔍
Summary:
This check aims to address a relatively common benign error where
Objective-C subclass initializers call -self on their superclass instead
of invoking a superclass initializer, typically -init. The error is
typically benign because libobjc recognizes that improper initializer
chaining is common¹.

One theory for the frequency of this error might be that -init and -self
have the same return type which could potentially cause inappropriate
autocompletion to -self instead of -init. The equal selector lengths and
triviality of common initializer code probably contribute to errors like
this slipping through code review undetected.

This check aims to flag errors of this form in the interests of
correctness and reduce incidence of initialization failing to chain to
-[NSObject init].

[1] "In practice, it will be hard to rely on this function.
     Many classes do not properly chain -init calls."
From  _objc_rootInit in https://opensource.apple.com/source/objc4/objc4-750.1/runtime/NSObject.mm.auto.html.

Test Notes:
Verified via `make check-clang-tools`.

Subscribers: mgorny, xazax.hun, jdoerfert, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D59806

llvm-svn: 358620
2019-04-17 22:29:06 +00:00
clang [analyzer] PR41185: Fix regression where __builtin_* functions weren't recognized 2019-04-17 19:56:40 +00:00
clang-tools-extra [clang-tidy] Add a check for [super self] in initializers 🔍 2019-04-17 22:29:06 +00:00
compiler-rt [builtins] Add __cmpsf2 for ARM version of comparesf2 2019-04-17 01:30:33 +00:00
debuginfo-tests Set config.lit_tools_dir, which is needed by lit.llvm.initialize. 2018-11-06 21:54:27 +00:00
libclc travis: Add LLVM-8 build 2019-03-27 21:28:31 +00:00
libcxx [libc++][CMake] Remove unnecessary conditional for defining new handlers 2019-04-17 21:57:49 +00:00
libcxxabi Fix PR41465 - Use __builtin_mul_overflow instead of hand-rolled check. 2019-04-11 17:16:35 +00:00
libunwind [NFC] Move the export attribute after extern "C". 2019-04-12 18:34:19 +00:00
lld [ELF] Use llvm::bsearch. NFC 2019-04-17 08:00:46 +00:00
lldb [crashlog] Use the right path for dsymforUUID and remove an unnecessary import. 2019-04-17 21:51:55 +00:00
llgo IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
llvm Test commit by Denis Bakhvalov 2019-04-17 22:27:30 +00:00
openmp Fixed memory leak reported in Bugzilla: 2019-04-17 10:44:28 +00:00
parallel-libs Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
polly Apply include-what-you-use #include removal suggestions. NFC. 2019-03-28 20:19:49 +00:00
pstl [pstl] Remove the stdlib headers from the PSTL and move them to the tests 2019-04-16 14:38:08 +00:00
.arcconfig Update monorepo .arcconfig with new project callsign. 2019-01-31 14:34:59 +00:00
.clang-format Add .clang-tidy and .clang-format files to the toplevel of the 2019-01-29 16:43:16 +00:00
.clang-tidy Disable tidy checks with too many hits 2019-02-01 11:20:13 +00:00
.gitignore Add a reduced copy of the llvm .gitignore 2019-04-09 00:52:49 +00:00
README.md

README.md

The LLVM Compiler Infrastructure

This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments.