llvm-project/clang/test
Richard Sandiford 39969c7d3a [Sema][SVE] Reject sizeof and alignof for sizeless types
clang current accepts:

  void foo1(__SVInt8_t *x, __SVInt8_t *y) { *x = *y; }
  void foo2(__SVInt8_t *x, __SVInt8_t *y) {
    memcpy(y, x, sizeof(__SVInt8_t));
  }

The first function is valid ACLE code and generates correct LLVM IR.
However, the second function is invalid ACLE code and generates a
zero-length memcpy.  The point of this patch is to reject the use
of sizeof in the second case instead.

There's no similar wrong-code bug for alignof.  However, the SVE ACLE
conservatively treats alignof in the same way as sizeof, just as the
C++ standard does for incomplete types.  The idea is that layout of
sizeless types is an implementation property and isn't defined at
the language level.

Implementation-wise, the patch adds a new CompleteTypeKind enum
that controls whether RequireCompleteType & friends accept sizeless
built-in types.  For now the default is to maintain the status quo
and accept sizeless types.  However, the end of the series will flip
the default and remove the Default enum value.

The patch also adds new ...CompleteSized... wrappers that callers can
use if they explicitly want to reject sizeless types.  The callers then
use diagnostics that have an extra 0/1 parameter to indicats whether
the type is sizeless or not.

The idea is to have three cases:

1. calls that explicitly reject sizeless types, with a tweaked diagnostic
   for the sizeless case

2. calls that explicitly allow sizeless types

3. normal/old-style calls that don't make an explicit choice either way

Once the default is flipped, the 3. calls will conservatively reject
sizeless types, using the same diagnostic as for other incomplete types.

Differential Revision: https://reviews.llvm.org/D75572
2020-03-12 17:06:53 +00:00
..
ARCMT
AST [clang] Prune 'IsOMPStructuredBlock' Stmt bit 2020-03-12 14:48:57 +03:00
ASTMerge
Analysis Add triple for non-x86 environments. 2020-03-10 15:26:03 -07:00
CXX [Sema][C++] Propagate conversion kind to specialize the diagnostics 2020-02-25 16:05:37 +00:00
ClangScanDeps [clang][clang-scan-deps] Aggregate the full dependency information. 2020-01-23 16:58:50 -08:00
CodeCompletion Another fix for 7d91633a2b 2020-02-19 17:15:11 -05:00
CodeGen [ARM,MVE] Add intrinsics and isel for MVE fused multiply-add. 2020-03-12 11:13:50 +00:00
CodeGenCUDA [HIP] Fix device stub name 2020-03-09 16:40:05 -04:00
CodeGenCXX Reland "[DebugInfo] Enable the debug entry values feature by default" 2020-03-10 09:15:06 +01:00
CodeGenCoroutines [Coroutines][New pass manager] Move CoroElide pass to right position 2020-03-01 21:48:24 +08:00
CodeGenHIP Don't dump IR output from this test to stdout. 2020-01-16 19:19:45 -08:00
CodeGenObjC Fix conflict value for metadata "Objective-C Garbage Collection" in the mix of swift and Objective-C bitcode 2020-03-11 13:26:06 -07:00
CodeGenObjCXX Fix the type of the capture passed to LambdaIntroducer::addCapture in 2020-03-09 12:25:28 -07:00
CodeGenOpenCL Recommit #2 "[Driver] Default to -fno-common for all targets" 2020-03-09 19:57:03 +00:00
CodeGenOpenCLCXX
Coverage
CoverageMapping Reland: [Coverage] Revise format to reduce binary size 2020-02-28 18:12:04 -08:00
Driver [CUDA] Warn about unsupported CUDA SDK version only if it's used. 2020-03-12 10:04:10 -07:00
FixIt [objc_direct] Small updates to help with adoption. 2020-02-16 16:32:41 -08:00
Format
Frontend Recommit #2 "[Driver] Default to -fno-common for all targets" 2020-03-09 19:57:03 +00:00
Headers [ARM,CDE] Generalize MVE intrinsics infrastructure to support CDE 2020-03-10 14:03:16 +00:00
Import [CodeGen] Emit destructor calls to destruct compound literals 2020-03-10 14:08:28 -07:00
Index [Index/USRGeneration] Make sure that ObjC properties in categories also get namescoped properly for USR generation 2020-03-07 15:07:37 -08:00
Integration
InterfaceStubs [clang][IFS][test] Temporary work around for in-process cc1 ASAN issues. 2020-01-21 22:56:20 -05:00
Layout
Lexer Add -std=c++20 flag, replace C++2a with C++20 throughout the Clang 2020-02-18 16:16:37 -08:00
Misc [ARM,CDE] Generalize MVE intrinsics infrastructure to support CDE 2020-03-10 14:03:16 +00:00
Modules Revert "[modules] Do not cache invalid state for modules that we attempted to load." 2020-03-10 10:59:26 -07:00
OpenMP [OPENMP]Fix PR45132: OpenMP doacross loop nest with a decreasing 2020-03-10 12:13:58 -04:00
PCH [clang] Prune 'IsOMPStructuredBlock' Stmt bit 2020-03-12 14:48:57 +03:00
Parser Recommit #2 "[Driver] Default to -fno-common for all targets" 2020-03-09 19:57:03 +00:00
Preprocessor [ARM,CDE] Implement CDE feature test macros 2020-03-09 16:14:06 +00:00
Profile Reland: [Coverage] Revise format to reduce binary size 2020-02-28 18:12:04 -08:00
Refactor
Rewriter
Sema [Sema][SVE] Reject sizeof and alignof for sizeless types 2020-03-12 17:06:53 +00:00
SemaCUDA Revert "[CUDA][HIP][OpenMP] Emit deferred diagnostics by a post-parsing AST travese" 2020-02-18 14:45:34 -05:00
SemaCXX [Sema][SVE] Reject sizeof and alignof for sizeless types 2020-03-12 17:06:53 +00:00
SemaObjC [CodeGen] Emit destructor calls to destruct compound literals 2020-03-10 14:08:28 -07:00
SemaObjCXX [Sema][C++] Propagate conversion kind to specialize the diagnostics 2020-02-25 16:05:37 +00:00
SemaOpenCL [Sema][C++] Propagate conversion kind to specialize the diagnostics 2020-02-25 16:05:37 +00:00
SemaOpenCLCXX [OpenCL] Restrict addr space conversions in nested pointers 2020-02-07 12:04:35 +00:00
SemaSYCL [SYCL] Driver option to select SYCL version 2020-03-07 18:28:54 +03:00
SemaTemplate PR45083: Mark statement expressions as being dependent if they appear in 2020-03-10 14:45:04 -07:00
TableGen
Templight
Tooling [PowerPC] Delete PPCMachObjectWriter and powerpc{,64}-apple-darwin 2020-03-05 11:05:26 -08:00
Unit
VFS [VFS] More consistent support for Windows 2020-02-05 11:38:20 -08:00
clang-rename [clang-rename] Fix the failure rename test. 2020-02-11 10:07:00 +01:00
utils/update_cc_test_checks Move update_cc_test_checks.py tests to clang 2020-02-14 14:39:55 +00:00
.clang-format
CMakeLists.txt Revert abb00753 "build: reduce CMake handling for zlib" (PR44780) 2020-03-03 11:03:09 +01:00
TestRunner.sh
cxx-sections.data
lit.cfg.py Quote a python executable path 2020-03-04 15:23:48 +00:00
lit.site.cfg.py.in Revert abb00753 "build: reduce CMake handling for zlib" (PR44780) 2020-03-03 11:03:09 +01:00
make_test_dirs.pl