Commit Graph

22610 Commits

Author SHA1 Message Date
Chris Lattner
b559c3f648 allow var's and funcs within structs, part of rdar://10157702
Swift SVN r824
2011-11-03 22:19:48 +00:00
Chris Lattner
dce8416508 allow dyn_cast'ing from declcontext to OneOfType.
Swift SVN r820
2011-11-02 00:33:06 +00:00
Chris Lattner
9e9f421f1a getAliasType() doesn't need an ASTContext argument anymore.
Swift SVN r816
2011-11-01 18:37:05 +00:00
Chris Lattner
da564d50d3 A long journey later, implement support for type inference of integer literals instead of
forcing them to int64 all the time.  Now the integer_literal_type in the standard library
is only used to resolve ambiguity in expressions.  Among other amazing things, we now
correctly accept:

  var x8 : int8 = 4

without a cast.

This still isn't doing any bounds checking and isn't checking the inferred type to tell if
it is compatible with integer literals (i.e. has a primitive conversion function from the
LLVM IR type).  Enough for now though.

This is progress towards rdar://10357238.



Swift SVN r814
2011-11-01 06:51:50 +00:00
Chris Lattner
164ab0ffee move lookupTypeName out to Module::lookupGlobalType and have it look in the current
module as well for consistency.


Swift SVN r811
2011-11-01 06:27:24 +00:00
Chris Lattner
e0a18996cd move lookupGlobalValue into Module, making it accessable to all of sema.
Swift SVN r810
2011-11-01 06:22:44 +00:00
Chris Lattner
5d8d0fd2f6 Have the name binder publish the list of imported modules into the TranslationUnit,
making it a real part of the AST.  Also, rework TUModuleCache to do its computation
when it is constructed, instead of trying in each query.


Swift SVN r809
2011-11-01 06:19:36 +00:00
Chris Lattner
e3b53c3b15 move the module-level name lookup stuff out of NameBinding.cpp into the
Module class.  Add a new Module.cpp file to implement this (along with
the existing caching strategy, if you're curious).  This eliminates the
parallel 'ModuleProvider' heirarchy.


Swift SVN r802
2011-11-01 05:19:35 +00:00
Chris Lattner
4933a27098 clean up lookupType/lookupValue to only take an AccessPath instead of an import decl.
Strip of the module name implicit in the access path.


Swift SVN r801
2011-11-01 04:43:51 +00:00
Chris Lattner
2ea1e72890 merge two copies of the same predicate into a helper method.
Swift SVN r800
2011-11-01 04:30:25 +00:00
Chris Lattner
0ca79b1075 rename ASTContext::BuiltinModule -> TheBuiltinModule for consistency with
the other ASTContext members.


Swift SVN r799
2011-11-01 04:18:23 +00:00
Chris Lattner
8e1c6c8ac6 flatten ModuleKind discriminator into DeclContext's one. Now Module is an
abstract class and we have an actual AST-level concept of the builtin module.


Swift SVN r798
2011-11-01 04:07:57 +00:00
Chris Lattner
fed35466d4 increase the # bits for DeclContextKind's to 3 bits.
Swift SVN r797
2011-11-01 03:58:21 +00:00
Chris Lattner
22808d5970 introduce a new Diagnostic class to represent a diagID + arguments.
Swift SVN r784
2011-10-22 06:03:30 +00:00
Chris Lattner
2cee9d300b simplify code a bit, I hear that classes with ctors can be in unions these days.
Swift SVN r783
2011-10-22 05:47:46 +00:00
Chris Lattner
9298082ebb move Diagnostics header to include/swift/AST to match .cpp files.
Swift SVN r782
2011-10-22 00:47:35 +00:00
Chris Lattner
f92f616aaf remove hte ASTContext::hadError bool.
Swift SVN r778
2011-10-22 00:32:39 +00:00
Chris Lattner
51680e3fdc remove the deprecated error/warning/note methods, finally.
Swift SVN r776
2011-10-22 00:26:34 +00:00
Chris Lattner
60afdf4842 switch irgen to new diags
Swift SVN r769
2011-10-20 21:29:50 +00:00
Chris Lattner
9f906da738 sink (a copy of) HadError into DiagnosticEngine, so that errors produced by it trigger error returns from main().
Swift SVN r768
2011-10-20 20:55:22 +00:00
Chris Lattner
3c43cae8b4 now that types can get their astcontext, remove some pointless argument passing.
Swift SVN r757
2011-10-18 23:25:42 +00:00
Chris Lattner
7aaf0c5e0c rework the canonical type system a bit to make it so that all Types can access
their ASTContext without bloating everything.  Basically, now instead of having
a canonical type point to itself when canonical, it points to the ASTContext 
when canonical.  This means that Canonical types always have direct access to
their context and non-canonical ones just indirect through the canonical type
pointer to get to it (so it's two jumps away) by using a PointerUnion.

This should make type manipulation more straight-forward.

While we're at it, we actually memoize type canonicalization.  Before we 
forgot to remember the result in the canonical type pointer in Type.


Swift SVN r755
2011-10-18 22:32:56 +00:00
Chris Lattner
d69b3cec39 add a helper method, not particularly useful yet because not all decls have a DeclContext.
Swift SVN r753
2011-10-18 21:52:46 +00:00
Chris Lattner
55651745b5 remove helper method, it is the same as T->isEqual(S, Ctx)
Swift SVN r752
2011-10-18 21:47:08 +00:00
Chris Lattner
33b3a22999 fix a fixme around a dead method.
Swift SVN r751
2011-10-18 01:27:13 +00:00
Chris Lattner
a7c7d64fa0 Switch swift to use SourceLoc instead of SMLoc.
Also use the new getAdvancedLoc() method instead of hacking
on SMLoc directly.

Also fix the warning/note/error methods to forward through ASTContext
instead of being replicated everywhere.



Swift SVN r750
2011-10-18 01:22:29 +00:00
John McCall
f121bd5e2d Arbitrary-associativity operator precedence parsing.
Swift SVN r743
2011-09-29 01:31:16 +00:00
John McCall
25ee366396 Add an lvalue-to-rvalue conversion AST node.
Swift SVN r742
2011-09-28 01:12:34 +00:00
John McCall
6b27921ce3 Propagate around l-value-ness. There aren't any interesting invariants
here yet.



Swift SVN r740
2011-09-27 23:46:08 +00:00
Doug Gregor
3d15bf3d55 Introduce a diagnostic-formatting engine and port most of the parser's
diagnostics over to it.

There are a few differences between this diagnostic engine and Clang's
engine:
  - Diagnostics are specified by a .def file (Diagnostics.def), rather
  than via tblgen, which drastically simplifies the build and makes
  code completion work when you add a new diagnostic.
  - Calls to the "diagnose()" method are safely typed based on the
  argument types specified in the .def file, so it's harder to write a
  diagnostic whose expected arguments (in the string) and whose actual
  arguments (in the code) don't match.
  - It uses variadic templates, so it hangs with the cool kids.



Swift SVN r734
2011-09-26 23:46:28 +00:00
John McCall
05459eced0 Add a convenience method for checking whether two types are
equivalent.



Swift SVN r729
2011-09-24 03:34:15 +00:00
John McCall
5fddb24ddc Basic verifier framework.
Swift SVN r728
2011-09-23 23:50:02 +00:00
John McCall
2db653cbfb Sequence, UnresolvedDot, and UnresolvedMember expressions actually
do survive name-binding.



Swift SVN r727
2011-09-23 23:49:32 +00:00
John McCall
344fe891da Macro metaprogramming for Stmt nodes.
Swift SVN r726
2011-09-23 23:32:07 +00:00
John McCall
cf0da63bbc A couple more unreachables.
Swift SVN r725
2011-09-23 21:59:16 +00:00
John McCall
ef8b77b718 Use Expr metaprogramming.
Swift SVN r723
2011-09-23 21:53:39 +00:00
John McCall
bbf14c61d3 Macro metaprogramming for the Expr hierarchy.
Swift SVN r722
2011-09-23 06:29:28 +00:00
John McCall
b2facdae4b Getterize Stmt.h.
Swift SVN r720
2011-09-20 07:07:53 +00:00
John McCall
b351394b6e Getterify the rest of Expr.h.
Swift SVN r719
2011-09-20 00:18:57 +00:00
John McCall
802262a7da More incremental getterization.
Swift SVN r718
2011-09-19 23:37:21 +00:00
John McCall
7a259f4bad Differentiate between the starting location and caret location of
an expression.  More incremental getterization.



Swift SVN r717
2011-09-19 22:45:58 +00:00
John McCall
02e47ed9ce Privatize Expr's Ty and Kind members; introduce getters and setters.
Swift SVN r716
2011-09-19 22:00:20 +00:00
John McCall
35d822f10f Give this enumeration an explicit backing type.
Swift SVN r714
2011-09-19 21:32:52 +00:00
John McCall
c61c807589 Mangle types for all declarations. Save the names of modules and mangle
those in, too.



Swift SVN r713
2011-09-18 09:21:42 +00:00
Chris Lattner
8eaddc1cda AST support for floating point literals.
Swift SVN r707
2011-09-15 21:37:46 +00:00
Chris Lattner
77237852d2 implement a.x syntax for using elements of a protocol.
Swift SVN r704
2011-09-11 17:39:45 +00:00
Chris Lattner
f833a1ed11 have ASTContext own the strings for its import paths instead of referencing
strings sitting on the stack in main().  No functionality change, just futureproofs
ASTContext a bit.


Swift SVN r701
2011-09-09 05:15:44 +00:00
Chris Lattner
e248bc875f switch to llvm.h
Swift SVN r700
2011-09-09 04:59:19 +00:00
Chris Lattner
8e369b34da make builtins.cpp include its header first (exposing that it isn't actually self-contained),
and switch to AST.h


Swift SVN r699
2011-09-09 04:58:39 +00:00
John McCall
37b07c8691 Add builtin bindings for a bunch of primitive LLVM instructions.
Swift SVN r698
2011-09-08 00:21:11 +00:00