Commit Graph

1176 Commits

Author SHA1 Message Date
Richard Smith 4cd5264534 [modules] Remove non-functional driver options -f[no-]modules-implicit-maps.
These driver options never did anything (they weren't forwarded to the
frontend). Also update the documentation to not mention them.

llvm-svn: 239787
2015-06-15 23:52:34 +00:00
Peter Collingbourne c4122c17b4 Protection against stack-based memory corruption errors using SafeStack: Clang command line option and function attribute
This patch adds the -fsanitize=safe-stack command line argument for clang,
which enables the Safe Stack protection (see http://reviews.llvm.org/D6094
for the detailed description of the Safe Stack).

This patch is our implementation of the safe stack on top of Clang. The
patches make the following changes:

- Add -fsanitize=safe-stack and -fno-sanitize=safe-stack options to clang
  to control safe stack usage (the safe stack is disabled by default).

- Add __attribute__((no_sanitize("safe-stack"))) attribute to clang that can be
  used to disable the safe stack for individual functions even when enabled
  globally.

Original patch by Volodymyr Kuznetsov and others at the Dependable Systems
Lab at EPFL; updates and upstreaming by myself.

Differential Revision: http://reviews.llvm.org/D6095

llvm-svn: 239762
2015-06-15 21:08:13 +00:00
Saleem Abdulrasool 28ff2317e5 docs: grammar adjustments in clang manpage
Fix a few typos and run-on sentences in the clang POD documentation.

Patch by Brian R. Gaeke!

llvm-svn: 239652
2015-06-13 01:21:58 +00:00
Daniel Jasper 20580fd5d3 clang-format: Make SFS_Inline imply SFS_Empty.
In the long run, these two might be independent or we might to only
allow specific combinations. Until we have a corresponding request,
however, it is hard to do the right thing and choose the right
configuration options. Thus, just don't touch the options yet and
just modify the behavior slightly.

llvm-svn: 239531
2015-06-11 13:31:45 +00:00
Vladimir Sukharev c85ed8567c Fix typo in cross-compilation docs: "-fpu" -> "-mfpu"
Reviewers: rengolin

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D10209

llvm-svn: 238912
2015-06-03 10:11:42 +00:00
Douglas Katzman 677324e0b5 Fix typo in tutorial.
llvm-svn: 238885
2015-06-02 22:40:27 +00:00
Douglas Katzman 9c19d35fa7 Correct DriverInternals.rst: ccc-print-options is gone.
Was removed in svn r189802.

llvm-svn: 238876
2015-06-02 22:06:32 +00:00
Diego Novillo 46ab35d680 Improve user documentation on profiling.
This clarifies the relationship between instrumentation and sampling based PGO,
code coverage analysis and the different formats supported by sample
profiling.

llvm-svn: 238504
2015-05-28 21:30:04 +00:00
Aaron Ballman a235996d4c Fixing an RST issue to silence a sphinx warning.
llvm-svn: 238241
2015-05-26 19:56:13 +00:00
Aaron Ballman 674cf26892 __declspec is not a core Clang language extension. Instead, require -fms-extensions or -fborland to enable the language extension.
Note: __declspec is also temporarily enabled when compiling for a CUDA target because there are implementation details relying on __declspec(property) support currently. When those details change, __declspec should be disabled for CUDA targets.
llvm-svn: 238238
2015-05-26 19:44:52 +00:00
Aaron Ballman d6ea91456a Going out on a limb and guessing that someone viewing the 3.7 release notes may instead want to view 3.6 instead of 3.5.
llvm-svn: 238212
2015-05-26 16:12:07 +00:00
Diego Novillo e0d289efbd Add clarifying note that sampling-based profiles cannot be used for code coverage.
llvm-svn: 238031
2015-05-22 16:05:07 +00:00
Aaron Ballman 8afcd0a71a Updating the documentation to include an operator! for negative capability support.
llvm-svn: 238020
2015-05-22 13:36:48 +00:00
Peter Collingbourne 915df9968b Implement no_sanitize attribute.
Differential Revision: http://reviews.llvm.org/D9631

llvm-svn: 237463
2015-05-15 18:33:32 +00:00
Richard Smith a0334a9277 Fix a #include cycle in the libclang headers. "Eventually" is now.
llvm-svn: 237320
2015-05-14 00:22:12 +00:00
Aaron Ballman d43f0c5e82 Made considerable updates to the documentation explaining how to add a new attribute to clang. Cleans up some of the existing wording, as well as adding new information and better explanations.
llvm-svn: 237268
2015-05-13 18:06:48 +00:00
Jonathan Roelofs 6800293701 Fix indentation problem introduced in r236964. NFC
llvm-svn: 236965
2015-05-11 02:13:24 +00:00
Jonathan Roelofs e868b624da Fix formatting of a few code blocks. NFC
llvm-svn: 236964
2015-05-11 02:05:20 +00:00
Alexey Samsonov 8fffba1ef1 Update docs for SanitizerCoverage.
llvm-svn: 236793
2015-05-07 23:04:19 +00:00
David Majnemer ee97fc7b15 Fix some glitches in the MSVCCompatibility document
- Fix the formatting of the "Exceptions and SEH" section.
- Make the "Complete" text for "Thread-safe initialization of local
  statics" green.

llvm-svn: 236706
2015-05-07 07:48:16 +00:00
David Majnemer 79a4d58ea1 Note that we support 'throw' for the MS ABI.
llvm-svn: 236698
2015-05-07 06:16:03 +00:00
David Majnemer 8354eeed19 [MS ABI] Implement thread-safe initialization using the MSVC 2015 ABI
The MSVC 2015 ABI utilizes a rather straightforward adaptation of the
algorithm found in the appendix of N2382.  While we are here, implement
support for emitting cleanups if an exception is thrown while we are
intitializing a static local variable.

llvm-svn: 236697
2015-05-07 06:15:46 +00:00
Sergey Matveev ea558e0b33 [docs] Update SanitizerCoverage docs.
llvm-svn: 236641
2015-05-06 21:09:00 +00:00
Reid Kleckner bc24c6ca76 Update MSVC compatibility doc note about exceptions
llvm-svn: 236458
2015-05-04 20:53:51 +00:00
Richard Smith 35932cd84d Mention PPCallbacks interface change in release notes.
llvm-svn: 236406
2015-05-04 03:18:47 +00:00
Daniel Jasper a4499133b1 clang-format: Add ability to align assignment operators.
In Objective-C some style guides use a style where assignment operators are
aligned, in an effort to increase code readability. This patch adds an option
to the format library which allows this functionality. It is disabled by
default for all the included styles, so it must be explicitly enabled.

The option will change code such as:
  - (void)method {
      NSNumber *one = @1;
      NSNumber *twentyFive = @25;
  }

to:
  - (void)method {
      NSNumber *one        = @1;
      NSNumber *twentyFive = @25;
  }

Patch by Matt Oakes. Thank you!

Accidentally reformatted all the tests...

llvm-svn: 236100
2015-04-29 13:06:49 +00:00
Paul Robinson d7214a7651 Support generating NMake/Jom-style depfiles.
NMake is a Make-like builder that comes with Microsoft Visual Studio.
Jom (https://wiki.qt.io/Jom) is an NMake-compatible build tool.
Dependency files for NMake/Jom need to use double-quotes to wrap
filespecs containing special characters, instead of the backslash
escapes that GNU Make wants.

Adds the -MV option, which specifies to use double-quotes as needed
instead of backslash escapes when writing the dependency file.

Differential Revision: http://reviews.llvm.org/D9260

llvm-svn: 235903
2015-04-27 18:14:32 +00:00
Sergey Matveev 33e322455f Fix clang docs build.
llvm-svn: 235650
2015-04-23 21:29:37 +00:00
Sergey Matveev 07e2d283a3 Add clang/docs/SanitizerCoverage.rst
Moved from https://code.google.com/p/address-sanitizer/wiki/AsanCoverage

llvm-svn: 235643
2015-04-23 20:40:04 +00:00
Peter Collingbourne 1a7488afaa Implement CFI type checks for non-virtual calls.
This uses the same class metadata currently used for virtual call and
cast checks.

The new flag is -fsanitize=cfi-nvcall. For consistency, the -fsanitize=cfi-vptr
flag has been renamed -fsanitize=cfi-vcall.

Differential Revision: http://reviews.llvm.org/D8756

llvm-svn: 233874
2015-04-02 00:23:30 +00:00
Richard Smith 8f4d3ff146 [modules] Restrict the module use-declaration to only appear in top-level
modules, and allow sub-modules of a module with a use-declaration to make use
of the nominated modules.

llvm-svn: 233323
2015-03-26 22:10:01 +00:00
Alexey Samsonov ecf380ef3b [UBSan] Don't allow to use UBSan with anything except for ASan.
We are not able to make a reliable solution for using UBSan together
with other sanitizers with runtime support (and sanitizer_common).
Instead, we want to follow the path used for LSan: have a "standalone"
UBSan tool, and plug-in UBSan that would be explicitly embedded into
specific sanitizers (in short term, it will be only ASan).

llvm-svn: 232829
2015-03-20 18:45:06 +00:00
Reid Kleckner 7ffc3fbb2f C++14: Disable sized deallocation by default due to ABI breakage
There are no widely deployed standard libraries providing sized
deallocation functions, so we have to punt and ask the user if they want
us to use sized deallocation. In the future, when such libraries are
deployed, we can teach the driver to detect them and enable this
feature.

N3536 claimed that a weak thunk from sized to unsized deallocation could
be emitted to avoid breaking backwards compatibility with standard
libraries not providing sized deallocation. However, this approach and
other variations don't work in practice.

With the weak function approach, the thunk has to have default
visibility in order to ensure that it is overridden by other DSOs
providing sized deallocation. Weak, default visibility symbols are
particularly expensive on MachO, so John McCall was considering
disabling this feature by default on Darwin. It also changes behavior
ELF linking behavior, causing certain otherwise unreferenced object
files from an archive to be pulled into the link.

Our second approach was to use an extern_weak function declaration and
do an inline conditional branch at the deletion call site. This doesn't
work because extern_weak only works on MachO if you have some archive
providing the default value of the extern_weak symbol. Arranging to
provide such an archive has the same challenges as providing the symbol
in the standard library. Not to mention that extern_weak doesn't really
work on COFF.

Reviewers: rsmith, rjmccall

Differential Revision: http://reviews.llvm.org/D8467

llvm-svn: 232788
2015-03-20 00:31:07 +00:00
Peter Collingbourne d2926c91d5 Implement bad cast checks using control flow integrity information.
This scheme checks that pointer and lvalue casts are made to an object of
the correct dynamic type; that is, the dynamic type of the object must be
a derived class of the pointee type of the cast. The checks are currently
only introduced where the class being casted to is a polymorphic class.

Differential Revision: http://reviews.llvm.org/D8312

llvm-svn: 232241
2015-03-14 02:42:25 +00:00
Nico Weber bdae5c390c Remove duplicate "the". N+1 redundancy is not useful here.
llvm-svn: 232086
2015-03-12 19:35:34 +00:00
Logan Chien 0d59d603ef [docs] Update the doxygen configuration file.
Update the doxygen configuration file and the Makefile build rules
to provide better output (simply use the default stylesheet and template
from the Doxygen distribution.)

This CL has upgrade doxygen.cfg.in to Doxygen 1.8.6.

llvm-svn: 232066
2015-03-12 17:27:53 +00:00
Logan Chien 6f43a4fa25 [docs] Replace the doxygen qch option properly.
llvm-svn: 232065
2015-03-12 17:27:19 +00:00
Peter Collingbourne 6e7908ddb7 docs: Document byte arrays.
llvm-svn: 231994
2015-03-12 00:30:41 +00:00
David Majnemer f4d9a5a964 MS ABI: Mark 'throw' as implemented in the compatibility doc
llvm-svn: 231953
2015-03-11 18:38:51 +00:00
Ben Langmuir 921f2e6746 Document __has_feature(modules) in LanguageExtensions
Fixes PR18985

Patch by Vassil Vassilev!

llvm-svn: 231789
2015-03-10 14:39:26 +00:00
Alexey Samsonov 21d2dda3d2 [UBSan] Split -fsanitize=shift into -fsanitize=shift-base and -fsanitize=shift-exponent.
This is a recommit of r231150, reverted in r231409. Turns out
that -fsanitize=shift-base check implementation only works if the
shift exponent is valid, otherwise it contains undefined behavior
itself.

Make sure we check that exponent is valid before we proceed to
check the base. Make sure that we actually report invalid values
of base or exponent if -fsanitize=shift-base or
-fsanitize=shift-exponent is specified, respectively.

llvm-svn: 231711
2015-03-09 21:50:19 +00:00
Benjamin Kramer 57dd9bd5cc ASTMatchers: Make AST_POLYMORPHIC_SUPPORTED_TYPES a variadic macro
C++11 finally allows us to use this C99 feature.

llvm-svn: 231575
2015-03-07 20:38:15 +00:00
Alexey Samsonov 48a9db034a Revert "[UBSan] Split -fsanitize=shift into -fsanitize=shift-base and -fsanitize=shift-exponent."
It's not that easy. If we're only checking -fsanitize=shift-base we
still need to verify that exponent has sane value, otherwise
UBSan-inserted checks for base will contain undefined behavior
themselves.

llvm-svn: 231409
2015-03-05 21:57:35 +00:00
Alexey Samsonov 783b8174ad [UBSan] Split -fsanitize=shift into -fsanitize=shift-base and -fsanitize=shift-exponent.
-fsanitize=shift is now a group that includes both these checks, so
exisiting users should not be affected.

This change introduces two new UBSan kinds that sanitize only left-hand
side and right-hand side of shift operation. In practice, invalid
exponent value (negative or too large) tends to cause more portability
problems, including inconsistencies between different compilers, crashes
and inadequeate results on non-x86 architectures etc. That is,
-fsanitize=shift-exponent failures should generally be addressed first.

As a bonus, this change simplifies CodeGen implementation for emitting left
shift (separate checks for base and exponent are now merged by the
existing generic logic in EmitCheck()), and LLVM IR for these checks
(the number of basic blocks is reduced).

llvm-svn: 231150
2015-03-03 22:15:35 +00:00
Evgeniy Stepanov 6e09bca0ef [msan] Change track-origins default mode from 1 to 2.
Change -fsanitize-memory-track-origins to be equivalent to
-fsanitize-memory-track-origins=2.

Track-origins=2 provides a lot more detailed reports at the cost of
some additional slowdown (ranging from none to, sometimes, 3x; ~3% average on
SPEC2006).

llvm-svn: 230644
2015-02-26 15:59:30 +00:00
Peter Collingbourne 4b0924dad6 docs: Document CFI padding and all-ones optimizations. Link to viewvc.
llvm-svn: 230588
2015-02-26 00:18:04 +00:00
Ben Langmuir 443aa4b4b0 Allow (Object *)kMyGlobalCFObj casts without bridging
Previously we allowed these casts only for constants declared in system
headers, which we assume are retain/release-neutral. Now also allow them
for constants in user headers, treating them as +0.  Practically, this
means that we will now allow:
id x = (id)kMyGlobalConst;

But unlike with system headers we cannot mix them with +1 values:
id y = (id)(b ? kMyGlobalConst : [Obj newValAtPlusOne]); // error
id z = (id)(b ? kSystemGlobalConst: [Obj newValAtPlusOne]); // OK

Thanks to John for suggesting this improvement.

llvm-svn: 230534
2015-02-25 20:09:06 +00:00
Peter Collingbourne 03054d489e docs: Document optimizations in control flow integrity design doc.
llvm-svn: 230458
2015-02-25 03:35:03 +00:00
Adrian Prantl cbc368c5b5 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
llvm-svn: 230454
2015-02-25 02:44:04 +00:00
Adrian Prantl 8bf7af3de8 Wrap clang module files in a Mach-O, ELF, or COFF container.
This is a necessary prerequisite for debugging with modules.
The .pcm files become containers that hold the serialized AST which allows
us to store debug information in the module file that can be shared by all
object files that were built importing the module.

This reapplies r230044 with a fixed configure+make build and updated
dependencies and testcase requirements. Over the last iteration this
version adds
- missing target requirements for testcases that specify an x86 triple,
- a missing clangCodeGen.a dependency to libClang.a in the make build.

rdar://problem/19104245

llvm-svn: 230423
2015-02-25 01:31:45 +00:00