Xcode 构建和分析 - 是否可以故意跳过对特定文件的分析?
我的项目中有一个特定的文件正在由其他人处理。我不想搞乱它,也不想等待“构建和分析”来处理它。有没有办法告诉 Xcode 跳过对此文件的分析?
I have one particular file in my project which is being worked on by someone else. I don't want to mess with it and would rather not wait for "Build and Analyze" to process it. Is there a way to tell Xcode to skip analysis on this file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果可以编辑文件,则可以使用暴力破解选项。
将其添加到文件的开头:
将其添加到末尾:
并且 clang 分析器将看不到文件的内容。
参考:控制静态分析器诊断
If it's OK to edit the file, there's a brute force option.
Add this to the beginning of the file:
Add this to the end:
and the clang analyzer won't see the contents of the file.
reference: Controlling Static Analyzer Diagnostics
与此答案相同的想法仅用于分析 -> 忽略所有使用 LLVM/Clang 在特定文件中发出警告
您可以在项目设置的“构建阶段”选项卡中包含“编译源”参数,以忽略分析器中的特定文件。以下是一些说明:
-Xanalyzer -analyzer-disable-checker
或-Xanalyzer -analyzer-disable-all-checks
-Wno-unused-如果 Xcode 抱怨在常规编译期间未使用
-Xanalyzer
并且您希望保持构建干净,则也可以使用命令行参数注意:添加 -w 还将禁用特定的警告文件也是如此。
Same idea as this answer only for analysis -> Ignore all warnings in a specific file using LLVM/Clang
You can include a "compile sources" argument in the "Build Phases" tab of the project settings to ignore a specific file from the analyzer. Here are some instructions:
-Xanalyzer -analyzer-disable-checker
, or-Xanalyzer -analyzer-disable-all-checks
for Xcode 10 and after-Wno-unused-command-line-argument
as well, if Xcode complains that-Xanalyzer
is unused during regular compiles and you want to keep your build cleanNote: adding -w will also disable warnings on a particular file as well.