diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Parse/ParseDeclCXX.cpp | 4 | ||||
-rw-r--r-- | lib/Parse/ParseExpr.cpp | 7 | ||||
-rw-r--r-- | lib/Sema/DeclSpec.cpp | 8 |
3 files changed, 18 insertions, 1 deletions
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 45562d908c..7583ccafeb 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -587,6 +587,8 @@ Decl *Parser::ParseStaticAssertDeclaration(SourceLocation &DeclEnd){ if (Tok.is(tok::kw__Static_assert) && !getLang().C1X) Diag(Tok, diag::ext_c1x_static_assert); + if (Tok.is(tok::kw_static_assert)) + Diag(Tok, diag::warn_cxx98_compat_static_assert); SourceLocation StaticAssertLoc = ConsumeToken(); @@ -2401,6 +2403,8 @@ Parser::MaybeParseExceptionSpecification(SourceRange &SpecificationRange, if (Tok.isNot(tok::kw_noexcept)) return Result; + Diag(Tok, diag::warn_cxx98_compat_noexcept_decl); + // If we already had a dynamic specification, parse the noexcept for, // recovery, but emit a diagnostic and don't store the results. SourceRange NoexceptRange; diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index aa86bb4d71..83075ab5db 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -654,6 +654,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, return ParseCXXBoolLiteral(); case tok::kw_nullptr: + Diag(Tok, diag::warn_cxx98_compat_nullptr); return Actions.ActOnCXXNullPtrLiteral(ConsumeToken()); case tok::annot_primary_expr: @@ -1031,6 +1032,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, return ParseCXXDeleteExpression(false, Tok.getLocation()); case tok::kw_noexcept: { // [C++0x] 'noexcept' '(' expression ')' + Diag(Tok, diag::warn_cxx98_compat_noexcept_expr); SourceLocation KeyLoc = ConsumeToken(); BalancedDelimiterTracker T(*this, tok::l_paren); @@ -1537,7 +1539,10 @@ ExprResult Parser::ParseUnaryExprOrTypeTraitExpression() { *Name, NameLoc, RParenLoc); } - + + if (OpTok.is(tok::kw_alignof)) + Diag(OpTok, diag::warn_cxx98_compat_alignof); + bool isCastExpr; ParsedType CastTy; SourceRange CastRange; diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp index f0a763e4ec..18ecf9ef52 100644 --- a/lib/Sema/DeclSpec.cpp +++ b/lib/Sema/DeclSpec.cpp @@ -15,6 +15,7 @@ #include "clang/Sema/DeclSpec.h" #include "clang/Sema/LocInfoType.h" #include "clang/Sema/ParsedTemplate.h" +#include "clang/Sema/SemaDiagnostic.h" #include "clang/Sema/Sema.h" #include "clang/AST/ASTContext.h" #include "clang/AST/Expr.h" @@ -889,6 +890,13 @@ void DeclSpec::Finish(DiagnosticsEngine &D, Preprocessor &PP) { StorageClassSpec == SCS_auto) Diag(D, StorageClassSpecLoc, diag::warn_auto_storage_class) << FixItHint::CreateRemoval(StorageClassSpecLoc); + if (TypeSpecType == TST_char16 || TypeSpecType == TST_char32) + Diag(D, TSTLoc, diag::warn_cxx98_compat_unicode_type) + << (TypeSpecType == TST_char16 ? "char16_t" : "char32_t"); + if (TypeSpecType == TST_decltype) + Diag(D, TSTLoc, diag::warn_cxx98_compat_decltype); + if (Constexpr_specified) + Diag(D, ConstexprLoc, diag::warn_cxx98_compat_constexpr); // C++ [class.friend]p6: // No storage-class-specifier shall appear in the decl-specifier-seq |