Commit Graph

2181 Commits

Author SHA1 Message Date
Steve Naroff c277ad10f0 Remove ObjCQualifiedInterfaceType:-)
llvm-svn: 76321
2009-07-18 15:33:26 +00:00
Sebastian Redl 3a0ae12162 Rename file in preparation of properly implementing C-style casts in C++.
llvm-svn: 76318
2009-07-18 15:08:18 +00:00
Sebastian Redl e644e19671 Enhance testing of overriding exception specs for inaccessible base exceptions.
llvm-svn: 76317
2009-07-18 14:32:15 +00:00
Argyrios Kyrtzidis e1a8c62ce7 Don't add a SourceLocation for 'self' if it does not actually appears in the source code.
llvm-svn: 76295
2009-07-18 08:49:37 +00:00
Argyrios Kyrtzidis 6b7e376160 Remove ASTContext::getCanonicalDecl() and use Decl::getCanonicalDecl in its place.
llvm-svn: 76274
2009-07-18 00:34:25 +00:00
Argyrios Kyrtzidis 02675dc49d Set ObjCMethodDecl's EndLoc to the '}' when it's a definition.
llvm-svn: 76269
2009-07-18 00:33:33 +00:00
Ted Kremenek 8a286fbdb9 Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methods
until Doug Gregor's Type smart pointer code lands (or more discussion occurs).
These methods just call the new Type::getAs<XXX> methods, so we still have
reduced implementation redundancy. Having explicit getAsXXXType() methods makes
it easier to set breakpoints in the debugger.

llvm-svn: 76193
2009-07-17 17:50:17 +00:00
Ted Kremenek b825c0ddc5 Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents.
llvm-svn: 76139
2009-07-17 01:20:38 +00:00
Ted Kremenek 3d486f08cb Replace Type::getAsReferenceType() with Type::getAs<ReferenceType>().
llvm-svn: 76132
2009-07-17 01:01:15 +00:00
Daniel Dunbar 54c596465d Fix unused variable warnings (with -Asserts)
llvm-svn: 76112
2009-07-16 22:10:11 +00:00
Ted Kremenek e3fb4b6524 Add member template 'Type::getAs<T>', which converts a Type* to a respective T*.
This method is intended to eventually replace the individual
Type::getAsXXXType<> methods.

The motivation behind this change is twofold:

1) Reduce redundant implementations of Type::getAsXXXType() methods. Most of
them are basically copy-and-paste.

2) By centralizing the implementation of the getAs<Type> logic we can more
smoothly move over to Doug Gregor's proposed canonical type smart pointer
scheme.

Along with this patch:

a) Removed 'Type::getAsPointerType()'; now clients use getAs<PointerType>.
b) Removed 'Type::getAsBlockPointerTypE()'; now clients use getAs<BlockPointerType>.

llvm-svn: 76098
2009-07-16 19:58:26 +00:00
Fariborz Jahanian ca75db7c02 Diagnose ++/-- op on objc pointers in
nonfragile abi, instead of crashing.

llvm-svn: 76088
2009-07-16 17:59:14 +00:00
Steve Naroff 79d1215d83 Remove ASTContext::isObjCObjectPointerType().
Convert all clients to use the new predicate on Type.

llvm-svn: 76076
2009-07-16 15:41:00 +00:00
Fariborz Jahanian 41136eec6b Generate error on declaration containing 'static' and '__attribute__((weak))'
Patch by Ryan Flynn

llvm-svn: 75879
2009-07-16 01:12:24 +00:00
Steve Naroff a057ba905b Avoid crashing for the enclosed test case.
This is fallout from the recent ObjCObjectPointerType rework. I'll work on fixing this tomorrow.

llvm-svn: 75870
2009-07-16 00:25:06 +00:00
Ted Kremenek d4adebbbd6 Handle some more fallout with the conversion of using PointerType for
Objective-C pointers to using ObjCObjectPointerType.

Now the checking for 'attribute ((nonnull))' in Sema doesn't emit an error when
trying to apply that attribute to a parameter that is an Objective-C pointer
(this is a regression).

To prevent this regression from occuring in the future, the 'nonnull.c' test was
moved to test/SemaObjC and renamed 'nonnull.m'. I also enhanced the tests to
show that function calls involved a NULL Objective-C pointer constant does not
trigger a warning. This is consistent with GCC, but should likely be fixed.

llvm-svn: 75856
2009-07-15 23:23:54 +00:00
Fariborz Jahanian 16094c2467 Added ASTs to destructor decl AST for default destruction of object's
base/members.

llvm-svn: 75849
2009-07-15 22:34:08 +00:00
Ted Kremenek 3e808edac9 Lexically order files in CMakeLists.txt files.
llvm-svn: 75832
2009-07-15 21:08:41 +00:00
Steve Naroff 1329fa0ed9 Implement the ObjC pseudo built-in types as clang "BuiltinType's". I say pseudo built-in types, since Sema still injects a typedef for recognition (i.e. they aren't truly built-ins from a parser perspective).
This removes the static data/methods on ObjCObjectPointerType while preserving the nice API (no need to fiddle with ASTContext:-).

This patch also adds Type::isObjCBuiltinType().

This should be the last fairly large patch related to recrafting the ObjC type system. The follow-on patches should be fairly small.

llvm-svn: 75808
2009-07-15 18:40:39 +00:00
Steve Naroff 6b712a7ba1 Introduce Type::isAnyPointerType() and convert all clients (suggested by Chris).
I don't love the name, however it simplifies the code and is a worthwhile change. If/when we come up with a better name, we can do a search/replace.

llvm-svn: 75650
2009-07-14 18:25:06 +00:00
Fariborz Jahanian 49c81799b0 Patch to build AST for ctor's initializer list according to
semantics of order of construction [class.init].

llvm-svn: 75649
2009-07-14 18:24:21 +00:00
Steve Naroff 5ec6ff7678 Add a "TypeSpecStartLoc" to FieldDecl. Patch contributed by Enea Zaffanella.
Note: One day, it might be useful to consider adding this info to DeclGroup (as the comments in FunctionDecl/VarDecl suggest). For now, I think this works fine. I considered moving this to ValueDecl (a common ancestor of FunctionDecl/VarDecl/FieldDecl), however this would add overhead to EnumConstantDecl (which would burn memory and isn't necessary).
llvm-svn: 75635
2009-07-14 14:58:18 +00:00
Alisdair Meredith a9ad47d94c Basic support for C++0x unicode types. Support for literals will follow in an incremental patch
llvm-svn: 75622
2009-07-14 06:30:34 +00:00
Argyrios Kyrtzidis ef1c1e572c For C++ overloaded operator calls, set the source location of the DeclRefExpr to the location of the operator.
llvm-svn: 75600
2009-07-14 03:19:38 +00:00
Argyrios Kyrtzidis 11a846ab53 Fixes for a couple of things:
- Declaration context of ParmVarDecls (that we got from the Declarator) was not their containing function.
- C++ out-of-line method definitions didn't get an access specifier.

Both were exposed by a crash when emitting a C++ method to a PCH file (assert at Decl::CheckAccessDeclContext()).

llvm-svn: 75597
2009-07-14 03:18:53 +00:00
Argyrios Kyrtzidis 23e1f1d6be Pass the right brace SourceLocation from the Parser to the TagDecls.
llvm-svn: 75591
2009-07-14 03:17:52 +00:00
Steve Naroff a63372da72 Remove superfluous call to getAsPointerType()...
llvm-svn: 75509
2009-07-13 21:32:29 +00:00
Steve Naroff aacd4cce73 Sema::CheckAdditionOperands(): Use Type::getPointeeType() and remove PTy and OPT variables.
llvm-svn: 75505
2009-07-13 21:20:41 +00:00
Steve Naroff 2efbbe3531 - Improve comment for Type::getPointeeType().
- Remove a couple redundant casts/returns.
- Fix 80 column violations for all getAsStringInternal() methods.

llvm-svn: 75485
2009-07-13 19:06:52 +00:00
Steve Naroff 4eed7a16d6 Fix 5 issues from Chris's feedback on http://llvm.org/viewvc/llvm-project?view=rev&revision=75314.
Still more to come...just wanted to get the no-brainers out of the way.

llvm-svn: 75477
2009-07-13 17:19:15 +00:00
Anders Carlsson ae01993a12 Implement more of C++0x 'auto'. A variable with an auto type specifier must have an initializer. Also, move some tests around to match the C++0x draft better.
llvm-svn: 75322
2009-07-11 00:34:39 +00:00
Ted Kremenek f514592197 Fix warning when compiling with optimizations:
warning: ‘OPT’ may be used uninitialized in this function

Now OPT is initialized to NULL. I'm not certain if this is the correct fix;
others please review.

llvm-svn: 75321
2009-07-11 00:21:48 +00:00
Anders Carlsson 9890fb5bf6 Remove some unused code from an experiment that I didn't like.
llvm-svn: 75315
2009-07-10 23:48:10 +00:00
Steve Naroff 7cae42b07a This patch includes a conceptually simple, but very intrusive/pervasive change.
The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches.

This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic.

By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time. 

Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks.

llvm-svn: 75314
2009-07-10 23:34:53 +00:00
Fariborz Jahanian 3554b5a37c Patch to build list of inherited virtual base classes
in their order of construction for each class and use it 
to to check on propery order of base class construction 
under -Wreorder option.

llvm-svn: 75270
2009-07-10 20:13:23 +00:00
Fariborz Jahanian 5582f231f2 don't crash if class is using itself as its super class.
llvm-svn: 75178
2009-07-09 22:08:26 +00:00
Fariborz Jahanian 341583c3ac Sema check on out of order object initialization of
class object's base and members under -Wreorder flag.

llvm-svn: 75168
2009-07-09 19:59:47 +00:00
Anders Carlsson 17973e684d Use getDeclName in DefineImplicitOverloadedAssign as well.
llvm-svn: 75152
2009-07-09 17:47:25 +00:00
Anders Carlsson 52b9180587 Pass the DeclName to the diagnostic builder so that member names will be quoted correctly.
llvm-svn: 75150
2009-07-09 17:37:12 +00:00
Douglas Gregor 6b6ba8bad8 Add test for C++ [over.over.]p1, the contexts in which one can take the address of an overloaded function.
llvm-svn: 75146
2009-07-09 17:16:51 +00:00
Anders Carlsson 03f89b1828 Store the isAddressOfOperand in the UnresolvedDeclRefExpr, so that we can pass it when instantiating the expr. Fixes another member pointer bug.
llvm-svn: 75075
2009-07-09 00:05:08 +00:00
Douglas Gregor b257e4fff8 Implement the simple form of overload resolution used when taking the
address of an overloaded function (which may involve both functions
and function templates). 

llvm-svn: 75069
2009-07-08 23:33:52 +00:00
Anders Carlsson 0b675f5ad5 It's not allowed to form member pointers to members that have reference type. Add a test for this and the rest of [dcl.mptr]p3.
llvm-svn: 75054
2009-07-08 21:45:58 +00:00
Douglas Gregor 9b14658713 Implement template argument deduction when taking the address of a
function template. Most of the change here is in factoring out the
common bits used for template argument deduction from a function call
and when taking the address of a function template.

llvm-svn: 75044
2009-07-08 20:55:45 +00:00
Douglas Gregor be759256b9 Fix a corner case with argument-dependent lookup and overloaded function sets.
llvm-svn: 74999
2009-07-08 10:57:20 +00:00
Douglas Gregor 197e5f7bb7 Improve argument-dependent lookup to find associated classes and
namespaces based on the template arguments of a class template
specialization type.

llvm-svn: 74993
2009-07-08 07:51:57 +00:00
Fariborz Jahanian 5f21d2f69a Implemented memmove_collectable API for Next runtime
when struct variables with GC'able members are copied into.
Will provide a test case later.

llvm-svn: 74984
2009-07-08 01:18:33 +00:00
Chris Lattner 2a7deb64c0 reimplement vector comparisons as [fi]cmp+sext instead of using v[if]cmp.
Also, enable them in sema so that they are tested, and now that the x86 backend
has stablized.

llvm-svn: 74983
2009-07-08 01:08:03 +00:00
Douglas Gregor d3cb356d14 Overload resolution prefers non-templates to templates
llvm-svn: 74971
2009-07-07 23:38:56 +00:00
Douglas Gregor 9fc6097145 Template argument deduction from a call has improved a bit
llvm-svn: 74966
2009-07-07 23:12:18 +00:00