diff options
Diffstat (limited to 'clang/Sema')
-rw-r--r-- | clang/Sema/SemaDecl.cpp | 11 | ||||
-rw-r--r-- | clang/Sema/SemaExpr.cpp | 4 |
2 files changed, 14 insertions, 1 deletions
diff --git a/clang/Sema/SemaDecl.cpp b/clang/Sema/SemaDecl.cpp index df6dd5c2e18..26528485db1 100644 --- a/clang/Sema/SemaDecl.cpp +++ b/clang/Sema/SemaDecl.cpp @@ -255,6 +255,8 @@ FunctionDecl *Sema::MergeFunctionDecl(FunctionDecl *New, ScopedDecl *OldD) { Diag(OldD->getLocation(), diag::err_previous_definition); return New; } + + // FIXME: propagate old Attrs to the New decl QualType OldQType = Old->getCanonicalType(); QualType NewQType = New->getCanonicalType(); @@ -1778,6 +1780,9 @@ void Sema::HandleDeclAttribute(Decl *New, AttributeList *Attr) { vDecl->setType(newType); } break; + case AttributeList::AT_deprecated: + New->addAttr(new DeprecatedAttr()); + break; case AttributeList::AT_aligned: HandleAlignedAttribute(New, Attr); break; @@ -1791,7 +1796,11 @@ void Sema::HandleDeclAttribute(Decl *New, AttributeList *Attr) { HandleNoReturnAttribute(New, Attr); break; default: - // FIXME: add other attributes... +#if 0 + // TODO: when we have the full set of attributes, warn about unknown ones. + Diag(Attr->getLoc(), diag::warn_attribute_ignored, + Attr->getName()->getName()); +#endif break; } } diff --git a/clang/Sema/SemaExpr.cpp b/clang/Sema/SemaExpr.cpp index 3d60866c015..5b5b2d235ce 100644 --- a/clang/Sema/SemaExpr.cpp +++ b/clang/Sema/SemaExpr.cpp @@ -100,6 +100,10 @@ Sema::ExprResult Sema::ActOnIdentifierExpr(Scope *S, SourceLocation Loc, } } if (ValueDecl *VD = dyn_cast<ValueDecl>(D)) { + // check if referencing an identifier with __attribute__((deprecated)). + if (VD->getAttr<DeprecatedAttr>()) + Diag(Loc, diag::warn_deprecated, VD->getName()); + // Only create DeclRefExpr's for valid Decl's. if (VD->isInvalidDecl()) return true; |