Xcode 3.2.1 #1613.0, CodeSense symbol lookup fails when Static Analysis enabled

Originator:searls
Number:rdar://7338181 Date Originated:26-Oct-2009 07:51 PM
Status:Open Resolved:No
Product:Developer Tools Product Version:1613.0 (Xcode 3.2.1)
Classification:UI/Usability Reproducible:Yes
 
Summary: 
For any project of mine in which RUN_CLANG_STATIC_ANALYZER is set to YES, CodeSense symbol lookup fails for non-explicitly-imported symbols (i.e. Foundation/UIKit classes and methods, etc.). Because the CodeSense index fails to build, code completion and option-double-click documentation searches also fail.

Steps to Reproduce:

#Setup:
1. Create a new iPhone SDK project (I'm targeting Device 3.1.2, but it happens for other targets as well)
2. Open a file containing a non-explicitly imported Symbol (say, RootViewController.m:83  ("UITableViewCell")
3. Verify that option-double-clicking on the symbol will open the Documentation snippet.

#Reproduction:
4. In Project -> Edit Project Settings -> Tab "Build", select "All Configurations" and check "Run Static Analyzer"
5. Perform a clean and build
6. Quit Xcode
7. Re-open the test project
8. In Project -> Edit Project Settings -> Tab "General", click "Rebuild Code Sense Index"
9. (You may need to Quit Xcode and perform another clean build)
10. Once again, double-option-click on the symbol verified in Step 3 to work

Expected Results:
Expected to see the Documentation window appear with a summary of the symbol.

Actual Results:
Inline inspector appears but with title "Documentation Not Found" and message: "Documentation not found for the symbol 'UITableViewCell'. Click here to view symbol declaration." (See  screenshot: http://i35.tinypic.com/9jod8p.jpg)

Regression:
Snow Leopard 10.6.1
MackBook Pro 5,1
Xcode: 64-bit Component versions Xcode IDE: 1613.0, Xcode Core: 1614.0, ToolSupport: 1591.0
iPhone SDK for Snow Leopard 3.2.1
(This is a clean 10.6 install; Xcode was first installed from Snow Leopard DVD, then updated with the Snow Leopard 3.2.1 SDK DMG)

Notes:
In Console, the first time an instance of Xcode loads a project with "Run Static Analysis" enabled, the following clang warning appears in Console:

------------
10/26/09 7:30:35 PM	Xcode[19251]	Warning:  Couldn't discover the 'clang' compiler's built-in search paths and preprocessor definitions for language dialect 'objective-c'.  This may lead to indexing issues.
Compiler: /Developer/usr/bin/clang
Reason:   clang version 1.0.1 (http://llvm.org/svn/llvm-project/cfe/tags/Apple/clang-24 exported)
Target: x86_64-apple-darwin10
clang: warning: not using the clang compiler for the 'armv6' architecture
clang: warning: argument unused during compilation: '-c'
 "/Developer/usr/bin/gcc" -v -dM -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.2.sdk -E -arch armv6 -o - -x objective-c /dev/null
gcc-4.2: error trying to exec '/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1': execvp: No such file or directory
--------------

Comments

Possible workaround

Open the project info pane. On the General tab, change the Project Format to Xcode 3.2-compatible.

I don't know why it works, or even if it will continue to work, but this problem has been bothering me for weeks and this seems to have fixed it.

By s.fisher.ca at Nov. 19, 2009, 12:19 a.m. (reply...)

I have such problem but with RUN_CLANG_STATIC_ANALYZER set to NO. Snow Leopard 10.6.1, XCode 3.2.1. It appeared after I migrated my settings to 10.6 from 10.5 using Migration Assistant application.

Re: Possible workaround

Same problem here, but changing the project format to XCode 3.2-compatible doesn't help.

The effect is obvious even in syntax highlighting. Check static analyzer in project settings, click rebuild index, and native methods go black. Uncheck static analyzer, click rebuild, and syntax coloring for the previous broken symbols reappears.

By paul.cantrell at Jan. 12, 2010, 9:17 p.m. (reply...)

Confirmed!

Bug s confirmed and the solution provided in the workaround works. The only way you get code sense back for UIKit classes is to disable the Static Analyzer and rebuilding the index. The project format change as suggested by s.fisher.ca does not work

After rebuilding I've tried setting RUN_CLANG_STATIC_ANALYZER = YES in only my debug .xcconfig and not in my adhoc/appstore .xcconfigs. So far (two build cycles...) that does appear to be providing both analysis and CodeSense in the debug configuration.

By alexcurylo at March 2, 2010, 6:13 p.m. (reply...)

Oddly enough, something about the very latest Xcode release brought this back for me unless I disabled RUN_CLANG_STATIC_ANALYZER to NO constitutively.

Also strangely, I found a link to this radar, read it, fixed it, and then realized that I was this ticket's original author.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!