CocoaLumberjackの以下のDDAbstractDatabaseLogger
メソッド:
- (void)createAndStartDeleteTimer
{
if ((deleteTimer == NULL) && (deleteInterval > 0.0) && (maxAge > 0.0))
{
deleteTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, loggerQueue);
if (deleteTimer != NULL) {
dispatch_source_set_event_handler(deleteTimer, ^{ @autoreleasepool {
[self performDelete];
}});
[self updateDeleteTimer];
dispatch_resume(deleteTimer);
}
}
}
- (void)updateDeleteTimer
{
if ((deleteTimer != NULL) && (deleteInterval > 0.0) && (maxAge > 0.0))
{
uint64_t interval = (uint64_t)(deleteInterval * NSEC_PER_SEC);
dispatch_time_t startTime;
if (lastDeleteTime > 0)
startTime = dispatch_time(lastDeleteTime, interval);
else
startTime = dispatch_time(DISPATCH_TIME_NOW, interval);
dispatch_source_set_timer(deleteTimer, startTime, interval, 1.0);
}
}
clang 静的アナライザーの警告をトリガーします。
CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m:207:13: Null pointer passed as an argument to a 'nonnull' parameter
手順のスクリーンショット:
ビルド出力を調べたところ、次の plist が見つかりました。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>clang_version</key>
<string>Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)</string>
<key>files</key>
<array>
<string>CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m</string>
</array>
<key>diagnostics</key>
<array>
<dict>
<key>path</key>
<array>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>194</integer>
<key>col</key><integer>2</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>194</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>194</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>194</integer>
<key>col</key><integer>17</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<!-- Lots of the same style of line, col, file key-values in dicts and arrays -->
</array>
<key>description</key><string>Null pointer passed as an argument to a 'nonnull' parameter</string>
<key>category</key><string>API</string>
<key>type</key><string>Argument with 'nonnull' attribute passed null</string>
<key>issue_context_kind</key><string>Objective-C method</string>
<key>issue_context</key><string>createAndStartDeleteTimer</string>
<key>issue_hash</key><integer>14</integer>
<key>location</key>
<dict>
<key>line</key><integer>207</integer>
<key>col</key><integer>13</integer>
<key>file</key><integer>0</integer>
</dict>
</dict>
</array>
</dict>
</plist>
静的アナライザーが null ポインターが渡されると考える抽象値を取得する方法はありますか? 私はそれを理解することはできません。