One small functionality change is to bring the sizeof-pointer checker in
line with the other checkers by making its category be "Logic error"
instead of just "Logic". There should be no other functionality changes.
Patch by Daniel Marjamäki!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191910
91177308-0d34-0410-b5e6-
96231b3b80d8
namespace ento {
namespace categories {
extern const char *CoreFoundationObjectiveC;
+ extern const char *LogicError;
extern const char *MemoryCoreFoundationObjectiveC;
extern const char *UnixAPI;
}
#define LLVM_CLANG_ANALYSIS_BUGTYPE
#include "clang/Basic/LLVM.h"
+#include "clang/StaticAnalyzer/Checkers/CommonBugCategories.h"
#include "llvm/ADT/FoldingSet.h"
#include <string>
const std::string desc;
public:
BuiltinBug(const char *name, const char *description)
- : BugType(name, "Logic error"), desc(description) {}
+ : BugType(name, categories::LogicError), desc(description) {}
BuiltinBug(const char *name)
- : BugType(name, "Logic error"), desc(name) {}
+ : BugType(name, categories::LogicError), desc(name) {}
StringRef getDescription() const { return desc; }
};
return NULL;
if (!BT_Null)
- BT_Null.reset(new BuiltinBug("Unix API",
+ BT_Null.reset(new BuiltinBug(categories::UnixAPI,
"Null pointer argument in call to byte string function"));
SmallString<80> buf;
return;
if (!BT_Overlap)
- BT_Overlap.reset(new BugType("Unix API", "Improper arguments"));
+ BT_Overlap.reset(new BugType(categories::UnixAPI, "Improper arguments"));
// Generate a report for this bug.
BugReport *report =
if (ExplodedNode *N = C.addTransition(state)) {
if (!BT_NotCString)
- BT_NotCString.reset(new BuiltinBug("Unix API",
+ BT_NotCString.reset(new BuiltinBug(categories::UnixAPI,
"Argument is not a null-terminated string."));
SmallString<120> buf;
if (ExplodedNode *N = C.addTransition(state)) {
if (!BT_NotCString)
- BT_NotCString.reset(new BuiltinBug("Unix API",
+ BT_NotCString.reset(new BuiltinBug(categories::UnixAPI,
"Argument is not a null-terminated string."));
SmallString<120> buf;
PathDiagnosticLocation::createBegin(E, BR.getSourceManager(), AC);
BR.EmitBasicReport(AC->getDecl(),
"Potential unintended use of sizeof() on pointer type",
- "Logic",
+ categories::LogicError,
"The code calls sizeof() on a pointer type. "
"This can produce an unexpected result.",
ELoc, &R, 1);
namespace clang { namespace ento { namespace categories {
const char *CoreFoundationObjectiveC = "Core Foundation/Objective-C";
+const char *LogicError = "Logic error";
const char *MemoryCoreFoundationObjectiveC =
"Memory (Core Foundation/Objective-C)";
const char *UnixAPI = "Unix API";