Clang import: fixed return type
This commit is contained in:
parent
e3ab688597
commit
67cc1776d5
|
@ -955,8 +955,10 @@ Token *clangimport::AstNode::createTokens(TokenList *tokenList)
|
|||
}
|
||||
if (nodeType == ReturnStmt) {
|
||||
Token *tok1 = addtoken(tokenList, "return");
|
||||
if (!children.empty())
|
||||
if (!children.empty()) {
|
||||
children[0]->setValueType(tok1);
|
||||
tok1->astOperand1(children[0]->createTokens(tokenList));
|
||||
}
|
||||
return tok1;
|
||||
}
|
||||
if (nodeType == StringLiteral)
|
||||
|
|
|
@ -5846,9 +5846,16 @@ static const Token * parsedecl(const Token *type, ValueType * const valuetype, V
|
|||
typestr += end->str();
|
||||
if (valuetype->fromLibraryType(typestr, settings))
|
||||
type = end;
|
||||
} else if (ValueType::Type::UNKNOWN_TYPE != ValueType::typeFromString(type->str(), type->isLong()))
|
||||
} else if (ValueType::Type::UNKNOWN_TYPE != ValueType::typeFromString(type->str(), type->isLong())) {
|
||||
ValueType::Type t0 = valuetype->type;
|
||||
valuetype->type = ValueType::typeFromString(type->str(), type->isLong());
|
||||
else if (type->str() == "auto") {
|
||||
if (t0 == ValueType::Type::LONG) {
|
||||
if (valuetype->type == ValueType::Type::LONG)
|
||||
valuetype->type = ValueType::Type::LONGLONG;
|
||||
else if (valuetype->type == ValueType::Type::DOUBLE)
|
||||
valuetype->type = ValueType::Type::LONGDOUBLE;
|
||||
}
|
||||
} else if (type->str() == "auto") {
|
||||
const ValueType *vt = type->valueType();
|
||||
if (!vt)
|
||||
return nullptr;
|
||||
|
|
|
@ -84,7 +84,7 @@ def test2():
|
|||
|
||||
def test_ast_calculations():
|
||||
check_ast('int x = 5; int y = (x + 4) * 2;')
|
||||
todo_check_ast('int dostuff(int x) { return x ? 3 : 5; }')
|
||||
check_ast('long long dostuff(int x) { return x ? 3 : 5; }')
|
||||
|
||||
def test_ast_control_flow():
|
||||
check_ast('void foo(int x) { if (x > 5){} }')
|
||||
|
|
Loading…
Reference in New Issue