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: unassignedclangb...@nondot.org
          Reporter: kpreis...@gmail.com
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to