Commit Graph

29 Commits

Author SHA1 Message Date
Yaxun Liu b34ec829be [OpenCL] Map default address space to alloca address space
For OpenCL, the private address space qualifier is 0 in AST. Before this change, 0 address space qualifier
is always mapped to target address space 0. As now target private address space is specified by
alloca address space in data layout, address space qualifier 0 needs to be mapped to alloca addr space specified by the data layout.

This change has no impact on targets whose alloca addr space is 0.

With contributions from Matt Arsenault, Tony Tye and Wen-Heng (Jack) Chung

Differential Revision: https://reviews.llvm.org/D31404

llvm-svn: 299965
2017-04-11 17:24:23 +00:00
Andrey Bokhanko 45d413260e [MSVC] Implementation of __unaligned as a proper type qualifier
This patch implements __unaligned (MS extension) as a proper type qualifier
(before that, it was implemented as an ignored attribute).

It also fixes PR27367 and PR27666.

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

llvm-svn: 269220
2016-05-11 18:38:21 +00:00
Nico Weber 2801d32c07 Revert r268727, it caused PR27666.
llvm-svn: 268736
2016-05-06 14:34:29 +00:00
Andrey Bokhanko ba0d7540e3 [MSVC] Implementation of __unaligned as a proper type qualifier
This patch implements __unaligned (MS extension) as a proper type qualifier
(before that, it was implemented as an ignored attribute).

It also fixes PR27367.

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

llvm-svn: 268727
2016-05-06 11:47:55 +00:00
Nico Weber 917fc9d7cb Revert r266415, it broke parsing SDK headers (PR27367).
llvm-svn: 266431
2016-04-15 14:35:06 +00:00
Andrey Bokhanko f7fa634887 [MSVC Compat] Implementation of __unaligned (MS extension) as a type qualifier
This patch implements __unaligned as a type qualifier; before that, it was
modeled as an attribute. Proper mangling of __unaligned is implemented as well.
Some OpenCL code/tests are tangenially affected, as they relied on existing
number and sizes of type qualifiers.

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

llvm-svn: 266415
2016-04-15 08:03:51 +00:00
Anastasia Stulova e6e082348d [OpenCL] Add missing OpenCL LangOpts in address space compatibility checks
and test checking broken (due to CL specific diagnostics) C functionality

M    test/Sema/address_spaces.c
M    lib/Sema/SemaExpr.cpp

llvm-svn: 248902
2015-09-30 13:49:55 +00:00
Aaron Ballman 9d695091fd Replacing err_attribute_argument_not_int with err_attribute_not_type_attr
llvm-svn: 187419
2013-07-30 14:10:17 +00:00
Aaron Ballman bcee83e99d Removed a redundant diagnostic and replaced it with a more standard one. Added a test case for the diagnostic.
llvm-svn: 186942
2013-07-23 14:54:24 +00:00
Richard Smith 6d6676b9d1 Add test for PR4997. This has been fixed for a while.
llvm-svn: 185614
2013-07-04 04:10:46 +00:00
Matt Arsenault 376f72092c Fix assertion failure when a field is given an address space.
llvm-svn: 176122
2013-02-26 21:16:00 +00:00
Peter Collingbourne 8f5f520653 Forbid address-space-qualified function types, per TR 18037
llvm-svn: 136257
2011-07-27 20:30:05 +00:00
John McCall 71de91cc09 When diagnosing address-space changes, apply array-to-pointer decay first.
llvm-svn: 124702
2011-02-01 23:28:01 +00:00
John McCall 4fff8f6cff Perform the bad-address-space conversions check as part of
CheckPointerTypesForAssignment.

llvm-svn: 124632
2011-02-01 00:10:29 +00:00
Chris Lattner 53fa04909c make clang print types as "const int *" instead of "int const*",
which is should have done from the beginning.  As usual, the most
fun with this sort of change is updating all the testcases.

llvm-svn: 113090
2010-09-05 00:04:01 +00:00
Douglas Gregor 8014df4c21 Refer to implicit "conversions" rather than implicit "casts", which
don't technically exist in the language. <rdar://problem/8085982>

llvm-svn: 107995
2010-07-09 18:18:35 +00:00
Douglas Gregor c68e140657 Improve diagnostics when we fail to convert from a source type to a
destination type for initialization, assignment, parameter-passing,
etc. The main issue fixed here is that we used rather confusing
wording for diagnostics such as

t.c:2:9: warning: initializing 'char const [2]' discards qualifiers,
      expected 'char *' [-pedantic]
  char *name = __func__;
        ^      ~~~~~~~~

We're not initializing a 'char const [2]', we're initializing a 'char
*' with an expression of type 'char const [2]'. Similar problems
existed for other diagnostics in this area, so I've normalized them all
with more precise descriptive text to say what we're
initializing/converting/assigning/etc. from and to. The warning for
the code above is now:

t.c:2:9: warning: initializing 'char *' from an expression of type
      'char const [2]' discards qualifiers [-pedantic]
  char *name = __func__;
        ^      ~~~~~~~~

Fixes <rdar://problem/7447179>.

llvm-svn: 100832
2010-04-09 00:35:39 +00:00
Daniel Dunbar 8fbe78f6fc Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Tanya Lattner fd2dcba7f3 Add an error for function parameters that have a qualified address space since this is not allowed by the embedded c extension spec.
llvm-svn: 83165
2009-09-30 20:47:43 +00:00
John McCall 8ccfcb51ee Refactor the representation of qualifiers to bring ExtQualType out of the
Type hierarchy.  Demote 'volatile' to extended-qualifier status.  Audit our
use of qualifiers and fix a few places that weren't dealing with qualifiers
quite right;  many more remain.

llvm-svn: 82705
2009-09-24 19:53:00 +00:00
John McCall 8945266f3d Bounds checking for address spaces.
llvm-svn: 77303
2009-07-28 06:52:18 +00:00
Chris Lattner 5c6160d019 fix rdar://6774906, a crash handling implicit conversions between pointers
in different address spaces.

llvm-svn: 68941
2009-04-13 06:04:39 +00:00
Daniel Dunbar a45cf5b6b0 Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.

llvm-svn: 67602
2009-03-24 02:24:46 +00:00
Chris Lattner 7b0ec8a9df upgrade various 'implicit int' warnings from an ext-warn to warning when not
in C89 mode.  This makes it enabled by default instead of only enabled with
-pedantic.  Clang defaults to c99 mode, so people will see this more often
than with GCC, but they can always use -std=c89 if they really want c89.

llvm-svn: 65647
2009-02-27 18:53:28 +00:00
Chris Lattner 5cdc94d282 testcase that works now with r62061
llvm-svn: 62062
2009-01-12 00:08:58 +00:00
Nate Begeman c506c78117 Extend QualType::getAddressSpace to do the right thing for array types, and in
the future, RecordTypes.

llvm-svn: 48784
2008-03-25 18:36:32 +00:00
Nate Begeman b561de7455 Correctly error on arrays with automatic storage full of objects with
non-default address space, and fix comment.
Add a test for this.

llvm-svn: 48366
2008-03-14 18:07:10 +00:00
Nate Begeman 144625ef9b ISO/IEC TR 18037
An address space name cannot be used to qualify an object that has automatic
storage duration.  Still not catching ASQual'd allocas of array type, just 
scalars at the moment.

llvm-svn: 48350
2008-03-14 00:22:18 +00:00
Chris Lattner a2417c9d8b add some semantic checks for address spaces.
llvm-svn: 47423
2008-02-21 01:42:41 +00:00