
The lack of documentation has been a long standing issue in the Static Analyzer, and one of the leading reasons behind this was a lack of good documentation infrastucture. This lead serious drawbacks, such as * Not having proper release notes for years * Not being able to have a sensible auto-generated checker documentations (which lead to most of them not having any) * The HTML website that has to updated manually is a chore, and has been outdated for a long while * Many design discussions are now hidden in phabricator revisions This patch implements a new documentation infrastucture using Sphinx, like most of the other subprojects in LLVM. It transformed some pages as a proof-of- concept, with many others to follow in later patches. The eventual goal is to preserve the original website's (https://clang-analyzer.llvm.org/) frontpage, but move everything else to the new format. Some other ideas, like creating a unipage for each checker (similar to how clang-tidy works now), are also being discussed. Patch by Dániel Krupp! Differential Revision: https://reviews.llvm.org/D54429 llvm-svn: 353126
42 lines
702 B
C++
42 lines
702 B
C++
void f(int *p);
|
|
|
|
void testUseMiddleArgAfterDelete(int *p) {
|
|
delete p;
|
|
f(p); // warn: use after free
|
|
}
|
|
|
|
class SomeClass {
|
|
public:
|
|
void f();
|
|
};
|
|
|
|
void test() {
|
|
SomeClass *c = new SomeClass;
|
|
delete c;
|
|
c->f(); // warn: use after free
|
|
}
|
|
|
|
void test() {
|
|
int *p = (int *)__builtin_alloca(sizeof(int));
|
|
delete p; // warn: deleting memory allocated by alloca
|
|
}
|
|
|
|
void test() {
|
|
int *p = new int;
|
|
delete p;
|
|
delete p; // warn: attempt to free released
|
|
}
|
|
|
|
void test() {
|
|
int i;
|
|
delete &i; // warn: delete address of local
|
|
}
|
|
|
|
void test() {
|
|
int *p = new int[1];
|
|
delete[] (++p);
|
|
// warn: argument to 'delete[]' is offset by 4 bytes
|
|
// from the start of memory allocated by 'new[]'
|
|
}
|
|
|