Open llvmbot opened 12 years ago
Retitling to reflect the broader fix that is need, which is essentially a reimplementation of scan-build.
This is part of the limitation of scan-build. It doesn't know what compiler Xcode intended to use for compilation, so it just defaults to gcc (which doesn't recognize the arguments -fdiagnostics-print-source-range-info, and so forth).
Beyond the link you cited, there is no really good way to fix this in scan-build without doing REAL interposition of the build (e.g., intercept exec's of the compiler and run the analyzer on the side) instead of the poor man's interposition we are doing now by overriding the compiler used by xcodebuild. Unfortunately, there are no resources currently allocated to that effort.
You're best bet for Xcode integration (right now) is to use the set-xcode-analyzer script:
http://clang-analyzer.llvm.org/xcode.html
and run the analyzer directly within Xcode or from the command line using xcodebuild.
Have you tried to "Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide." as you were suggested?
assigned to @tkremenek
Extended Description
When I run the latest (258) scan-build on code built using XCode 4.2 I get the following error:-
2012-01-24 10:19:37.498 xcodebuild[780:3803] DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-928/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCCommandLineToolSpecification.m:828 Details: Unable to get message category info for tool '/Applications/checker-258/libexec/ccc-analyzer'. Reason: i686-apple-darwin11-llvm-gcc-4.2: no input files
Object: <XCCompilerSpecificationClang: 0x4007d47e0> Method: -messageCategoryInfoForExecutablePath: Thread: <NSThread: 0x400fae3c0>{name = (null), num = 6} Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
CompileC build/Appy.build/Debug-iphonesimulator/Appy.build/Objects-normal/i386/main.o Appy/main.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler cd /Users/Mo/dev/latest setenv LANG en_US.US-ASCII setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin" /Applications/checker-258/libexec/ccc-analyzer -x objective-c -arch i386 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -std=gnu99 -fobjc-arc -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -DDEBUG -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -fexceptions -fasm-blocks -mmacosx-version-min=10.6 -gdwarf-2 -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch "-DIBOutlet=attribute((iboutlet))" "-DIBOutletCollection(ClassName)=attribute((iboutletcollection(ClassName)))" "-DIBAction=void)attribute((ibaction)" -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -iquote /Users/Mo/dev/latest/build/Appy.build/Debug-iphonesimulator/Appy.build/Appy-generated-files.hmap -I/Users/Mo/dev/latest/build/Appy.build/Debug-iphonesimulator/Appy.build/Appy-own-target-headers.hmap -I/Users/Mo/dev/latest/build/Appy.build/Debug-iphonesimulator/Appy.build/Appy-all-target-headers.hmap -iquote /Users/Mo/dev/latest/build/Appy.build/Debug-iphonesimulator/Appy.build/Appy-project-headers.hmap -I/Users/Mo/dev/latest/build/Debug-iphonesimulator/include -I/Users/Mo/dev/latest/build/Appy.build/Debug-iphonesimulator/Appy.build/DerivedSources/i386 -I/Users/Mo/dev/latest/build/Appy.build/Debug-iphonesimulator/Appy.build/DerivedSources -F/Users/Mo/dev/latest/build/Debug-iphonesimulator -F/Users/Mo/dev/latest -include /Users/Mo/dev/latest/Appy/Appy-Prefix.pch -MMD -MT dependencies -MF /Users/Mo/dev/latest/build/Appy.build/Debug-iphonesimulator/Appy.build/Objects-normal/i386/main.d -c /Users/Mo/dev/latest/Appy/main.m -o /Users/Mo/dev/latest/build/Appy.build/Debug-iphonesimulator/Appy.build/Objects-normal/i386/main.o cc1obj: error: unrecognized command line option "-Wno-sign-conversion" cc1obj: error: unrecognized command line option "-fdiagnostics-print-source-range-info" cc1obj: error: unrecognized command line option "-fdiagnostics-show-category=id" cc1obj: error: unrecognized command line option "-fdiagnostics-parseable-fixits" cc1obj: error: unrecognized command line option "-fobjc-arc" Command /Applications/checker-258/libexec/ccc-analyzer failed with exit code 1
BUILD FAILED
The following build commands failed: CompileC build/Appy.build/Debug-iphonesimulator/Appy.build/Objects-normal/i386/main.o Appy/main.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure) scan-build: Removing directory '/var/folders/p6/r86f0tb17tq2c5crbndb0q7m0000gn/T/scan-build-2012-01-24-1' because it contains no reports.
I can fix this using a solution listed here: http://stackoverflow.com/questions/7820011/clang-scan-build-wont-work-with-xcode-4-2-llvm-3-0-build-configuration however even when using this "hack" the results imply the scanner does not recognise ARC'd code as I have numerous false warnings about potential memory leaks.
Thanks for any help