From a558d5823a600af0da42b2d4b14bd9d2e24f623a Mon Sep 17 00:00:00 2001 From: Hal Finkel Date: Sun, 24 Aug 2014 04:50:19 +0000 Subject: [PATCH] Move __vector long deprecation checking into DeclSpec::Finish __vector long is deprecated, but __vector long long is not. As a result, we cannot check for __vector long (to issue the deprecation warning) as we parse the type because we need to know how many 'long's we have first. DeclSpec::Finish seems like a more-appropriate place to perform the check (which places it with several other similar Altivec vector checks). Fixes PR20720. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216342 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/DeclSpec.cpp | 9 +++------ test/Parser/altivec.c | 5 +++++ test/Parser/cxx-altivec.cpp | 5 +++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp index d7372b7a27..17dccc8d22 100644 --- a/lib/Sema/DeclSpec.cpp +++ b/lib/Sema/DeclSpec.cpp @@ -553,12 +553,6 @@ bool DeclSpec::SetTypeSpecWidth(TSW W, SourceLocation Loc, else if (W != TSW_longlong || TypeSpecWidth != TSW_long) return BadSpecifier(W, (TSW)TypeSpecWidth, PrevSpec, DiagID); TypeSpecWidth = W; - if (TypeAltiVecVector && !TypeAltiVecBool && - ((TypeSpecWidth == TSW_long) || (TypeSpecWidth == TSW_longlong))) { - PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType, Policy); - DiagID = diag::warn_vector_long_decl_spec_combination; - return true; - } return false; } @@ -978,6 +972,9 @@ void DeclSpec::Finish(DiagnosticsEngine &D, Preprocessor &PP, const PrintingPoli if ((TypeSpecType == TST_char) || (TypeSpecType == TST_int) || (TypeSpecWidth != TSW_unspecified)) TypeSpecSign = TSS_unsigned; + } else if (TypeSpecWidth == TSW_long) { + Diag(D, TSWLoc, diag::warn_vector_long_decl_spec_combination) + << getSpecifierName((TST)TypeSpecType, Policy); } if (TypeAltiVecPixel) { diff --git a/test/Parser/altivec.c b/test/Parser/altivec.c index 0b8147a3b7..a9b41b9b7a 100644 --- a/test/Parser/altivec.c +++ b/test/Parser/altivec.c @@ -78,6 +78,11 @@ vector bool unsigned int v_bsc2; // expected-error {{cannot use 'unsigned' w vector bool long v_bl; // expected-error {{cannot use 'long' with '__vector bool'}} vector bool long long v_bll; // expected-error {{cannot use 'long long' with '__vector bool'}} +// vector long is deprecated, but vector long long is not. +vector long long v_ll; +vector signed long long v_sll; +vector unsigned long long v_ull; + typedef char i8; typedef short i16; typedef int i32; diff --git a/test/Parser/cxx-altivec.cpp b/test/Parser/cxx-altivec.cpp index 565decc601..23a6acd86b 100644 --- a/test/Parser/cxx-altivec.cpp +++ b/test/Parser/cxx-altivec.cpp @@ -78,6 +78,11 @@ vector bool unsigned int v_bsc2; // expected-error {{cannot use 'unsigned' vector bool long v_bl; // expected-error {{cannot use 'long' with '__vector bool'}} vector bool long long v_bll; // expected-error {{cannot use 'long long' with '__vector bool'}} +// vector long is deprecated, but vector long long is not. +vector long long v_ll; +vector signed long long v_sll; +vector unsigned long long v_ull; + void f() { __vector unsigned int v = {0,0,0,0}; __vector int v__cast = (__vector int)v; -- 2.50.1