[PATCH] D53787: [Sema] Use proper visibility for global new and delete declarations

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 29 17:41:57 PDT 2018


rnk added a comment.

This seems pretty inconsistent with how -fvisibility=hidden behaves with normal, user written declarations. Consider this code:

  void foo();
  void bar() { foo(); }

We get this IR:

  $ clang -S -emit-llvm --target=x86_64-linux t.c -o - -fvisibility=hidden
  ...
  define hidden void @bar() #0 {
  entry:
    call void @foo()
    ret void
  }
  declare dso_local void @foo() #1

Basically, declarations are never marked hidden, only definitions are. This is because system headers are not explicitly marked with default visibility annotations, and you still want to be able to call libc from code compiled with -fvisibility=hidden.

I'm... kind of surprised we have code to explicitly mark these declarations with default visibility attributes.


Repository:
  rC Clang

https://reviews.llvm.org/D53787





More information about the cfe-commits mailing list