diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-03-18 16:10:52 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-03-18 16:10:52 +0000 |
commit | d6a49bb69fadcb04119433278c808797a87d2d31 (patch) | |
tree | 100ca1919bac1d488b62bb25f1cd9d5ffd43960e /lib/Sema/SemaDeclCXX.cpp | |
parent | 7693b1021862ea04f522cca9ca1df67bd1d2d54e (diff) |
Add an opt-in -Wheader-hygiene, which current diagnoses the use of
global using directives in C++ headers, from Elliot Glaysher!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127881 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 858a5f9251..8b7bbb6954 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -3922,6 +3922,12 @@ Decl *Sema::ActOnUsingDirective(Scope *S, UDir = UsingDirectiveDecl::Create(Context, CurContext, UsingLoc, NamespcLoc, SS.getWithLocInContext(Context), IdentLoc, Named, CommonAncestor); + + if (CurContext->getDeclKind() == Decl::TranslationUnit && + !SourceMgr.isFromMainFile(IdentLoc)) { + Diag(IdentLoc, diag::warn_using_directive_in_header); + } + PushUsingDirective(S, UDir); } else { Diag(IdentLoc, diag::err_expected_namespace_name) << SS.getRange(); |