summaryrefslogtreecommitdiffstats
path: root/clang/Sema
diff options
context:
space:
mode:
Diffstat (limited to 'clang/Sema')
-rw-r--r--clang/Sema/Sema.h2
-rw-r--r--clang/Sema/SemaDecl.cpp19
-rw-r--r--clang/Sema/SemaStmt.cpp2
3 files changed, 12 insertions, 11 deletions
diff --git a/clang/Sema/Sema.h b/clang/Sema/Sema.h
index 30953083547..1e74321fd9e 100644
--- a/clang/Sema/Sema.h
+++ b/clang/Sema/Sema.h
@@ -165,7 +165,7 @@ private:
DeclTy **Elements, unsigned NumElements);
private:
/// Subroutines of ParseDeclarator()...
- TypedefDecl *ParseTypedefDecl(Scope *S, Declarator &D, Decl *LastDeclarator);
+ TypedefDecl *ParseTypedefDecl(Scope *S, Declarator &D, ScopedDecl *LastDecl);
TypedefDecl *MergeTypeDefDecl(TypedefDecl *New, ScopedDecl *Old);
FunctionDecl *MergeFunctionDecl(FunctionDecl *New, ScopedDecl *Old);
VarDecl *MergeVarDecl(VarDecl *New, ScopedDecl *Old);
diff --git a/clang/Sema/SemaDecl.cpp b/clang/Sema/SemaDecl.cpp
index 97e8e07aafb..1a808f87b4c 100644
--- a/clang/Sema/SemaDecl.cpp
+++ b/clang/Sema/SemaDecl.cpp
@@ -430,8 +430,8 @@ bool Sema::CheckInitializer(Expr *&Init, QualType &DeclType, bool isStatic) {
}
Sema::DeclTy *
-Sema::ParseDeclarator(Scope *S, Declarator &D, DeclTy *lastDeclarator) {
- Decl *LastDeclarator = (Decl*)lastDeclarator;
+Sema::ParseDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) {
+ ScopedDecl *LastDeclarator = dyn_cast_or_null<ScopedDecl>((Decl *)lastDecl);
IdentifierInfo *II = D.getIdentifier();
// All of these full declarators require an identifier. If it doesn't have
@@ -608,16 +608,17 @@ void Sema::AddInitializerToDecl(DeclTy *dcl, ExprTy *init) {
/// The declarators are chained together backwards, reverse the list.
Sema::DeclTy *Sema::FinalizeDeclaratorGroup(Scope *S, DeclTy *group) {
// Often we have single declarators, handle them quickly.
- Decl *Group = static_cast<Decl*>(group);
- if (Group == 0)
+ Decl *GroupDecl = static_cast<Decl*>(group);
+ if (GroupDecl == 0)
return 0;
-
- Decl *NewGroup = 0;
+
+ ScopedDecl *Group = dyn_cast<ScopedDecl>(GroupDecl);
+ ScopedDecl *NewGroup = 0;
if (Group->getNextDeclarator() == 0)
NewGroup = Group;
else { // reverse the list.
while (Group) {
- Decl *Next = Group->getNextDeclarator();
+ ScopedDecl *Next = Group->getNextDeclarator();
Group->setNextDeclarator(NewGroup);
NewGroup = Group;
Group = Next;
@@ -625,7 +626,7 @@ Sema::DeclTy *Sema::FinalizeDeclaratorGroup(Scope *S, DeclTy *group) {
}
// Perform semantic analysis that depends on having fully processed both
// the declarator and initializer.
- for (Decl *ID = NewGroup; ID; ID = ID->getNextDeclarator()) {
+ for (ScopedDecl *ID = NewGroup; ID; ID = ID->getNextDeclarator()) {
VarDecl *IDecl = dyn_cast<VarDecl>(ID);
if (!IDecl)
continue;
@@ -846,7 +847,7 @@ Decl *Sema::ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D,
- Decl *LastDeclarator) {
+ ScopedDecl *LastDeclarator) {
assert(D.getIdentifier() && "Wrong callback for declspec without declarator");
QualType T = GetTypeForDeclarator(D, S);
diff --git a/clang/Sema/SemaStmt.cpp b/clang/Sema/SemaStmt.cpp
index 2e7e7539858..7b544a28074 100644
--- a/clang/Sema/SemaStmt.cpp
+++ b/clang/Sema/SemaStmt.cpp
@@ -481,7 +481,7 @@ Sema::ParseForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
if (DeclStmt *DS = dyn_cast_or_null<DeclStmt>(First)) {
// C99 6.8.5p3: The declaration part of a 'for' statement shall only declare
// identifiers for objects having storage class 'auto' or 'register'.
- for (Decl *D = DS->getDecl(); D; D = D->getNextDeclarator()) {
+ for (ScopedDecl *D = DS->getDecl(); D; D = D->getNextDeclarator()) {
BlockVarDecl *BVD = dyn_cast<BlockVarDecl>(D);
if (BVD && !BVD->hasLocalStorage())
BVD = 0;
OpenPOWER on IntegriCloud