Commit Graph

2528 Commits

Author SHA1 Message Date
Nick Desaulniers abb9bf4bcf Revert "[Clang] implement -fno-eliminate-unused-debug-types"
This reverts commit e486921fd6.

Breaks windows builds and osx builds.
2020-08-07 16:11:41 -07:00
Nick Desaulniers e486921fd6 [Clang] implement -fno-eliminate-unused-debug-types
Fixes pr/11710.
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D80242
2020-08-07 14:13:48 -07:00
Peter Smith 839d974ee0 [DOCS] Add more detail to stack protector documentation
The Clang -fstack-protector documentation mentions what functions are considered
vulnerable but does not mention the details of the implementation such as the use
of a global variable for the guard value. This brings the documentation more in
line with the GCC documentation at:
https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
and gives someone using the option more idea about what is protected.

This partly addresses https://bugs.llvm.org/show_bug.cgi?id=42764

Differential Revision: https://reviews.llvm.org/D85239
2020-08-06 13:47:21 +01:00
Jan Korous 820e8d8656 [Analyzer][WebKit] UncountedLambdaCaptureChecker
Differential Revision: https://reviews.llvm.org/D82837
2020-08-05 15:23:55 -08:00
Joel E. Denny 03bb545b68 [OpenMP][Docs] Mark `present` map type modifier as done 2020-08-05 10:03:31 -04:00
Joel E. Denny 26cf9c1704 [OpenMP][Docs] Add map clause reordering status as unclaimed 2020-08-05 10:03:31 -04:00
Fangrui Song 7cf4603fae Reland D61689 Change -gz and -Wa,--compress-debug-sections to use gABI compression (SHF_COMPRESSED) with integrated assembler
This fixes an inconsistency: clang -c -gz -fno-integrated-as means SHF_COMPRESSED
while clang -c -gz -fintegrated-as means zlib-gnu.

---

Since July 15, 2015 (binutils-gdb commit
19a7fe52ae3d0971e67a134bcb1648899e21ae1c, included in 2.26), gas
--compress-debug-sections=zlib (gcc -gz) means zlib-gabi:
SHF_COMPRESSED. Before that GCC/binutils used zlib-gnu (.zdebug).

clang's -gz was introduced in rC306115 (Jun 2017) to indicate zlib-gnu. It
is 2020 now and it is not unreasonable to assume users of the new
feature to have new linkers (ld.bfd/gold >= 2.26, lld >= rLLD273661).

Change clang's default accordingly to improve standard conformance.
zlib-gnu becomes out of fashion and gets poorer toolchain support.
Its mangled names confuse tools and are more likely to cause problems.

Reviewed By: compnerd

Differential Revision: https://reviews.llvm.org/D61689
2020-08-03 15:12:01 -07:00
Andrei Lebedev 8dd4e3ceb8 Updated the -I option description. 2020-08-01 15:54:11 -07:00
Andrei Lebedev 731292e5f3 Updated the -I option description. 2020-07-31 15:39:12 -07:00
Michael Kruse 18eba165e7 [OpenMP][docs] Update loop tiling status. 2020-07-31 13:01:55 -05:00
Joel E. Denny 3d06fc0049 [OpenMP][Docs] Mark `present` motion modifier as done 2020-07-30 12:21:37 -04:00
Matt Morehouse e2d0b44a7c [DFSan] Add efficient fast16labels instrumentation mode.
Adds the -fast-16-labels flag, which enables efficient instrumentation
for DFSan when the user needs <=16 labels.  The instrumentation
eliminates most branches and most calls to __dfsan_union or
__dfsan_union_load.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D84371
2020-07-29 18:58:47 +00:00
Johannes Doerfert 7db017bf34 [OpenMP][Docs] Update Clang Support docs after D75591 2020-07-29 10:21:05 -05:00
Joel E. Denny f250eb37cd [OpenMP][Docs] Update `present` modifier status 2020-07-27 19:23:55 -04:00
Richard Smith 6c18f7db73 For PR46800, implement the GCC __builtin_complex builtin.
glibc's implementation of the CMPLX macro uses it (with -fgnuc-version
set to 4.7 or later).
2020-07-22 13:43:10 -07:00
Luboš Luňák 54eea6127c add -fpch-codegen/debuginfo mapping to -fmodules-codegen/debuginfo
Using -fmodules-* options for PCHs is a bit confusing, so add -fpch-*
variants. Having extra options also makes it simple to do a configure
check for the feature.
Also document the options in the release notes.

Differential Revision: https://reviews.llvm.org/D83623
2020-07-22 10:21:53 +02:00
Anders Waldenborg 52ab7aa0ba [clang-format] Add BitFieldColonSpacing option
This new option allows controlling if there should be spaces around
the ':' in a bitfield declaration.

BitFieldColonSpacing accepts four different values:

  // "Both" - default
  unsigned bitfield : 5
  unsigned bf2      : 5  // AlignConsecutiveBitFields=true

  // "None"
  unsigned bitfield:5
  unsigned bf2     :5

  // "Before"
  unsigned bitfield :5
  unsigned bf2      :5

  // "After"
  unsigned bitfield: 5
  unsigned bf2     : 5

Differential Revision: https://reviews.llvm.org/D84090
2020-07-20 20:55:51 +02:00
Anders Waldenborg 6d7ec54170 [clang-format] Make sure rst documentation matches comments
clang/docs/tools/dump_format_style.py is used to read the comments
from clang/include/clang/Format/Format.h and update the contents of
clang/docs/ClangFormatStyleOptions.rst

Recent changes made these out of date. This commit syncs them by
folding the improved wording back to the comments and then
regenerating the rst file.

Differential Revision: https://reviews.llvm.org/D84103
2020-07-18 18:02:14 +02:00
Joel E. Denny d6e79e3dd6 [OpenMP][Docs] Update `present` map type modifier status 2020-07-15 11:17:00 -04:00
Hans Wennborg 7ab7b979d2 Bump the trunk major version to 12
and clear the release notes.
2020-07-15 12:05:05 +02:00
Luboš Luňák d1ca9960bc document -fpch-instantiate-templates in release notes
This should have been included in D69585.

Differential Revision: https://reviews.llvm.org/D83622
2020-07-14 23:18:27 +02:00
Stephen Hines 9d5a8b7edb Fix a missing update that C compiles default to gnu17.
https://reviews.llvm.org/D75383 switched the C default to gnu17, but
missed this instance.

Differential Revision: https://reviews.llvm.org/D83726
2020-07-13 16:35:54 -07:00
Vedant Kumar 8c4a65b9b2 [ubsan] Check implicit casts in ObjC for-in statements
Check that the implicit cast from `id` used to construct the element
variable in an ObjC for-in statement is valid.

This check is included as part of a new `objc-cast` sanitizer, outside
of the main 'undefined' group, as (IIUC) the behavior it's checking for
is not technically UB.

The check can be extended to cover other kinds of invalid casts in ObjC.

Partially addresses: rdar://12903059, rdar://9542496

Differential Revision: https://reviews.llvm.org/D71491
2020-07-13 15:11:18 -07:00
Atmn Patel 78443666bc [OpenMP] Add firstprivate as a default data-sharing attribute to clang
This implements the default(firstprivate) clause as defined in OpenMP
Technical Report 8 (2.22.4).

Reviewed By: jdoerfert, ABataev

Differential Revision: https://reviews.llvm.org/D75591
2020-07-12 23:01:40 -05:00
Anastasia Stulova 8c8a2fd1f0 [OpenCL] Fixed typo for ctor stub name in UsersManual 2020-07-10 19:04:49 +01:00
Kevin P. Neal d4ce862f2a Reland "[FPEnv][Clang][Driver] Disable constrained floating point on targets lacking support."
We currently have strict floating point/constrained floating point enabled
for all targets. Constrained SDAG nodes get converted to the regular ones
before reaching the target layer. In theory this should be fine.

However, the changes are exposed to users through multiple clang options
already in use in the field, and the changes are _completely_ _untested_
on almost all of our targets. Bugs have already been found, like
"https://bugs.llvm.org/show_bug.cgi?id=45274".

This patch disables constrained floating point options in clang everywhere
except X86 and SystemZ. A warning will be printed when this happens.

Use the new -fexperimental-strict-floating-point flag to force allowing
strict floating point on hosts that aren't already marked as supporting
it (X86 and SystemZ).

Differential Revision: https://reviews.llvm.org/D80952
2020-07-10 08:49:45 -04:00
Nithin Vadukkumchery Rajendrakumar 20e271a98d [analyzer] Warning for default constructed unique_ptr dereference
Summary: Add support for warning incase of default constructed unique pointer dereferences

Reviewed By: NoQ, Szelethus, vsavchenko, xazax.hun

Tags: #clang

Differential Revision: https://reviews.llvm.org/D81315
2020-07-08 09:51:02 +02:00
Zola Bridges 9d9e499840 [x86][seses] Add clang flag; Use lvi-cfi with seses
This patch creates a clang flag to enable SESES. This flag also ensures that
lvi-cfi is on when using seses via clang.

SESES should use lvi-cfi to mitigate returns and indirect branches.

The flag to enable the SESES functionality only without lvi-cfi is now
-x86-seses-enable-without-lvi-cfi to warn users part of the mitigation is not
enabled if they use this flag. This is useful in case folks want to see the
cost of SESES separate from the LVI-CFI.

Reviewed By: sconstab

Differential Revision: https://reviews.llvm.org/D79910
2020-07-07 13:20:13 -07:00
Nathan James b0d3ea171b
[ASTMatchers] Added hasDirectBase Matcher
Adds a matcher called `hasDirectBase` for matching the `CXXBaseSpecifier` of a class that directly derives from another class.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D81552
2020-07-07 16:05:11 +01:00
Xiang1 Zhang 939d8309db [X86-64] Support Intel AMX Intrinsic
INTEL ADVANCED MATRIX EXTENSIONS (AMX).
AMX is a new programming paradigm, it has a set of 2-dimensional registers
(TILES) representing sub-arrays from a larger 2-dimensional memory image and
operate on TILES.

These intrinsics use direct TMM register number as its params.

Spec can be found in Chapter 3 here https://software.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D83111
2020-07-07 10:13:40 +08:00
Dmitri Gribenko 5689b38c6a Removed a RecursiveASTVisitor feature to visit operator kinds with different methods
Summary:
This feature was only used in two places, but contributed a non-trivial
amount to the complexity of RecursiveASTVisitor, and was buggy (see my
recent patches where I was fixing the bugs that I noticed). I don't
think the convenience benefit of this feature is worth the complexity.

Besides complexity, another issue with the current state of
RecursiveASTVisitor is the non-uniformity in how it handles different
AST nodes. All AST nodes follow a regular pattern, but operators are
special -- and this special behavior not documented. Correct usage of
RecursiveASTVisitor relies on shadowing member functions with specific
names and signatures. Near misses don't cause any compile-time errors,
incorrectly named or typed methods are just silently ignored. Therefore,
predictability of RecursiveASTVisitor API is quite important.

This change reduces the size of the `clang` binary by 38 KB (0.2%) in
release mode, and by 7 MB (0.3%) in debug mode. The `clang-tidy` binary
is reduced by 205 KB (0.3%) in release mode, and by 5 MB (0.4%) in debug
mode. I don't think these code size improvements are significant enough
to justify this change on its own (for me, the primary motivation is
reducing code complexity), but they I think are a nice side-effect.

Reviewers: rsmith, sammccall, ymandel, aaron.ballman

Reviewed By: rsmith, sammccall, ymandel, aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D82921
2020-07-06 13:38:01 +02:00
Kai Luo 68e07da3e5 [clang][PowerPC] Enable -fstack-clash-protection option for ppc64
Differential Revision: https://reviews.llvm.org/D81355
2020-07-05 03:43:56 +00:00
Stephen Kelly 551092bc3d Revert AST Matchers default to AsIs mode
Reviewers: aaron.ballman, klimek

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D83076
2020-07-03 21:19:46 +01:00
Nathan James f51a319cac
[ASTMatchers] Enhanced support for matchers taking Regex arguments
Added new Macros `AST(_POLYMORPHIC)_MATCHER_REGEX(_OVERLOAD)` that define a matchers that take a regular expression string and optionally regular expression flags. This lets users match against nodes while ignoring the case without having to manually use `[Aa]` or `[A-Fa-f]` in their regex. The other point this addresses is in the current state, matchers that use regular expressions have to compile them for each node they try to match on, Now the regular expression is compiled once when you define the matcher and used for every node that it tries to match against. If there is an error while compiling the regular expression an error will be logged to stderr showing the bad regex string and the reason it couldn't be compiled. The old behaviour of this was down to the Matcher implementation and some would assert, whereas others just would never match. Support for this has been added to the documentation script as well. Support for this has been added to dynamic matchers ensuring functionality is the same between the 2 use cases.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D82706
2020-07-02 14:52:25 +01:00
Nico Weber ac8d059c8e typo fixes to cycle bots 2020-07-01 19:20:05 -04:00
Philippe Blain a1f4e48c4a [clang][docs] Add note about using `-flto` with `-g` on macOS
If -Wl,object_path_lto,<lto-filename>.o is not passed at link time
when compiling and linking in separate steps with -flto and -g, the
temporary file used for Link Time Optimization is deleted by the linker,
so the executable is missing debug symbols and can't be easily debugged,
and dsymutil can't be run.

Document this behaviour.

Differential revision: https://reviews.llvm.org/D82733
2020-06-30 09:33:20 -07:00
Jake Merdich 0c332a7784 [clang-format] Preserve whitespace in selected macros
Summary:
https://bugs.llvm.org/show_bug.cgi?id=46383

When the c preprocessor stringizes tokens, the generated string literals
are affected by the whitespace. This means clang-format can affect
codegen silently, adding spaces and newlines to strings.  Practically
speaking, the vast majority of cases will be harmless, only affecting
single identifiers or debug macros.

In the interest of doing no harm in other cases though, this introduces
a blacklist option 'WhitespaceSensitiveMacros', which contains a list of
names of function-like macros whose contents should not be touched by
clang-format, period. Clang-format can't automatically detect these
without a real compile context, so users will have to specify it
explicitly (it still beats clang-format off'ing at every invocation).

Defaults include "STRINGIZE", "PP_STRINGIZE", and "BOOST_PP_STRINGIZE".

Subscribers: kristof.beyls, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D82620
2020-06-29 09:57:47 -04:00
Nathan James abafb655c8
[clang][docs] Remove untracked files from formatted status
Currently on http://clang.llvm.org/docs/ClangFormattedStatus.html there are format stats on files no actually inside the tree but generated by build scripts. These are usually copied from somewhere else. Right now for example there are files from `llvm/utils/release/llvm-package...`. Adding these files bloats the list while not giving an accurate representation of how formatted the repo is.
This addresses this issue by checking the git index and ignoring any folder that doesn't contain tracked files.

I'm still unsure whether it would be better to just do away with the `os.walk` method and just check over every file returned from `git ls-index <project-root>`.

Reviewed By: MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D82707
2020-06-28 09:49:39 +01:00
mydeveloperday a43b99a1e3 [clang-format] NFC 1% improvement in the overall clang-formatted status 2020-06-27 12:18:23 +01:00
David Zarzycki dab859d1bf Reland: [clang driver] Move default module cache from system temporary directory
This fixes a unit test. Otherwise here is the original commit:

1) Shared writable directories like /tmp are a security problem.
2) Systems provide dedicated cache directories these days anyway.
3) This also refines LLVM's cache_directory() on Darwin platforms to use
   the Darwin per-user cache directory.

Reviewers: compnerd, aprantl, jakehehrlich, espindola, respindola, ilya-biryukov, pcc, sammccall

Reviewed By: compnerd, sammccall

Subscribers: hiraditya, llvm-commits, cfe-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D82362
2020-06-27 05:35:15 -04:00
Melanie Blower 467ba4c92f More corrections to documented spelling of ffinite-math to ffinite-math-only 2020-06-26 13:17:55 -07:00
Melanie Blower 7cc5307c73 Correct documented spelling of ffinite-math to ffinite-math-only
This is to correct bugs.llvm.org/show_bug.cgi?id=46444
ffinite-math-only is a gcc option.  That is the correct spelling.
File modified is clang/docs/UsersManual.rst
2020-06-26 12:50:45 -07:00
Nico Weber 4d5c448943 Revert "[clang driver] Move default module cache from system temporary directory"
This reverts commit bb26838cef.
Breaks Support.CacheDirectoryNoEnv, Support.CacheDirectoryWithEnv
in SupportTests (part of check-llvm) on macOS.
2020-06-26 13:25:45 -04:00
David Zarzycki bb26838cef [clang driver] Move default module cache from system temporary directory
1) Shared writable directories like /tmp are a security problem.
2) Systems provide dedicated cache directories these days anyway.
3) This also refines LLVM's cache_directory() on Darwin platforms to use
   the Darwin per-user cache directory.

Reviewers: compnerd, aprantl, jakehehrlich, espindola, respindola, ilya-biryukov, pcc, sammccall

Reviewed By: compnerd, sammccall

Subscribers: hiraditya, llvm-commits, cfe-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D82362
2020-06-26 07:46:03 -04:00
Joel E. Denny 3fa666b883 [OpenMP][Docs] Mark TR8 `present` as claimed in docs 2020-06-24 14:21:11 -04:00
Alexey Bataev 264f0dbef8 [OPENMP][DOCS]Update status of supported constructs, NFC. 2020-06-23 08:53:58 -04:00
Nathan James c2b22c57fc
Fixed ASTMatchers registry and regen ast docs 2020-06-22 10:56:20 +01:00
Fangrui Song 2a4317bfb3 [SanitizeCoverage] Rename -fsanitize-coverage-{white,black}list to -fsanitize-coverage-{allow,block}list
Keep deprecated -fsanitize-coverage-{white,black}list as aliases for compatibility for now.

Reviewed By: echristo

Differential Revision: https://reviews.llvm.org/D82244
2020-06-19 22:22:47 -07:00
Fangrui Song d8c9729216 [docs] Regenerate clang/docs/ClangCommandLineReference.rst 2020-06-18 14:52:39 -07:00
Alexey Bataev eed45b5fa2 [OPENMP][DOCS]Update status of supported constructs, NFC. 2020-06-18 13:29:33 -04:00