Commit Graph

7 Commits

Author SHA1 Message Date
Rafael Espindola 1a7902c767 Add a testcase for a recent regression.
Thanks to Bill Wendling for the original testcase.

llvm-svn: 180586
2013-04-26 00:29:11 +00:00
Eli Friedman 839192fd29 Change linkage computation so it doesn't depend on FunctionDecl::isExternC or VarDecl::isExternC, and instead queries what it actually cares about: whether the given declaration is inside an extern "C" context. Fundamentally, figuring out whether a function/variable uses C linkage requires knowing the linkage, and the logic in FunctionDecl::isExternC and VarDecl::isExternC was getting it wrong. Given that, fix FunctionDecl::isExternC and VarDecl::isExternC to use much simpler implementations that depend on the fixed linkage computation.
Fixes a regression to test/SemaCXX/linkage.cpp caused by a new warning exposing the fact that the internal state was wrong.

llvm-svn: 148207
2012-01-15 01:23:58 +00:00
Eli Friedman c09e0557a5 Progress towards making isUsed() reflect whether a declaration is odr-used; don't set isUsed for local variables which are referenced in unevaluated contexts. Make other code use isReferenced() (which basically indicates that a declaration isn't dead) where appropriate.
I was forced to change test/SemaCXX/linkage.cpp because we aren't actually modeling extern "C" in the AST the way that testcase expects; we were not printing a warning only because we skipped the relevant check.  Someone who actually understands the semantics here should fix that.

llvm-svn: 148158
2012-01-13 23:41:25 +00:00
Chandler Carruth 4322a2864e Fix the rest of PR9316 along with some other bugs spotted by inspection.
I tried to add test cases for these, but I can't because variables
aren't warned on the way functions are and the codegen layer appears to
use different logic for determining that 'a' and 'g' in the test case
should receive C mangling. I've included the test so that if we ever
switch the codegen layer to use these functions, we won't regress due to
latent bugs.

llvm-svn: 126453
2011-02-25 00:05:02 +00:00
Chandler Carruth 9682a2fd3a Likely fix for PR9316 and other unknown bugs: don't use the anonynmous
namespace blanket rule for variables and functions declared 'extern
"C"'.

llvm-svn: 126400
2011-02-24 19:03:39 +00:00
John McCall f768aa7613 Move the check that gives functions with unique-external types unique-external
linkage into Decl.cpp.  Disable this logic for extern "C" functions, because
the operative rule there is weaker.  Fixes rdar://problem/8898466

llvm-svn: 125268
2011-02-10 06:50:24 +00:00
John McCall 53c72e71cc Test case accidentally left out of my last commit.
llvm-svn: 125119
2011-02-08 22:28:39 +00:00