-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GAIAPLAT-672] Add type safety to connect/disconnect params #816
Changes from all commits
4de12ab
577342a
265670e
bfdb21b
fe10491
73a1bf1
a8a7167
cd75876
e4fc06a
0266218
e65fe59
c905181
3bcd219
89e4a5b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11323,36 +11323,32 @@ static void DiagnoseRecursiveConstFields(Sema &S, const Expr *E, | |
static bool CheckForModifiableLvalue(Expr *E, SourceLocation Loc, Sema &S) { | ||
assert(!E->hasPlaceholderType(BuiltinType::PseudoObject)); | ||
|
||
if (S.getLangOpts().Gaia && S.getCurScope()->isInRulesetScope()) | ||
{ | ||
DeclRefExpr *exp = dyn_cast<DeclRefExpr>(E); | ||
if (S.getLangOpts().Gaia && S.getCurScope()->isInRulesetScope()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: why are these spaces here? clang-format goof or just typos? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are not running |
||
{ | ||
DeclRefExpr* exp = dyn_cast<DeclRefExpr>(E); | ||
|
||
if (exp != nullptr) | ||
{ | ||
ValueDecl *decl = exp->getDecl(); | ||
if (exp == nullptr) | ||
{ | ||
MemberExpr* memberExp = dyn_cast<MemberExpr>(E); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It has the same semantic but works differently, it does not require v-tables. https://stackoverflow.com/a/12083335/1214125. It seems the standard across the LLVM/Clang codebase hence I'm sticking to it. I honestly don't know what is the advantage of not using v-tables, I assume is performance... |
||
|
||
if (decl->hasAttr<GaiaFieldAttr>() || | ||
decl->hasAttr<GaiaFieldValueAttr>() || | ||
decl->hasAttr<FieldTableAttr>()) | ||
{ | ||
decl->addAttr(GaiaFieldLValueAttr::CreateImplicit(S.Context)); | ||
} | ||
} | ||
else | ||
{ | ||
MemberExpr *memberExp = dyn_cast<MemberExpr>(E); | ||
if (memberExp != nullptr) | ||
{ | ||
ValueDecl *decl = memberExp->getMemberDecl(); | ||
if (decl->hasAttr<GaiaFieldAttr>() || | ||
decl->hasAttr<GaiaFieldValueAttr>() || | ||
decl->hasAttr<FieldTableAttr>()) | ||
{ | ||
decl->addAttr(GaiaFieldLValueAttr::CreateImplicit(S.Context)); | ||
} | ||
} | ||
} | ||
} | ||
if (memberExp != nullptr) | ||
{ | ||
exp = dyn_cast<DeclRefExpr>(memberExp->getBase()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't know the class relationships here, but can't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to the MemeberExpr constructor, it can't be (it would throw SegFault if Base was If There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Base may be non nullptr but it may be not of DeclRefExpr type so dyn_cast may return nullptr |
||
} | ||
} | ||
|
||
if (exp != nullptr) | ||
{ | ||
ValueDecl* decl = exp->getDecl(); | ||
|
||
if (decl->hasAttr<GaiaFieldAttr>() | ||
|| decl->hasAttr<GaiaFieldValueAttr>() | ||
|| decl->hasAttr<FieldTableAttr>()) | ||
{ | ||
decl->addAttr(GaiaFieldLValueAttr::CreateImplicit(S.Context)); | ||
} | ||
} | ||
} | ||
|
||
S.CheckShadowingDeclModification(E, Loc); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment can go away now, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well no, this is related to the convention used to name the actual methods within
clang
.eg:
Apparently, clang people realized it too that they messed it up wrt naming, and they are trying to fix it in the upcoming releases... We could start by being consistent ourselves..