This is an archive of the discontinued LLVM Phabricator instance.

[ASTMatchers] Force c++ unittests to specify correct language standard
ClosedPublic

Authored by njames93 on May 31 2020, 2:18 AM.

Details

Summary

Force the unittests on c++ code for matchers to specify the correct standard.

Diff Detail

Unit TestsFailed

Event Timeline

njames93 created this revision.May 31 2020, 2:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 31 2020, 2:18 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

This is an interesting question. Since Clang accepts certain constructs in older C++ standard versions as extensions, shouldn't we test AST matchers in those modes as well? I think it could be argued either way.

Approving since I think that it is probably too costly for tooling to try to handle such language extensions. We also don't have a principled way to know what "future" C++ feature is supported in a given language mode, so I think we would always have implementation and testing gaps because people implementing tooling won't know what features to even expect in ASTs.

gribozavr2 accepted this revision.May 31 2020, 4:08 AM
This revision is now accepted and ready to land.May 31 2020, 4:08 AM

This is an interesting question. Since Clang accepts certain constructs in older C++ standard versions as extensions, shouldn't we test AST matchers in those modes as well? I think it could be argued either way.

Clang accepts a lot of stuff for better or worse, my fist try at this was using -pedantic-errors, but that was throwing errors with gnu and microsoft extensions which would be a much more invasive fix to sort out.

This revision was automatically updated to reflect the committed changes.