<div dir="ltr">Temporarily reverted in r191936 until the layering violation is fixed.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 3, 2013 at 11:44 AM, Jordan Rose <span dir="ltr"><<a href="mailto:jordan_rose@apple.com" target="_blank">jordan_rose@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ha, whoops. I didn't even notice that. I'll fix the layering one way or another later today or tomorrow morning. Thanks, Eric!<br>
<div class="HOEnZb"><div class="h5"><br>
On Oct 3, 2013, at 11:24 , Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>> wrote:<br>
<br>
> So this patch makes the core static analyzer depend upon headers in<br>
> the checkers. I don't know if that's something we want to do?<br>
><br>
> -eric<br>
><br>
> On Thu, Oct 3, 2013 at 9:57 AM, Jordan Rose <<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>> wrote:<br>
>> Author: jrose<br>
>> Date: Thu Oct 3 11:57:20 2013<br>
>> New Revision: 191910<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=191910&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=191910&view=rev</a><br>
>> Log:<br>
>> [analyzer] Replace bug category magic strings with shared constants.<br>
>><br>
>> One small functionality change is to bring the sizeof-pointer checker in<br>
>> line with the other checkers by making its category be "Logic error"<br>
>> instead of just "Logic". There should be no other functionality changes.<br>
>><br>
>> Patch by Daniel Marjamäki!<br>
>><br>
>> Modified:<br>
>> cfe/trunk/include/clang/StaticAnalyzer/Checkers/CommonBugCategories.h<br>
>> cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h<br>
>> cfe/trunk/lib/StaticAnalyzer/Checkers/CStringChecker.cpp<br>
>> cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp<br>
>> cfe/trunk/lib/StaticAnalyzer/Checkers/CommonBugCategories.cpp<br>
>><br>
>> Modified: cfe/trunk/include/clang/StaticAnalyzer/Checkers/CommonBugCategories.h<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Checkers/CommonBugCategories.h?rev=191910&r1=191909&r2=191910&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Checkers/CommonBugCategories.h?rev=191910&r1=191909&r2=191910&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/include/clang/StaticAnalyzer/Checkers/CommonBugCategories.h (original)<br>
>> +++ cfe/trunk/include/clang/StaticAnalyzer/Checkers/CommonBugCategories.h Thu Oct 3 11:57:20 2013<br>
>> @@ -15,6 +15,7 @@ namespace clang {<br>
>> namespace ento {<br>
>> namespace categories {<br>
>> extern const char *CoreFoundationObjectiveC;<br>
>> + extern const char *LogicError;<br>
>> extern const char *MemoryCoreFoundationObjectiveC;<br>
>> extern const char *UnixAPI;<br>
>> }<br>
>><br>
>> Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h?rev=191910&r1=191909&r2=191910&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h?rev=191910&r1=191909&r2=191910&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h (original)<br>
>> +++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h Thu Oct 3 11:57:20 2013<br>
>> @@ -15,6 +15,7 @@<br>
>> #define LLVM_CLANG_ANALYSIS_BUGTYPE<br>
>><br>
>> #include "clang/Basic/LLVM.h"<br>
>> +#include "clang/StaticAnalyzer/Checkers/CommonBugCategories.h"<br>
>> #include "llvm/ADT/FoldingSet.h"<br>
>> #include <string><br>
>><br>
>> @@ -54,10 +55,10 @@ class BuiltinBug : public BugType {<br>
>> const std::string desc;<br>
>> public:<br>
>> BuiltinBug(const char *name, const char *description)<br>
>> - : BugType(name, "Logic error"), desc(description) {}<br>
>> + : BugType(name, categories::LogicError), desc(description) {}<br>
>><br>
>> BuiltinBug(const char *name)<br>
>> - : BugType(name, "Logic error"), desc(name) {}<br>
>> + : BugType(name, categories::LogicError), desc(name) {}<br>
>><br>
>> StringRef getDescription() const { return desc; }<br>
>> };<br>
>><br>
>> Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CStringChecker.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CStringChecker.cpp?rev=191910&r1=191909&r2=191910&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CStringChecker.cpp?rev=191910&r1=191909&r2=191910&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/lib/StaticAnalyzer/Checkers/CStringChecker.cpp (original)<br>
>> +++ cfe/trunk/lib/StaticAnalyzer/Checkers/CStringChecker.cpp Thu Oct 3 11:57:20 2013<br>
>> @@ -231,7 +231,7 @@ ProgramStateRef CStringChecker::checkNon<br>
>> return NULL;<br>
>><br>
>> if (!BT_Null)<br>
>> - BT_Null.reset(new BuiltinBug("Unix API",<br>
>> + BT_Null.reset(new BuiltinBug(categories::UnixAPI,<br>
>> "Null pointer argument in call to byte string function"));<br>
>><br>
>> SmallString<80> buf;<br>
>> @@ -525,7 +525,7 @@ void CStringChecker::emitOverlapBug(Chec<br>
>> return;<br>
>><br>
>> if (!BT_Overlap)<br>
>> - BT_Overlap.reset(new BugType("Unix API", "Improper arguments"));<br>
>> + BT_Overlap.reset(new BugType(categories::UnixAPI, "Improper arguments"));<br>
>><br>
>> // Generate a report for this bug.<br>
>> BugReport *report =<br>
>> @@ -702,7 +702,7 @@ SVal CStringChecker::getCStringLength(Ch<br>
>><br>
>> if (ExplodedNode *N = C.addTransition(state)) {<br>
>> if (!BT_NotCString)<br>
>> - BT_NotCString.reset(new BuiltinBug("Unix API",<br>
>> + BT_NotCString.reset(new BuiltinBug(categories::UnixAPI,<br>
>> "Argument is not a null-terminated string."));<br>
>><br>
>> SmallString<120> buf;<br>
>> @@ -762,7 +762,7 @@ SVal CStringChecker::getCStringLength(Ch<br>
>><br>
>> if (ExplodedNode *N = C.addTransition(state)) {<br>
>> if (!BT_NotCString)<br>
>> - BT_NotCString.reset(new BuiltinBug("Unix API",<br>
>> + BT_NotCString.reset(new BuiltinBug(categories::UnixAPI,<br>
>> "Argument is not a null-terminated string."));<br>
>><br>
>> SmallString<120> buf;<br>
>><br>
>> Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp?rev=191910&r1=191909&r2=191910&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp?rev=191910&r1=191909&r2=191910&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp (original)<br>
>> +++ cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp Thu Oct 3 11:57:20 2013<br>
>> @@ -65,7 +65,7 @@ void WalkAST::VisitUnaryExprOrTypeTraitE<br>
>> PathDiagnosticLocation::createBegin(E, BR.getSourceManager(), AC);<br>
>> BR.EmitBasicReport(AC->getDecl(),<br>
>> "Potential unintended use of sizeof() on pointer type",<br>
>> - "Logic",<br>
>> + categories::LogicError,<br>
>> "The code calls sizeof() on a pointer type. "<br>
>> "This can produce an unexpected result.",<br>
>> ELoc, &R, 1);<br>
>><br>
>> Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CommonBugCategories.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CommonBugCategories.cpp?rev=191910&r1=191909&r2=191910&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CommonBugCategories.cpp?rev=191910&r1=191909&r2=191910&view=diff</a><br>
>> ==============================================================================<br>
>> --- cfe/trunk/lib/StaticAnalyzer/Checkers/CommonBugCategories.cpp (original)<br>
>> +++ cfe/trunk/lib/StaticAnalyzer/Checkers/CommonBugCategories.cpp Thu Oct 3 11:57:20 2013<br>
>> @@ -11,6 +11,7 @@<br>
>> namespace clang { namespace ento { namespace categories {<br>
>><br>
>> const char *CoreFoundationObjectiveC = "Core Foundation/Objective-C";<br>
>> +const char *LogicError = "Logic error";<br>
>> const char *MemoryCoreFoundationObjectiveC =<br>
>> "Memory (Core Foundation/Objective-C)";<br>
>> const char *UnixAPI = "Unix API";<br>
>><br>
>><br>
>> _______________________________________________<br>
>> cfe-commits mailing list<br>
>> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div>