Skip to content

Commit 24d7d39

Browse files
author
Зишан Мирза
committed
[clang-tidy] add ctime and localtime to clang-tidy
Closes llvm#107445
1 parent cea738b commit 24d7d39

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

clang/lib/StaticAnalyzer/Checkers/cert/InvalidPtrChecker.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ class InvalidPtrChecker
7676
&InvalidPtrChecker::postPreviousReturnInvalidatingCall},
7777
{{CDM::CLibrary, {"asctime"}, 1},
7878
&InvalidPtrChecker::postPreviousReturnInvalidatingCall},
79+
{{CDM::CLibrary, {"ctime"}, 1},
80+
&InvalidPtrChecker::postPreviousReturnInvalidatingCall},
81+
{{CDM::CLibrary, {"localtime"}, 1},
82+
&InvalidPtrChecker::postPreviousReturnInvalidatingCall},
7983
};
8084

8185
// The private members of this checker corresponding to commandline options

clang/lib/Tooling/Inclusions/Stdlib/CSymbolMap.inc

+4
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ SYMBOL(and, None, <iso646.h>)
220220
SYMBOL(and_eq, None, <iso646.h>)
221221
SYMBOL(asctime, None, <time.h>)
222222
SYMBOL(asctime_s, None, <time.h>)
223+
SYMBOL(ctime, None, <time.h>)
224+
SYMBOL(ctime_s, None, <time.h>)
225+
SYMBOL(localtime, None, <time.h>)
226+
SYMBOL(localtime_s, None, <time.h>)
223227
SYMBOL(asin, None, <math.h>)
224228
SYMBOL(asinf, None, <math.h>)
225229
SYMBOL(asinh, None, <math.h>)

clang/lib/Tooling/Inclusions/Stdlib/StdSymbolMap.inc

+6
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,12 @@ SYMBOL(as_writable_bytes, std::, <span>)
618618
SYMBOL(asctime, std::, <ctime>)
619619
SYMBOL(asctime, None, <ctime>)
620620
SYMBOL(asctime, None, <time.h>)
621+
SYMBOL(ctime, std::, <time.h>)
622+
SYMBOL(ctime, None, <ctime>)
623+
SYMBOL(ctime, None, <time.h>)
624+
SYMBOL(localtime, std::, <ctime>)
625+
SYMBOL(localtime, None, <ctime>)
626+
SYMBOL(localtime, None, <time.h>)
621627
SYMBOL(asin, std::, <cmath>)
622628
SYMBOL(asin, None, <cmath>)
623629
SYMBOL(asin, None, <math.h>)

clang/test/Analysis/cert/env34-c.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ lconv *localeconv(void);
1515

1616
typedef struct {
1717
} tm;
18-
char *asctime(const tm *timeptr);
18+
char *asctime(const tm *timeptr)
19+
;
20+
typedef struct {
21+
} tm;
22+
char *ctime(const tm *timeptr);
23+
typedef struct {
24+
} tm;
25+
struct tm *localtime(struct tm *tm);
1926

2027
int strcmp(const char*, const char*);
2128
extern void foo(char *e);

0 commit comments

Comments
 (0)