Граф коммитов

588 Коммитов

Автор SHA1 Сообщение Дата
Rafael Espindola d2615cc53b Add 178663 back.
http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green
before it processed the reverted 178663, so it could not have been the culprit.

Revert "Revert 178663."

This reverts commit 4f8a3eb2ce.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178682 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 19:27:57 +00:00
Rafael Espindola 4f8a3eb2ce Revert 178663.
Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb

Revert "Don't compute a patched/semantic storage class."

This reverts commit 8f187f62cb.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178681 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 19:22:20 +00:00
Rafael Espindola 8f187f62cb Don't compute a patched/semantic storage class.
For variables and functions clang used to store two storage classes. The one
"as written" in the code and a patched one, which, for example, propagates
static to the following decls.

This apparently is from the days clang lacked linkage computation. It is now
redundant and this patch removes it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178663 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 15:50:00 +00:00
Reid Kleckner e93e2552e7 [ms-cxxabi] Add more tests for r178297
This covers a few cases where the class of a member pointer is not a
CXXRecordDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178307 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28 23:11:29 +00:00
Reid Kleckner 4bbae38abf [sema] Check the result of getAsCXXRecordDecl() to fix the build
I'm not 100% sure what should happen here to find the real
CXXRecordDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178297 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28 22:15:11 +00:00
Reid Kleckner edd2cb381e [sema] Remove unused variable from r178283
Wouldn't it be cool if we had a compiler for Windows that could warn
about these things?

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178289 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28 20:54:13 +00:00
Reid Kleckner 84e9ab44af [ms-cxxabi] Correctly compute the size of member pointers
Summary:
This also relaxes the requirement on Windows that the member pointer
class type be a complete type (http://llvm.org/PR12070).  We still ask
for a complete type to instantiate any templates (MSVC does this), but
if that fails we continue as normal, relying on any inheritance
attributes on the declaration.

Reviewers: rjmccall

CC: triton, timurrrr, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178283 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28 20:02:56 +00:00
Richard Smith eb82a53aaa For -Wignored-qualifiers, don't warn on qualifiers which we acquire via a
typedef. Also don't warn on the _Atomic type specifier, just on the _Atomic
type qualifier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178218 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28 03:27:52 +00:00
Richard Smith 8c952cd40c Teach -Wigored-qualifiers about exotic flavors of declarator and the _Atomic type qualifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178217 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28 02:51:21 +00:00
Richard Smith 47681531ce Remove outdated FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178211 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28 01:56:34 +00:00
Richard Smith 4cf4a5e96a Support C11 _Atomic type qualifier. This is more-or-less just syntactic sugar for the _Atomic type specifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178210 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28 01:55:44 +00:00
Richard Smith 93d6b07cd7 Fold together the two implementations of 6.7.3p2 in SemaType. Fix two bugs, each of which was only present in one version:
* Give the right diagnostic for 'restrict' applied to a non-pointer, non-reference type.
 * Don't reject 'restrict' applied indirectly to an Objective-C object pointer type (eg, through template instantiation).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178200 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28 00:03:10 +00:00
Richard Smith 9807a2e0dd Don't reject __restrict applied to a dependent type; it might instantiate to a pointer or reference type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178198 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-27 23:36:39 +00:00
Jordan Rose 0918989f0e Sema: Preserve attributes on parameters in instantiated function templates.
This was causing correctness issues for ARC and the static analyzer when a
function template has "consumed" Objective-C object parameters (i.e.
parameters that will be released by the function before returning).

The fix is threefold:
(1) Actually copy over the attributes from old ParmVarDecls to new ones.
(2) Have Sema::BuildFunctionType only work for building FunctionProtoTypes,
    which it was doing anyway. This allows us to pass an ExtProtoInfo
    instead of a plain ExtInfo and several flags.
(3) Drop param attributes as part of StripImplicitInstantiation, which is
    used when an implicit instantiation is followed by an explicit one.

<rdar://problem/12685622>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176728 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-08 22:25:36 +00:00
Jordan Rose bea522ff43 ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType.
No (intended) functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176726 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-08 21:51:21 +00:00
Jordan Rose 41f3f3a479 Silence a number of static analyzer warnings with assertions and such.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176469 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 01:27:54 +00:00
John McCall b2381b1c91 Attempt to not place ownership qualifiers on the result type
of block declarators.  Document the rule we use.

Also document the rule that Doug implemented a few weeks ago
which drops ownership qualifiers on function result types.

rdar://10127067

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176336 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01 07:58:16 +00:00
Peter Collingbourne 7728cddd78 Revert r175912, "Add support for coldcc to clang" at John's request.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175936 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-23 00:06:18 +00:00
Peter Collingbourne 4c67aa9640 Add support for coldcc to clang
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175912 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-22 19:24:35 +00:00
Argyrios Kyrtzidis d5668a2447 When a parameter list in a C function has an error, recover by forming a K&R function,
instead of a non-function type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175868 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-22 06:58:32 +00:00
David Blaikie 66874fb18a Use None rather than Optional<T>() where possible.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175705 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-21 01:47:18 +00:00
David Blaikie dc84cd5efd Include llvm::Optional in clang/Basic/LLVM.h
Post-commit CR feedback from Jordan Rose regarding r175594.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175679 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20 22:23:23 +00:00
Richard Smith 6b3d3e54c0 Process and handle attributes on conditions and for loop variables. Process and
diagnose attributes on alias declarations, using directives, and attribute
declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175649 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20 19:22:51 +00:00
David Blaikie 39e6ab4be9 Replace TypeLoc llvm::cast support to be well-defined.
The TypeLoc hierarchy used the llvm::cast machinery to perform undefined
behavior by casting pointers/references to TypeLoc objects to derived types
and then using the derived copy constructors (or even returning pointers to
derived types that actually point to the original TypeLoc object).

Some context is in this thread:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html
Though it's spread over a few months which can be hard to read in the mail
archive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175462 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-18 22:06:02 +00:00
John McCall 9dd74c5504 Diagnose loads of 'half' l-values in OpenCL.
Patch by Joey Gouly!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174928 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12 01:29:43 +00:00
Guy Benyei 21f18c4fda Add OpenCL samplers as Clang builtin types and check sampler related restrictions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174601 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 10:55:47 +00:00
Richard Smith d03de6aaa3 Downgrade 'attribute ignored when parsing type' from error to warning, to match
the diagnostic's warn_ name. Switch some places (notably C++11 attributes)
which really wanted an error over to a different diagnostic. Finally, suppress
the diagnostic entirely for __ptr32, __ptr64 and __w64, to avoid producing
diagnostics in important system headers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173788 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29 10:02:16 +00:00
Richard Smith 5cd532ca0b Replace AS_MSTypespec with AS_Keyword, for representing any attribute spelled
as a keyword. Rationalize existing attributes to use it as appropriate, and to
not lie about some __declspec attributes being GNU attributes. In passing,
remove a gross hack which was discarding attributes which we could handle. This
results in us actually respecting the __pascal keyword again.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173746 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29 01:24:26 +00:00
John McCall b8b2c9da87 First pass at abstracting out a class for the target C++ ABI.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173514 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 22:30:49 +00:00
Dmitri Gribenko 630f4bb9f1 Implement -Wvla correctly
GCC implements -Wvla as "warn on every VLA" (this is useful to find every VLA,
for example, if they are forbidden by coding guidelines).  Currently Clang
implements -Wvla as "warn on VLA when it is an extension".

The attached patch makes our behavior match GCC.  The existing vla extwarn is
moved under -Wvla-extension and is still included into -Wgnu.

This fixes PR5953.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173286 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 20:02:51 +00:00
Joey Gouly 19dbb20ac4 Add a new LangOpt NativeHalfType. This option allows for native half/fp16
operations (as opposed to storage only half/fp16).

Also add some semantic checks for OpenCL half types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173254 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 11:56:20 +00:00
Guy Benyei e6b9d802fb Implement OpenCL event_t as Clang builtin type, including event_t related OpenCL restrictions (OpenCL 1.2 spec 6.9)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172973 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-20 12:31:11 +00:00
Douglas Gregor 02dd798309 In Objective-C ARC, completely ignore ownership qualifiers on the
return type of a function by canonicalizing them away. They are
useless anyway, and conflict with our rules for template argument
deduction and __strong. Fixes <rdar://problem/12367446>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172768 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-17 23:36:45 +00:00
Joey Gouly 617bb317a7 Add some semantic checks for OpenCL. Variadic macros, VLAs and bitfields are not supported.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172732 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-17 17:35:00 +00:00
Richard Smith cd8ab51a44 Implement C++11 semantics for [[noreturn]] attribute. This required splitting
it apart from [[gnu::noreturn]] / __attribute__((noreturn)), since their
semantics are not equivalent (for instance, we treat [[gnu::noreturn]] as
affecting the function type, whereas [[noreturn]] does not).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172691 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-17 01:30:42 +00:00
Richard Smith 5c52166525 Fix behavior of [[gnu::]] function attributes. Per g++'s behavior, these
attributes appertain to a declaration, even though they would be much more
naturally modelled as appertaining to a function type. Previously, we would
try to distribute them from the declarator to the function type, then
reject them for being at an incorrect location. Now, we just distribute them
as far as the declarator; the existing attribute handling code can actually
apply them there just fine.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172504 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 02:48:13 +00:00
Richard Smith f7a052732c Accept [[gnu::*]] for all __attribute__((*))s which are:
1) Supported by Clang, and
 2) Supported by GCC, and
 3) Documented in GCC's manual.

g++ allows its C++11-style attributes to appertain only to the entity being
declared, and never to a type (even for a type attribute), so we do the same.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172382 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14 07:53:01 +00:00
Richard Smith 21c8fa87a3 PR12008: defer adding the implicit 'const' to a constexpr member function until
we know whether it is static.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172376 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14 05:37:29 +00:00
Richard Smith a4fa900898 Remove some duplication in the handling of __attribute__((ext_vector_size(N))).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172340 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-13 02:11:23 +00:00
Douglas Gregor ca2ab45341 Provide Decl::getOwningModule(), which determines the (sub)module in
which a particular declaration resides. Use this information to
customize the "definition of 'blah' must be imported from another
module" diagnostic with the module the user actually has to
import. Additionally, recover by importing that module, so we don't
complain about other names in that module.

Still TODO: coming up with decent Fix-Its for these cases, and expand
this recovery approach for other name lookup failures.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172290 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-12 01:29:50 +00:00
Enea Zaffanella 601e6e894c Fixed an assertion failure triggered by invalid code.
Set invalid type of declarator after emitting error diagnostics,
so that it won't be later considered when instantiating the template.
Added test5_inst in test/SemaCXX/condition.cpp for non-regression.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172201 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-11 14:34:39 +00:00
Douglas Gregor 3c7236e01d Back out my no-op change from r171783.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171817 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-08 00:01:45 +00:00
Douglas Gregor 57cbb141ca Use the C++11 POD definition in C++11 mode to determine whether one
can create a VLA of class type. Fixes <rdar://problem/12151822>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171783 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 20:03:16 +00:00
Richard Smith 80ad52f327 s/CPlusPlus0x/CPlusPlus11/g
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171367 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-02 11:42:31 +00:00
Guy Benyei 38980086c0 Add intel_ocl_bicc calling convention as a function attribute to clang. The calling convention is already implemented in LLVM.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171056 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-25 08:53:55 +00:00
Guy Benyei b13621d08e Re-commit r170428 changes with Linux style file endings.
Add OpenCL images as clang builtin types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170432 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 14:38:23 +00:00
Guy Benyei 7f92f2d8d9 Revert changes from r170428, as I accidentally changed the line endings of these files to Windows style.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170431 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 14:30:41 +00:00
Guy Benyei 736104a761 Add OpenCL images as clang builtin types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170428 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 12:30:03 +00:00
Richard Smith ac71351acd Properly compute triviality for explicitly-defaulted or deleted special members.
Remove pre-standard restriction on explicitly-defaulted copy constructors with
'incorrect' parameter types, and instead just make those special members
non-trivial as the standard requires.

This required making CXXRecordDecl correctly handle classes which have both a
trivial and a non-trivial special member of the same kind.

This also fixes PR13217 by reimplementing DiagnoseNontrivial in terms of the
new triviality computation technology.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169667 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-08 02:53:02 +00:00
Chandler Carruth 55fc873017 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 09:13:33 +00:00