diff options
author | Francois Pichet <pichet2000@gmail.com> | 2011-10-11 01:50:09 +0000 |
---|---|---|
committer | Francois Pichet <pichet2000@gmail.com> | 2011-10-11 01:50:09 +0000 |
commit | 9a57fb573442a8990e8401029363cdc9ef2e5680 (patch) | |
tree | 44229e55f3bf3100ed98f91a3fb87ad73e32847e /clang/lib/Sema/SemaDecl.cpp | |
parent | 32fc9601a16d974e5455f1dc02a9e16fdaeb623b (diff) | |
download | bcm5719-llvm-9a57fb573442a8990e8401029363cdc9ef2e5680.tar.gz bcm5719-llvm-9a57fb573442a8990e8401029363cdc9ef2e5680.zip |
[Microsoft] If -fms-compatibility, then downgrade missing typename error to warning at function prototype scope.
llvm-svn: 141630
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index b510091ffac..d19023d0455 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -317,7 +317,7 @@ DeclSpec::TST Sema::isTagName(IdentifierInfo &II, Scope *S) { /// A<T>::TYPE a; // no typename required because A<T> is a base class. /// }; /// @endcode -bool Sema::isMicrosoftMissingTypename(const CXXScopeSpec *SS) { +bool Sema::isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S) { if (CurContext->isRecord()) { const Type *Ty = SS->getScopeRep()->getAsType(); @@ -326,8 +326,9 @@ bool Sema::isMicrosoftMissingTypename(const CXXScopeSpec *SS) { BaseEnd = RD->bases_end(); Base != BaseEnd; ++Base) if (Context.hasSameUnqualifiedType(QualType(Ty, 1), Base->getType())) return true; + return S->isFunctionPrototypeScope(); } - return CurContext->isFunctionOrMethod(); + return CurContext->isFunctionOrMethod() || S->isFunctionPrototypeScope(); } bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II, @@ -409,7 +410,7 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II, << &II << DC << SS->getRange(); else if (isDependentScopeSpecifier(*SS)) { unsigned DiagID = diag::err_typename_missing; - if (getLangOptions().MicrosoftMode && isMicrosoftMissingTypename(SS)) + if (getLangOptions().MicrosoftMode && isMicrosoftMissingTypename(SS, S)) DiagID = diag::warn_typename_missing; Diag(SS->getRange().getBegin(), DiagID) |