tekknolagi created this revision.
tekknolagi added reviewers: bcraig, NoQ.
tekknolagi added a project: clang.
The existing padding checker skips classes that have any base classes. This
patch allows the checker to traverse very simple cases: classes that have no
fields and have one base class.
tekknolagi edited reviewers, added: dcoughlin; removed: malcolm.parsons.
tekknolagi added a comment.
Sorry @malcolm.parsons -- I misunderstood code owners. Should not have just
looked at a blame of the file...
Repository:
rC Clang
https://reviews.llvm.org/D53206
__
tekknolagi added inline comments.
Comment at: lib/StaticAnalyzer/Checkers/PaddingChecker.cpp:167-171
}
+// How do you reorder fields if you haven't got any?
+else if (RD->field_empty())
+ return true;
+
bcraig wrote:
> I think this should just b
tekknolagi updated this revision to Diff 169501.
tekknolagi added a comment.
Fix confusing & wrong if-statements, add new test suggested by @bcraig
Repository:
rC Clang
https://reviews.llvm.org/D53206
Files:
lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
test/Analysis/padding_cpp.cpp
t
tekknolagi added inline comments.
Comment at: test/Analysis/padding_cpp.cpp:204-212
+// expected-warning@+1{{Excessive padding in 'struct FakeIntSandwich'}}
+struct FakeIntSandwich {
+ char c1;
+ int i;
+ char c2;
+};
+
bcraig wrote:
> Looking at this again...
tekknolagi updated this revision to Diff 170464.
tekknolagi edited the summary of this revision.
tekknolagi added a comment.
Remove useless test case in `padding_cpp.cpp`
Repository:
rC Clang
https://reviews.llvm.org/D53206
Files:
lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
test/Analy
tekknolagi added inline comments.
Comment at: test/Analysis/padding_cpp.cpp:204-212
+// expected-warning@+1{{Excessive padding in 'struct FakeIntSandwich'}}
+struct FakeIntSandwich {
+ char c1;
+ int i;
+ char c2;
+};
+
tekknolagi wrote:
> bcraig wrote:
> > Lo
tekknolagi updated this revision to Diff 170475.
tekknolagi added a comment.
Make the test case a little easier to read
Repository:
rC Clang
https://reviews.llvm.org/D53206
Files:
lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
test/Analysis/padding_inherit.cpp
Index: test/Analysis/paddi
tekknolagi added a comment.
Ping @NoQ @george.karpenkov
Repository:
rC Clang
https://reviews.llvm.org/D53206
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
tekknolagi added inline comments.
Comment at: lib/StaticAnalyzer/Checkers/PaddingChecker.cpp:78-81
+// We need to be looking at a definition, not just any pointer to the
+// declaration.
+if (!(RD = RD->getDefinition()))
+ return;
NoQ wrote:
> Th
tekknolagi updated this revision to Diff 171234.
tekknolagi added a comment.
Add comments suggested by @NoQ and @bcraig
Repository:
rC Clang
https://reviews.llvm.org/D53206
Files:
lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
test/Analysis/padding_inherit.cpp
Index: test/Analysis/paddi
tekknolagi added a comment.
@NoQ I think @alexshap will be committing this. Thanks
Repository:
rC Clang
https://reviews.llvm.org/D53206
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com
tekknolagi added inline comments.
Comment at: lib/StaticAnalyzer/Checkers/PaddingChecker.cpp:78-81
+// We need to be looking at a definition, not just any pointer to the
+// declaration.
+if (!(RD = RD->getDefinition()))
+ return;
tekknolagi wrot
tekknolagi updated this revision to Diff 171568.
tekknolagi added a comment.
Skip non-definitions in `VisitRecord`
Repository:
rC Clang
https://reviews.llvm.org/D53206
Files:
lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
test/Analysis/padding_inherit.cpp
Index: test/Analysis/padding_in
14 matches
Mail list logo