Index: include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h =================================================================== --- include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h +++ include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h @@ -17,6 +17,7 @@ extern const char * const CoreFoundationObjectiveC; extern const char * const LogicError; extern const char * const MemoryCoreFoundationObjectiveC; + extern const char * const MemoryError; extern const char * const UnixAPI; } } Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -19,6 +19,7 @@ #include "clang/Basic/SourceManager.h" #include "clang/Basic/TargetInfo.h" #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" +#include "clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h" #include "clang/StaticAnalyzer/Core/Checker.h" #include "clang/StaticAnalyzer/Core/CheckerManager.h" #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h" @@ -1697,8 +1698,8 @@ if (ExplodedNode *N = C.generateErrorNode()) { if (!BT_BadFree[*CheckKind]) - BT_BadFree[*CheckKind].reset( - new BugType(CheckNames[*CheckKind], "Bad free", "Memory Error")); + BT_BadFree[*CheckKind].reset(new BugType( + CheckNames[*CheckKind], "Bad free", categories::MemoryError)); SmallString<100> buf; llvm::raw_svector_ostream os(buf); @@ -1742,8 +1743,8 @@ if (ExplodedNode *N = C.generateErrorNode()) { if (!BT_FreeAlloca[*CheckKind]) - BT_FreeAlloca[*CheckKind].reset( - new BugType(CheckNames[*CheckKind], "Free alloca()", "Memory Error")); + BT_FreeAlloca[*CheckKind].reset(new BugType( + CheckNames[*CheckKind], "Free alloca()", categories::MemoryError)); auto R = llvm::make_unique( *BT_FreeAlloca[*CheckKind], @@ -1768,7 +1769,7 @@ if (!BT_MismatchedDealloc) BT_MismatchedDealloc.reset( new BugType(CheckNames[CK_MismatchedDeallocatorChecker], - "Bad deallocator", "Memory Error")); + "Bad deallocator", categories::MemoryError)); SmallString<100> buf; llvm::raw_svector_ostream os(buf); @@ -1828,8 +1829,8 @@ return; if (!BT_OffsetFree[*CheckKind]) - BT_OffsetFree[*CheckKind].reset( - new BugType(CheckNames[*CheckKind], "Offset free", "Memory Error")); + BT_OffsetFree[*CheckKind].reset(new BugType( + CheckNames[*CheckKind], "Offset free", categories::MemoryError)); SmallString<100> buf; llvm::raw_svector_ostream os(buf); @@ -1880,7 +1881,7 @@ if (ExplodedNode *N = C.generateErrorNode()) { if (!BT_UseFree[*CheckKind]) BT_UseFree[*CheckKind].reset(new BugType( - CheckNames[*CheckKind], "Use-after-free", "Memory Error")); + CheckNames[*CheckKind], "Use-after-free", categories::MemoryError)); auto R = llvm::make_unique(*BT_UseFree[*CheckKind], "Use of memory after it is freed", N); @@ -1906,8 +1907,8 @@ if (ExplodedNode *N = C.generateErrorNode()) { if (!BT_DoubleFree[*CheckKind]) - BT_DoubleFree[*CheckKind].reset( - new BugType(CheckNames[*CheckKind], "Double free", "Memory Error")); + BT_DoubleFree[*CheckKind].reset(new BugType( + CheckNames[*CheckKind], "Double free", categories::MemoryError)); auto R = llvm::make_unique( *BT_DoubleFree[*CheckKind], @@ -1935,7 +1936,8 @@ if (ExplodedNode *N = C.generateErrorNode()) { if (!BT_DoubleDelete) BT_DoubleDelete.reset(new BugType(CheckNames[CK_NewDeleteChecker], - "Double delete", "Memory Error")); + "Double delete", + categories::MemoryError)); auto R = llvm::make_unique( *BT_DoubleDelete, "Attempt to delete released memory", N); @@ -1961,8 +1963,9 @@ if (ExplodedNode *N = C.generateErrorNode()) { if (!BT_UseZerroAllocated[*CheckKind]) - BT_UseZerroAllocated[*CheckKind].reset(new BugType( - CheckNames[*CheckKind], "Use of zero allocated", "Memory Error")); + BT_UseZerroAllocated[*CheckKind].reset( + new BugType(CheckNames[*CheckKind], "Use of zero allocated", + categories::MemoryError)); auto R = llvm::make_unique(*BT_UseZerroAllocated[*CheckKind], "Use of zero-allocated memory", N); @@ -2164,8 +2167,8 @@ assert(N); if (!BT_Leak[*CheckKind]) { - BT_Leak[*CheckKind].reset( - new BugType(CheckNames[*CheckKind], "Memory leak", "Memory Error")); + BT_Leak[*CheckKind].reset(new BugType(CheckNames[*CheckKind], "Memory leak", + categories::MemoryError)); // Leaks should not be reported if they are post-dominated by a sink: // (1) Sinks are higher importance bugs. // (2) NoReturnFunctionChecker uses sink nodes to represent paths ending Index: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp +++ lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp @@ -178,7 +178,7 @@ const MemRegion *Region, BugReporter &BR, const Stmt *ValueExpr = nullptr) const { if (!BT) - BT.reset(new BugType(this, "Nullability", "Memory error")); + BT.reset(new BugType(this, "Nullability", categories::MemoryError)); auto R = llvm::make_unique(*BT, Msg, N); if (Region) { Index: lib/StaticAnalyzer/Checkers/ValistChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/ValistChecker.cpp +++ lib/StaticAnalyzer/Checkers/ValistChecker.cpp @@ -256,7 +256,7 @@ if (!BT_uninitaccess) BT_uninitaccess.reset(new BugType(CheckNames[CK_Uninitialized], "Uninitialized va_list", - "Memory Error")); + categories::MemoryError)); auto R = llvm::make_unique(*BT_uninitaccess, Msg, N); R->markInteresting(VAList); R->addVisitor(llvm::make_unique(VAList)); @@ -274,7 +274,8 @@ for (auto Reg : LeakedVALists) { if (!BT_leakedvalist) { BT_leakedvalist.reset(new BugType(CheckNames[CK_Unterminated], - "Leaked va_list", "Memory Error")); + "Leaked va_list", + categories::MemoryError)); BT_leakedvalist->setSuppressOnSink(true); } Index: lib/StaticAnalyzer/Core/CommonBugCategories.cpp =================================================================== --- lib/StaticAnalyzer/Core/CommonBugCategories.cpp +++ lib/StaticAnalyzer/Core/CommonBugCategories.cpp @@ -16,5 +16,6 @@ const char * const LogicError = "Logic error"; const char * const MemoryCoreFoundationObjectiveC = "Memory (Core Foundation/Objective-C)"; +const char * const MemoryError = "Memory error"; const char * const UnixAPI = "Unix API"; }}} Index: test/Analysis/MismatchedDeallocator-path-notes.cpp =================================================================== --- test/Analysis/MismatchedDeallocator-path-notes.cpp +++ test/Analysis/MismatchedDeallocator-path-notes.cpp @@ -287,7 +287,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory allocated by 'new[]' should be deallocated by 'delete[]', not 'delete' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeBad deallocator // CHECK-NEXT: check_nameunix.MismatchedDeallocator // CHECK-NEXT: Index: test/Analysis/NewDelete-path-notes.cpp =================================================================== --- test/Analysis/NewDelete-path-notes.cpp +++ test/Analysis/NewDelete-path-notes.cpp @@ -257,7 +257,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionAttempt to free released memory -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeDouble free // CHECK-NEXT: check_namecplusplus.NewDelete // CHECK-NEXT: @@ -475,7 +475,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionAttempt to free released memory -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeDouble free // CHECK-NEXT: check_namecplusplus.NewDelete // CHECK-NEXT: Index: test/Analysis/diagnostics/report-issues-within-main-file.cpp =================================================================== --- test/Analysis/diagnostics/report-issues-within-main-file.cpp +++ test/Analysis/diagnostics/report-issues-within-main-file.cpp @@ -945,7 +945,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory allocated by 'new[]' should be deallocated by 'delete[]', not 'delete' (within a call to '~auto_ptr') -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeBad deallocator // CHECK-NEXT: check_nameunix.MismatchedDeallocator // CHECK-NEXT: Index: test/Analysis/edges-new.mm =================================================================== --- test/Analysis/edges-new.mm +++ test/Analysis/edges-new.mm @@ -20042,7 +20042,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential leak of memory pointed to by 'buf' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -20284,7 +20284,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory allocated by 'new[]' should be deallocated by 'delete[]', not 'delete' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeBad deallocator // CHECK-NEXT: check_nameunix.MismatchedDeallocator // CHECK-NEXT: Index: test/Analysis/malloc-plist.c =================================================================== --- test/Analysis/malloc-plist.c +++ test/Analysis/malloc-plist.c @@ -421,7 +421,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential leak of memory pointed to by 'p' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -586,7 +586,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential leak of memory pointed to by 'A' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -974,7 +974,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential leak of memory pointed to by 'buf' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -1376,7 +1376,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential leak of memory pointed to by 'buf' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -1962,7 +1962,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionUse of memory after it is freed -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeUse-after-free // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -2524,7 +2524,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential leak of memory pointed to by 'buf' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -2795,7 +2795,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential leak of memory pointed to by 'v' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -3144,7 +3144,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionUse of memory after it is freed -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeUse-after-free // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -3309,7 +3309,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential leak of memory pointed to by 'm' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -3517,7 +3517,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential leak of memory pointed to by 'x' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -3725,7 +3725,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential leak of memory pointed to by 'x' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -4030,7 +4030,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential leak of memory pointed to by 'x' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -4335,7 +4335,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential leak of memory pointed to by 'x' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -4543,7 +4543,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential leak of memory pointed to by 'x' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -4751,7 +4751,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential leak of memory pointed to by 'x' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -4988,7 +4988,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential memory leak -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -5225,7 +5225,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential memory leak -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: @@ -5496,7 +5496,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential memory leak -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: Index: test/Analysis/plist-macros.cpp =================================================================== --- test/Analysis/plist-macros.cpp +++ test/Analysis/plist-macros.cpp @@ -218,7 +218,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory allocated by malloc() should be deallocated by free(), not 'delete' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeBad deallocator // CHECK-NEXT: check_nameunix.MismatchedDeallocator // CHECK-NEXT: @@ -315,7 +315,7 @@ // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionPotential leak of memory pointed to by 'x' -// CHECK-NEXT: categoryMemory Error +// CHECK-NEXT: categoryMemory error // CHECK-NEXT: typeMemory leak // CHECK-NEXT: check_nameunix.Malloc // CHECK-NEXT: