Change self/_cmd to be instances of ImplicitParamDecl instead of ParmVarDecl.
Patch by David Chisnall!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52422 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index dbe476d..a2b39c4 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -40,6 +40,12 @@
}
+ImplicitParamDecl *ImplicitParamDecl::Create(ASTContext &C, DeclContext *DC,
+ SourceLocation L, IdentifierInfo *Id, QualType T, ScopedDecl *PrevDecl) {
+ void *Mem = C.getAllocator().Allocate<ImplicitParamDecl>();
+ return new (Mem) ImplicitParamDecl(ImplicitParam, DC, L, Id, T, PrevDecl);
+}
+
VarDecl *VarDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
IdentifierInfo *Id, QualType T,
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index 296304a..89c61ae 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -206,6 +206,7 @@
case ObjCPropertyImpl: nObjCPropertyImplDecl++; break;
case LinkageSpec: nLinkageSpecDecl++; break;
case FileScopeAsm: nFileScopeAsmDecl++; break;
+ case ImplicitParam:
case TranslationUnit: break;
// FIXME: Statistics for C++ decls.
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 496afd6..e18c27c 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -389,10 +389,12 @@
if (cast<ArraySubscriptExpr>(this)->getBase()->getType()->isVectorType())
return cast<ArraySubscriptExpr>(this)->getBase()->isLvalue();
return LV_Valid;
- case DeclRefExprClass: // C99 6.5.1p2
- if (isa<VarDecl>(cast<DeclRefExpr>(this)->getDecl()))
+ case DeclRefExprClass: { // C99 6.5.1p2
+ const Decl *RefdDecl = cast<DeclRefExpr>(this)->getDecl();
+ if (isa<VarDecl>(RefdDecl) || isa<ImplicitParamDecl>(RefdDecl))
return LV_Valid;
break;
+ }
case MemberExprClass: { // C99 6.5.2.3p4
const MemberExpr *m = cast<MemberExpr>(this);
return m->isArrow() ? LV_Valid : m->getBase()->isLvalue();