Index: include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h =================================================================== --- include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h +++ include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h @@ -225,7 +225,7 @@ /// invalid value types for that given option are reported as an error in /// non-compatibility mode. void addCheckerOption(StringRef OptionType, - StringRef CheckerFullName, + StringRef FullName, StringRef OptionName, StringRef DefaultValStr, StringRef Description); @@ -243,7 +243,7 @@ /// invalid value types for that given option are reported as an error in /// non-compatibility mode. void addPackageOption(StringRef OptionType, - StringRef PackageFullName, + StringRef FullName, StringRef OptionName, StringRef DefaultValStr, StringRef Description); Index: lib/StaticAnalyzer/Core/AnalyzerOptions.cpp =================================================================== --- lib/StaticAnalyzer/Core/AnalyzerOptions.cpp +++ lib/StaticAnalyzer/Core/AnalyzerOptions.cpp @@ -163,7 +163,7 @@ bool HasFailed = getCheckerStringOption(CheckerName, OptionName, std::to_string(DefaultVal), SearchInParents) - .getAsInteger(10, Ret); + .getAsInteger(0, Ret); assert(!HasFailed && "analyzer-config option should be numeric"); (void)HasFailed; return Ret; Index: lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp =================================================================== --- lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp +++ lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp @@ -316,18 +316,20 @@ } void CheckerRegistry::addCheckerOption(StringRef OptionType, - StringRef CheckerFullName, + StringRef FullName, StringRef OptionName, StringRef DefaultValStr, StringRef Description) { - auto CheckerIt = binaryFind(Checkers, CheckerFullName); + auto CheckerIt = binaryFind(Checkers, FullName); assert(CheckerIt != Checkers.end() && "Failed to find the checker while attempting to add a command line " "option to it!"); CheckerIt->CmdLineOptions.emplace_back( OptionType, OptionName, DefaultValStr, Description); + + AnOpts.Config.insert({(FullName + ":" + OptionName).str(), DefaultValStr}); } void CheckerRegistry::addPackage(StringRef FullName) { @@ -347,6 +349,8 @@ PackageIt->CmdLineOptions.emplace_back( OptionType, OptionName, DefaultValStr, Description); + + AnOpts.Config.insert({(FullName + ":" + OptionName).str(), DefaultValStr}); } void CheckerRegistry::initializeManager(CheckerManager &checkerMgr) const { Index: test/Analysis/analyzer-config.c =================================================================== --- test/Analysis/analyzer-config.c +++ test/Analysis/analyzer-config.c @@ -3,6 +3,16 @@ // CHECK: [config] // CHECK-NEXT: aggressive-binary-operation-simplification = false +// CHECK-NEXT: alpha.clone.CloneChecker:IgnoredFilesPattern = "" +// CHECK-NEXT: alpha.clone.CloneChecker:MinimumCloneComplexity = 50 +// CHECK-NEXT: alpha.clone.CloneChecker:ReportNormalClones = true +// CHECK-NEXT: alpha.cplusplus.UninitializedObject:CheckPointeeInitialization = false +// CHECK-NEXT: alpha.cplusplus.UninitializedObject:IgnoreGuardedFields = false +// CHECK-NEXT: alpha.cplusplus.UninitializedObject:IgnoreRecordsWithField = "" +// CHECK-NEXT: alpha.cplusplus.UninitializedObject:NotesAsWarnings = false +// CHECK-NEXT: alpha.cplusplus.UninitializedObject:Pedantic = false +// CHECK-NEXT: alpha.security.MmapWriteExec:MmapProtExec = 0x04 +// CHECK-NEXT: alpha.security.MmapWriteExec:MmapProtRead = 0x01 // CHECK-NEXT: avoid-suppressing-null-argument-paths = false // CHECK-NEXT: c++-allocator-inlining = true // CHECK-NEXT: c++-container-inlining = false @@ -18,9 +28,26 @@ // CHECK-NEXT: cfg-rich-constructors = true // CHECK-NEXT: cfg-scopes = false // CHECK-NEXT: cfg-temporary-dtors = true +// CHECK-NEXT: cplusplus.Move:WarnOn = KnownsAndLocals // CHECK-NEXT: crosscheck-with-z3 = false // CHECK-NEXT: ctu-dir = "" // CHECK-NEXT: ctu-index-name = externalDefMap.txt +// CHECK-NEXT: debug.AnalysisOrder:* = false +// CHECK-NEXT: debug.AnalysisOrder:Bind = false +// CHECK-NEXT: debug.AnalysisOrder:EndFunction = false +// CHECK-NEXT: debug.AnalysisOrder:LiveSymbols = false +// CHECK-NEXT: debug.AnalysisOrder:NewAllocator = false +// CHECK-NEXT: debug.AnalysisOrder:PostCall = false +// CHECK-NEXT: debug.AnalysisOrder:PostStmtArraySubscriptExpr = false +// CHECK-NEXT: debug.AnalysisOrder:PostStmtCXXNewExpr = false +// CHECK-NEXT: debug.AnalysisOrder:PostStmtCastExpr = false +// CHECK-NEXT: debug.AnalysisOrder:PostStmtOffsetOfExpr = false +// CHECK-NEXT: debug.AnalysisOrder:PreCall = false +// CHECK-NEXT: debug.AnalysisOrder:PreStmtArraySubscriptExpr = false +// CHECK-NEXT: debug.AnalysisOrder:PreStmtCXXNewExpr = false +// CHECK-NEXT: debug.AnalysisOrder:PreStmtCastExpr = false +// CHECK-NEXT: debug.AnalysisOrder:PreStmtOffsetOfExpr = false +// CHECK-NEXT: debug.AnalysisOrder:RegionChanges = false // CHECK-NEXT: display-ctu-progress = false // CHECK-NEXT: eagerly-assume = true // CHECK-NEXT: elide-constructors = true @@ -40,7 +67,15 @@ // CHECK-NEXT: mode = deep // CHECK-NEXT: model-path = "" // CHECK-NEXT: notes-as-events = false +// CHECK-NEXT: nullability:NoDiagnoseCallsToSystemHeaders = false // CHECK-NEXT: objc-inlining = true +// CHECK-NEXT: optin.cplusplus.VirtualCall:PureOnly = false +// CHECK-NEXT: optin.osx.cocoa.localizability.NonLocalizedStringChecker:AggressiveReport = false +// CHECK-NEXT: optin.performance.Padding:AllowedPad = 24 +// CHECK-NEXT: osx.NumberObjectConversion:Pedantic = false +// CHECK-NEXT: osx.cocoa.RetainCount:CheckOSObject = true +// CHECK-NEXT: osx.cocoa.RetainCount:TrackNSCFStartParam = false +// CHECK-NEXT: osx.cocoa.RetainCount:leak-diagnostics-reference-allocation = false // CHECK-NEXT: prune-paths = true // CHECK-NEXT: region-store-small-struct-limit = 2 // CHECK-NEXT: report-in-main-source-file = false @@ -49,7 +84,8 @@ // CHECK-NEXT: suppress-c++-stdlib = true // CHECK-NEXT: suppress-inlined-defensive-checks = true // CHECK-NEXT: suppress-null-return-paths = true +// CHECK-NEXT: unix.DynamicMemoryModeling:Optimistic = false // CHECK-NEXT: unroll-loops = false // CHECK-NEXT: widen-loops = false // CHECK-NEXT: [stats] -// CHECK-NEXT: num-entries = 49 +// CHECK-NEXT: num-entries = 85