Commit Graph

1440 Commits

Author SHA1 Message Date
Artem Dergachev 733e71b73b [analyzer] Fix symbolic element index lifetime.
SymbolReaper was destroying the symbol too early when it was referenced only
from an index SVal of a live ElementRegion.

In order to test certain aspects of this patch, extend the debug.ExprInspection
checker to allow testing SymbolReaper in a direct manner.

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

llvm-svn: 255236
2015-12-10 09:28:06 +00:00
Alexey Bataev 897451d372 [OPENMP] Make -fopenmp to turn on OpenMP support by default, clang part
Patch turns on OpenMP support in clang by default after fixing OpenMP buildbots.
Differential Revision: http://reviews.llvm.org/D13803

llvm-svn: 255223
2015-12-10 05:47:10 +00:00
Yunzhong Gao eecc9e97d2 Fix a typo in the clang user manual.
-fmax-unknown-pointer-align => -fmax-type-align

llvm-svn: 255200
2015-12-10 01:37:18 +00:00
Alexey Samsonov b6761c2e1e [Docs] One more cleanup of -fsanitize= section.
Describe -fsanitize-blacklist flags in separate paragraphs, move
notes about importance of clang++ for vptr down to UBSan docs.

llvm-svn: 254798
2015-12-04 23:13:14 +00:00
Alexey Samsonov 1f7051e31b [Docs] Update MSan docs
Summary:
1. Move MSan-specific flags and features from user manual to MSan page.
2. Update current status / list of supported platforms.

Reviewers: eugenis, kcc

Subscribers: cfe-commits

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

llvm-svn: 254788
2015-12-04 22:50:44 +00:00
Alexey Samsonov 9eda64043e [Docs] Move the list of CFI schemes down to CFI doc, and update it.
Use proper headling levels in CFI doc. Before that, all sections
were considered a subsection of "Introduction".

Reviewers: pcc, kcc

Subscribers: cfe-commits

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

llvm-svn: 254771
2015-12-04 21:30:58 +00:00
Alexey Samsonov 8846017dd4 [Docs] Remove false claim: UBSan can also be combined with TSan/MSan.
llvm-svn: 254734
2015-12-04 17:35:47 +00:00
Alexey Samsonov 778fc728ed Clang documentation for UBSan.
Summary:
Create a separate page describing UBSan tool, move the description of
fine-grained checks there, provide extra information about supported
platforms, symbolization etc. This text is compiled from four parts:

* Existing documentation copied from User's Manual
* Layout used in documentation for another sanitizers (ASan, MSan etc.)
* Text written from scratch
* Small parts taken from Michael Morrison's attempt at creating UBSan
  page:
  http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20141215/249503.html

Reviewers: kcc, rsmith, silvas

Subscribers: tberghammer, danalbert, srhines, kcc

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

llvm-svn: 254733
2015-12-04 17:30:29 +00:00
Alexey Samsonov 2e2469d9d9 [Docs] Sanitizer docs migrated from code.google.com to github.com.
llvm-svn: 254672
2015-12-04 00:38:13 +00:00
Aaron Ballman a60bcdab92 Add a narrowing AST matcher that matches on a FunctionDecl with a non-throwing exception specification.
llvm-svn: 254516
2015-12-02 15:23:59 +00:00
Kostya Serebryany 5ce81794c3 [sanitizer coverage] document -fsanitize-coverage=trace-bb
llvm-svn: 254481
2015-12-02 02:08:26 +00:00
Peter Collingbourne 9de8fc5766 docs: Add design documentation for forward-edge CFI for indirect calls.
llvm-svn: 254464
2015-12-01 21:58:54 +00:00
Kostya Serebryany a94e6e7eb0 [libFuzzer] clarify the limitation of fsanitize-coverage=trace-cmp
llvm-svn: 254337
2015-11-30 22:17:19 +00:00
Justin Bogner 98712bd771 docs: Remove references to the long-defunct LLVM_USED_LIBS
LLVM_USED_LIBS hasn't done anything since 2012, stop telling people to
set it in the docs.

llvm-svn: 254173
2015-11-26 19:52:24 +00:00
Richard Smith 50668455a7 Remove DataRecursiveASTVisitor; it no longer serves any purpose, since it's just an alias for RecursiveASTVisitor.
llvm-svn: 253949
2015-11-24 03:55:01 +00:00
Aaron Ballman 6290fc9154 Add an AST matcher for narrowing when a type is volatile-qualified.
llvm-svn: 253882
2015-11-23 17:09:24 +00:00
Hans Wennborg 543cb4c333 Revert r253582: "clang-cl: Make /W4 imply -Wall -Wextra (PR25563)"
The patch expanded the flag *at the end*, breaking invocations like:

  clang-cl /W4 -Wno-unused-parameter

Reverting for now.

llvm-svn: 253678
2015-11-20 16:51:56 +00:00
Benjamin Kramer 7d0cc23786 Regenerate ASTMatchersReference without CRLF.
llvm-svn: 253654
2015-11-20 07:57:46 +00:00
Benjamin Kramer 611d33a5a2 Fix ASTMatcher reference newlines and make the generator script windows-proof.
llvm-svn: 253653
2015-11-20 07:46:19 +00:00
Hans Wennborg 2763dc29a5 clang-cl: Make /W4 imply -Wall -Wextra (PR25563)
llvm-svn: 253582
2015-11-19 17:49:59 +00:00
Aaron Ballman 8e7f00b0eb Re-committing r253473 after hopefully fixing the bot breakage. There was a copy-pasta issue that my local testing did not catch.
llvm-svn: 253481
2015-11-18 17:56:55 +00:00
Aaron Ballman 81d17f2f7e Reverting r253473 while I investigate build bot failures.
llvm-svn: 253475
2015-11-18 17:16:01 +00:00
Aaron Ballman 34e0bd40e4 Adding AST matchers for VarDecl storage durations. Can now determine whether a VarDecl has automatic, static, or thread storage duration. This also updates the documentation for matchers, which appear to be missing some previous additions.
llvm-svn: 253473
2015-11-18 17:05:39 +00:00
David Majnemer 55cf252d75 Mark is_destructible/is_nothrow_destructible as implemented
These were implemented back in r244564.  However, I forgot to update the
docs.

llvm-svn: 253128
2015-11-14 07:21:35 +00:00
Yury Gribov 5bfeca1201 [ASan] Allow -fsanitize-recover=address.
Differential Revision: http://reviews.llvm.org/D14243

llvm-svn: 252721
2015-11-11 10:45:48 +00:00
Alexander Kornienko 149af59113 Fixed a link.
llvm-svn: 252069
2015-11-04 19:42:17 +00:00
Alexander Kornienko 4f6725c426 Fixed header levels.
llvm-svn: 252068
2015-11-04 19:40:05 +00:00
Alexander Kornienko dec64d8e16 Removed mentions of clang-modernize, added a short description of clang-tidy.
llvm-svn: 252066
2015-11-04 19:34:55 +00:00
John McCall 03107a4ef0 Add support for __builtin_{add,sub,mul}_overflow.
Patch by David Grayson!

llvm-svn: 251651
2015-10-29 20:48:01 +00:00
Daniel Jasper 6501f7e8fd clang-format: Add an additional value to AlignAfterOpenBracket: AlwaysBreak.
Summary:
If this option is set, clang-format will always insert a line wrap, e.g.
before the first parameter of a function call unless all parameters fit
on the same line. This obviates the need to make a decision on the
alignment itself.

Use this style for Google's JavaScript style and add some minor tweaks
to correctly handle nested blocks etc. with it. Don't use this option
for for/while loops.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 251405
2015-10-27 12:38:37 +00:00
Diego Novillo 843dc6ffbf Sample Profiles - Fix location of binary encoding documentation. NFC.
llvm-svn: 250705
2015-10-19 15:53:17 +00:00
Saleem Abdulrasool 7f66d75832 docs: remote stale refs
Since the attribute documentation is now auto-generated, the previous references
are no longer valid.  This prevented the docs build from completing
successfully.

llvm-svn: 250674
2015-10-19 01:24:08 +00:00
Nico Weber 187fcf1e5d Update `clang-format -help` output in clang-format docs.
-assume-filename, -fallback-style, and -sort-includes are new.  (They're also
longer than the previous options, so all descriptions shift over by some amount,
making this diff look larger than it is.)

It looks like someone renamed "General options" to "Generic Options" too.

llvm-svn: 250672
2015-10-19 01:08:30 +00:00
Eric Fiselier 3acf5fdd88 Add an AST node matcher for TemplateTypeParmDecl objects.
llvm-svn: 250602
2015-10-17 02:34:44 +00:00
Diego Novillo 33452761bb Sample profiles - Update text profile documentation.
There's been some changes to the text encoding for sample profiles. This
updates the documentation and an example.

llvm-svn: 250310
2015-10-14 18:37:39 +00:00
Matthias Gehre 2cf7e803bb Add decayedType and hasDecayedType AST matchers
Summary: Add decayedType and hasDecayedType AST matchers

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 250114
2015-10-12 21:46:07 +00:00
Daniel Jasper 8e1ecca2ec clang-format: Hopefully fix code blocks in docs.
Otherwise I will have to install sphinx ;)..

llvm-svn: 249542
2015-10-07 13:02:45 +00:00
Daniel Jasper b5bda7c0b0 clang-format: Add empty line before code-blocks in Docs.
llvm-svn: 249394
2015-10-06 12:11:51 +00:00
Daniel Jasper 8ce1b8df76 clang-format: Make IncludeCategories configurable in .clang-format file.
This was made much easier by introducing an IncludeCategory struct to
replace the previously used std::pair.

Also, cleaned up documentation and added examples.

llvm-svn: 249392
2015-10-06 11:54:18 +00:00
Aaron Ballman 478a8eb2b6 Adding an AST node matcher for NonTypeTemplateParmDecl objects.
llvm-svn: 249341
2015-10-05 19:44:42 +00:00
Aaron Ballman 3fd6c110be Adding a narrowing AST matcher for FunctionDecl::isVariadic(), plus tests and documentation.
llvm-svn: 249321
2015-10-05 14:41:27 +00:00
Daniel Jasper fcbea71b4f clang-format: Small doc fix.
llvm-svn: 249312
2015-10-05 13:30:42 +00:00
Daniel Jasper 28ff728787 clang-format: Remove sentence in option cost threshold that weakens the
statement. Specifically, we don't want people that have already written
a patch to just write a style guide for their 1-person project.

llvm-svn: 249290
2015-10-05 07:36:40 +00:00
Daniel Jasper 49d3d58a45 clang-format: Document threshold for adding new options.
llvm-svn: 249289
2015-10-05 07:24:55 +00:00
Daniel Jasper c1bc38ed4f clang-format: Add a new brace style "custom" as well as flags to
control the individual braces. The existing choices for brace wrapping
are now merely presets for the different flags that get expanded upon
calling the reformat function.

All presets have been chose to keep the existing formatting, so there
shouldn't be any difference in formatting behavior.

Also change the dump_format_style.py to properly document the nested
structs that are used to keep these flags discoverable among all the
configuration flags.

llvm-svn: 248802
2015-09-29 14:57:55 +00:00
Adrian Prantl b20f1d0a3c Fix a typo.
llvm-svn: 247895
2015-09-17 15:58:54 +00:00
Aaron Ballman cdc43afa20 Update the 3.8 release notes with the breaking change information regarding AST matchers.
llvm-svn: 247887
2015-09-17 13:47:22 +00:00
Aaron Ballman 512fb64765 Rename AST node matchers to match the AST node names directly. Part of this rename also splits recordDecl() (which used to match CXXRecordDecl) into recordDecl() (that matches RecordDecl) and cxxRecordDecl (that matches CXXRecordDecl). Also adds isStruct(), isUnion(), and isClass() narrowing matchers for RecordDecl objects.
llvm-svn: 247885
2015-09-17 13:30:52 +00:00
Naomi Musgrave bf8f00586a Updating docs for MSan to describe poison-in-dtor.
Summary:
Describe the compile and runtime flags to enable MemorySanitizer
detection of use-after-destroy.

Reviewers: eugenis

Subscribers: llvm-commits

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

Revise doc description of use-after-dtor.

Change wording to specify memory no longer readable.

llvm-svn: 247871
2015-09-17 00:10:59 +00:00
Aaron Ballman b85be665b0 Fixed HasDeclarationMatcher to properly convert all types into decls where possible. Added objcObjectPointerType(), objcInterfaceDecl(), templateTypeParmType(), injectedClassNameType(), and unresolvedUsingTypenameDecl(). Updated documentation for pointerType() to call out that it does not match ObjCObjectPointerType types. Changed pointsTo() to handle ObjCObjectPointerType as well as PointerType.
While this may seem like a lot of unrelated changes, they all relate back to fixing HasDeclarationMatcher.

This now allows us to write a matcher like:

varDecl(hasType(namedDecl(hasName("Foo"))))

that matches code using typedefs, objc interfaces, template type parameters, injected class names, or unresolved using typenames.

llvm-svn: 247404
2015-09-11 11:51:24 +00:00
Michael Zolotukhin 59d72b1c8a Docs: Document __builtin_nontemporal_load and __builtin_nontemporal_store.
Summary:
In r247104 I added the builtins for generating non-temporal memory operations,
but now I realized that they lack documentation. This patch adds some.

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

llvm-svn: 247374
2015-09-11 02:01:15 +00:00
Michael Zolotukhin c3f09ffa4d Docs: Add missing new line before a list.
llvm-svn: 247360
2015-09-10 23:56:10 +00:00
Peter Collingbourne 2c7f7e31c4 CFI: Introduce -fsanitize=cfi-icall flag.
This flag causes the compiler to emit bit set entries for functions as well
as runtime bitset checks at indirect call sites. Depends on the new function
bitset mechanism.

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

llvm-svn: 247238
2015-09-10 02:17:40 +00:00
Sanjay Patel a24296b459 add __builtin_unpredictable and convert to metadata
This patch depends on r246688 (D12341).

The goal is to make LLVM generate different code for these functions for a target that
has cheap branches (see PR23827 for more details):

int foo();

int normal(int x, int y, int z) {
   if (x != 0 && y != 0) return foo();
   return 1;
}

int crazy(int x, int y) {
   if (__builtin_unpredictable(x != 0 && y != 0)) return foo();
   return 1;
}

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

llvm-svn: 246699
2015-09-02 20:01:30 +00:00
Nico Weber ee1cff5fab Make trunk release notes point to 3.7, not 3.6
llvm-svn: 246589
2015-09-01 21:13:14 +00:00
Aaron Ballman 6e14652550 Updating the AST matcher documentation with a new entry; NFC.
llvm-svn: 246324
2015-08-28 19:39:56 +00:00
Aaron Ballman 6c79f352b8 Adding an AST matcher for namespaceAliasDecl.
llvm-svn: 246322
2015-08-28 19:39:21 +00:00
Adrian Prantl 6b21ab21d1 Add a -gmodules option to the driver and a -dwarf-ext-refs to cc1
to enable the use of external type references in the debug info
(a.k.a. module debugging).

The driver expands -gmodules to "-g -fmodule-format=obj -dwarf-ext-refs"
and passes that to cc1. All this does at the moment is set a flag
codegenopts.

http://reviews.llvm.org/D11958

llvm-svn: 246192
2015-08-27 19:46:20 +00:00
Gabor Horvath 28690925ed [Static Analyzer] Checks to catch nullability related issues.
Differential Revision: http://reviews.llvm.org/D11468

llvm-svn: 246105
2015-08-26 23:17:43 +00:00
Alexey Bataev ae8c17ef58 [OPENMP] Info about OpenMP Support in Users Manual, NFC.
Differential Revision: http://reviews.llvm.org/D12152

llvm-svn: 245823
2015-08-24 05:31:10 +00:00
Aaron Ballman 11825f2592 Add AST narrowing matchers for inline and anonymous namespaces. Since the inline keyword can also be specified on a FunctionDecl, this is a polymorphic matcher.
llvm-svn: 245337
2015-08-18 19:55:20 +00:00
Hans Wennborg 83c058925c Doxygen: add build option to use svg instead of png files for graphs
Differential Revision: http://reviews.llvm.org/D11994

llvm-svn: 245259
2015-08-17 23:38:56 +00:00
Manuel Klimek 5d093286f0 Fix AST matcher documentation.
Fix a bug in the matcher docs where callExpr(on(...)) was in the examples,
but didn't work (on() only works for memberCallExpr).

Fix a bug in the doc dump script that was introduced in r231575 when
removing a regexp capture without adapting the code that uses the
captures.

llvm-svn: 245040
2015-08-14 11:47:51 +00:00
Hans Wennborg 32847fb7ab Docs: keep copyright years up-to-date
llvm-svn: 244797
2015-08-12 19:45:01 +00:00
Hans Wennborg 0d08062b7b Docs: update clang-cl command-line documentation
llvm-svn: 244794
2015-08-12 19:35:01 +00:00
Hans Wennborg eb2bd9a269 ReleaseNotes: Small version nbr fix
llvm-svn: 244761
2015-08-12 16:40:42 +00:00
Aaron Ballman b2e2c57419 Add missing documentation for conversionDecl; NFC.
llvm-svn: 244669
2015-08-11 21:12:46 +00:00
Aaron Ballman 6f6d0b6c5a Add a polymorphic AST matcher for testing whether a constructor or a conversion declaration is marked as explicit or not.
llvm-svn: 244666
2015-08-11 21:09:52 +00:00
Aaron Ballman ed455d4062 Add an AST matcher to match member intializers of a CXXCtorInitializer.
llvm-svn: 244662
2015-08-11 20:42:00 +00:00
Nick Lewycky 00a5d21803 Fix typo.
llvm-svn: 244490
2015-08-10 19:54:11 +00:00
Mark Heffernan 397a98d86d Add new llvm.loop.unroll.enable metadata for use with "#pragma unroll".
This change adds the new unroll metadata "llvm.loop.unroll.enable" which directs
the optimizer to unroll a loop fully if the trip count is known at compile time, and
unroll partially if the trip count is not known at compile time. This differs from
"llvm.loop.unroll.full" which explicitly does not unroll a loop if the trip count is not
known at compile time

With this change "#pragma unroll" generates "llvm.loop.unroll.enable" rather than
"llvm.loop.unroll.full" metadata. This changes the semantics of "#pragma unroll" slightly
to mean "unroll aggressively (fully or partially)" rather than "unroll fully or not at all".

The motivating example for this change was some internal code with a loop marked
with "#pragma unroll" which only sometimes had a compile-time trip count depending
on template magic. When the trip count was a compile-time constant, everything works
as expected and the loop is fully unrolled. However, when the trip count was not a
compile-time constant the "#pragma unroll" explicitly disabled unrolling of the loop(!).
Removing "#pragma unroll" caused the loop to be unrolled partially which was desirable
from a performance perspective.

llvm-svn: 244467
2015-08-10 17:29:39 +00:00
Roman Kashitsyn 291f64fd03 Add WebKit brace style configuration option.
Summary:
Add brace style `BS_WebKit` as described on https://www.webkit.org/coding/coding-style.html:

* Function definitions: place each brace on its own line.
* Other braces: place the open brace on the line preceding the code block; place the close brace on its own line.

Set brace style used in `getWebKitStyle()` to the newly added `BS_WebKit`.

Reviewers: djasper, klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 244446
2015-08-10 13:43:19 +00:00
Diego Novillo 758f3f542a Add flags to disable profile generation.
This patch adds flags -fno-profile-instr-generate and
-fno-profile-instr-use, and the GCC aliases -fno-profile-generate and
-fno-profile-use.

These flags are used in situations where users need to disable profile
generation or use for specific files in a build, without affecting other
files.

llvm-svn: 244153
2015-08-05 21:49:51 +00:00
James Y Knight 81167fb799 Add missing atomic libcall support.
Support for emitting libcalls for __atomic_fetch_nand and
__atomic_{add,sub,and,or,xor,nand}_fetch was missing; add it, and some
test cases.

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

llvm-svn: 244063
2015-08-05 16:57:36 +00:00
Aaron Ballman 1ca258e6a8 Add AST matchers for narrowing constructors that are default, copy, or move constructors, as well as functionality to determine whether a ctor initializer is a base initializer.
llvm-svn: 244036
2015-08-05 12:11:30 +00:00
Tanya Lattner 4a08e931b6 Update mailing list references to lists.llvm.org
llvm-svn: 244000
2015-08-05 03:55:23 +00:00
Douglas Katzman 1e7bf36f45 Grammar: Don't imply that a program wouldn't want a person as its output.
(Because, hey, who wouldn't?)

llvm-svn: 243901
2015-08-03 20:41:31 +00:00
Kostya Serebryany b17e298a64 [libFuzzer] minimal documentation on data-flow-guided fuzzing
llvm-svn: 243793
2015-07-31 21:48:10 +00:00
Chih-Hung Hsieh 2c656c9417 Add -femulated-tls flag to select the emulated TLS model.
This will be used for old targets like Android that do not
support ELF TLS models.

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

llvm-svn: 243441
2015-07-28 16:27:56 +00:00
Aaron Ballman 41143bb573 Add an AST matcher, isFinal(), for testing whether a method or class declaration are marked final.
llvm-svn: 243107
2015-07-24 12:35:41 +00:00
Aaron Ballman 3f07e7b063 Updating the documentation for the hasAttr AST matcher, which behaves somewhat differently when used within clang-query. Fixes PR24217.
llvm-svn: 243029
2015-07-23 17:54:59 +00:00
Aaron Ballman 079d3e152d Something was unbalanced, and it wasn't the parentheses. ;-) Reverts r242915.
llvm-svn: 242927
2015-07-22 20:02:00 +00:00
Aaron Ballman cd1646823b Balancing parenthesis in comments and documentation; NFC.
llvm-svn: 242915
2015-07-22 17:51:42 +00:00
James Dennett d8b775a166 Doxygen: Enable autobrief feature, matching llvm config/coding standards.
Summary: This corresponds to the change made in r237417 - "Doxygen: Enable autobrief feature and update coding standards."

Reviewers: eliben

Subscribers: eliben, cfe-commits

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

llvm-svn: 242485
2015-07-16 23:17:43 +00:00
Aaron Ballman 3991846c33 Add the ability to AST match a variable declaration that is an exception variable.
llvm-svn: 242303
2015-07-15 17:11:21 +00:00
Peter Collingbourne 6fccf95aad CodeGen: Improve CFI type blacklisting mechanism.
We now use the sanitizer special case list to decide which types to blacklist.
We also support a special blacklist entry for types with a uuid attribute,
which are generally COM types whose virtual tables are defined externally.

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

llvm-svn: 242286
2015-07-15 12:15:56 +00:00
Hans Wennborg 775993ca7d docs/conf.py: update version to 3.8
llvm-svn: 242240
2015-07-14 22:53:35 +00:00
Hans Wennborg e904ea2b4d ReleaseNotes.rst: Bump version to 3.8
The notes for 3.7 are on the 3.7 branch.

llvm-svn: 242238
2015-07-14 22:52:36 +00:00
Mark Heffernan 7ccb5e2316 Update documentation for unroll pragmas on loops with runtime trip counts.
This change updates the documentation for the loop unrolling pragma behavior
change in r242047. Specifically, with that change "#pragma unroll" will not
unroll loops with a runtime trip count.

llvm-svn: 242048
2015-07-13 18:31:37 +00:00
Birunthan Mohanathas 305fa9c2bf clang-format: Add Mozilla brace breaking style
Differential Revision: http://reviews.llvm.org/D10883

llvm-svn: 241986
2015-07-12 03:13:54 +00:00
Diego Novillo 578caf5da7 Add GCC-compatible flags -fprofile-generate and -fprofile-use.
This patch adds support for specifying where the profile is emitted in a
way similar to GCC. These flags are used to specify directories instead
of filenames. When -fprofile-generate=DIR is used, the compiler will
generate code to write to <DIR>/default.profraw.

The patch also adds a couple of extensions: LLVM_PROFILE_FILE can still be
used to override the directory and file name to use and -fprofile-use
accepts both directories and filenames.

To simplify the set of flags used in the backend, all the flags get
canonicalized to -fprofile-instr-{generate,use} when passed to the
backend. The decision to use a default name for the profile is done
in the driver.

llvm-svn: 241825
2015-07-09 17:23:53 +00:00
Adrian Prantl 26686c4af0 Update PCHInternals.rst to document PCH wrapped in object file containers.
llvm-svn: 241690
2015-07-08 16:52:51 +00:00
Douglas Katzman 0dd8eb324d Grammar bug. NFC
llvm-svn: 241451
2015-07-06 15:25:31 +00:00
Birunthan Mohanathas b001a0ba5e clang-format: Add MacroBlock{Begin,End} options
The MacroBlockBegin and MacroBlockEnd options make matching macro identifiers
behave like '{' and '}', respectively, in terms of indentation.

Mozilla code, for example, uses several macros that begin and end a scope.
Previously, Clang-Format removed the indentation resulting in:

    MACRO_BEGIN(...)
    MACRO_ENTRY(...)
    MACRO_ENTRY(...)
    MACRO_END

Now, using the options

    MacroBlockBegin: "^[A-Z_]+_BEGIN$"
    MacroBlockEnd: "^[A-Z_]+_END$"

will yield the expected result:

    MACRO_BEGIN(...)
      MACRO_ENTRY(...)
      MACRO_ENTRY(...)
    MACRO_END

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

llvm-svn: 241363
2015-07-03 17:25:16 +00:00
Justin Bogner 2d74ae53f2 Driver: Replace a couple of out of date terms in the docs
The Job base class was removed in r241310, so replace a couple of
references to it with Command. Also change another use of Job with
Action, since that's the term used in the source.

llvm-svn: 241327
2015-07-03 08:03:43 +00:00
Aaron Ballman 9b869aa4a1 Implement an AST matcher for C++ exception catch handlers that can catch any exception type (...).
llvm-svn: 241256
2015-07-02 12:53:22 +00:00
Andrew Wilkins 6238c6f09a Sphinx-based clang man pages
Summary:
This diff introduces .rst files, Sphinx config, and a CMake target
for building clang man pages. This will deprecate the existing .pod-
based man page, and will integrate nicely with CMake. This diff does
not remove the existing man page; that will be done in a follow-up
once packagers have had a chance to react to the change.

For now, only clang(1) has been done; others can be added over time
by dropping additional files into the docs/CommandGuide directory.
The index page for CommandGuide has been copied from LLVM's
docs/CommandGuide.

The man page itself is mostly the same, with a few minor cosmetic
changes. The only major change is the SYNOPSIS section. I was unable
to get .rst/Sphinx produce the same style as in the existing man page.
Instead, I changed it to match the LLVM tools' relatively simple style.

To build the man pages, use the "docs-clang-man" target if building
with CMake. Otherwise, use "make -f Makefile.sphinx man".

Reviewers: cmatthews, silvas

Subscribers: dim, gaeke, beanz, cfe-commits

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

llvm-svn: 241037
2015-06-30 02:52:38 +00:00
Birunthan Mohanathas a0388a8af2 clang-format: Add option to break after definition return type for top-level functions only
Differential Revision: http://reviews.llvm.org/D10774

llvm-svn: 240959
2015-06-29 15:30:42 +00:00
Alex Denisov 21065ec50e Fix typo. NFC.
llvm-svn: 240888
2015-06-27 19:04:55 +00:00
Birunthan Mohanathas b744e7210b clang-format: Fix language of DisableFormat description
This is a comment-only change to test commit access.

llvm-svn: 240879
2015-06-27 09:25:28 +00:00
Alex Denisov fde64956f9 [ObjC] Add NSValue support for objc_boxed_expressions
Patch extends ObjCBoxedExpr to accept records (structs and unions):

typedef struct __attribute__((objc_boxable)) _Color {
  int r, g, b;
} Color;

Color color;
NSValue *boxedColor = @(color); // [NSValue valueWithBytes:&color objCType:@encode(Color)];

llvm-svn: 240761
2015-06-26 05:28:36 +00:00
Anna Zaks 8264a8cdbc [docs] Several updates to the Address Sanitizer webpage.
- Added the description of the interceptor suppression.
 - Re-organized a bit: grouped a few things under the Issue Suppression
   section, grouped IOC and leaks under a section, placed symbolication
   info into Symbolizing the Reports section..
 - In supported platforms: "MacOS" -> "OS X"; added "iOS Simulator"
 - Added a paragraph to the Usage section describing when DYLD_INSERT_LIBRARIES
   might need to be used.
 - "attribute((no_sanitize_address))" -> "__attribute__((no_sanitize("address")))"
 - Updated Leak Sanitizer page with most up to date info.
....

http://reviews.llvm.org/D10559

llvm-svn: 240725
2015-06-25 23:36:44 +00:00
Peter Collingbourne 5b74593e16 docs: Fix bad link in SafeStack.rst.
llvm-svn: 240696
2015-06-25 21:02:17 +00:00
Aaron Ballman d95d0dab46 Silencing some Sphinx warnings about duplicate explicit target names.
llvm-svn: 240536
2015-06-24 12:11:04 +00:00
Peter Collingbourne 7ce9199a57 SafeStack documentation improvements
This patch makes the following improvements to the SafeStack documentation:

Explicitly states the security guarantees of the SafeStack
Clarifies which of the security guarantees are probabilistic
Re-orders security limitations to put the most severe ones first
Explains how `__attribute__((no_sanitize("safe-stack")))` works and how to use it safely
Explains that SafeStack should be combined with a forward-edge protection mechanism, such as CPI, IFCC or others
Multiple readability and stylistic improvements

Patch by Volodymyr Kuznetsov!

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

llvm-svn: 240472
2015-06-23 22:24:45 +00:00
Aaron Ballman a8bc40cf3d Adding a title to appease the sphinx build bot.
llvm-svn: 240430
2015-06-23 17:31:30 +00:00
Aaron Ballman 234197f28b AttributeReference.rst is automatically generated by a server-side process currently. To cut down on accidental commits to this file that are not properly reflected in AttrDocs.td (such as r215806 - r215808), this file now contains nothing but a comment explaining the current state of affairs.
llvm-svn: 240428
2015-06-23 17:14:51 +00:00
Douglas Gregor 1a3ae83722 Document the nullability attributes.
llvm-svn: 240296
2015-06-22 17:06:56 +00:00
Alexey Samsonov 907880edd9 [CFI] Require -flto instead of implying it.
Summary:
This is unfortunate, but would let us land http://reviews.llvm.org/D10467,
that makes ToolChains responsible for computing the set of sanitizers
they support.

Unfortunately, Darwin ToolChains doesn't know about actual OS they
target until ToolChain::TranslateArgs() is called. In particular, it
means we won't be able to construct SanitizerArgs for these ToolChains
before that.

This change removes SanitizerArgs::needsLTO() method, so that now
ToolChain::IsUsingLTO(), which is called very early, doesn't need
SanitizerArgs to implement this method.

Docs and test cases are updated accordingly. See
https://llvm.org/bugs/show_bug.cgi?id=23539, which describes why we
start all these.

Test Plan: regression test suite

Reviewers: pcc

Subscribers: cfe-commits

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

llvm-svn: 240170
2015-06-19 19:57:46 +00:00
Eric Christopher 2c4555ad1b Fix "the the" in comments/documentation/etc.
llvm-svn: 240110
2015-06-19 01:52:53 +00:00
Peter Collingbourne 6708c4a176 Implement diagnostic mode for -fsanitize=cfi*, -fsanitize=cfi-diag.
This causes programs compiled with this flag to print a diagnostic when
a control flow integrity check fails instead of aborting. Diagnostics are
printed using UBSan's runtime library.

The main motivation of this feature over -fsanitize=vptr is fidelity with
the -fsanitize=cfi implementation: the diagnostics are printed under exactly
the same conditions as those which would cause -fsanitize=cfi to abort the
program. This means that the same restrictions apply regarding compiling
all translation units with -fsanitize=cfi, cross-DSO virtual calls are
forbidden, etc.

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

llvm-svn: 240109
2015-06-19 01:51:54 +00:00
Peter Collingbourne 9881b78b53 Introduce -fsanitize-trap= flag.
This flag controls whether a given sanitizer traps upon detecting
an error. It currently only supports UBSan. The existing flag
-fsanitize-undefined-trap-on-error has been made an alias of
-fsanitize-trap=undefined.

This change also cleans up some awkward behavior around the combination
of -fsanitize-trap=undefined and -fsanitize=undefined. Previously we
would reject command lines containing the combination of these two flags,
as -fsanitize=vptr is not compatible with trapping. This required the
creation of -fsanitize=undefined-trap, which excluded -fsanitize=vptr
(and -fsanitize=function, but this seems like an oversight).

Now, -fsanitize=undefined is an alias for -fsanitize=undefined-trap,
and if -fsanitize-trap=undefined is specified, we treat -fsanitize=vptr
as an "unsupported" flag, which means that we error out if the flag is
specified explicitly, but implicitly disable it if the flag was implied
by -fsanitize=undefined.

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

llvm-svn: 240105
2015-06-18 23:59:22 +00:00
Daniel Jasper 2aaedd3a7e clang-format: Make AlwaysBreakBeforeMultilineStrings more conservative.
In essence this is meant to consistently indent multiline strings by a
fixed amount of spaces from the start of the line. Don't do this in
cases where it wouldn't help anyway.

Before:
  someFunction(aaaaa,
               "aaaaa"
               "bbbbb");

After:
  someFunction(aaaaa, "aaaaa"
                      "bbbbb");

llvm-svn: 240004
2015-06-18 09:12:47 +00:00
Richard Smith cf18b79ccf [modules] Rename -fmodule-maps to -fimplicit-module-maps (and likewise for
-fno-module-maps). The old names are preserved for compatibility.

llvm-svn: 239792
2015-06-16 00:20:23 +00:00
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
Adrian Prantl a39924a1f8 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
This reverts commit r230305.
Off to fix another round of missing dependencies on various platforms.

llvm-svn: 230309
2015-02-24 05:14:17 +00:00
Adrian Prantl fc360dc30b 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.

rdar://problem/19104245

This reapplies r230044 with a fixed configure+make build and updated
dependencies. Take 3.

llvm-svn: 230305
2015-02-24 04:25:59 +00:00
Peter Collingbourne 0100e6c08c CFI: Improve design doc with larger virtual tables and asm examples.
llvm-svn: 230254
2015-02-23 20:22:17 +00:00
Adrian Prantl 67fbfa3773 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
This reverts commit 230099.

The Linux configure+make build variant still needs some work.

llvm-svn: 230103
2015-02-21 00:29:14 +00:00
Adrian Prantl f2b0cd91eb 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.

rdar://problem/19104245

This reapplies r230044 with a fixed configure+make build and updated
dependencies. Take 2.

llvm-svn: 230089
2015-02-20 23:34:26 +00:00
Adrian Prantl 690b2f7746 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
This reverts commit r230067.

Investigating another batch of problems found by the bots.

llvm-svn: 230073
2015-02-20 22:12:19 +00:00
Adrian Prantl b59bc1a528 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.

rdar://problem/19104245

This reapplies r230044 with a fixed configure+make build and updated
dependencies.

llvm-svn: 230067
2015-02-20 21:53:12 +00:00
Peter Collingbourne a4ccff3281 Implement Control Flow Integrity for virtual calls.
This patch introduces the -fsanitize=cfi-vptr flag, which enables a control
flow integrity scheme that checks that virtual calls take place using a vptr of
the correct dynamic type. More details in the new docs/ControlFlowIntegrity.rst
file.

It also introduces the -fsanitize=cfi flag, which is currently a synonym for
-fsanitize=cfi-vptr, but will eventually cover all CFI checks implemented
in Clang.

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

llvm-svn: 230055
2015-02-20 20:30:56 +00:00
Adrian Prantl a4f522fa19 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
This reverts commit r230044 while dealing with buildbot breakage.

Conflicts:
	test/Modules/module_container.m

llvm-svn: 230052
2015-02-20 20:00:27 +00:00
Adrian Prantl c4091aa74e 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.

rdar://problem/19104245

llvm-svn: 230044
2015-02-20 19:44:52 +00:00
Manuel Klimek d2e8b04d61 Add -fno-implicit-modules.
If this flag is set, we error out when a module build is required. This is
useful in environments where all required modules are passed via -fmodule-file.

llvm-svn: 230006
2015-02-20 11:44:41 +00:00
Alexey Samsonov 3a433f62fb [docs] Recommend to use CMake for building sanitizers.
llvm-svn: 229754
2015-02-18 22:26:20 +00:00
Matthias Braun 44bf1c9c53 Revert "Remove support for building sanitizers from Makefile/autoconf build."
This reverts commit r229554.

Reverting this commit for now as several apple internal builds still
rely on this functionality.

llvm-svn: 229582
2015-02-17 23:27:37 +00:00
Alexey Samsonov 883a04ade7 Remove support for building sanitizers from Makefile/autoconf build.
They autotools build has a number of missing features, supports less
OS, architectures, build configurations, doesn't have any tests and
is hard to support in sync with CMake build.

llvm-svn: 229554
2015-02-17 21:53:22 +00:00
Alex Denisov 793e0676f0 Fix amount of diagnostic classes
llvm-svn: 228814
2015-02-11 07:56:16 +00:00
Samuel Benzaquen ef621f43ff Add translationUnitDecl matcher.
Summary: Add translationUnitDecl matcher.

Reviewers: alexfh

Subscribers: klimek, cfe-commits

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

llvm-svn: 228694
2015-02-10 14:46:45 +00:00
Yaron Keren 08ee9c803d Replace DeclContext::getNextContext with DeclContext::collectAllContexts
in the Clang CFE Internals Manual (done in r147729).

llvm-svn: 228510
2015-02-07 22:16:16 +00:00
Reid Kleckner ee15ea3560 Fix broken doc link to Clang 3.5 release notes
We appear to use 3.5.0 in the directory structure now. That's probably
unnecessary. We should probably let the micro releases update the docs
for the same minor version.

llvm-svn: 227127
2015-01-26 19:53:16 +00:00
Evgeniy Stepanov 5e927b6285 [msan] Remove MSanDR reference from the manual.
It is no longer supported.

llvm-svn: 227078
2015-01-26 09:17:37 +00:00
Hans Wennborg fb8b408ba0 docs/conf.py: update for 3.7
llvm-svn: 226010
2015-01-14 18:14:05 +00:00
Hans Wennborg 0a7ec77ee0 ReleaseNotes.rst: update to 3.7
The 3.6 release notes are in the 3.6 branch.

llvm-svn: 226009
2015-01-14 18:14:03 +00:00
Roman Divacky ed94e2f455 Mention FreeBSD support.
llvm-svn: 225834
2015-01-13 21:31:03 +00:00
Alexey Samsonov 8845952b54 Reimplement -fsanitize-recover family of flags.
Introduce the following -fsanitize-recover flags:
  - -fsanitize-recover=<list>: Enable recovery for selected checks or
      group of checks. It is forbidden to explicitly list unrecoverable
      sanitizers here (that is, "address", "unreachable", "return").
  - -fno-sanitize-recover=<list>: Disable recovery for selected checks or
     group of checks.
  - -f(no-)?sanitize-recover is now a synonym for
    -f(no-)?sanitize-recover=undefined,integer and will soon be deprecated.

These flags are parsed left to right, and mask of "recoverable"
sanitizer is updated accordingly, much like what we do for -fsanitize= flags.
-fsanitize= and -fsanitize-recover= flag families are independent.

CodeGen change: If there is a single UBSan handler function, responsible
for implementing multiple checks, which have different recoverable setting,
then we emit two handler calls instead of one:
the first one for the set of "unrecoverable" checks, another one - for
set of "recoverable" checks. If all checks implemented by a handler have the
same recoverability setting, then the generated code will be the same.

llvm-svn: 225719
2015-01-12 22:39:12 +00:00
Nico Weber a894e9e070 Fix markup from r224894.
llvm-svn: 224895
2014-12-28 02:12:59 +00:00
Nico Weber 933607f10e Add stub sections about Parse, Sema, CodeGen to the internals manual.
I'd be interested if the paragraph on Parse not knowing much about AST is
something folks agree with.  I think this used to be true after rjmccall removed
the Action interface in r112244 and I believe it's still true, but I'm not sure.
(For example, ParseOpenMP.cpp does include AST/StmtOpenMP.h.  Other than that,
Parse not using AST nodes much seems to be still true, though.)

llvm-svn: 224894
2014-12-28 02:07:26 +00:00
Aaron Ballman 4bfaeba6a9 Amending r223468 with this documentation change.
llvm-svn: 223479
2014-12-05 17:11:49 +00:00
Aaron Ballman a6f759e423 Modify __has_attribute so that it only looks for GNU-style attributes. Removes the ability to look for generic attributes and keywords via this macro, which has the potential to be a breaking change. However, since there is __has_cpp_attribute and __has_declspec_attribute, and given the limited usefulness of querying a generic attribute name regardless of syntax, this seems like the correct path forward.
llvm-svn: 223468
2014-12-05 15:24:55 +00:00
Aaron Ballman 3c0f9b4a7d Added a new preprocessor macro: __has_declspec_attribute. This can be used as a way to determine whether Clang supports a __declspec spelling for a given attribute, similar to __has_attribute and __has_cpp_attribute.
llvm-svn: 223467
2014-12-05 15:05:29 +00:00
Nico Weber 736a993828 Add support for has_feature(cxx_alignof) and has_feature(c_alignof).
r142020 added support for has_feature(cxx_alignas). This does the same for
alignof.

llvm-svn: 223186
2014-12-03 01:25:49 +00:00
Daniel Jasper 7f43266778 clang-format: Escape '*' in generated flag documentation.
llvm-svn: 223118
2014-12-02 14:21:16 +00:00
Daniel Jasper 3219e43c94 clang-format: Add option to suppress operator alignment.
With alignment:
  int aaaaaa = aa
               + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                     * cccccccccccccccccccccccccccccccc;

Without alignment:
  int aaaaaa = aa
      + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
          * cccccccccccccccccccccccccccccccc;

This fixes llvm.org/PR21666.

llvm-svn: 223117
2014-12-02 13:24:51 +00:00
Manuel Klimek d3aa1f4a63 Re-apply r222646 (was reverted in r222667). Adding 4 ASTMatchers: typedefDecl, isInMainFile, isInSystemFile, isInFileMatchingName
Change to original: ifndef out tests in Windows due to /-separated
paths.

Summary:
Often one is only interested in matches within the main-file or matches
that are not within a system-header, for which this patch adds
isInMainFile and isInSystemFile. They take no arguments and narrow down
the matches.

The isInFileMatchingName is mainly thought for interactive
clang-query-sessions, to make a matcher more specific without restarting
the session with the files you are interested in for that moment. It
takes a string that will be used as regular-expression to match the
filename of where the matched node is expanded.

Patch by Hendrik von Prince.

llvm-svn: 222765
2014-11-25 17:01:06 +00:00
Daniel Jasper 21a0f55755 Add flag -f(no-)modules-implicit-maps.
This suppresses the implicit search for files called 'module.modulemap' and
similar.

llvm-svn: 222745
2014-11-25 09:45:48 +00:00
David Majnemer 442d0a2e5a MS ABI: Add CodeGen support for rethrowing MS C++ exceptions
Rethrowing exceptions in the MS model is very simple: just call
_CxxThrowException with nullptr for both arguments.

N.B.  They chose stdcall as the calling convention for x86 but cdecl for
all other platforms.

llvm-svn: 222733
2014-11-25 07:20:20 +00:00
David Majnemer 81537b5c8e docs: Update the MSVCCompatibility doc for changes to debug info
The document should reflect that we now support emission for DWARF.

llvm-svn: 222731
2014-11-25 06:59:35 +00:00
Aaron Ballman 6265102c17 Reverting r222646; the tests do not pass on Windows. Also reverts r222664, which was required for r222646 to compile with Visual Studio 2012.
llvm-svn: 222667
2014-11-24 17:39:44 +00:00