Commit Graph

92 Commits

Author SHA1 Message Date
Richard Smith b5216aaf80 Advertize support for constexpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150524 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-14 22:56:17 +00:00
Kostya Serebryany 71efba0bba The following patch adds __attribute__((no_address_safety_analysis)) which will allow to disable
address safety analysis (such as e.g. AddressSanitizer or SAFECode) for a specific function.

When building with AddressSanitizer, add AddressSafety function attribute to every generated function
except for those that have __attribute__((no_address_safety_analysis)).

With this patch we will be able to
1. disable AddressSanitizer for a particular function
2. disable AddressSanitizer-hostile optimizations (such as some cases of load widening) when AddressSanitizer is on.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148842 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-24 19:25:38 +00:00
Benjamin Kramer 3419d7cd2e Tweak markup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148221 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-15 16:42:14 +00:00
Anton Yartsev da90c77753 added descriptions of vector extensions, info about vector literals and vector operations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148220 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-15 16:22:24 +00:00
Benjamin Kramer 665a8dc953 Fix ALL the markup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148219 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-15 15:26:07 +00:00
Benjamin Kramer ffbe9b9c64 Mass rename C1x references to C11. The name hasn't proliferated like "C++0x" so this patch is surprisingly small.
Also drop -Wc1x-extensions in favor of -Wc11-extensions. I don't think we need to keep this around for compatibility.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147221 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-23 17:00:35 +00:00
Chris Lattner d4b66b9403 clarify that clang version number macros are marketing version #'s, not something useful.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146672 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-15 19:06:36 +00:00
Douglas Gregor 5e9392ba18 Implement support for the __is_final type trait, to determine whether
a class is marked 'final', from Alberto Ganesh Barbati! Fixes
PR11462.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145775 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-03 18:14:24 +00:00
Kostya Serebryany ce98c9b1a5 First version of AddressSanitizer docs; documentation for __has_feature(address_sanitizer)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145276 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-28 20:51:02 +00:00
Douglas Gregor 8a0ace669e Fix grammaro
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143633 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-03 18:33:01 +00:00
Douglas Gregor f695a6952f Add __has_feature(cxx_defaulted_functions) for querying "defaulted
functions", from Michel Morin!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143411 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01 01:19:34 +00:00
David Blaikie 5090e9f96e Update documentation to use "C++11" instead of "C++0x"
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142339 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18 05:49:30 +00:00
Peter Collingbourne fd5f6866a7 Add c_alignas and cxx_alignas features
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142020 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-14 23:44:46 +00:00
Ted Kremenek d768150ef5 Implement built-in macro '__has_warning', which allows one to query if a warning flag is valid. Fixes <rdar://problem/10263428>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141802 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-12 19:46:30 +00:00
Sebastian Redl 72a81d239d Now that we support move generation, mention this in the language extension and C++ status pages. Also update the C++ status for default functions, which are complete now that we can generate move functions, and destructor exception specifications, which I did a while ago.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141558 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-10 18:10:00 +00:00
Eli Friedman 0c706c29f2 Add list initialization for complex numbers in C. Essentially, this allows "_Complex float x = {1.0f, 2.0f};". See changes to docs/LanguageExtensions.html for a longer description.
<rdar://problem/9397672>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140090 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-19 23:17:44 +00:00
Douglas Gregor aebb653a28 Document __has_feature(objc_instancetype).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139299 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 17:19:31 +00:00
Douglas Gregor 5471bc85b6 Allow C++0x enumerations with a fixed underlying type in
Objective-C. The @encode'ing of such an enumeration type is the same
as its underlying type. <rdar://problem/5276348>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139297 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 17:18:35 +00:00
Douglas Gregor e97179c675 Implement the Objective-C 'instancetype' type, which is an alias of
'id' that can be used (only!) via a contextual keyword as the result
type of an Objective-C message send. 'instancetype' then gives the
method a related result type, which we have already been inferring for
a variety of methods (new, alloc, init, self, retain). Addresses
<rdar://problem/9267640>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139275 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 01:46:34 +00:00
Douglas Gregor ece3894a9f Add and document __has_feature values for the remaining C++0x
features, so clients can check for the availability of these features
even before we get around to implementing them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138741 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-29 17:28:38 +00:00
Caitlin Sadowski b51e0315d4 Thread Safety: Added basic argument parsing for all new attributes.
This patch special cases the parser for thread safety attributes so that all
attribute arguments are put in the argument list (instead of a special
parameter) since arguments may not otherwise resolve correctly without two-token
lookahead.

This patch also adds checks to make sure that attribute arguments are
lockable objects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137130 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-09 17:59:31 +00:00
Sean Hunt e1f6dea1c9 Add a __has_feature macro for generalized initializers, turned off
because we don't support them yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137027 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-07 00:34:32 +00:00
Caitlin Sadowski db33e14661 Added basic parsing for all remaining attributes, thread safety
analysis. This includes checking that the attributes are applied in the
correct contexts and with the correct number of arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136383 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-28 20:12:35 +00:00
Caitlin Sadowski 73cbbc8d78 Thread safety: Fix typo in documentation
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136370 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-28 18:38:36 +00:00
Caitlin Sadowski fdde9e719a Added parsing for guarded_var, pt_guarded_var, lockable,
scoped_lockable, and no_thread_safety_analysis attributes, all for thread safety analysis

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136364 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-28 17:21:07 +00:00
Sean Hunt 1fba8281b9 Thanks to Chandler for reminding me to update the documentation for the
__underlying_type feature.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135402 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 17:22:33 +00:00
Sean Hunt d96249971d Add documentation about __has_feature(cxx_delegationg_constructors)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133693 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-23 06:11:37 +00:00
Sean Hunt 64f857b4ef Fix a minor copy-paste-o that broke the stylesheets
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133678 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-23 01:22:53 +00:00
Sean Hunt 7e98b477de Fix a bunch of HTML compliance problems with LanguageExtensions.html
One weird thing is the addition of several <a name=""> tags where
previously there were id attributes on the <h3> tags. This is because
the id attribute must begin with a letter, not an underscore. The name
attribute is not so constrained, so links will continue to work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133677 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-23 01:21:01 +00:00
Sean Hunt 647ba1bc2e Revert "-fexceptions does not, in fact, enable C++ exceptions"
In fact it does. For the driver anyway, and not cc1 which I'm supposed
to pretend doesn't exist.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133673 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-23 00:42:53 +00:00
Sean Hunt 4b4ba8b1d4 -fexceptions does not, in fact, enable C++ exceptions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133666 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-22 23:49:12 +00:00
John McCall f85e193739 Automatic Reference Counting.
Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133103 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-15 23:02:42 +00:00
Douglas Gregor 926df6cfab Implement Objective-C Related Result Type semantics.
Related result types apply Cocoa conventions to the type of message
sends and property accesses to Objective-C methods that are known to
always return objects whose type is the same as the type of the
receiving class (or a subclass thereof), such as +alloc and
-init. This tightens up static type safety for Objective-C, so that we
now diagnose mistakes like this:

t.m:4:10: warning: incompatible pointer types initializing 'NSSet *'
with an
      expression of type 'NSArray *' [-Wincompatible-pointer-types]
  NSSet *array = [[NSArray alloc] init];
         ^       ~~~~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:72:1:
note: 
      instance method 'init' is assumed to return an instance of its
      receiver
      type ('NSArray *')
- (id)init;
^

It also means that we get decent type inference when writing code in
Objective-C++0x:

  auto array = [[NSMutableArray alloc] initWithObjects:@"one",  @"two",nil];
  //    ^ now infers NSMutableArray* rather than id




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132868 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-11 01:09:30 +00:00
Douglas Gregor 84ee2eeec9 Audit and finish the implementation of C++0x nullptr, fixing two
minor issues along the way:
  - Non-type template parameters of type 'std::nullptr_t' were not
  permitted.
  - We didn't properly introduce built-in operators for nullptr ==,
  !=, <, <=, >=, or > as candidate functions .

To my knowledge, there's only one (minor but annoying) part of nullptr
that hasn't been implemented: catching a thrown 'nullptr' as a pointer
or pointer-to-member, per C++0x [except.handle]p4.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131813 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-21 23:15:46 +00:00
Peter Collingbourne c1b5fa41f0 Introduce __has_extension macro
__has_extension is a function-like macro which takes the same set
of feature identifiers as __has_feature.  It evaluates to 1 if the
feature is supported by Clang in the current language (either as a
language extension or a standard language feature) or 0 if not.

At the same time, add support for the C1X feature identifiers
c_generic_selections (renamed from generic_selections) and
c_static_assert, and document them.

Patch by myself and Jean-Daniel Dupas.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131308 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 20:54:45 +00:00
Douglas Gregor 7822ee3ef9 Implement CWG1170, which makes access-control errors into template
argument deduction failures. Only implemented in C++0x, since this is
a significant change in behavior from C++98/03.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131209 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-11 23:45:11 +00:00
Richard Smith 3e4c6c4c79 Implement support for C++0x alias templates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130953 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-05 21:57:07 +00:00
Richard Smith a391a4642c Add __has_feature(cxx_range_for) check for C++11 range-based for loop.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129573 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 15:14:40 +00:00
Peter Collingbourne f111d93572 C1X: implement generic selections
As an extension, generic selection support has been added for all
supported languages.  The syntax is the same as for C1X.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129554 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 00:35:48 +00:00
Chris Lattner 23aa9c8ca0 add a __sync_swap builtin to fill out the rest of the __sync builtins.
Patch by Dave Zarzycki!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129189 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 03:57:26 +00:00
Anders Carlsson c8b9f79770 we can now claim to fully support the override control feature in C++0x.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128281 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-25 15:04:23 +00:00
Chris Lattner c70e193052 and now there are 3!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128001 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-21 16:25:11 +00:00
John McCall 87494017b8 Improve the documentation for some of the analyzer attributes I added
a while back.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127866 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 03:51:49 +00:00
Sebastian Redl 4561ecdf27 Create __has_feature(cxx_noexcept) and mark it as working.
Find out that our C++0x status has only one field for noexcept expression and specification together, and that it was accidentally already marked as fully implemented.
This completes noexcept specification work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127701 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 21:17:12 +00:00
Richard Smith fd405efea1 Update the www to indicate that auto is now implemented.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126280 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-23 00:41:16 +00:00
Douglas Gregor 0750800623 Add a __has_feature check for default template arguments in function
templates, a C++0x feature.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124973 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 20:35:30 +00:00
Douglas Gregor afdf137c50 Add __has_feature() for each of the type traits
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124820 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 21:57:35 +00:00
Jeffrey Yasskin b7ee2e5cc9 Revert r124217 because it didn't catch the actual error case it was trying to
catch:

  lock_guard(my_mutex);

declares a variable instead of creating a temporary.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124398 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27 19:17:54 +00:00
Douglas Gregor 56209ffed2 Add __has_feature(cxx_reference_qualified_functions); update tests and
documentation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124322 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 21:25:54 +00:00
Jeffrey Yasskin c60e13aeff Add an attribute to forbid temporary instances of a type. This allows class
authors to write 

  class __attribute__((forbid_temporaries)) Name { ... };

when they want to force users to name all variables of the type. This protects
people from doing things like creating a scoped_lock that only lives for a
single statement instead of an entire scope.

The warning produced by this attribute can be disabled by
-Wno-forbid-temporaries.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124217 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 20:08:12 +00:00