Commit Graph

275 Commits

Author SHA1 Message Date
Chris Lattner
19dbcaa171 pull the casting operators into LLVM.h
Swift SVN r421
2011-07-19 05:57:01 +00:00
Chris Lattner
e647b29339 stop the llvm-namespace-qualification-insanity by caving in and
adding a new swift/AST/LLVM.h file which forward declares and imports
common llvm classes, starting with SMLoc.


Swift SVN r420
2011-07-19 05:49:43 +00:00
Chris Lattner
96103cab95 use the new llvm::TinyPtrVector class, which was derived from this code.
Swift SVN r408
2011-07-18 02:13:37 +00:00
Doug Gregor
50323196b3 Teach module lookup to look first in the directory where the importing
module is located, and then fall back to the current directory if
nothing was found there. This allows us to run the Swift regression
tests from a directory other than "test" (e.g., in the build
directory, as is currently needed by CMake).

The implementation itself is a temporary hack that will eventually
need to be replaced with a proper virtual file system + module
manager.


Swift SVN r405
2011-07-14 19:16:45 +00:00
Chris Lattner
79ba41c1fe add a specialization of AllocateCopy to help out argument deduction a bit,
simplifying some code.


Swift SVN r385
2011-04-29 07:18:11 +00:00
Chris Lattner
c3c602f9d3 Reimplement processing of dot expressions to have their base resolved as part of Type checking of SequenceExprs. This ensures that we can establish a proper base expression for the value.
Swift SVN r363
2011-04-11 05:20:21 +00:00
Chris Lattner
a6ccf69bc6 Implement support for overloading in .-style name lookup. This is not super useful yet because we don't have conversion ranking, but it's progress.
Swift SVN r356
2011-04-10 16:48:31 +00:00
Chris Lattner
3b4a8b03d2 1. With overloading in play, SemaDecl should never resolve unqualified lookup that hits at translation unit scope to a DeclRefExpr. Doing so can break overloading.
2. This exposed a bug: when parsing structs, we weren't adding all decls to the translation unit, we were just adding the type alias.
3. This exposed that TypeChecking wasn't handling OneOfElementDecl.
4. Introduce a new NLKind enum in NameLookup instead of passing around a bool.
5. Have unqualified lookup that returns an overload set form a new OverloadSetRefExpr, which has dependent type.
6. Enhance various stuff to handle OverloadSetRefExpr.  It's still not fully handled yet though, so it can't be used for anything useful.
7. Change Expr.cpp to print types with << instead of T->print(OS) which is simpler and correct in the face of null.

Swift SVN r351
2011-04-10 05:57:10 +00:00
Chris Lattner
2810c91dd2 Implement lookup of overloaded values through import decls.
Swift SVN r350
2011-04-10 03:35:13 +00:00
Chris Lattner
229141ab80 Start adding support for value overloading. Right now we allow overloaded definitions (at top level only), and name binding just takes the first value of a name.
Swift SVN r348
2011-04-10 03:08:27 +00:00
Chris Lattner
5e28a6fcdd Finally get around to doing a major type system refactoring, where we introduce Type as a "smart pointer" and rename the existing Type class to TypeBase.
This prevents use of isa/dyn_cast/etc on Type*'s and means we just pass around Type by value instead of having to use Type* everywhere.

Swift SVN r343
2011-04-05 01:06:57 +00:00
Chris Lattner
5e2346492e Implement basic "dot syntax" for applying functions to values. size.area now applies size to area when area is defined as a global function.
Swift SVN r341
2011-04-02 23:10:55 +00:00
Chris Lattner
7530ec988c Add a error to reject foo() when foo is not a function type. Previously we allowed it because these are two valid top-level values, but we now reject them because they are almost certainly a bug. This can be disabled by putting a space between them if this is useful for some reason.
Swift SVN r339
2011-03-27 02:56:47 +00:00
Chris Lattner
85f67d0fc6 NameBinder shouldn't create exprs, it should return decls.
Swift SVN r337
2011-03-27 00:30:24 +00:00
Chris Lattner
c9ee19e269 Implement parser, sema, doc, and name lookup support for refined import declarations. You can still only do top level references, but that's because we don't have namespaces or anything else interesting yet.
This allows "import swift.int" for example. 

Swift SVN r329
2011-03-23 05:18:29 +00:00
Chris Lattner
aeb7c0895e The isGroupingParen() predicate doesn't make sense since TupleExpr can be used to create tuple expressions out of a scalar when there is a single element involved. In this case, isGroupingParen would return true but the source and dest types would be different.
This didn't manifest as a bug yet, but it doesn't make sense to wait until it does.  This aspect of grouping parens is a syntactic issue, so make the creator of TupleExpr specify whether the expr is a grouping paren or not and persist this.

Swift SVN r312
2011-03-22 05:04:48 +00:00
Chris Lattner
024b479b76 Fix a crash on invalid: we can't produce null elements of brace exprs.
Swift SVN r297
2011-03-20 07:52:09 +00:00
Chris Lattner
c9eb885752 Introduce top-level expressions and simplify TranslationUnitDecl (and various things that hack on it) by making it hold a single BraceExpr instead of a list of exprs and decls.
Swift SVN r293
2011-03-20 06:59:37 +00:00
Chris Lattner
a1e6e7bfc3 implement name binding support (including looking through imports) for types! We can now have a swift standard library.
Swift SVN r292
2011-03-20 05:26:50 +00:00
Chris Lattner
cb8884e832 Move error reporting for unresolved types from SemaDecl to NameBinding, where it should be. This requires enhancing TranslationUnitDecl to hold a list of unresolved types.
Swift SVN r290
2011-03-20 04:45:06 +00:00
Chris Lattner
097248057f Add a todo comment, use a note instead of warning in one case.
Swift SVN r289
2011-03-20 04:32:13 +00:00
Chris Lattner
204ffac987 Implement import for value names!
Swift SVN r288
2011-03-19 19:43:54 +00:00
Chris Lattner
6807ad7fb1 Move some type validity checking to SemaDecl::handleEndOfTranslationUnit, out of NameBinding.
Swift SVN r287
2011-03-19 06:41:26 +00:00
Chris Lattner
07b8860f71 Implement name binding for forward referenced values, and diagnose references to undefined decls. This properly implements the rest of name-binding! Since we don't have import statements yet, we don't have to worry about types. SemaDecl still does all the heavy lifting for them.
Swift SVN r276
2011-03-17 05:02:50 +00:00
Chris Lattner
1eb17f15dd Stub out a namebinding pass, fix some crash-on-invalid cases in TypeChecking.
Swift SVN r263
2011-03-14 06:07:44 +00:00