llvm-project/clang/lib/Sema
Aaron Ballman 006c49d890 Change behavior with zero-sized static array extents
Currently, Clang previously diagnosed this code by default:
  void f(int a[static 0]);
saying that "static has no effect on zero-length arrays", which was
accurate.

However, static array extents require that the caller of the function
pass a nonnull pointer to an array of *at least* that number of
elements, but it can pass more (see C17 6.7.6.3p6). Given that we allow
zero-sized arrays as a GNU extension and that it's valid to pass more
elements than specified by the static array extent, we now support
zero-sized static array extents with the usual semantics because it can
be useful in cases like:

  void my_bzero(char p[static 0], int n);
  my_bzero(&c+1, 0); //ok
  my_bzero(t+k,n-k); //ok, pattern from actual code
2020-07-10 15:58:11 -04:00
..
AnalysisBasedWarnings.cpp Thread safety analysis: Add note for double unlock 2020-06-08 17:00:29 +02:00
CMakeLists.txt [openmp] Base of tablegen generated OpenMP common declaration 2020-06-23 10:32:32 -04:00
CodeCompleteConsumer.cpp Remove llvm::Error include form Diagnostic.h 2020-04-06 10:42:17 -07:00
CoroutineStmtBuilder.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DeclSpec.cpp [PowerPC] Add support for vector bool __int128 for Power10 2020-06-23 21:25:56 -05:00
DelayedDiagnostic.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
IdentifierResolver.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
JumpDiagnostics.cpp [CodeGen] Emit destructor calls to destruct compound literals 2020-03-10 14:08:28 -07:00
MultiplexExternalSemaSource.cpp recommit 1b978ddba0 [CUDA][HIP][OpenMP] Emit deferred diagnostics by a post-parsing AST travese 2020-03-23 12:09:07 -04:00
OpenCLBuiltins.td [OpenCL] Add sub-group builtin functions 2020-04-02 13:18:56 +01:00
ParsedAttr.cpp [Sema] Silence warnings when targeting x86 with VS2019 16.5.4 2020-05-06 09:11:59 -04:00
Scope.cpp Un-revert "[coroutines][PR40978] Emit error for co_yield within catch block" 2019-03-25 00:53:10 +00:00
ScopeInfo.cpp PR42104: Support instantiations of lambdas that implicitly capture 2019-06-04 17:17:20 +00:00
Sema.cpp Reland D81869 "Modify FPFeatures to use delta not absolute settings" 2020-06-27 01:34:57 -07:00
SemaAccess.cpp [c++20] Delete defaulted comparison functions if they would invoke an 2019-12-10 19:28:30 -08:00
SemaAttr.cpp Move Sema::PragmaStack<ValueType>::Act into Sema.h so it can be instantiated as needed 2020-06-29 18:02:12 -07:00
SemaAvailability.cpp Prune TargetInfo.h include from ParsedAttr.h, NFC 2020-03-11 20:47:11 -07:00
SemaCUDA.cpp [CUDA][HIP] Let lambda be host device by default 2020-07-08 13:10:26 -04:00
SemaCXXScopeSpec.cpp [Clang] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:04:18 +00:00
SemaCast.cpp [clang][Attribute] Fix noderef attribute false-negatives 2020-06-10 12:20:54 -07:00
SemaChecking.cpp [Sema] Teach -Wcast-align to compute alignment of CXXThisExpr 2020-07-07 17:45:04 -07:00
SemaCodeComplete.cpp [CodeComplete] Add code completion after function equals 2020-07-01 12:51:25 +08:00
SemaConcept.cpp PR45589: Properly decompose overloaded `&&` and `||` operators in 2020-05-12 13:45:45 -07:00
SemaConsumer.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SemaCoroutine.cpp [Coroutines] Warning if return type of coroutine_handle::address is not void* 2020-07-06 13:46:01 +08:00
SemaDecl.cpp [AST][RecoveryExpr] Avoid spurious 'missing typename' diagnostic when the NNS contains errors. 2020-06-30 16:18:32 +02:00
SemaDeclAttr.cpp [AIX][Frontend] Static init implementation for AIX considering no priority 2020-06-19 08:27:07 -04:00
SemaDeclCXX.cpp PR46640: Permit the first parameter of a destroying 'operator delete' to 2020-07-08 14:29:39 -07:00
SemaDeclObjC.cpp [AST/Lex/Parse/Sema] As part of using inclusive language within 2020-06-20 01:15:32 -07:00
SemaExceptionSpec.cpp [Coroutines] Ensure co_await promise.final_suspend() does not throw 2020-06-22 15:01:42 -07:00
SemaExpr.cpp Move default argument instantiation to SemaTemplateInstantiateDecl.cpp. 2020-07-09 17:24:19 -07:00
SemaExprCXX.cpp PR45521: Preserve the value kind when performing a standard conversion 2020-07-07 18:28:28 -07:00
SemaExprMember.cpp Resolve exception specifications after marking the corresponding 2019-12-15 22:02:30 -08:00
SemaExprObjC.cpp [SemaObjC] Add a warning for @selector expressions that potentially refer to objc_direct methods 2020-07-07 13:29:54 -04:00
SemaFixItUtils.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SemaInit.cpp [clang] Fix a crash when passing a C structure of incompatible type to a function with a reference parameter. 2020-07-08 16:57:54 +01:00
SemaLambda.cpp [CUDA][HIP] Let lambda be host device by default 2020-07-08 13:10:26 -04:00
SemaLookup.cpp DR458: Search template parameter scopes in the right order. 2020-06-23 17:14:33 -07:00
SemaModule.cpp [DeclCXX] Remove unknown external linkage specifications 2019-11-21 15:23:05 +02:00
SemaObjCProperty.cpp [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec. 2020-04-23 17:21:25 -04:00
SemaOpenMP.cpp [OPENMP50] extend array section for stride (Parsing/Sema/AST) 2020-07-09 13:28:51 -05:00
SemaOverload.cpp [AST][RecoveryExpr] Fix the value category for recovery expr. 2020-07-08 13:55:07 +02:00
SemaPseudoObject.cpp Reland D81869 "Modify FPFeatures to use delta not absolute settings" 2020-06-27 01:34:57 -07:00
SemaSYCL.cpp [OpenMP][SYCL] Improve diagnosing of unsupported types usage 2020-05-29 18:00:48 +03:00
SemaStmt.cpp [AST/Lex/Parse/Sema] As part of using inclusive language within 2020-06-20 01:15:32 -07:00
SemaStmtAsm.cpp Prohibit capture of _ExtInt in inline assembly. 2020-05-14 07:21:09 -07:00
SemaStmtAttr.cpp [clang] Add nomerge function attribute to clang 2020-05-21 17:07:39 -07:00
SemaTemplate.cpp [clang] Fix a null-NSS-access crash in DependentNameType. 2020-07-02 14:58:32 +02:00
SemaTemplateDeduction.cpp Recover more gracefully from stack exhaustion during template argument 2020-07-08 13:08:38 -07:00
SemaTemplateInstantiate.cpp PR46648: Do not eagerly instantiate default arguments for a generic 2020-07-09 17:24:20 -07:00
SemaTemplateInstantiateDecl.cpp PR46648: Do not eagerly instantiate default arguments for a generic 2020-07-09 17:24:20 -07:00
SemaTemplateVariadic.cpp [ARM] Add __bf16 as new Bfloat16 C Type 2020-06-05 10:32:43 +01:00
SemaType.cpp Change behavior with zero-sized static array extents 2020-07-10 15:58:11 -04:00
TreeTransform.h [OPENMP50] extend array section for stride (Parsing/Sema/AST) 2020-07-09 13:28:51 -05:00
TypeLocBuilder.cpp [NFC] avoid AlignedCharArray in clang 2019-07-29 23:12:48 +00:00
TypeLocBuilder.h [NFC] avoid AlignedCharArray in clang 2019-07-29 23:12:48 +00:00
UsedDeclVisitor.h recommit 1b978ddba0 [CUDA][HIP][OpenMP] Emit deferred diagnostics by a post-parsing AST travese 2020-03-23 12:09:07 -04:00