File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1944,8 +1944,8 @@ bool Converter::VisitImplicitCastExpr(clang::ImplicitCastExpr *expr) {
19441944 }
19451945 bool dest_pointee_const =
19461946 expr->getType ()->getPointeeType ().isConstQualified ();
1947- if (const auto *member = clang::dyn_cast<clang::MemberExpr>(
1948- sub_expr->IgnoreParenImpCasts ());
1947+ if (const auto *member =
1948+ clang::dyn_cast<clang::MemberExpr>( sub_expr->IgnoreParenImpCasts ());
19491949 member && IsCharArrayFieldFromLibc (member->getMemberDecl ())) {
19501950 PushParen paren (*this );
19511951 Convert (sub_expr);
Original file line number Diff line number Diff line change 11// no-compile: refcount
2+ #include <dirent.h>
23#include <pwd.h>
34#include <unistd.h>
45
@@ -8,5 +9,11 @@ int main(void) {
89 return 0 ;
910 }
1011 char * home = pw -> pw_dir ;
11- return home == 0 ;
12+
13+ struct dirent * d = readdir (opendir ("/tmp" ));
14+ // d_name is a char array which gets translated as i8. We model chars as u8 in
15+ // Rust.
16+ char * dname = d -> d_name ;
17+
18+ return 0 ;
1219}
Original file line number Diff line number Diff line change @@ -17,5 +17,9 @@ unsafe fn main_0() -> i32 {
1717 return 0 ;
1818 }
1919 let mut home: * mut u8 = ( ( * pw) . pw_dir as * mut u8 ) ;
20- return ( ( ( home) . is_null ( ) ) as i32 ) ;
20+ let mut d: * mut dirent = libc:: readdir ( libc:: opendir (
21+ ( b"/tmp\0 " . as_ptr ( ) . cast_mut ( ) ) . cast_const ( ) as * const i8 ,
22+ ) ) ;
23+ let mut dname: * mut u8 = ( ( * d) . d_name . as_mut_ptr ( ) as * mut u8 ) ;
24+ return 0 ;
2125}
You can’t perform that action at this time.
0 commit comments