llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.94k stars 11.94k forks source link

static analyzer false positive: reports instance variable used while 'self' is not set to the result of [(super or self)] init #15464

Closed llvmbot closed 11 years ago

llvmbot commented 11 years ago
Bugzilla Link 15092
Resolution FIXED
Resolved on Jan 28, 2013 18:10
Version trunk
OS MacOS X
Attachments Test Files (Xcode project and source).
Reporter LLVM Bugzilla Contributor
CC @AnnaZaks,@belkadan

Extended Description

Analyze the attached code with clang. We are using Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn) that shipped with the Xcode 4.6 GM. By code analysis we think it exists in TOT clang. We think the code is fine and we are getting a false positive with regards to init.

Filed as radar 12838705 Xcode 4.6 Analyzer False Positive on init Method

/Users/dmaclach/Desktop/AnalyzerTest/AnalyzerTest/ANALystTherapist.mm:29:12: Instance variable used while 'self' is not set to the result of '[(super or self) init...]'

Analyze AnalyzerTest/ANALystTherapist.mm cd /Users/dmaclach/Desktop/AnalyzerTest setenv LANG en_US.US-ASCII setenv PATH "/Applications/Xcode46-DP3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode46-DP3.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode46-DP3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c++ -arch i386 -fmessage-length=0 -std=gnu++11 -stdlib=libc++ -fobjc-arc -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wduplicate-method-match -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wenum-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -Wno-c++11-extensions -DDEBUG=1 -isysroot /Applications/Xcode46-DP3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -fexceptions -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -g -fvisibility-inlines-hidden -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch -Xclang -analyzer-output=plist-multi-file -Xclang -analyzer-checker -Xclang security.insecureAPI.UncheckedReturn -Xclang -analyzer-checker -Xclang security.insecureAPI.getpw -Xclang -analyzer-checker -Xclang security.insecureAPI.gets -Xclang -analyzer-checker -Xclang security.insecureAPI.mkstemp -Xclang -analyzer-checker -Xclang security.insecureAPI.mktemp -Xclang -analyzer-disable-checker -Xclang security.insecureAPI.rand -Xclang -analyzer-disable-checker -Xclang security.insecureAPI.strcpy -Xclang -analyzer-checker -Xclang security.insecureAPI.vfork -mios-simulator-version-min=6.1 -iquote /Users/dmaclach/Desktop/AnalyzerTest/DerivedData/AnalyzerTest/Build/Intermediates/AnalyzerTest.build/Debug-iphonesimulator/AnalyzerTest.build/AnalyzerTest-generated-files.hmap -I/Users/dmaclach/Desktop/AnalyzerTest/DerivedData/AnalyzerTest/Build/Intermediates/AnalyzerTest.build/Debug-iphonesimulator/AnalyzerTest.build/AnalyzerTest-own-target-headers.hmap -I/Users/dmaclach/Desktop/AnalyzerTest/DerivedData/AnalyzerTest/Build/Intermediates/AnalyzerTest.build/Debug-iphonesimulator/AnalyzerTest.build/AnalyzerTest-all-target-headers.hmap -iquote /Users/dmaclach/Desktop/AnalyzerTest/DerivedData/AnalyzerTest/Build/Intermediates/AnalyzerTest.build/Debug-iphonesimulator/AnalyzerTest.build/AnalyzerTest-project-headers.hmap -I/Users/dmaclach/Desktop/AnalyzerTest/DerivedData/AnalyzerTest/Build/Products/Debug-iphonesimulator/include -I/Applications/Xcode46-DP3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode46-DP3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode46-DP3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/dmaclach/Desktop/AnalyzerTest/DerivedData/AnalyzerTest/Build/Intermediates/AnalyzerTest.build/Debug-iphonesimulator/AnalyzerTest.build/DerivedSources/i386 -I/Users/dmaclach/Desktop/AnalyzerTest/DerivedData/AnalyzerTest/Build/Intermediates/AnalyzerTest.build/Debug-iphonesimulator/AnalyzerTest.build/DerivedSources -F/Users/dmaclach/Desktop/AnalyzerTest/DerivedData/AnalyzerTest/Build/Products/Debug-iphonesimulator -include /Users/dmaclach/Desktop/AnalyzerTest/DerivedData/AnalyzerTest/Build/Intermediates/PrecompiledHeaders/AnalyzerTest-Prefix-anksenmdcuygoccglwndlscwldsp/AnalyzerTest-Prefix.pch -MMD -MT dependencies -MF /Users/dmaclach/Desktop/AnalyzerTest/DerivedData/AnalyzerTest/Build/Intermediates/AnalyzerTest.build/Debug/AnalyzerTest.build/StaticAnalyzer/normal/i386/ANALystTherapist.d --analyze /Users/dmaclach/Desktop/AnalyzerTest/AnalyzerTest/ANALystTherapist.mm -o /Users/dmaclach/Desktop/AnalyzerTest/DerivedData/AnalyzerTest/Build/Intermediates/AnalyzerTest.build/Debug/AnalyzerTest.build/StaticAnalyzer/normal/i386/ANALystTherapist.plist

belkadan commented 11 years ago

This is fixed in trunk, or at least mostly fixed -- there are still a few edge cases where the warning will fire, but not your project.

(Dave, for now all of the main analyzer engineers do work at Apple, so there's no real need to file duplicates. The LLVM people who don't work at Apple don't have access to Apple Clang, which ships with Xcode, and this fix didn't make Xcode 4.6. You can also get newer checker builds from http://clang-analyzer.llvm.org)

llvmbot commented 11 years ago

assigned to @tkremenek