This is an archive of the discontinued LLVM Phabricator instance.

[ASTMatchers] HasNameMatcher handles `extern "C"`
ClosedPublic

Authored by njames93 on Feb 26 2020, 11:14 AM.

Diff Detail

Event Timeline

njames93 created this revision.Feb 26 2020, 11:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 26 2020, 11:14 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
aaron.ballman accepted this revision.Feb 26 2020, 1:41 PM

LGTM!

clang/lib/ASTMatchers/ASTMatchersInternal.cpp
518

I would imagine we'd want to skip an ExternCContextDecl for similar reasons, though I am struggling to find a test case that actually generates that context.

clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
1648

As another test:

namespace foo {
extern "C" {
void test();
}
}
This revision is now accepted and ready to land.Feb 26 2020, 1:41 PM
njames93 updated this revision to Diff 246829.Feb 26 2020, 2:07 PM
njames93 marked an inline comment as done.
  • Add extra test case
njames93 marked an inline comment as done.Feb 26 2020, 2:07 PM
njames93 added inline comments.
clang/lib/ASTMatchers/ASTMatchersInternal.cpp
518

I couldn't figure a way to generate one of those either. However if a context type that isnt found matched the assertions should go off and we can look into the issue again

This revision was automatically updated to reflect the committed changes.