• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rieske / trans / 29861581689

21 Jul 2026 07:27PM UTC coverage: 91.142% (+0.4%) from 90.735%
29861581689

push

github

web-flow
Merge pull request #52 from rieske/tests/fuzz

Fuzz test and fix issues

86 of 110 new or added lines in 9 files covered. (78.18%)

5371 of 5893 relevant lines covered (91.14%)

368978.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.79
/src/ast/FunctionDeclarator.cpp
1
#include "FunctionDeclarator.h"
2

3
#include "AbstractSyntaxTreeVisitor.h"
4

5
namespace ast {
6

7
FunctionDeclarator::FunctionDeclarator(std::unique_ptr<DirectDeclarator> declarator) :
444✔
8
        DirectDeclarator(declarator->getName(), declarator->getContext()),
888✔
9
        nested { std::move(declarator) }
1,332✔
10
{
11
}
444✔
12

13
FunctionDeclarator::FunctionDeclarator(std::unique_ptr<DirectDeclarator> declarator, FormalArguments formalArguments) :
80✔
14
        DirectDeclarator(declarator->getName(), declarator->getContext()),
160✔
15
        nested { std::move(declarator) },
80✔
16
        formalArguments { std::move(formalArguments) }
320✔
17
{
18
}
80✔
19

20
void FunctionDeclarator::accept(AbstractSyntaxTreeVisitor& visitor) {
1,534✔
21
    visitor.visit(*this);
1,534✔
22
}
1,534✔
23

24
void FunctionDeclarator::visitFormalArguments(AbstractSyntaxTreeVisitor& visitor) {
1,534✔
25
    for (auto& argument : formalArguments) {
2,076✔
26
        argument.accept(visitor);
542✔
27
    }
28
}
1,534✔
29

NEW
30
void FunctionDeclarator::visitNestedDeclarator(AbstractSyntaxTreeVisitor& visitor) {
×
NEW
31
    if (nested) {
×
NEW
32
        nested->accept(visitor);
×
33
    }
NEW
34
}
×
35

36
const FormalArguments& ast::FunctionDeclarator::getFormalArguments() const {
522✔
37
    return formalArguments;
522✔
38
}
39

40
type::Type FunctionDeclarator::getFundamentalType(std::vector<Pointer> indirection, const type::Type& returnType) {
2✔
41
    // Outer pointers apply to the return type: `int *f()` is a function returning int*.
42
    type::Type actualReturn = returnType;
2✔
43
    for (Pointer pointer : indirection) {
2✔
NEW
44
        actualReturn = type::pointer(actualReturn, pointer.getQualifiers());
×
NEW
45
    }
×
46
    std::vector<type::Type> argumentTypes;
2✔
47
    for (const auto& argument : formalArguments) {
2✔
48
        argumentTypes.push_back(argument.getType());
×
49
    }
50
    type::Type functionType = type::function(actualReturn, argumentTypes);
2✔
51
    // Nested declarator may wrap further (e.g. `int (*f)()` → pointer to function).
52
    return nested->getFundamentalType({}, functionType);
4✔
53
}
2✔
54

55
} // namespace ast
56

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc