This extension allows to declare variants in between `omp begin/end
declare variant` that do not match the type of the existing function
with that name. Without this extension we would not find a base function
(with a compatible type), therefore create a new one, which would
cause conflicting declarations. With this extension we will not create
"missing" base functions, which basically renders these specializations
harmless. They will be generated but never called.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
5926 | Does the user of this function expect that BaseFD can be nullptr after this change? |
clang/lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
5926 | It was always OK to return a nullptr, I think. The important thing is that we mangle the name, but not returning a BaseFD will simply not add an OMPDeclareVariantAttr to anything, making this variant unused code. |
If I recall correctly, &foo with variants of foo returns a pointer to the base. If we have no base, and disable_implicit_base, what does &foo yield? It should probably be a compilation error with some descriptive message
Correct.
If we have no base, and disable_implicit_base, what does &foo yield? It should probably be a compilation error with some descriptive message
undefined symbol foo, or whatever message we emit if you use a variable that doesn't exist. A function definition bar inside of begin/end declare variant is *not* a function bar. It is a variant of a base function that exists or that we assume to exist (=implicitly declare).
Does the user of this function expect that BaseFD can be nullptr after this change?