[PATCH] D48522: [analyzer] Highlight c_str() call in DanglingInternalBuffer checker

2018-07-07 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC336495: [analyzer] Highlight c_str() call in DanglingInternalBufferChecker. (authored by rkovacs, committed by ). Changed prior to commit: https://reviews.llvm.org/D48522?vs=152719&id=154499#toc Reposi

[PATCH] D48522: [analyzer] Highlight c_str() call in DanglingInternalBuffer checker

2018-06-25 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 152719. rnkovacs added a comment. Fixed the constness of `c_str()` in the test file. https://reviews.llvm.org/D48522 Files: lib/StaticAnalyzer/Checkers/AllocationState.h lib/StaticAnalyzer/Checkers/DanglingInternalBufferChecker.cpp lib/StaticAnalyzer

[PATCH] D48522: [analyzer] Highlight c_str() call in DanglingInternalBuffer checker

2018-06-25 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 152627. rnkovacs marked an inline comment as done. rnkovacs added a comment. Fixed variable name inside the visitor. I also clang-formatted the file, sorry for any line number shifting. https://reviews.llvm.org/D48522 Files: lib/StaticAnalyzer/Checkers/A

[PATCH] D48522: [analyzer] Highlight c_str() call in DanglingInternalBuffer checker

2018-06-24 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun accepted this revision. xazax.hun added inline comments. Comment at: lib/StaticAnalyzer/Checkers/DanglingInternalBufferChecker.cpp:41 +// Tracked pointer to a buffer. +SymbolRef Sym; + I am fine with this as is, but I prefer self documenting cod

[PATCH] D48522: [analyzer] Highlight c_str() call in DanglingInternalBuffer checker

2018-06-24 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 152616. rnkovacs marked 4 inline comments as done. rnkovacs added a comment. Thanks! Addressed comments. https://reviews.llvm.org/D48522 Files: lib/StaticAnalyzer/Checkers/AllocationState.h lib/StaticAnalyzer/Checkers/DanglingInternalBufferChecker.cpp

[PATCH] D48522: [analyzer] Highlight c_str() call in DanglingInternalBuffer checker

2018-06-23 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision. NoQ added a comment. This revision is now accepted and ready to land. Looks good tho! Comment at: lib/StaticAnalyzer/Checkers/DanglingInternalBufferChecker.cpp:63-64 + RawPtrMapTy Map = State->get(); + for (const auto Entry : Map) { +

[PATCH] D48522: [analyzer] Highlight c_str() call in DanglingInternalBuffer checker

2018-06-23 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: lib/StaticAnalyzer/Checkers/AllocationState.h:23-25 +std::unique_ptr +getDanglingBufferBRVisitor(SymbolRef Sym); + I think we should start commenting this stuff up. Like, "This function provides an additional visitor that a

[PATCH] D48522: [analyzer] Highlight c_str() call in DanglingInternalBuffer checker

2018-06-23 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment. Looks better, thanks! Comment at: lib/StaticAnalyzer/Checkers/DanglingInternalBufferChecker.cpp:65 +if (Entry.second == Sym) + Found = true; + } Maybe early return here? https://reviews.llvm.org/D48522 _

[PATCH] D48522: [analyzer] Highlight c_str() call in DanglingInternalBuffer checker

2018-06-23 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 152604. rnkovacs marked an inline comment as done. rnkovacs added a comment. Um, sorry, I totally forgot about that. Added your case to the tests. https://reviews.llvm.org/D48522 Files: lib/StaticAnalyzer/Checkers/AllocationState.h lib/StaticAnalyzer/C

[PATCH] D48522: [analyzer] Highlight c_str() call in DanglingInternalBuffer checker

2018-06-23 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment. Regarding the visitor: Maybe rather than looking at the AST, we should check the states, when we started to track the returned symbol? Using your current design you need to check for the AST twice. Once in the visitor and once in the check. Also, I wonder if this alw

[PATCH] D48522: [analyzer] Highlight c_str() call in DanglingInternalBuffer checker

2018-06-23 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs created this revision. rnkovacs added reviewers: NoQ, xazax.hun, george.karpenkov, dcoughlin. Herald added subscribers: mikhail.ramalho, a.sidorin, dkrupp, szepet, baloghadamsoftware, whisperity. Add a bug visitor to `DanglingInternalBuffer` checker that places a note at the point where