Commit Graph

10477 Commits

Author SHA1 Message Date
Fariborz Jahanian b107143fed Fix a bug in calculation of composite type
of conditional expressions of objc pointer types
where one type is the immediate base type of the
other. // rdar://9296866

llvm-svn: 129718
2011-04-18 21:16:59 +00:00
Richard Smith 0c502d2a62 Fix PR9741. The implicit declarations created for range-based for loops weren't being added to the DeclContext (nor were they being marked as implicit). Also, the declarations were being emitted in the wrong order when building the CFG.
llvm-svn: 129700
2011-04-18 15:49:25 +00:00
Douglas Gregor 6c7a9eec42 When providing code completions of ivar names for a property
implementation such as

  @synthesize Prop1 = 

Give priority to ivars whose type matches or closely matches the
property type (as we do for several other kinds of
results). Additionally, if there is an ivar with the same name as the
property, or differs only due to a _ prefix or suffix, give that ivar
a priority bump. Finally, verify that this search is properly
returning ivars within class extensions and implementations
(<rdar://problem/8488854>).

llvm-svn: 129699
2011-04-18 14:40:46 +00:00
Douglas Gregor 331faa0f73 When producing code completion results for the Objective-C property
implementation 

  @synthesize <property> = 

also produce a completion for a to-be-synthesized ivar named
_<property>.

llvm-svn: 129697
2011-04-18 14:13:53 +00:00
Anders Carlsson ce758c1d27 Put a typeid test in its own namespace.
llvm-svn: 129681
2011-04-17 23:33:40 +00:00
Chris Lattner 97bbee2fb4 Fix a miscompilation I introduced in r129652, thanks for Eli for tracking
it down.  we effectively were compile the testcase into:

void test14(int x) {
  switch (x) {
    case 11: break;
    case 42: test14(97);  // fallthrough
    default: test14(42); break;

which is not the same thing at all.  This fixes a miscompilation of 
MallocBench/gs seen on the clang-x86_64-linux-fnt buildbot.

llvm-svn: 129679
2011-04-17 23:21:26 +00:00
Anders Carlsson 02feb58dd7 Use the right type name.
llvm-svn: 129674
2011-04-17 21:57:29 +00:00
Anders Carlsson fcaaa697ec When laying out bases in, always try the "base subobject" LLVM type. If it
turns out that a field or base needs to be laid out in the tail padding of
the base, CGRecordLayoutBuilder::ResizeLastBaseFieldIfNecessary will convert
it to an array of i8.

I've audited the new test results to make sure that they are still valid. I've
also verified that we pass a self-host with this change.

This (finally) fixes PR5589!

llvm-svn: 129673
2011-04-17 21:56:13 +00:00
Anders Carlsson 2caf2074fd Cleanup tests, no functionality change.
llvm-svn: 129672
2011-04-17 21:49:47 +00:00
Chris Lattner 38b6057a93 when assertions are disabled, labels go away. Hopefully fixes the windows build.
llvm-svn: 129660
2011-04-17 16:19:57 +00:00
Chris Lattner bc204c8043 implement rdar://9289524 - case followed immediately by break results in empty IR block,
a -O0 code quality issue.

llvm-svn: 129652
2011-04-17 00:54:30 +00:00
Chris Lattner 30107ed600 fold memcpy/set/move_chk to llvm.memcpy/set/move when the sizes
are trivial.  This exposes opportunities earlier, and allows fastisel
to do good things with these at -O0.

This addresses rdar://9289468 - clang doesn't fold memset_chk at -O0

llvm-svn: 129651
2011-04-17 00:40:24 +00:00
Chris Lattner 56784f9de6 fix rdar://9289603 - clang should fold trivial ?: for enums as well as integer constants into select at -O0
by making the isCheapEnoughToEvaluateUnconditionally predicate handle anything that folds to a constant.  In particular, we now fold enums.

llvm-svn: 129649
2011-04-16 23:15:35 +00:00
Tanya Lattner 5bea4c3859 Modify test for 32 and 64 bit.
llvm-svn: 129627
2011-04-16 01:00:29 +00:00
Devang Patel 9d6c857862 Emit debug info for Objective-C properties.
llvm-svn: 129625
2011-04-16 00:12:55 +00:00
Tanya Lattner 5ac257d738 Fix bug in vector initializer when initializing a vector with another vector.
Add test case.

llvm-svn: 129617
2011-04-15 22:42:59 +00:00
Fariborz Jahanian 0fe1a9861c Enforce nonnull __attribute__ on Objective-C method calls.
// rdar://9287695

llvm-svn: 129615
2011-04-15 22:06:22 +00:00
Douglas Gregor 46ce91a964 Initial work to improve documentation for Clang's diagnostics, from Matthieu Monrocq
llvm-svn: 129614
2011-04-15 22:04:17 +00:00
Douglas Gregor 5d3d3fa33d For the purposes of overload resolution, consider a conversion from an
Objective-C pointer to void* as a "conversion to void*". This allows
us to prefer an Objective-C object pointer conversion to a superclass
object pointer over an Objective-C object pointer conversion to
cv-void*. Fixes PR9735.

llvm-svn: 129603
2011-04-15 20:45:44 +00:00
Douglas Gregor 39d1a0973d Forbid the use of C++ new/delete to allocate/free objects within an
address space. I could see that this functionality would be useful,
but not in its current form (where the address space is ignored):
rather, we'd want to encode the address space into the parameter list
passed to operator new/operator delete somehow, which would require a
bunch more semantic analysis.

llvm-svn: 129593
2011-04-15 19:46:20 +00:00
Fariborz Jahanian 193f783a99 Fixes a crash when generating dependency file stuff
and output file is not writable. // rdar://9286457.

llvm-svn: 129587
2011-04-15 18:49:23 +00:00
Douglas Gregor b472e93af7 Implement appropriate semantics for C++ casting and conversion when
dealing with address-space- and GC-qualified pointers. Previously,
these qualifiers were being treated just like cvr-qualifiers (in some
cases) or were completely ignored, leading to uneven behavior. For
example, const_cast would allow conversion between pointers to
different address spaces.

The new semantics are fairly simple: reinterpret_cast can be used to
explicitly cast between pointers to different address spaces
(including adding/removing addresss spaces), while
static_cast/dynamic_cast/const_cast do not tolerate any changes in the
address space. C-style casts can add/remove/change address spaces
through the reinterpret_cast mechanism. Other non-CVR qualifiers
(e.g., Objective-C GC qualifiers) work similarly.

As part of this change, I tweaked the "casts away constness"
diagnostic to use the term "casts away qualifiers". The term
"constness" actually comes from the C++ standard, despite the fact
that removing "volatile" also falls under that category. In Clang, we
also have restrict, address spaces, ObjC GC attributes, etc., so the
more general "qualifiers" is clearer.

llvm-svn: 129583
2011-04-15 17:59:54 +00:00
Fariborz Jahanian 66a6c06dd6 Allow shadowin of 'self' in objc methods in
cases where stand-alone ivar can be looked up
in shadowed object. To fix gcc compatibility
breakage. // rdar://9284603

llvm-svn: 129576
2011-04-15 17:04:42 +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
Michael J. Spencer 6826eb816a Add 3DNow! Intrinsics.
llvm-svn: 129570
2011-04-15 15:07:13 +00:00
Richard Smith dda56e4b4a Support for C++11 (non-template) alias declarations.
llvm-svn: 129567
2011-04-15 14:24:37 +00:00
Richard Smith 3504faf6e4 Apply NAKAMURA Takumi's workaround to fix thses tests on -Asserts build. The labels there are numbered, not named, and numbered labels are formatted differently.
llvm-svn: 129562
2011-04-15 10:12:39 +00:00
Ted Kremenek 1551d55295 Improve diagnostics on GNU attributes by warning about attributes that should have no arguments or parameters. Patch by Michael Han!
llvm-svn: 129560
2011-04-15 05:49:29 +00:00
Chris Lattner 57540c5be0 fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129559
2011-04-15 05:22:18 +00:00
Peter Collingbourne 3d9cbdc3e6 C1X: implement static asserts
llvm-svn: 129555
2011-04-15 00:35:57 +00:00
Peter Collingbourne 9114759641 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.

llvm-svn: 129554
2011-04-15 00:35:48 +00:00
Douglas Gregor 6ca6410e3a If the declaration of a C++ member function with an inline definition
is so broken that Sema can't form a declaration for it, don't bother
trying to parse the definition later. Fixes <rdar://problem/9221993>.

llvm-svn: 129547
2011-04-14 23:19:27 +00:00
Richard Smith 02e85f3bc5 Add support for C++0x's range-based for loops, as specified by the C++11 draft standard (N3291).
llvm-svn: 129541
2011-04-14 22:09:26 +00:00
Richard Smith 55858499e2 Detect when the string "<::" is found in code after a cast or template name and is interpreted as "[:" because of the digraph "<:". When found, give an error with a fix-it to add whitespace between the "<" and "::".
Patch by Richard Trieu! Plus a small tweak from me to deal with one of the tokens coming from a macro.

llvm-svn: 129540
2011-04-14 21:45:45 +00:00
Fariborz Jahanian bc2ee9382c Match pointer of compatible vection types.
// rdar://9208404

llvm-svn: 129536
2011-04-14 20:33:36 +00:00
Douglas Gregor af670a81e9 When determining the "usage" type of a declaration for the purposes of code
completion, look through block pointer and function pointer types to the
result type of the block/function. Fixes <rdar://problem/9282583>.

llvm-svn: 129535
2011-04-14 20:33:34 +00:00
Anton Korobeynikov 231e875b5c Implement ARM pcs attribute. Basically it's another way of calling convention selection (AAPCS or
AAPCS+VFP), similar to fastcall / stdcall / whatevercall seen on x86.

In particular, all library functions should always be AAPCS regardless of floating point ABI used.

llvm-svn: 129534
2011-04-14 20:06:49 +00:00
Richard Smith f7b6202e6c Implement C++0x [lex.pptoken]p3's handling of <::.
llvm-svn: 129525
2011-04-14 18:36:27 +00:00
Douglas Gregor 23c8476748 Parse an '@' in an Objective-C++ class member specification,
diagnosing it as an error rather than looping infinitely. Also,
explicitly disallow @defs in Objective-C++. Fixes <rdar://problem/9260136>.

llvm-svn: 129521
2011-04-14 17:21:19 +00:00
Sebastian Redl 9ab988fe00 Chained PCH: Remember when additional specializations are added to a function template from a previous PCH. Fixes the only crasher when using massive chains on Clang's Sema component. We still have some incomplete codegen there.
llvm-svn: 129516
2011-04-14 14:07:59 +00:00
Argyrios Kyrtzidis 36e4ae3e57 When creating an implicit member expression through a qualified-id, check that the class
named by the nested-name-specifier is same or base of the class in which the member expression appears.

It seems we also had an ill-formed test case, mon dieu! Fixes rdar://8576107.

llvm-svn: 129493
2011-04-14 00:46:47 +00:00
Anders Carlsson d162fb83f2 In C++, when initializing an array from a pascal string, it's OK if the array
is 1 element smaller than the string, because we can just strip off the last
null character. This matches GCC.

llvm-svn: 129490
2011-04-14 00:41:11 +00:00
Anders Carlsson a5a9bafeb9 Rename test.
llvm-svn: 129486
2011-04-13 23:55:47 +00:00
Chandler Carruth a7773f719e Add -no-canonical-prefixes to tests which assert on the name of the
built clang binary that is used by the test. Build systems that use
symlinks for build outputs will fail these assertions otherwise.

llvm-svn: 129482
2011-04-13 22:28:36 +00:00
Fariborz Jahanian 38675543c5 Issue the 2nd fixit even if fix-it hint is supressed.
// rdar://9091893

llvm-svn: 129481
2011-04-13 22:18:37 +00:00
Fariborz Jahanian e72509c10c No fixit hint for builtin expressions which are
defined in a macro. // rdar://9091893

llvm-svn: 129465
2011-04-13 20:31:26 +00:00
Bill Wendling a865185ad6 Removing the unaligned load tests from builtins-x86.c since they're generated by a regular 'load' now.
llvm-svn: 129464
2011-04-13 20:17:22 +00:00
Chandler Carruth 0a7aa3b60b Teach -Wuninitialized about C++'s typeid expression, including both the
evaluated and unevaluated contexts. Add some testing of sizeof and
typeid.

Both of the typeid tests added here were triggering warnings previously.
Now the one false positive is suppressed without suppressing the warning
on actually buggy code.

llvm-svn: 129431
2011-04-13 08:18:42 +00:00
Francois Pichet 48c946e5ef In Microsoft mode, within class scope, if a CXXScopeSpec's type is equal to the type of one of the base classes then downgrade the missing typename error to a warning. Up to now this is the only case I found where MSVC doesn't require "typename" at class scope. Really strange!
This fixes 1 error when parsing the MSVC 2008 header files.
Example:

template<class T> class A {
public:
  typedef int TYPE;
};
template<class T> class B : public A<T> {
public:
  A<T>::TYPE a; // no typename required because A<T> is a base class.
};

llvm-svn: 129425
2011-04-13 02:38:49 +00:00
Fariborz Jahanian 82bc436c28 Redeclaration of 'self' should be flagged in
objective-c instead of crashing in IRgen.
// rdar://9154582.

llvm-svn: 129412
2011-04-12 23:39:33 +00:00