translate-c: Improve function pointer handling

Omit address-of operator if operand is a function.

Improve handling of function-call translation when using function pointers

Fixes #4124
This commit is contained in:
Evan Haas
2021-02-05 15:37:18 -08:00
committed by Veikka Tuominen
parent 1adac0a55b
commit 221f1d898c
6 changed files with 107 additions and 21 deletions

View File

@@ -2773,6 +2773,11 @@ struct ZigClangSourceLocation ZigClangUnaryOperator_getBeginLoc(const struct Zig
return bitcast(casted->getBeginLoc());
}
struct ZigClangQualType ZigClangValueDecl_getType(const struct ZigClangValueDecl *self) {
auto casted = reinterpret_cast<const clang::ValueDecl *>(self);
return bitcast(casted->getType());
}
const struct ZigClangExpr *ZigClangWhileStmt_getCond(const struct ZigClangWhileStmt *self) {
auto casted = reinterpret_cast<const clang::WhileStmt *>(self);
return reinterpret_cast<const struct ZigClangExpr *>(casted->getCond());