[Sema] Mark target of __attribute__((alias("target"))) used for C
authorNick Desaulniers <ndesaulniers@google.com>
Wed, 9 Jan 2019 23:54:55 +0000 (23:54 +0000)
committerNick Desaulniers <ndesaulniers@google.com>
Wed, 9 Jan 2019 23:54:55 +0000 (23:54 +0000)
commit9b9fe4166f521eb8b1c3da16bb30a02be08398fa
treee5a9b1db6e72a89e1be484ebf62d14e4d349910b
parentd4e7a0d83ca785925a4f8c82d114377f5b156bbf
[Sema] Mark target of __attribute__((alias("target"))) used for C

Summary:
Prevents -Wunneeded-internal-delcaration warnings when the target has no
other references. This occurs frequently in device drivers in the Linux
kernel.

Sema would need to invoke the demangler on the target, since in C++ the
target name is mangled:

int f() { return 42; }
int g() __attribute__((alias("_Z1fv")));

Sema does not have the ability to demangle names at this time.

https://bugs.llvm.org/show_bug.cgi?id=39088
https://github.com/ClangBuiltLinux/linux/issues/232

Reviewers: rsmith, rjmccall

Reviewed By: rsmith

Subscribers: erik.pilkington, cfe-commits, pirama, srhines

Differential Revision: https://reviews.llvm.org/D54188

llvm-svn: 350776
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/Sema/alias-unused.c [new file with mode: 0644]