Commit Graph

4600 Commits

Author SHA1 Message Date
Fariborz Jahanian 00bdca561a Workaround a possible VS C++ bug.
llvm-svn: 106070
2010-06-16 00:16:38 +00:00
Fariborz Jahanian 021510e96f Patch adds support for copying of those
objective-c++ class objects which have GC'able objc object
pointers and need to use ObjC's objc_memmove_collectable
API (radar 8070772). 

llvm-svn: 106061
2010-06-15 22:44:06 +00:00
Douglas Gregor f267edd8ac Update equality and relationship comparisons of pointers to reflect
C++ semantics, eliminating an extension diagnostic that doesn't match
C++ semantics (ordered comparison with NULL) and tightening some
extwarns to errors in C++ to match GCC and maintain conformance in
SFINAE contexts. Fixes <rdar://problem/7941392>.

llvm-svn: 106050
2010-06-15 21:38:40 +00:00
Douglas Gregor c4827d31aa Remove a completely useless and utterly incorrect assertion.
llvm-svn: 106040
2010-06-15 20:38:36 +00:00
Douglas Gregor 9858ed5b69 Teach code completion not to ignore data members when performing code
completion for expressions.

llvm-svn: 106037
2010-06-15 20:26:51 +00:00
Chris Lattner a8687ae490 tidy up
llvm-svn: 106011
2010-06-15 18:05:34 +00:00
Douglas Gregor 20527e2c83 Allocate template parameter lists for out-of-line definitions via the
ASTContext rather than via the normal heap.

llvm-svn: 106008
2010-06-15 17:44:38 +00:00
Douglas Gregor 0832963acd Implement -fvisibility-inlines-hidden. <rdar://problem/7819834>
llvm-svn: 106003
2010-06-15 17:05:35 +00:00
Nick Lewycky a2fb98bfda When analyzing for member self-assignment, don't attempt to dereference null
Stmt* such as those which occur in ?: . Fixes PR7378.

Also, generally whip the code into shape fixing several coding style violations.

llvm-svn: 105992
2010-06-15 07:32:55 +00:00
Douglas Gregor c9d2682df3 Warn when a 'typename' or a 'template' keyword refers to a
non-dependent type or template name, respectively, in C++98/03. Fixes
PR7111 and <rdar://problem/8002682>.

llvm-svn: 105968
2010-06-14 22:07:54 +00:00
Nate Begeman 91e1feab7a Add some missing shifts
Fix multiplies by scalar
Add SemaChecking code for all immediates
Add SemaChecking-gen support to arm_neon.td

llvm-svn: 105930
2010-06-14 05:21:25 +00:00
John McCall 30576cdce3 TemplateSpecializationType's isCurrentInstantiation bit can be derived
from its canonical type.

llvm-svn: 105912
2010-06-13 09:25:03 +00:00
Nate Begeman d773fe67dd Most of NEON sema checking & fix to polynomial type detection
llvm-svn: 105908
2010-06-13 04:47:52 +00:00
Abramo Bagnara da41d0cf5b Added template parameters info for out-of-line definitions of class template methods.
llvm-svn: 105882
2010-06-12 08:15:14 +00:00
Abramo Bagnara 8075c85230 Don't omit class explicit instantiation from AST.
llvm-svn: 105880
2010-06-12 07:44:57 +00:00
John McCall 45d30c3e36 When deciding whether an expression has the boolean nature, don't look through
explicit casts.  Fixes PR7359.

llvm-svn: 105871
2010-06-12 01:56:02 +00:00
John McCall b86a6b830e Allow pseudo-destructors to be called on qualified pointers. Patch by
Troy Straszheim!

llvm-svn: 105823
2010-06-11 17:36:40 +00:00
John McCall 6d1116ac49 Conversions from Objective C object pointers to bool are "pointer conversions
to bool" in the sense of C++ [over.ics.rank]p4 bullet 1.  I have decreed it.

llvm-svn: 105817
2010-06-11 10:04:22 +00:00
Jeffrey Yasskin 5d474d0a96 Fix the 64-bit build. operator<<(DiagnosticBuilder, long) doesn't exist, so
ptrdiff_t (long on 64-bit, apparently) is ambiguous between the int and
unsigned int overloads.

llvm-svn: 105816
2010-06-11 06:58:43 +00:00
Jeffrey Yasskin 2b99c6fc4f Add an option -fshow-overloads=best|all to limit the number of overload
candidates printed.  We default to 'all'.  At the moment, 'best' prints only
the first 4 overloads, but we'll improve that over time.

llvm-svn: 105815
2010-06-11 05:57:47 +00:00
John McCall c392f37ae8 Split DependentNameType into two types. DependentNameType represents the
case of an elaborated-type-specifier like 'typename A<T>::foo', and
DependentTemplateSpecializationType represents the case of an
elaborated-type-specifier like 'typename A<T>::template B<T>'.  The TypeLoc
representation of a DependentTST conveniently exactly matches that of an
ElaboratedType wrapping a TST.

Kill off the explicit rebuild methods for RebuildInCurrentInstantiation;
the standard implementations work fine because the nested name specifier
is computable in the newly-entered context.

llvm-svn: 105801
2010-06-11 00:33:02 +00:00
Chandler Carruth c65667c8ba Another chunk of the new RecursiveASTVisitor implementation: switch the return
value semantics such that we recurse while the visitors return true, and halt
as soon as one returns false. Patch by csilvers.

llvm-svn: 105787
2010-06-10 10:31:57 +00:00
Sebastian Redl c3eba8f547 Commit my WIP on constexpr support. This commit: an XFAILed test and treating constexpr as a top-level const.
llvm-svn: 105752
2010-06-09 21:19:43 +00:00
Sebastian Redl 243d9057d0 Fix two typos in comments.
llvm-svn: 105751
2010-06-09 21:17:41 +00:00
Abramo Bagnara 656e300f03 Added inherited info to template and non-type arguments of templates.
llvm-svn: 105716
2010-06-09 09:26:05 +00:00
Chandler Carruth af80f66997 Major redesign of the RecursiveASTVisitor. This implements the majority of the
new design discussed on cfe-dev, with further steps in that direction to come.
It is already much more complete than the previous visitor.

Patch by Zhanyong and Craig with 80 column wraps and one missing declaration
added by me.

llvm-svn: 105709
2010-06-09 08:17:30 +00:00
Tom Care b704270779 Added FixIt support to printf format string checking.
- Refactored LengthModifier to be a class.
- Added toString methods in all member classes of FormatSpecifier.
- FixIt suggestions keep user specified flags unless incorrect.

Limitations:
- The suggestions are not conversion specifier sensitive. For example, if we have a 'pad with zeroes' flag, and the correction is a string conversion specifier, we do not remove the flag. Clang will warn us on the next compilation.

A    test/Sema/format-strings-fixit.c
M    include/clang/Analysis/Analyses/PrintfFormatString.h
M    lib/Analysis/PrintfFormatString.cpp
M    lib/Sema/SemaChecking.cpp

llvm-svn: 105680
2010-06-09 04:11:11 +00:00
Douglas Gregor 1fc3d66da4 Tweak our handling of the notion of a standard conversion sequence
being a subsequence of another standard conversion sequence. Instead
of requiring exact type equality for the second conversion step,
require type *similarity*, which is type equality with cv-qualifiers
removed at all levels. This appears to match the behavior of EDG and
VC++ (albeit not GCC), and feels more intuitive. Big thanks to John
for the line of reasoning that supports this change: since
cv-qualifiers are orthogonal to the second conversion step, we should
ignore them in the type comparison.

llvm-svn: 105678
2010-06-09 03:53:18 +00:00
Nate Begeman 5548309fa7 Implement transpose/zip/unzip & table lookup.
Test out some basic constant-checking.

llvm-svn: 105667
2010-06-09 01:10:23 +00:00
Douglas Gregor 6f2e095f06 When referring to a tag that was previously declared only as a friend,
build a new declaration for that tag type that will be visible for
future lookups of that tag.

llvm-svn: 105643
2010-06-08 21:27:36 +00:00
Douglas Gregor ce21919bd6 A built-in overload candidate is consider a non-template function when
determining whether one overload candidate is better than
another. Fixes PR7319.

llvm-svn: 105642
2010-06-08 21:03:17 +00:00
Daniel Dunbar ee6b692551 Makefiles: Set Clang CPP compiler flags in a single location, instead of scattered throughout the project Makefiles.
llvm-svn: 105638
2010-06-08 20:44:43 +00:00
Daniel Dunbar e6c1daa8fd Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.
- This eliminates most dependencies on how Clang is installed relative to LLVM.

llvm-svn: 105637
2010-06-08 20:34:18 +00:00
Douglas Gregor ec170db73d Warn about comparisons between arrays and improve self-comparison
warnings, from Troy Straszheim! Fixes PR6163.

llvm-svn: 105631
2010-06-08 19:50:34 +00:00
Fariborz Jahanian 8e73928f52 Fixes a typo which prevented proper code gen. for
copy-in of c++ class objects into blocks.

llvm-svn: 105622
2010-06-08 17:52:11 +00:00
Douglas Gregor 4038cf4b57 Implement a warning when converting the literal 'false' to a
pointer. Original patch by Troy D. Straszheim; fixes PR7283.

llvm-svn: 105621
2010-06-08 17:35:15 +00:00
Nate Begeman 4904e32d46 Since the enum values for each arch's builtins overlap, it is not appropriate to check them when compiling or other archs. Fixes a problem where compiling for NEON would use x86 sema rules.
llvm-svn: 105593
2010-06-08 02:47:44 +00:00
Nate Begeman a011002195 Extend __builtin_shufflevector to expose the full power of the llvm shufflevector instruction. This means it can now be used for vector truncation and concatenation. This will be used for the ARM NEON implementation.
llvm-svn: 105589
2010-06-08 00:16:34 +00:00
Fariborz Jahanian be21aa34a0 When using property-dot assignment syntax to call a setter method,
type of rhs need be compared to setter's argument and
not the getter type. Fixes radar 8062778

llvm-svn: 105560
2010-06-07 22:02:01 +00:00
Fariborz Jahanian 28ed927ddf Use MaybeCreateCXXExprWithTemporaries for potential destruction of
created temporary. Use own initialized entity for copied in block
variables.

llvm-svn: 105533
2010-06-07 16:14:00 +00:00
Jeffrey Yasskin caa710dfd2 PR7245: Make binding a reference to a temporary without a usable copy
constructor into an extension warning into the error that C++98 requires.

llvm-svn: 105529
2010-06-07 15:58:05 +00:00
John McCall cb0f89a434 Simplify the methods for creating a pointer, reference, member-pointer,
or block-pointer type by removing the qualifiers parameter.  Introduce a
method to perform semantic checking when adding qualifiers to a type.

llvm-svn: 105526
2010-06-05 06:41:15 +00:00
Abramo Bagnara d73405829b Added AccessSpecDecl node.
llvm-svn: 105525
2010-06-05 05:09:32 +00:00
Jeffrey Yasskin 2f96e9f5c9 Add an extension to avoid an error when a global template has the same name as
a member template, and you try to call the member template with an explicit
template argument.  See PR7247 

For example, this downgrades the error to a warning in:

template<typename T> struct set{};
struct Value {
    template<typename T>
    void set(T value) {
    }
};
void foo() {
    Value v;
    v.set<double>(3.2);  // Warning here.
}

llvm-svn: 105518
2010-06-05 01:39:57 +00:00
John McCall 8cb7bdfd33 Alter the interface of GetTypeForDeclarator to return a TypeSourceInfo*.
This is never null, but the associated type might be.

llvm-svn: 105503
2010-06-04 23:28:52 +00:00
Anders Carlsson 76f513f862 When deciding whether reinterpret_cast casts away constness we need to look at array qualifiers. Fixes rdar://problem/8018292.
llvm-svn: 105494
2010-06-04 22:47:55 +00:00
Fariborz Jahanian ea882cd92e Build AST for copy-construction of copied-in
class object in blocks and carry it to IRGen.

llvm-svn: 105487
2010-06-04 21:35:44 +00:00
John McCall 339bb66246 Remember type source information for Objective C property declarations.
llvm-svn: 105484
2010-06-04 20:50:08 +00:00
John McCall 8e346702b6 Preserve more information from a block's original function declarator, if one
was given.  Remove some unnecessary accounting from BlockScopeInfo.  Handle
typedef'ed function types until such time as we decide not.

llvm-svn: 105478
2010-06-04 19:02:56 +00:00
John McCall a3ccba0417 Restructure how we interpret block-literal declarators. Correctly handle
the case where we pick up block arguments from a typedef.  Save the block
signature as it was written, and preserve same through PCH.

llvm-svn: 105466
2010-06-04 11:21:44 +00:00