summaryrefslogtreecommitdiffstats
path: root/clang/docs
Commit message (Collapse)AuthorAgeFilesLines
...
* Add `__reference_binds_to_temporary` trait for checking safe reference ↵Eric Fiselier2018-01-121-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | initialization. Summary: The STL types `std::pair` and `std::tuple` can both store reference types. However their constructors cannot adequately check if the initialization of reference types is safe. For example: ``` std::tuple<std::tuple<int> const&> t = 42; // The stored reference is already dangling. ``` Libc++ has a best effort attempts in tuple to diagnose this, but they're not able to handle all valid cases (If I'm not mistaken). For example initialization of a reference from the result of a class's conversion operator. Libc++ would benefit from having a builtin traits which can provide a much better implementation. This patch introduce the `__reference_binds_to_temporary(T, U)` trait that determines whether a reference of type `T` bound to an expression of type `U` would bind to a materialized temporary object. Note that the trait simply returns false if `T` is not a reference type instead of reporting it as an error. ``` static_assert(__is_constructible(int const&, long)); static_assert(__reference_binds_to_temporary(int const&, long)); ``` Reviewers: majnemer, rsmith Reviewed By: rsmith Subscribers: compnerd, cfe-commits Differential Revision: https://reviews.llvm.org/D29930 llvm-svn: 322334
* Document attribute target multiversioning.Erich Keane2018-01-081-0/+6
| | | | | | | | | | Add attribute target multiversioning to the release notes. Additionally adds multiversioning support to the attribute documentation for 'target'. Differential Revision: https://reviews.llvm.org/D41837 llvm-svn: 322043
* [OPENMP] Current status of OpenMP support.Alexey Bataev2018-01-082-0/+69
| | | | | | | | | | | | Summary: Some info about supported features of OpenMP 4.5-5.0. Reviewers: hfinkel, rsmith Subscribers: kkwli0, Hahnfeld, cfe-commits Differential Revision: https://reviews.llvm.org/D39457 llvm-svn: 322018
* [Docs] Re-generate command line documentation, primarily to get the icelake ↵Craig Topper2018-01-031-1/+21
| | | | | | feature command line options in, but there were a couple other changes too. llvm-svn: 321749
* Update docs version and clear release notes for 7.0.0Hans Wennborg2018-01-032-172/+16
| | | | llvm-svn: 321728
* UserManual: Update with the latest clang-cl flagsHans Wennborg2018-01-031-1/+8
| | | | llvm-svn: 321705
* Fixed markup formattingSerge Pavlov2018-01-011-1/+1
| | | | llvm-svn: 321623
* Enable configuration files in clangSerge Pavlov2018-01-011-0/+73
| | | | | | | | | | | | | | | | | | | | | Clang is inherently a cross compiler and can generate code for any target enabled during build. It however requires to specify many parameters in the invocation, which could be hardcoded during configuration process in the case of single-target compiler. The purpose of configuration files is to make specifying clang arguments easier. A configuration file is a collection of driver options, which are inserted into command line before other options specified in the clang invocation. It groups related options together and allows specifying them in simpler, more flexible and less error prone way than just listing the options somewhere in build scripts. Configuration file may be thought as a "macro" that names an option set and is expanded when the driver is called. Use of configuration files is described in `UserManual.rst`. Differential Revision: https://reviews.llvm.org/D24933 llvm-svn: 321621
* Reverted 321587: Enable configuration files in clangSerge Pavlov2017-12-301-71/+0
| | | | | | Need to check targets in tests more carefully. llvm-svn: 321588
* Enable configuration files in clangSerge Pavlov2017-12-301-0/+71
| | | | | | | | | | | | | | | | | | | | | Clang is inherently a cross compiler and can generate code for any target enabled during build. It however requires to specify many parameters in the invocation, which could be hardcoded during configuration process in the case of single-target compiler. The purpose of configuration files is to make specifying clang arguments easier. A configuration file is a collection of driver options, which are inserted into command line before other options specified in the clang invocation. It groups related options together and allows specifying them in simpler, more flexible and less error prone way than just listing the options somewhere in build scripts. Configuration file may be thought as a "macro" that names an option set and is expanded when the driver is called. Use of configuration files is described in `UserManual.rst`. Differential Revision: https://reviews.llvm.org/D24933 llvm-svn: 321587
* [docs] Added description of `-f[no]-openmp-simd` option to UsersManual.Alexey Bataev2017-12-291-0/+5
| | | | llvm-svn: 321562
* [docs] Updated ReleaseNotes for OpenMP part.Alexey Bataev2017-12-291-1/+12
| | | | llvm-svn: 321561
* [Modules] Change private modules rules and warningsBruno Cardoso Lopes2017-12-221-14/+15
| | | | | | | | | | | | | | | | We used to advertise private modules to be declared as submodules (Foo.Private). This has proven to not scale well since private headers might carry several dependencies, introducing unwanted content into the main module and often causing dep cycles. Change the canonical way to name it to Foo_Private, forcing private modules as top level ones, and provide warnings under -Wprivate-module to suggest fixes for other private naming. Update documentation to reflect that. rdar://problem/31173501 llvm-svn: 321337
* [ubsan] Diagnose noreturn functions which returnVedant Kumar2017-12-211-2/+2
| | | | | | | | | | | | | | | | | | Diagnose 'unreachable' UB when a noreturn function returns. 1. Insert a check at the end of functions marked noreturn. 2. A decl may be marked noreturn in the caller TU, but not marked in the TU where it's defined. To diagnose this scenario, strip away the noreturn attribute on the callee and insert check after calls to it. Testing: check-clang, check-ubsan, check-ubsan-minimal, D40700 rdar://33660464 Differential Revision: https://reviews.llvm.org/D40698 llvm-svn: 321231
* [hwasan] update the design docKostya Serebryany2017-12-181-9/+25
| | | | llvm-svn: 321027
* Harmonize GNU- and C++-style attribute spellings.Aaron Ballman2017-12-141-0/+6
| | | | | | | | Most attributes will now use the Clang<"name"> construct to provide both __attribute__((name)) and [[clang::name]] syntaxes for the attribute. Attributes deviating from this should be marked with a comment explaining why they are not supported under both spellings. Common reasons are: the attribute is provided by some other specification that controls the syntax or the attribute cannot be exposed under a particular spelling for some given reason. Because this is a mechanical change that only introduces new spellings, there are no test cases for the commit. llvm-svn: 320752
* [Preprocessor] Implement __is_target_{arch|vendor|os|environment} function-likeAlex Lorenz2017-12-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | builtin macros This patch implements the __is_target_arch, __is_target_vendor, __is_target_os, and __is_target_environment Clang preprocessor extensions that were proposed by @compnerd in Bob's cfe-dev post: http://lists.llvm.org/pipermail/cfe-dev/2017-November/056166.html. These macros can be used to examine the components of the target triple at compile time. A has_builtin(is_target_???) preprocessor check can be used to check for their availability. __is_target_arch allows you to check if an arch is specified without worring about a specific subarch, e.g. __is_target_arch(arm) returns 1 for the target arch "armv7" __is_target_arch(armv7) returns 1 for the target arch "armv7" __is_target_arch(armv6) returns 0 for the target arch "armv7" __is_target_vendor and __is_target_environment match the specific vendor or environment. __is_target_os matches the specific OS, but __is_target_os(darwin) will match any Darwin-based OS. "Unknown" can be used to test if the triple's component is specified. rdar://35753116 Differential Revision: https://reviews.llvm.org/D41087 llvm-svn: 320734
* [Driver][CodeGen] Add -mprefer-vector-width driver option and attribute ↵Craig Topper2017-12-111-0/+4
| | | | | | | | | | | | | | | | during CodeGen. This adds a new command line option -mprefer-vector-width to specify a preferred vector width for the vectorizers. Valid values are 'none' and unsigned integers. The driver will check that it meets those constraints. Specific supported integers will be managed by the targets in the backend. Clang will take the value and add it as a new function attribute during CodeGen. This represents the alternate direction proposed by Sanjay in this RFC: http://lists.llvm.org/pipermail/llvm-dev/2017-November/118734.html The syntax here matches gcc, though gcc treats it as an x86 specific command line argument. gcc only allows values of 128, 256, and 512. I'm not having clang check any values. Differential Revision: https://reviews.llvm.org/D40230 llvm-svn: 320419
* [Docs] Regenerate command line documentation.Craig Topper2017-12-111-8/+22
| | | | llvm-svn: 320418
* Switch to gnu++14 as the default dialect.Tim Northover2017-12-091-1/+4
| | | | | | This is C++14 with conforming GNU extensions. llvm-svn: 320250
* [hwasan] typo in docsKostya Serebryany2017-12-081-1/+1
| | | | llvm-svn: 320168
* Add new language mode flags for C17.Aaron Ballman2017-12-071-0/+6
| | | | | | This adds -std=c17, -std=gnu17, and -std=iso9899:2017 as language mode flags for C17 and updates the value of __STDC_VERSION__ to the value based on the C17 FDIS. Given that this ballot cannot succeed until 2018, it is expected that we (and GCC) will add c18 flags as aliases once the ballot passes. llvm-svn: 320089
* Add support for the __has_c_attribute builtin preprocessor macro.Aaron Ballman2017-12-072-0/+34
| | | | | | This behaves similar to the __has_cpp_attribute builtin macro in that it allows users to detect whether an attribute is supported with the [[]] spelling syntax, which can be enabled in C with -fdouble-square-bracket-attributes. llvm-svn: 320088
* update hwasan docsKostya Serebryany2017-12-071-8/+24
| | | | | | | | | | | | | | | | Summary: * use more readable name * document the hwasan attribute Reviewers: eugenis Reviewed By: eugenis Subscribers: llvm-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D40938 llvm-svn: 320075
* [clang-format] Releasenotes for rL319024 : Add option to group multiple ↵Sylvestre Ledru2017-12-051-0/+13
| | | | | | | | | | | | | | | | | | #include blocks when sorting includes Summary: This change adds missing releasenotes for commit rL319024 https://reviews.llvm.org/rL319024 Patch by Krzysztof Kapusta Reviewers: sylvestre.ledru Reviewed By: sylvestre.ledru Differential Revision: https://reviews.llvm.org/D40827 llvm-svn: 319748
* design document for a hardware-assisted memory safety (HWAMS) tool, similar ↵Kostya Serebryany2017-12-042-0/+124
| | | | | | | | | | | | | | | | | | | | to AddressSanitizer Summary: preliminary design document for a hardware-assisted memory safety (HWAMS) tool, similar to AddressSanitizer The name TaggedAddressSanitizer and the rest of the document, are early draft, suggestions are welcome. The code will follow shortly. Reviewers: eugenis, alekseyshl Reviewed By: eugenis Subscribers: davidxl, cryptoad, fedor.sergeev, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D40568 llvm-svn: 319684
* [analyzer] Fix false negative on post-increment of uninitialized variable.Roman Lebedev2017-11-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Currently clang static analyzer does warn on: ``` int x; x+=1; x-=1; x=x+1; x=x-1; ``` But does warn on: ``` int x; x++; x--; --x; ++x; ``` This differential should fix that. Fixes https://bugs.llvm.org/show_bug.cgi?id=35419 Reviewers: dcoughlin, NoQ Reviewed By: dcoughlin Subscribers: NoQ, xazax.hun, szepet, cfe-commits, a.sidorin Tags: #clang Differential Revision: https://reviews.llvm.org/D40463 llvm-svn: 319411
* Add the hasDefinition() AST matcher to match class declarations that also ↵Aaron Ballman2017-11-291-0/+9
| | | | | | | | have a definition. Patch by Julie Hockett. llvm-svn: 319360
* Toolchain: Normalize dwarf, sjlj and seh ehMartell Malone2017-11-291-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a re-apply of r319294. adds -fseh-exceptions and -fdwarf-exceptions flags clang will check if the user has specified an exception model flag, in the absense of specifying the exception model clang will then check the driver default and append the model flag for that target to cc1 -fno-exceptions has a higher priority then specifying the model move __SEH__ macro definitions out of Targets into InitPreprocessor behind the -fseh-exceptions flag move __ARM_DWARF_EH__ macrodefinitions out of verious targets and into InitPreprocessor behind the -fdwarf-exceptions flag and arm|thumb check remove unused USESEHExceptions from the MinGW Driver fold USESjLjExceptions into a new GetExceptionModel function that gives the toolchain classes more flexibility with eh models Reviewers: rnk, mstorsjo Differential Revision: https://reviews.llvm.org/D39673 llvm-svn: 319297
* Revert "Toolchain: Normalize dwarf, sjlj and seh eh"Martell Malone2017-11-291-8/+0
| | | | | | | | This reverts rL319294. The windows sanitizer does not like seh on x86. Will re apply with None type for x86 llvm-svn: 319295
* Toolchain: Normalize dwarf, sjlj and seh ehMartell Malone2017-11-291-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | adds -fseh-exceptions and -fdwarf-exceptions flags clang will check if the user has specified an exception model flag, in the absense of specifying the exception model clang will then check the driver default and append the model flag for that target to cc1 clang cc1 assumes dwarf is the default if none is passed and -fno-exceptions has a higher priority then specifying the model move __SEH__ macro definitions out of Targets into InitPreprocessor behind the -fseh-exceptions flag move __ARM_DWARF_EH__ macrodefinitions out of verious targets and into InitPreprocessor behind the -fdwarf-exceptions flag and arm|thumb check remove unused USESEHExceptions from the MinGW Driver fold USESjLjExceptions into a new GetExceptionModel function that gives the toolchain classes more flexibility with eh models Reviewers: rnk, mstorsjo Differential Revision: https://reviews.llvm.org/D39673 llvm-svn: 319294
* [clang-format] Add option to group multiple #include blocks when sorting ↵Krasimir Georgiev2017-11-271-0/+39
| | | | | | | | | | | | | | | | | | | | includes Summary: This patch allows grouping multiple #include blocks together and sort all includes as one big block. Additionally, sorted includes can be regrouped after sorting based on configured categories. Contributed by @KrzysztofKapusta! Reviewers: krasimir Reviewed By: krasimir Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D40288 llvm-svn: 319024
* [ASTMatchers] Matchers for new[] operatorsAdam Balogh2017-11-231-0/+20
| | | | | | | | Two new matchers for `CXXNewExpr` are added which may be useful e.g. in `clang-tidy` checkers. One of them is `isArray` which matches `new[]` but not plain `new`. The other one, `hasArraySize` matches `new[]` for a given size. llvm-svn: 318909
* CachePruning: Allow limiting the number of files in the cache directory.Peter Collingbourne2017-11-221-0/+4
| | | | | | | | | | | The default limit is 1000000 but it can be configured with a cache policy. The motivation is that some filesystems (notably ext4) have a limit on the number of files that can be contained in a directory (separate from the inode limit). Differential Revision: https://reviews.llvm.org/D40327 llvm-svn: 318857
* [Docs] Update list of languages clang-format can formatMalcolm Parsons2017-11-221-1/+1
| | | | llvm-svn: 318827
* Add an AST matcher for hasDefaultArgument() to match on parameter ↵Aaron Ballman2017-11-211-0/+9
| | | | | | | | declarations that have a default value. Patch by Julie Hockett. llvm-svn: 318794
* [Docs] Regenerate the command line option reference.Craig Topper2017-11-201-5/+45
| | | | llvm-svn: 318672
* Indent code blocks so they are actually treated as suchStephan Bergmann2017-11-171-9/+9
| | | | llvm-svn: 318530
* Make isDefinition matcher support ObjCMethodDeclDave Lee2017-11-141-5/+48
| | | | | | | | | | | | | | | | | Summary: Allow the `isDefinition()` matcher to apply to `ObjCMethodDecl` nodes, in addition to those it already supports. For whatever reason, `ObjCMethodDecl` does not inherit from `FunctionDecl` and so this is specialization is necessary. Reviewers: aaron.ballman, malcolm.parsons, alexshap Reviewed By: aaron.ballman Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D39948 llvm-svn: 318152
* [analyzer] Document the issue hash debugging facilityGabor Horvath2017-11-131-0/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D39543 llvm-svn: 318030
* Fix AST matcher documentation typoDave Lee2017-11-111-1/+1
| | | | llvm-svn: 317993
* Add ObjC exception statement AST matchersDave Lee2017-11-111-0/+35
| | | | | | | | | | | | | | Summary: Add AST matchers for Objective-C @throw, @try, @catch and @finally. Reviewers: aaron.ballman, malcolm.parsons, alexshap, compnerd Reviewed By: aaron.ballman Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D39940 llvm-svn: 317992
* [clang-format] Keep Sphinx happy after r317794Krasimir Georgiev2017-11-091-5/+6
| | | | llvm-svn: 317799
* [clang-format] Sort using declarations by splitting on '::'Krasimir Georgiev2017-11-092-8/+32
| | | | | | | | | | | | | | Summary: This patch improves using declarations sorting. Reviewers: bkramer Reviewed By: bkramer Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D39786 llvm-svn: 317794
* [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.Sam McCall2017-11-091-0/+6
| | | | | | | | | | | | | | | | | | | | | Summary: This is an alternative to JSONCompilationDatabase for simple projects that don't use a build system such as CMake. (You can also drop one in ~, to make your tools use e.g. C++11 by default) There's no facility for varying flags per-source-file or per-machine. Possibly this could be accommodated backwards-compatibly using cpp, but even if not the simplicity seems worthwhile for the cases that are addressed. Tested with clangd, works great! (requires clangd restart) Reviewers: klimek Subscribers: ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D39799 llvm-svn: 317777
* [docs] Add section 'Half-Precision Floating Point'Sjoerd Meijer2017-11-071-0/+43
| | | | | | | | | This documents the differences/interactions between _Float16 and __fp16 and is a companion change for the _Float16 type implementation (r312794). Differential Revision: https://reviews.llvm.org/D35295 llvm-svn: 317558
* [Sema] Document+test the -Wsign-conversion change for enums in C code [NFC]Roman Lebedev2017-11-041-1/+2
| | | | | | | | | | | | Basically a regression after r316268. However the diagnostic is correct, but the test coverage is bad. So just like rL316500, introduce yet more tests, and adjust the release notes. See https://bugs.llvm.org/show_bug.cgi?id=35200 llvm-svn: 317421
* [CFI] Add CFI-icall pointer type generalizationVlad Tsyrklevich2017-10-313-0/+26
| | | | | | | | | | | | | | | | | | | | | | | Summary: This change allows generalizing pointers in type signatures used for cfi-icall by enabling the -fsanitize-cfi-icall-generalize-pointers flag. This works by 1) emitting an additional generalized type signature metadata node for functions and 2) llvm.type.test()ing for the generalized type for translation units with the flag specified. This flag is incompatible with -fsanitize-cfi-cross-dso because it would require emitting twice as many type hashes which would increase artifact size. Reviewers: pcc, eugenis Reviewed By: pcc Subscribers: kcc Differential Revision: https://reviews.llvm.org/D39358 llvm-svn: 317044
* Use -fuse-init-array if no gcc installation is found.Nico Weber2017-10-261-0/+4
| | | | | | | | | | | | | | | | clang currently uses .init_array instead of .ctors on Linux if it detects gcc 4.7+. Make it so that it also uses .init_array if no gcc installation is found at all – if there's no old gcc, there's nothing we need to be compatible with. icecc for example runs clang in a very small chroot, so before this change clang would use .ctors if run under icecc. And lld currently silently mislinks inputs with .ctors sections, so before this clang + icecc + lld would produce broken binaries. (But this seems like a good change independent of that lld bug.) https://reviews.llvm.org/D39317 llvm-svn: 316713
* [www] Regenerate diagnostics reference.Richard Smith2017-10-261-128/+668
| | | | llvm-svn: 316701
OpenPOWER on IntegriCloud