diff options
| author | John McCall <rjmccall@apple.com> | 2009-12-11 02:10:03 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2009-12-11 02:10:03 +0000 |
| commit | a009726ce3a05bf7412c7f6beefeda3c12788432 (patch) | |
| tree | d2cdae55454f784f8e3403d70ac4ba4960ef2662 /clang/lib/Sema | |
| parent | 56caf31afb5ffed870a2b970a87291019f1aeb24 (diff) | |
| download | bcm5719-llvm-a009726ce3a05bf7412c7f6beefeda3c12788432.tar.gz bcm5719-llvm-a009726ce3a05bf7412c7f6beefeda3c12788432.zip | |
Implement access declarations. Most of the work here is parsing them, which
is difficult because they're so terribly, terribly ambiguous.
We implement access declarations in terms of using declarations, which is
quite reasonable. However, we should really persist the access/using
distinction in the AST and use the appropriate name in diagnostics. This
isn't a priority, so I'll just file a PR and hope someone else does it. :)
llvm-svn: 91095
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/Sema.h | 1 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h index 88de8da2b38..aed7a9bc848 100644 --- a/clang/lib/Sema/Sema.h +++ b/clang/lib/Sema/Sema.h @@ -1768,6 +1768,7 @@ public: virtual DeclPtrTy ActOnUsingDeclaration(Scope *CurScope, AccessSpecifier AS, + bool HasUsingKeyword, SourceLocation UsingLoc, const CXXScopeSpec &SS, UnqualifiedId &Name, diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 70ee24c68e8..75021c28509 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -2876,6 +2876,7 @@ void Sema::PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir) { Sema::DeclPtrTy Sema::ActOnUsingDeclaration(Scope *S, AccessSpecifier AS, + bool HasUsingKeyword, SourceLocation UsingLoc, const CXXScopeSpec &SS, UnqualifiedId &Name, @@ -2914,6 +2915,18 @@ Sema::DeclPtrTy Sema::ActOnUsingDeclaration(Scope *S, if (!TargetName) return DeclPtrTy(); + // Warn about using declarations. + // TODO: store that the declaration was written without 'using' and + // talk about access decls instead of using decls in the + // diagnostics. + if (!HasUsingKeyword) { + UsingLoc = Name.getSourceRange().getBegin(); + + Diag(UsingLoc, diag::warn_access_decl_deprecated) + << CodeModificationHint::CreateInsertion(SS.getRange().getBegin(), + "using "); + } + NamedDecl *UD = BuildUsingDeclaration(S, AS, UsingLoc, SS, Name.getSourceRange().getBegin(), TargetName, AttrList, |

