Commit Graph

163 Commits

Author SHA1 Message Date
Kostya Serebryany c3333e879f implement __has_feature(address_sanitizer); also use LangOpts.AddressSanitizer instead of CodeGenOpts.AddressSanitizer
llvm-svn: 145054
2011-11-22 01:28:36 +00:00
Eli Friedman fc08bdcc57 Tests for UTF-8 encoding in strings in source code. Patch by Seth Cantrell.
llvm-svn: 143418
2011-11-01 02:26:36 +00:00
Douglas Gregor a7efb88baa Add __has_feature(cxx_raw_string_literals) and
__has_feature(cxx_unicode_literals), from Michel Morin!

llvm-svn: 143412
2011-11-01 01:23:44 +00:00
Douglas Gregor 3c469769a2 Add __has_feature(cxx_defaulted_functions) for querying "defaulted
functions", from Michel Morin!

llvm-svn: 143411
2011-11-01 01:19:34 +00:00
Douglas Gregor 2c4542d3ec Give __STDC_VERSION__ the value 201001L when we're in C1x mode. The
committee hasn't set a value for __STDC_VERSION__ yet, so this is a
placeholder. But at least it's > 199901L.

llvm-svn: 143245
2011-10-28 23:02:54 +00:00
Douglas Gregor ab6bc1d13e Make the -Wc++11-compat warnings ignored by default, so we don't break
valid C++98/03 code. However, add these warnings to -Wall, for those
who obviously already like clean code.

llvm-svn: 142903
2011-10-25 03:07:45 +00:00
Douglas Gregor 9885f6153f Make -fms-compatibility imply -fms-extensions. Fixes PR11204.
llvm-svn: 142797
2011-10-24 15:27:23 +00:00
Peter Collingbourne 60188eb8bf Add c_alignas and cxx_alignas features
llvm-svn: 142020
2011-10-14 23:44:46 +00:00
Richard Smith 9ca5c42582 Update all tests other than Driver/std.cpp to use -std=c++11 rather than
-std=c++0x. Patch by Ahmed Charles!

llvm-svn: 141900
2011-10-13 22:29:44 +00:00
Douglas Gregor 227c352bae We do parse hexfloats in C++11; make it actually work.
llvm-svn: 141798
2011-10-12 18:51:02 +00:00
Richard Smith a9e33d44a6 Handle Perforce-style conflict markers like normal conflict markers. Perforce
swaps over the <<<< and >>>> markers, and uses shorter markers than traditional
tools.

llvm-svn: 141751
2011-10-12 00:37:51 +00:00
Richard Smith 7ab47734a2 Fix test: don't use __thread without a target triple.
llvm-svn: 141719
2011-10-11 21:51:31 +00:00
Richard Smith 4dd85d6fa1 Add a -Wc++0x-compat warning for C++11 keywords used as identifiers when in
C++98 mode. Only the first occurrence of each keyword will produce a warning.

llvm-svn: 141700
2011-10-11 19:57:52 +00:00
John McCall 9b0a7cea0f Make -fobjc-nonfragile-abi the -cc1 default, since it's the
increasingly prevailing case to the point that new features
like ARC don't even support the fragile ABI anymore.

This required a little bit of reshuffling with exceptions
because a check was assuming that ObjCNonFragileABI was
only being set in ObjC mode, and that's actually a bit
obnoxious to do.

Most, though, it involved a perl script to translate a ton
of test cases.

Mostly no functionality change for driver users, although
there are corner cases with disabling language-specific
exceptions that we should handle more correctly now.

llvm-svn: 140957
2011-10-02 01:16:38 +00:00
Douglas Gregor 4d68366b2f When parsing a character literal, extract the characters from the
buffer as an 'unsigned char', so that integer promotion doesn't
sign-extend character values > 127 into oblivion. Fixes
<rdar://problem/10188919>.

llvm-svn: 140608
2011-09-27 17:00:18 +00:00
Richard Smith a8a5c402bb Advertise support for cxx_range_for as an extension in C++98 mode. Patch by Jean-Daniel Dupas!
Also provide a modicum of test coverage for ranged for in C++98.

llvm-svn: 139149
2011-09-06 18:03:41 +00:00
Benjamin Kramer 17ff23c708 Speed up BCPL comment lexing by looking aggressively for newlines and then scannig backwards to see if the newline is escaped.
3% speedup in preprocessing all of clang with -Eonly. Also includes a small testcase for coverage.

llvm-svn: 139116
2011-09-05 07:19:39 +00:00
Sebastian Redl e9c4e84f8e Add test case for defaulted copy and move structure validation.
Fix bug this uncovered.
Address minor comments from Doug.
Enable cxx_implicit_moves feature.

llvm-svn: 139101
2011-09-04 18:14:28 +00:00
Argyrios Kyrtzidis 7aecbc7661 Make Lexer::ComputePreamble accept a LangOptions parameter, otherwise it may be
out-of-sync how a file is compiled. Patch by Matthias Kleine!

llvm-svn: 138580
2011-08-25 20:39:19 +00:00
Craig Topper 6eb2058a6a Warn about and truncate UCNs that are too big for their character literal type.
llvm-svn: 138031
2011-08-19 03:20:12 +00:00
Craig Topper c0a06c5cfd Fix a couple raw string literal tests
llvm-svn: 137422
2011-08-12 03:20:18 +00:00
Craig Topper 6d64a738fa Add tests for string literal concatenation.
llvm-svn: 137302
2011-08-11 05:57:09 +00:00
Craig Topper 54edccafc5 Add support for C++0x raw string literals.
llvm-svn: 137298
2011-08-11 04:06:15 +00:00
Douglas Gregor fb65e592e0 Add support for C++0x unicode string and character literals, from Craig Topper!
llvm-svn: 136210
2011-07-27 05:40:30 +00:00
Anna Zaks c8eab671cf Expose no newline at end of file warning under Wnewline-eof flag.
llvm-svn: 135822
2011-07-22 23:08:19 +00:00
Alexis Hunt c6d1d946e7 Remember to add a has_feature macro for __underlying_type now that it is
correctly impelmented

llvm-svn: 135401
2011-07-18 17:08:00 +00:00
John McCall 24fc0decfe Change the driver's logic about Objective-C runtimes: abstract out a
structure to hold inferred information, then propagate each invididual
bit down to -cc1.  Separate the bits of "supports weak" and "has a native
ARC runtime";  make the latter a CodeGenOption.

The tool chain is still driving this decision, because it's the place that
has the required deployment target information on Darwin, but at least it's
better-factored now.

llvm-svn: 134453
2011-07-06 00:26:06 +00:00
John McCall 31168b077c 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.

llvm-svn: 133103
2011-06-15 23:02:42 +00:00
Douglas Gregor 80af31397a 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.

llvm-svn: 131813
2011-05-21 23:15:46 +00:00
Alexis Hunt 7957fdb60a Revert r131672 until __underlying_type is properly implemented in the
template case.

llvm-svn: 131692
2011-05-19 22:52:25 +00:00
Alexis Hunt d6cbf0d4be Implement a __has_feature for __underlying_type
llvm-svn: 131672
2011-05-19 20:48:13 +00:00
Peter Collingbourne d5d410faa8 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.

llvm-svn: 131308
2011-05-13 20:54:45 +00:00
Alexis Hunt d9a5cc13cf Implement the __is_trivially_copyable type trait
llvm-svn: 131270
2011-05-13 00:31:07 +00:00
Howard Hinnant 2d3eadac9b enable __has_feature(is_standard_layout)
llvm-svn: 131240
2011-05-12 19:52:14 +00:00
Matt Beaumont-Gay 5bd77b3b0f Change magic string "abc" to better magic string "qux".
Wait, what?

So, we run Clang (and LLVM) tests in an environment where the md5sum of the
input files becomes a component of the path. When testing the preprocessor,
the path becomes part of the output (in line directives). In this test, we
were grepping for the absence of "abc" in the output. When the stars aligned
properly, the md5sum component of the path contained "abc" and the test
failed. Oops.

llvm-svn: 131147
2011-05-10 20:28:29 +00:00
Richard Smith 3f1b5d077b Implement support for C++0x alias templates.
llvm-svn: 130953
2011-05-05 21:57:07 +00:00
Argyrios Kyrtzidis 99fbd4d1d8 Have #pragma message not turn into error by -Werror, by default. Fixes rdar://9308989.
llvm-svn: 129916
2011-04-21 17:11:44 +00:00
Richard Smith 9bc6eedab4 Add __has_feature(cxx_range_for) check for C++11 range-based for loop.
llvm-svn: 129573
2011-04-15 15:14:40 +00:00
Richard Smith 13f68cf53e clang has had full and tested support for C++0x trailing-return-type and auto type deduction since r126166. Update the website to reflect this, and add a __has_feature test.
trailing-return-type codegen is not tested yet (name mangling in particular).

llvm-svn: 128787
2011-04-03 14:12:46 +00:00
Anders Carlsson 69f1f9391b we can now claim to fully support the override control feature in C++0x.
llvm-svn: 128281
2011-03-25 15:04:23 +00:00
Sebastian Redl c17003c66b 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.

llvm-svn: 127701
2011-03-15 21:17:12 +00:00
Richard Smith 7ee0d5664e Turn on __has_feature(cxx_auto_type). The feature is now fully implemented.
llvm-svn: 126078
2011-02-20 12:13:05 +00:00
Argyrios Kyrtzidis c541ade850 Warn for missing terminating " or ' instead of error for gcc compatibility. Fixed rdar://8914293.
llvm-svn: 125616
2011-02-15 23:45:31 +00:00
Douglas Gregor 7115aee109 Add a __has_feature check for default template arguments in function
templates, a C++0x feature.

llvm-svn: 124973
2011-02-05 20:35:30 +00:00
Douglas Gregor 7c60768590 Add __has_feature() for each of the type traits
llvm-svn: 124820
2011-02-03 21:57:35 +00:00
Douglas Gregor 56d5f0abaa Add __has_feature(cxx_reference_qualified_functions); update tests and
documentation.

llvm-svn: 124322
2011-01-26 21:25:54 +00:00
Douglas Gregor c41d94eb1a Clean up the C++0x __has_feature tests. Specifically:
- Don't publicize a C++0x feature through __has_feature if we aren't
    in C++0x mode (even if the feature is available only with a
    warning). 
  - "auto" is not implemented well enough for its __has_feature to be
    turned on.
  - Fix the test of C++0x __has_feature to actually test what we're
  trying to test. Searching for the substring "foo" when our options
  are "foo" and "no_foo" doesn't work :)

llvm-svn: 124291
2011-01-26 15:36:03 +00:00
Douglas Gregor 0098499f7d Downgrade the error about rvalue references to an extension warning
and turn on __has_feature(cxx_rvalue_references). The core rvalue
references proposal seems to be fully implemented now, pending lots
more testing.

llvm-svn: 124169
2011-01-25 02:17:32 +00:00
Douglas Gregor 312ab72dbd Eradicate any mention of C++0x concepts.
llvm-svn: 123860
2011-01-19 23:15:20 +00:00
Douglas Gregor eecc6bc388 Variadic templates are fully implemented.
Turn on the __has_feature switch for variadic templates, document
their completion, and put the ExtWarn into the c++0x-extensions
warning group.

llvm-svn: 123854
2011-01-19 22:11:50 +00:00