Page MenuHomePhabricator

[clang][AST] Handle overload callee type in CallExpr::getCallReturnType.
Needs ReviewPublic

Authored by balazske on Jan 22 2021, 9:09 AM.

Details

Summary

Type of Callee can be overloaded function type that was not handled.
This causes a crash if the function is called in such case.

Diff Detail

Event Timeline

balazske created this revision.Jan 22 2021, 9:09 AM
balazske requested review of this revision.Jan 22 2021, 9:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 22 2021, 9:09 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Should add some responsible (for this code) reviewers.

balazske added inline comments.Jan 25 2021, 7:04 AM
clang/lib/AST/Expr.cpp
1410

Here occurs the problem: If CalleeType is of type BuiltinType::Overload it does not cast to FunctionType.

Hi Balázs,

Could you please create a lit test file which ignites the related crash?

balazske updated this revision to Diff 319261.Jan 26 2021, 3:28 AM

Adding a test, fixing other problems revealed by the test.

I could add a test in ToolingTests, lit test is much more difficult to add because the function is normally not called on "bad" code.

clang/lib/AST/Expr.cpp
1403

I am not sure if dependent type is here (and later) the correct value to return. But only a null type is another possibility.

martong added subscribers: majnemer, rsmith.

Adding reviewers.
@rsmith as code owner,
@majnemer based on git blame of CallExpr::getCallReturnType.