[llvm-bugs] [Bug 42193] New: hasName AST matcher is confused by extern "C" in namespace

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jun 8 02:27:31 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42193

            Bug ID: 42193
           Summary: hasName AST matcher is confused by extern "C" in
                    namespace
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kpreisert at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Given the following code:

namespace foo {
    extern "C" void test() {}
}


... I expect an AST matcher declared as functionDecl(hasName("::foo::test")) to
match the function, but functionDecl(hasName("::test")) should not match.
However, the opposite is the case. (see the example on Compiler Explorer:
http://ce.steveire.com/z/VDTi_g)

When I do this locally with a build with assertions, I get an assertion failure
at
https://github.com/llvm/llvm-project/blob/bca56ab073a00cdec8e0995e3119baf25cf775b8/clang/lib/ASTMatchers/ASTMatchersInternal.cpp#L540,
so I think the problem is that matchesNodeFullFast does not correctly handle
extern "C" functions.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190608/774a3cd7/attachment-0001.html>


More information about the llvm-bugs mailing list