LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 39630 - llvm-undname sometimes drops a "const"
Summary: llvm-undname sometimes drops a "const"
Status: RESOLVED WONTFIX
Alias: None
Product: new-bugs
Classification: Unclassified
Component: new bugs (show other bugs)
Version: unspecified
Hardware: PC All
: P enhancement
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-11 13:08 PST by Nico Weber
Modified: 2018-11-12 03:12 PST (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nico Weber 2018-11-11 13:08:34 PST
$ bin/llvm-undname '?wrapper_type_info_@WorkletGlobalScope@blink@@0ABUWrapperTypeInfo@2@B'
?wrapper_type_info_@WorkletGlobalScope@blink@@0ABUWrapperTypeInfo@2@B
private: static struct blink::WrapperTypeInfo const &blink::WorkletGlobalScope::wrapper_type_info_


But regular undname prints:

private: static struct blink::WrapperTypeInfo const & const blink::WorkletGlobalScope::wrapper_type_info_

(`const &` vs `const & const`)

There are a bunch of similar examples, also with `const *` vs `const * const`, in blink_core.dll.
Comment 1 Zachary Turner 2018-11-11 13:20:59 PST
I’m not sure if this is the same case, but there’s at least one instance of this “bug” where llvm-undname is correct and undname is wrong.  See the tests, i even left a comment about it in the test file.  If this is the same thing, we should close this one since I believe the bug to be in undname.
Comment 2 Nico Weber 2018-11-12 03:12:31 PST
I'm willing to believe it's an undname bug :-) The wine implementation of _unDName has it too fwiw.

I tried finding the test case you mention but failed.

...aha, but here's a from-source repro that shows you're right:

$ cat test.cc
struct S {};

struct T {
  static const S* s_;

  const S* s();
  void set(const S* s);
};

const S* T::s() { return s_; }
void T::set(const S* s) { s_ = s; }


$ third_party/llvm-build/Release+Asserts/bin/clang-cl /c test.cc /Fa -Xclang -emit-llvm 2&>1 > /dev/null ; cat test.asm | grep s_
@"?s_@T@@2PEBUS@@EB" = external dso_local global %struct.S*, align 8
  %0 = load %struct.S*, %struct.S** @"?s_@T@@2PEBUS@@EB", align 8
  store %struct.S* %0, %struct.S** @"?s_@T@@2PEBUS@@EB", align 8


$ demumble '?s_@T@@2PEBUS@@EB'  # currently uses wine _unDName()
public: static struct S const * __ptr64 const __ptr64 T::s_


$ bin/llvm-undname '?s_@T@@2PEBUS@@EB'
?s_@T@@2PEBUS@@EB
public: static struct S const *T::s_