You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
opencode-go/omen-alpha responding of behalf of @lm-sousa
Summary
Clava's $call.declaration.qualifiedName reports the canonical declaration's qualified name, so when user code references a function through a standard-library alias, the alias is lost and the reported name depends on which STL Clava was compiled against. Concretely:
auto a = std::chrono::high_resolution_clock::now();
reports:
std::chrono::system_clock::now when <chrono> resolves via libstdc++ (Linux, and Windows while the bundled clang used libstdc++ headers)
std::chrono::steady_clock::now via libc++ (macOS)
std::chrono::steady_clock::now via MSVC STL (Windows with the current clang 18 dumper build)
There is no way for a Clava script to recover the name as written in the source (std::chrono::high_resolution_clock::now), even though that information exists in the AST (MemberExpr's nested-name-specifier spells the alias).
Why this matters
This is not just cosmetic — it makes goldens and platform behavior diverge. The legacy integration test Setters currently needs platform-specific result files purely because of this (ClavaWeaver/resources/clava/test/weaver/cpp/results/Setters.js.txt expects system_clock, Setters.js.macos.txt expects steady_clock, and there is no windows file — the windows MSVC resolution is why Setters fails on the windows-latest CI jobs of the current stacked branches, e.g. PR #258's base).
If the weaver exposed the source-spelled qualified name, a single golden (high_resolution_clock::now) would be valid on every platform.
Root cause
The pipeline loses the alias before the weaver ever sees it:
The clang-dumper emits the declaration's qualified prefix using clang's canonical semantics (Decl::getQualifiedNameAsString()), which walks through typedefs/using-aliases. In the clang AST there is no declaration named high_resolution_clock::now — high_resolution_clock is an alias, so the canonical decl genuinely is system_clock::now/steady_clock::now.
ClangAstParser stores that string verbatim (DeclDataParser.parseNamedDeclData, NamedDecl.QUALIFIED_PREFIX).
The weaver concatenates it (ANamedDecl.getQualifiedNameImpl() / NamedDecl.getFullyQualifiedName()).
Alias information only exists at the reference site: a MemberExpr's qualifier spelling. The declaration itself is shared by all references and cannot report three different names — so the fix belongs at the call/reference level, not on the decl attribute (which must stay canonical for setQualifiedName/setQualifiedPrefix renaming to work).
Proposed fix
clang-dumper: for call/reference nodes, also emit the source-spelled qualified name (or qualifier) taken from the MemberExpr/DeclRefExpr nested-name-specifier.
ClavaWeaver: expose it on the Call join point (e.g. a source-spelled qualifiedName/name attribute alongside declaration, which keeps pointing at the canonical decl).
Notes
Behavior is consistent across clang 16 and 18 dumper builds; the clang 16 → 18 bump only changed which canonical decl the windows STL's alias chain resolves to, which is why the windows Setters failure appeared when the dumper release moved to v18.1.8_*.
Alternative interim mitigation for CI: add a windows-specific Setters result file mirroring the macOS one. The alias-preserving call attribute is the proper fix and would let those files be collapsed into one.
Note
opencode-go/omen-alpha responding of behalf of @lm-sousa
Summary
Clava's
$call.declaration.qualifiedNamereports the canonical declaration's qualified name, so when user code references a function through a standard-library alias, the alias is lost and the reported name depends on which STL Clava was compiled against. Concretely:auto a = std::chrono::high_resolution_clock::now();reports:
std::chrono::system_clock::nowwhen<chrono>resolves via libstdc++ (Linux, and Windows while the bundled clang used libstdc++ headers)std::chrono::steady_clock::nowvia libc++ (macOS)std::chrono::steady_clock::nowvia MSVC STL (Windows with the current clang 18 dumper build)There is no way for a Clava script to recover the name as written in the source (
std::chrono::high_resolution_clock::now), even though that information exists in the AST (MemberExpr's nested-name-specifier spells the alias).Why this matters
This is not just cosmetic — it makes goldens and platform behavior diverge. The legacy integration test
Setterscurrently needs platform-specific result files purely because of this (ClavaWeaver/resources/clava/test/weaver/cpp/results/Setters.js.txtexpectssystem_clock,Setters.js.macos.txtexpectssteady_clock, and there is no windows file — the windows MSVC resolution is whySettersfails on thewindows-latestCI jobs of the current stacked branches, e.g. PR #258's base).If the weaver exposed the source-spelled qualified name, a single golden (
high_resolution_clock::now) would be valid on every platform.Root cause
The pipeline loses the alias before the weaver ever sees it:
Decl::getQualifiedNameAsString()), which walks through typedefs/using-aliases. In the clang AST there is no declaration namedhigh_resolution_clock::now—high_resolution_clockis an alias, so the canonical decl genuinely issystem_clock::now/steady_clock::now.ClangAstParserstores that string verbatim (DeclDataParser.parseNamedDeclData,NamedDecl.QUALIFIED_PREFIX).ANamedDecl.getQualifiedNameImpl()/NamedDecl.getFullyQualifiedName()).Alias information only exists at the reference site: a
MemberExpr's qualifier spelling. The declaration itself is shared by all references and cannot report three different names — so the fix belongs at the call/reference level, not on the decl attribute (which must stay canonical forsetQualifiedName/setQualifiedPrefixrenaming to work).Proposed fix
MemberExpr/DeclRefExprnested-name-specifier.qualifiedName/nameattribute alongsidedeclaration, which keeps pointing at the canonical decl).Notes
Settersfailure appeared when the dumper release moved tov18.1.8_*.Settersresult file mirroring the macOS one. The alias-preserving call attribute is the proper fix and would let those files be collapsed into one.