Commit Graph

130 Commits

Author SHA1 Message Date
Ulrich Weigand 3c5038a535 Add support for System z vector language extensions
The z13 vector facility has an associated language extension,
closely modeled on AltiVec/VSX.  The main differences are:

- vector long, vector float and vector pixel are not supported

- vector long long and vector double are supported (like VSX)

- comparison operators return a vector rather than a scalar integer

- shift operators behave like the OpenCL shift operators

- vector bool is only supported as argument to certain operators;
  some operators allow mixing a bool with a non-bool vector 

This patch adds clang support for the extension.  It is closely modelled
on the AltiVec support.  Similarly to the -faltivec option, there's a
new -fzvector option to enable the extensions (as well as an -mzvector
alias for compatibility with GCC).  There's also a separate LangOpt.

The extension as implemented here is intended to be compatible with
the -mzvector extension recently implemented by GCC.

Based on a patch by Richard Sandiford.

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

llvm-svn: 243642
2015-07-30 14:08:36 +00:00
Douglas Gregor ab209d83be Implement the Objective-C __kindof type qualifier.
The __kindof type qualifier can be applied to Objective-C object
(pointer) types to indicate id-like behavior, which includes implicit
"downcasting" of __kindof types to subclasses and id-like message-send
behavior. __kindof types provide better type bounds for substitutions
into unspecified generic types, which preserves more type information.

llvm-svn: 241548
2015-07-07 03:58:42 +00:00
Richard Smith 2aedca340c [modules] Before checking whether the controlling macro of a header is defined,
update the identifier in case we've imported a definition of the macro (and
thus the contents of the header) from a module.

Also fold ExternalIdentifierLookup into ExternalPreprocessorSource; it no longer
makes sense to keep these separate now that the only user of the former also
needs the latter.

llvm-svn: 241137
2015-07-01 02:29:35 +00:00
Douglas Gregor aea7afdc13 Replace __double_underscored type nullability qualifiers with _Uppercase_underscored
Addresses a conflict with glibc's __nonnull macro by renaming the type
nullability qualifiers as follows:

  __nonnull -> _Nonnull
  __nullable -> _Nullable
  __null_unspecified -> _Null_unspecified

This is the major part of rdar://problem/21530726, but does not yet
provide the Darwin-specific behavior for the old names.

llvm-svn: 240596
2015-06-24 22:02:08 +00:00
Alexander Kornienko ab9db51042 Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").
llvm-svn: 240353
2015-06-22 23:07:51 +00:00
Alexander Kornienko 3d9d929e42 Fixed/added namespace ending comments using clang-tidy. NFC
The patch is generated using this command:

  $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \
      -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \
      work/llvm/tools/clang

To reduce churn, not touching namespaces spanning less than 10 lines.

llvm-svn: 240270
2015-06-22 09:47:44 +00:00
Nico Weber 708aabd3ef Suppress bogus gcc -Wreturn-type warnings.
llvm-svn: 240199
2015-06-20 00:06:30 +00:00
Douglas Gregor 813a066f16 Extend type nullability qualifiers for Objective-C.
Introduce context-sensitive, non-underscored nullability specifiers
(nonnull, nullable, null_unspecified) for Objective-C method return
types, method parameter types, and properties.

Introduce Objective-C-specific semantics, including computation of the
nullability of the result of a message send, merging of nullability
information from the @interface of a class into its @implementation,
etc .

This is the Objective-C part of rdar://problem/18868820.

llvm-svn: 240154
2015-06-19 18:14:38 +00:00
Hubert Tong 6e04f98bc3 [Concepts] lex keywords: concept and requires
Summary:
This patch enables lexing of `concept` and `requires` as keywords.
Further changes which add messages for future keyword compat are to
follow.

Test Plan:
Testing of C++14 + Concepts TS mode is added to
`test/Lexer/keywords_test.cpp`, which expects that the new keywords are
enabled under said mode.

Reviewers: faisalv, fraggamuffin, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 239128
2015-06-05 01:10:24 +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
Richard Smith 31d5184dc5 Generalize future keyword compat diagnostics.
This, in preparation for the introduction of more new keywords in the
implementation of the C++ language, generalizes the support for future keyword
compat diagnostics (e.g., diag::warn_cxx11_keyword) by extending the
applicability of the relevant property in IdentifierTable with appropriate
renaming.

Patch by Hubert Tong!

llvm-svn: 237332
2015-05-14 04:00:59 +00:00
David Majnemer b710a938d6 Give isCompatibleWithMSVC a better interface
We now use an enum which maps the marketing name (almost always a year)
to the major version number.

llvm-svn: 236967
2015-05-11 03:57:49 +00:00
Anastasia Stulova b1152f1e56 OpenCL: CL2.0 atomic types
OpenCL C Spec v2.0 Section 6.13.11

- Made c11 _Atomic being not accepted for OpenCL

- Implemented CL2.0 atomics by aliasing them to the corresponding c11 atomic types using implicit typedef

- Added diagnostics for atomics Khronos extension enabling

llvm-svn: 232631
2015-03-18 12:55:29 +00:00
David Majnemer 28aae9c29b MSVC Compat: Permit char16_t, char32_t and _Atomic when targeting > 2013
We disabled support for _Atomic because the STL had name conflicts,
they've been resolved in 2015.  Similarly, reenable char16_t and
char32_t.

llvm-svn: 232611
2015-03-18 04:15:23 +00:00
Serge Pavlov 83cf078f8f Emit warning if define or undef reserved identifier or keyword.
Recommit of r223114, reverted in r223120.

llvm-svn: 224012
2014-12-11 12:18:08 +00:00
Serge Pavlov 376aee9ae7 Reverted r223114, it caused failure on on clang-native-arm-cortex-a9.
llvm-svn: 223120
2014-12-02 14:52:20 +00:00
Serge Pavlov 1ecb41c09b Emit warning if define or undef reserved identifier or keyword.
Summary:
This change implements warnings if macro name is identical to a keyword or
reserved identifier. The warnings are different depending on the "danger"
of the operation. Defining macro that replaces a keyword is on by default.
Other cases produce warning that is off by default but can be turned on
using option -Wreserved-id-macro.

This change fixes PR11488.

Reviewers: rnk

Reviewed By: rnk

Subscribers: rnk, cfe-commits

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

llvm-svn: 223114
2014-12-02 11:06:09 +00:00
Serge Pavlov 77af3812ec Use enumerators instead of hardcoded integers when we decide if keyword is enabled.
llvm-svn: 220849
2014-10-29 10:59:18 +00:00
Fariborz Jahanian 6485fe4b07 Objective-C. Under a special flag, -Wcstring-format-directive,
off by default, issue a warning if %s directive is used in
certain CF/NS formatting APIs, to assist user in deprecating
use of such %s in these APIs. rdar://18182443

llvm-svn: 217467
2014-09-09 23:10:54 +00:00
Fariborz Jahanian 78e9debf68 Objective-C. Warn if user has made explicit call
to +initilize as this results in an extra call
to this method. rdar://16628028

llvm-svn: 216271
2014-08-22 16:57:26 +00:00
Benjamin Kramer f3ca269839 Decouple ExprCXX.h and DeclCXX.h and clean up includes a bit.
Required pulling LambdaExpr::Capture into its own header.
No functionality change.

llvm-svn: 208470
2014-05-10 16:31:55 +00:00
Craig Topper f1186c5a8f [C++11] Use 'nullptr'.
llvm-svn: 208280
2014-05-08 06:41:40 +00:00
Richard Smith 997ff02c7b Fix a typo in r204164 that made *all* keywords available in OpenCL mode.
llvm-svn: 204196
2014-03-18 22:43:19 +00:00
Yunzhong Gao fcdc45ff2d Creating a printing policy for "half":
Since "half" is an OpenCL keyword and clang accepts __fp16 as an extension for
other languages, error messages and metadata (and hence debug info) should refer
to the half-precision floating point as "__fp16" instead of "half" when
compiling for non-OpenCL languages. This patch creates a new printing policy for
half in a similar manner to what is done for bool and wchar_t.

Differential Revision: http://llvm-reviews.chandlerc.com/D2952

llvm-svn: 204164
2014-03-18 17:55:18 +00:00
Craig Topper 3164f33f8f [C++11] Add 'override' keyword to virtual methods that override their base class.
llvm-svn: 203537
2014-03-11 03:39:26 +00:00
Alp Toker bfa3934f27 Rename language option MicrosoftMode to MSVCCompat
There's been long-standing confusion over the role of these two options. This
commit makes the necessary changes to differentiate them clearly, following up
from r198936.

MicrosoftExt (aka. fms-extensions):
 Enable largely unobjectionable Microsoft language extensions to ease
 portability. This mode, also supported by gcc, is used for building software
 like FreeBSD and Linux kernel extensions that share code with Windows drivers.

MSVCCompat (aka. -fms-compatibility, formerly MicrosoftMode):
 Turn on a special mode supporting 'heinous' extensions for drop-in
 compatibility with the Microsoft Visual C++ product. Standards-compilant C and
 C++ code isn't guaranteed to work in this mode. Implies MicrosoftExt.

Note that full -fms-compatibility mode is currently enabled by default on the
Windows target, which may need tuning to serve as a reasonable default.

See cfe-commits for the full discourse, thread 'r198497 - Move MS predefined
type_info out of InitializePredefinedMacros'

No change in behaviour.

llvm-svn: 199209
2014-01-14 12:51:41 +00:00
Chandler Carruth 5553d0d4ca Sort all the #include lines with LLVM's utils/sort_includes.py which
encodes the canonical rules for LLVM's style. I noticed this had drifted
quite a bit when cleaning up LLVM, so wanted to clean up Clang as well.

llvm-svn: 198686
2014-01-07 11:51:46 +00:00
Aaron Ballman b190f974c9 Fixed a FIXME; created a print method for Selectors that accepts a raw_ostream, and started using it in places it made sense.
No functional changes intended, just API cleanliness.

llvm-svn: 198428
2014-01-03 17:59:55 +00:00
Fariborz Jahanian 7c87b43d28 ObjectiveC migrator: For 'default' and 'shared' family of
methods, infer their self's type as their result type.
// rdar://15145218

llvm-svn: 192377
2013-10-10 18:23:13 +00:00
Fariborz Jahanian 985da6c936 ObjectiveC migrator: A typical implementation of
'default' methods in Foundation does not
infer 'instancetype' for methods' result type.
// rdar://15145218

llvm-svn: 192129
2013-10-07 20:41:53 +00:00
Fariborz Jahanian 1c900bcf26 ObjectiveC migrator: For consistency, also infer
'instancetype' for known family of methods
with related result type; such as 'init'
methods. // rdar://14987948

llvm-svn: 190956
2013-09-18 20:35:47 +00:00
Fariborz Jahanian 4ccdc73f44 ObjectiveC migrator: remove dead code.
llvm-svn: 189592
2013-08-29 16:22:26 +00:00
Fariborz Jahanian 9275c688ea ObjectiveC migrator: Add another family of factory
methods which can be migrated to instancetype.

llvm-svn: 187672
2013-08-02 20:54:18 +00:00
Fariborz Jahanian c4291852a4 ObjectiveC migrator: Fixes public buildbot failures,
in my previous patch which was reverted in r187657

llvm-svn: 187661
2013-08-02 18:00:53 +00:00
Fariborz Jahanian 87dc0bc078 revert patch I added in r187655. It still breaks public
buildbot.

llvm-svn: 187657
2013-08-02 16:25:41 +00:00
Fariborz Jahanian 11fe914549 ObjectiveC migration. Check-in patch reverted in r187634.
Also removed check for "NS" prefix for class name.

llvm-svn: 187655
2013-08-02 16:00:08 +00:00
Rafael Espindola 6cbcc10e84 Revert "ObjectiveC migrator. Migrate to instancetype return type for mehods with certain prefix selector matching their class names' suffix."
This reverts commit r187626.

It is breaking the bots.

llvm-svn: 187634
2013-08-02 00:01:14 +00:00
Fariborz Jahanian 8234d40843 ObjectiveC migrator. Migrate to instancetype return type
for mehods with certain prefix selector matching their class names'
suffix.

llvm-svn: 187626
2013-08-01 22:29:32 +00:00
Fariborz Jahanian 267bae3ad6 Objective-C migrator: some cleanup.
Expose static type of init/alloc/retain with
instance type as well. Ad-hoc cases are coming
next.

llvm-svn: 187068
2013-07-24 19:18:37 +00:00
Fariborz Jahanian 7122135fc3 ObjC migrator: more knobs toward doing
instancetype migration.

llvm-svn: 187000
2013-07-23 22:42:28 +00:00
Fariborz Jahanian 4f3a64fd6e ObjC migrator: Define family of methods
which are candidate for migrating to
'instancetype'. wip.

llvm-svn: 186981
2013-07-23 19:31:17 +00:00
Adrian Prantl 6e77c96872 cleanup (address some more review comments for r183474):
- reduce default buffer size to 64, which will still be large enough to
  hold any property names found in the wild.
- get rid of the /*static*/ comments.

llvm-svn: 183697
2013-06-10 21:36:55 +00:00
Adrian Prantl a4ce906bc0 address some comments on r183474:
- factor the name construction part out from constructSetterName
- rename constructSetterName to the more appropriate constructSetterSelector

no functionality change intended.
rdar://problem/14035789

llvm-svn: 183582
2013-06-07 22:29:12 +00:00
Argyrios Kyrtzidis 9aca3c61c0 [Modules] Use global index to improve typo correction performance
Typo correction for an unqualified name needs to walk through all of the identifier tables of all modules.
When we have a global index, just walk its identifier table only.

rdar://13425732

llvm-svn: 179730
2013-04-17 22:10:55 +00:00
Jordan Rose 4938f276a5 Remove some stray uses of <ctype.h> functions.
These are causing assertions on some MSVC builds.

llvm-svn: 174805
2013-02-09 10:09:43 +00:00
Jordan Rose a7d03840e6 Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.
Nearly all of these changes are one-to-one replacements; the few that
aren't have to do with custom identifier validation.

llvm-svn: 174768
2013-02-08 22:30:41 +00:00
Richard Smith 89645bc888 s/CXX0X/CXX11/g, except for __GNU_EXPERIMENTAL_CXX0X__, and update a few nearby 'C++0x' comments.
llvm-svn: 171372
2013-01-02 12:01:23 +00:00
Richard Smith 2bf7fdb723 s/CPlusPlus0x/CPlusPlus11/g
llvm-svn: 171367
2013-01-02 11:42:31 +00:00
Douglas Gregor c50d4924eb Use @import rather than @__experimental_modules_import, since the
latter is rather a mess to type.

llvm-svn: 169919
2012-12-11 22:11:52 +00:00
Chandler Carruth 3a02247dc9 Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

llvm-svn: 169237
2012-12-04 09:13:33 +00:00