This is an archive of the discontinued LLVM Phabricator instance.

[clangd][Hover] Handle uninstantiated default args
ClosedPublic

Authored by kadircet on Jan 30 2020, 9:43 AM.

Details

Summary

Default args might exist but be unparsed or uninstantiated.
getDefaultArg asserts on those. This patch makes sure we don't crash in such
scenarios.

Diff Detail

Event Timeline

kadircet created this revision.Jan 30 2020, 9:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 30 2020, 9:43 AM

Unit tests: pass. 62330 tests passed, 0 failed and 838 were skipped.

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

ilya-biryukov accepted this revision.Jan 31 2020, 5:15 AM

LGTM

clang-tools-extra/clangd/Hover.cpp
290

NIT: maybe move this into a helper function?

Expr* getDefaultArgForPresentation(ParmVarDecl*);

I imagine this could be useful in other contexts too.

PS: As usual, naming is not my strong side.

This revision is now accepted and ready to land.Jan 31 2020, 5:15 AM
kadircet updated this revision to Diff 241707.Jan 31 2020, 6:02 AM
kadircet marked an inline comment as done.
  • Address comments
This revision was automatically updated to reflect the committed changes.

Unit tests: pass. 62330 tests passed, 0 failed and 838 were skipped.

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.