diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-09-30 17:22:47 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-09-30 17:22:47 +0000 |
commit | abee2d789ce799ce9a5d611e13a1713090f305f3 (patch) | |
tree | 6a5f86ca93fbb43b674b258b9f99ada1d282a64d | |
parent | ba78cc0c6839d606f5ce8f023d822b500f84e6d3 (diff) |
Add diagnostic for .{lo,hi,e,o} on odd-sized extended vectors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56859 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Basic/DiagnosticKinds.def | 2 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/include/clang/Basic/DiagnosticKinds.def b/include/clang/Basic/DiagnosticKinds.def index 84aa391437..1e9580c3ce 100644 --- a/include/clang/Basic/DiagnosticKinds.def +++ b/include/clang/Basic/DiagnosticKinds.def @@ -678,6 +678,8 @@ DIAG(err_typecheck_ext_vector_not_typedef, ERROR, "ext_vector_type only applies to types, not variables") DIAG(err_ext_vector_component_exceeds_length, ERROR, "vector component access exceeds type '%0'") +DIAG(err_ext_vector_component_requires_even, ERROR, + "vector component access invalid for odd-sized type '%0'") DIAG(err_ext_vector_component_name_illegal, ERROR, "illegal vector component name '%0'") DIAG(err_ext_vector_component_access, ERROR, diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index b19da68abe..07428fdac7 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -846,6 +846,8 @@ CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc, // is an even number, since all special component names return exactly half // the elements. if (SpecialComponent && (vecType->getNumElements() & 1U)) { + Diag(OpLoc, diag::err_ext_vector_component_requires_even, + baseType.getAsString(), SourceRange(CompLoc)); return QualType(); } |