mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-20 03:55:48 -04:00

Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952. Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D30373 llvm-svn: 296895
25 lines
651 B
C
25 lines
651 B
C
// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.unix.Chroot -analyzer-store region -verify %s
|
|
|
|
extern int chroot(const char* path);
|
|
extern int chdir(const char* path);
|
|
|
|
void foo(void) {
|
|
}
|
|
|
|
void f1(void) {
|
|
chroot("/usr/local"); // root changed.
|
|
foo(); // expected-warning {{No call of chdir("/") immediately after chroot}}
|
|
}
|
|
|
|
void f2(void) {
|
|
chroot("/usr/local"); // root changed.
|
|
chdir("/"); // enter the jail.
|
|
foo(); // no-warning
|
|
}
|
|
|
|
void f3(void) {
|
|
chroot("/usr/local"); // root changed.
|
|
chdir("../"); // change working directory, still out of jail.
|
|
foo(); // expected-warning {{No call of chdir("/") immediately after chroot}}
|
|
}
|