The OpenMP variant clause current ensures unique function identifiers by
mangling the name with $ompvariant.... This patch adds an extension to
prevent this by stripping off the mangling during code generation. Doing
this will conflict with the other symbols in the module, but it will
allow us to overload the names of existing symbols if their definitions
are allowed to be dropped. This is most useful for overloading the
meaning of math functions without changing the symbol so they can still
be identified by LLVM.
Details
- Reviewers
jdoerfert aaron.ballman
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
The test currently fails because we don't do the stripping when we emit the precompiled header, it will simply be imported using the mangled version and it will not have in the original input info associated with it. I will need to figure out where we emit the PCH definitions and also demangle it there.
Updating to use an attribute instead to get around the loss of the identifier info when using PCH. Unfortunately this still causes problems when using PCH.
Updating to stop erroring if a function with the same mangled error exists, but is never emitted.
clang/lib/CodeGen/CodeGenModule.cpp | ||
---|---|---|
3062 | This should only get called if we plan to emit this global, if the global has the attribute stating that it should not be mangled we're basically just asserting that its associated non-variant declaration should not be found. So even if we hit a name mangling conflict, as long as we haven't tried to emit that global we should be fine. I can add a test for this. |
clang/lib/CodeGen/CodeGenModule.cpp | ||
---|---|---|
3062 | We only put things in this set for a special OpenMP case, correct? So all non-openmp codes will never see this diagnostic, or what am I missing? |
Check OpenMP in the lang opts.