summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/nonnull.c
Commit message (Collapse)AuthorAgeFilesLines
* Revert r298491 and r298494 which changed Clang's handling of 'nonnull'Chandler Carruth2017-03-241-84/+0
| | | | | | | | | | | | | | | | | attributes. These patches don't work because we can't currently access the parameter information in a reliable way when building attributes. I thought this would be relatively straightforward to fix, but it seems not to be the case. Fixing this will requrie a substantial re-plumbing of machinery to allow attributes to be handled in this location, and several other fixes to the attribute machinery should probably be made at the same time. All of this will make the patch .... substantially more complicated. Reverting for now as there are active miscompiles caused by the current version. llvm-svn: 298695
* [nonnull] Teach Clang to attach the nonnull LLVM attribute toChandler Carruth2017-03-221-0/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | declarations and calls instead of just definitions, and then teach it to *not* attach such attributes even if the source code contains them. This follows the design direction discussed on cfe-dev here: http://lists.llvm.org/pipermail/cfe-dev/2017-January/052066.html The idea is that for C standard library builtins, even if the library vendor chooses to annotate their routines with __attribute__((nonnull)), we will ignore those attributes which pertain to pointer arguments that have an associated size. This allows the widespread (and seemingly reasonable) pattern of calling these routines with a null pointer and a zero size. I have only done this for the library builtins currently recognized by Clang, but we can now trivially add to this set. This will be controllable with -fno-builtin if anyone should care to do so. Note that this does *not* change the AST. As a consequence, warnings, static analysis, and source code rewriting are not impacted. This isn't even a regression on any platform as neither Clang nor LLVM have ever put 'nonnull' onto these arguments for declarations. All this patch does is enable it on other declarations while preventing us from ever accidentally enabling it on these libc functions due to a library vendor. It will also allow any other libraries using this annotation to gain optimizations based on the annotation even when only a declaration is visible. llvm-svn: 298491
* Properly handle multiple nonnull attributes in CodeGenAlexey Samsonov2014-08-281-0/+8
| | | | llvm-svn: 216638
* Fix regression in r216520: don't apply nonnull to non-pointer functionRichard Smith2014-08-271-0/+20
| | | | | | parameters in the IR. llvm-svn: 216574
* Add nonnull in CodeGen for __attribute__((returns_nonnull))Hal Finkel2014-07-121-0/+6
| | | | | | | As a follow-up to r212835, also add the LLVM nonnull function attribute when __attribute__((returns_nonnull)) is provided. llvm-svn: 212874
* Add nonnull in CodeGen for __attribute__((nonnull))Hal Finkel2014-07-111-0/+17
We now have an LLVM-level nonnull attribute that can be applied to function parameters, and we emit it for reference types (as of r209723), but did not emit it when an __attribute__((nonnull)) was provided. Now we will. llvm-svn: 212835
OpenPOWER on IntegriCloud