[PATCH] D31673: Allow casting C pointers declared using extern "C" to ObjC pointer types
Akira Hatanaka via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 10 11:07:53 PDT 2017
ahatanak added inline comments.
================
Comment at: lib/Sema/SemaExprObjC.cpp:3358
var &&
- var->getStorageClass() == SC_Extern &&
+ !var->isThisDeclarationADefinition() &&
var->getType().isConstQualified()) {
----------------
rjmccall wrote:
> ahatanak wrote:
> > rjmccall wrote:
> > > Hmm. Come to think of it, I wonder if we actually care whether the variable has a definition, given that it's const.
> > >
> > > Well, we can consider that later. I agree that this change is good.
> > If we don't care whether the variable is a definition, it's possible to check whether the variable declaration is directly contained in a language linkage instead (using a function like isSingleLineLanguageLinkage in lib/AST/Decl.cpp).
> Nah, let's keep it simple for now.
>
> Well, maybe the rule ought to be "does a definition exist?" rather than "is the specific declaration that lookup found a definition?"
I think you are right. Changed it to a call to hasDefinition.
https://reviews.llvm.org/D31673
More information about the cfe-commits
mailing list