[PATCH] D53153: [OpenCL] Mark namespace scope variables and kernel functions with default visibility
Scott Linder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 12 12:28:41 PDT 2018
scott.linder added a comment.
That's my understanding, at least.
Take for example:
$ cat foo.c
static void foo() { }
void bar() { }
void baz() { bar(); foo(); }
$ clang -fvisibility=protected -O0 -S -emit-llvm foo.c -o -
...
; Function Attrs: noinline nounwind optnone uwtable
define protected void @bar() #0 {
entry:
ret void
}
; Function Attrs: noinline nounwind optnone uwtable
define protected void @baz() #0 {
entry:
call void @bar()
call void @foo()
ret void
}
; Function Attrs: noinline nounwind optnone uwtable
define internal void @foo() #0 {
entry:
ret void
}
...
Here `foo` has default visibility, while the user asked for protected. I still do not completely understand the interaction between linkage and visibility, as Clang gives default visibility to any symbol with internal linkage.
https://reviews.llvm.org/D53153
More information about the cfe-commits
mailing list