[llvm-dev] Why hasExternalLinkage() is not true for an external variable?
Eli Friedman via llvm-dev
llvm-dev at lists.llvm.org
Fri Jan 18 11:16:11 PST 2019
On 1/18/2019 8:57 AM, Peng Yu via llvm-dev wrote:
> Hi,
>
> I am trying to test whether an operand is external or not (code is
> shown below). The variable "U" should be a global variable. But
> hasExternalLinkage() returns 0 for it. Why is it so?
You probably want "!hasLocalLinkage()", or something like that.
hasExternalLinkage() specifically checks for "external" linkage, but
your variable has "common" linkage. See
http://llvm.org/docs/LangRef.html#linkage-types .
-Eli
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
More information about the llvm-dev
mailing list