This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Fix ParsedASTTest.TopLevelDecls test.
ClosedPublic

Authored by ilya-golovenko on Oct 29 2020, 4:42 AM.

Details

Summary

Google test matcher DeclKind uses NamedDecl::getDeclKindName() to compare its result with expected declaration name.
Both, returned value of this function and the expected kind name argument have type const char *, so this matcher effectively
compares two pointers instead of the respective strings.

The test was passing on most platforms because compilers mostly were able to coalesce these string literals.

Diff Detail

Event Timeline

ilya-golovenko created this revision.Oct 29 2020, 4:42 AM
ilya-golovenko requested review of this revision.Oct 29 2020, 4:42 AM
ilya-golovenko edited the summary of this revision. (Show Details)Oct 29 2020, 4:49 AM
ilya-golovenko edited the summary of this revision. (Show Details)
ilya-golovenko edited the summary of this revision. (Show Details)Oct 29 2020, 5:41 AM
hokein accepted this revision.Oct 29 2020, 6:17 AM

Great! Thanks for doing this!

This revision is now accepted and ready to land.Oct 29 2020, 6:17 AM
ilya-golovenko added a comment.EditedOct 29 2020, 6:42 AM

@hokein I don't have commit access. Could you please commit it on my behalf?
Ilya Golovenko <ilya.golovenko@huawei.com>

This revision was automatically updated to reflect the committed changes.