Skip to content

Commit d9d20c3

Browse files
committed
Add comments
1 parent d21cb4c commit d9d20c3

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

cpp2rust/converter/converter_lib.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,8 @@ clang::Expr *NormalizeToBool(clang::Expr *expr, clang::ASTContext &ctx) {
688688
return expr;
689689
}
690690

691+
// If logical not returns integer, then craft a new logical not that returns
692+
// bool.
691693
if (auto bin = clang::dyn_cast<clang::UnaryOperator>(expr)) {
692694
if (bin->getOpcode() == clang::UO_LNot) {
693695
return clang::UnaryOperator::Create(
@@ -697,6 +699,7 @@ clang::Expr *NormalizeToBool(clang::Expr *expr, clang::ASTContext &ctx) {
697699
}
698700
}
699701

702+
// Either to pointer -> bool, or int -> bool.
700703
clang::CastKind cast_kind;
701704
if (expr->getType()->isPointerType()) {
702705
cast_kind = clang::CK_PointerToBoolean;

0 commit comments

Comments
 (0)