Commit Graph

1745 Commits

Author SHA1 Message Date
Enrico Granata
74f111d310 The space here was needed
Swift SVN r7333
2013-08-19 22:26:19 +00:00
Enrico Granata
de0e9c7f6f Fixing a crasher where the demangler was not checking a substitution for NULL
Swift SVN r7331
2013-08-19 21:38:29 +00:00
Enrico Granata
c127e98f1c Removing non doxygen-kosher comments
Swift SVN r7298
2013-08-16 22:46:39 +00:00
Enrico Granata
47d1a137b5 Major demangler changes.
This commit changes the Swift demangler to produce a tree-like list of tokens instead of a string.
This is mostly useful for LLDB since we can use the inherent structure in a Swift mangled name to make more informed decisions about matters such as type information extraction from modules
The ability to convert the tokenized output into a plain string for viewing purposes is of course preserved



Swift SVN r7297
2013-08-16 22:30:58 +00:00
Joe Groff
a94489473c IRGen: Add ValueWitness enumerators for union layout and access.
These value witness table entries will be conditionally available for types that support specialized union representation through extra inhabitants and/or spare bits and for union value witnesses:

- storeExtraInhabitant, to store an extra inhabitant representation;
- getExtraInhabitantIndex, to recognize an extra inhabitant representation;
- getUnionTag, to get a union's discriminator; and
- inplaceProjectUnionData, to extract the value in place from a union.

This just sets up the enumerators and related IR types and mangling; nothing emits these witnesses yet.

Swift SVN r7234
2013-08-14 21:01:21 +00:00
Dmitri Hrybenko
70f2b64ad9 Add CharSourceRange -- a half-open character range, which will be used in IDE
integration

Motivation: libIDE clients should be simple, and they should not have to
translate token-based SourceRanges to character locations.

This also allows us to remove the dependency of DiagnosticConsumer on the
Lexer.  Now the DiagnosticEngine translates the diagnostics to CharSourceRanges
and passes character-based ranges to the DiagnosticConsumer.


Swift SVN r7173
2013-08-12 20:15:51 +00:00
Dmitri Hrybenko
3d37954e81 Remove SourceManager::decompose() and switch its clients to normal location and
range printing


Swift SVN r7122
2013-08-10 02:19:50 +00:00
Dmitri Hrybenko
efd688dcd9 Now findBufferContainingLoc() can not fail, so store Buffer IDs in unsigned
variables.


Swift SVN r7121
2013-08-10 02:12:59 +00:00
Dmitri Hrybenko
09837a1b88 Simplify the implementation of SourceManager::decompose() and its client
Swift SVN r7119
2013-08-10 01:32:42 +00:00
Dmitri Hrybenko
9c57f8454c Do the final cleanups and make SourceLoc::Value private
Swift SVN r7115
2013-08-09 23:52:01 +00:00
Dmitri Hrybenko
aacef757ed Move decompose from PrettyStackTrace.cpp to the SourceManager
It requires direct access to the SourceLoc internals and is generally useful
anyway.


Swift SVN r7111
2013-08-09 22:50:58 +00:00
Dmitri Hrybenko
db08a32a95 Factor out SourceManager::getLocOffsetInBuffer()
and remove some abuse of SourceLoc::Value::getPointer()


Swift SVN r7105
2013-08-09 21:53:32 +00:00
Dmitri Hrybenko
de59d8dcd4 Remove unneeded llvm:: qualifier for llvm::StringRef and llvm::SmallVector
Swift SVN r7089
2013-08-09 18:41:46 +00:00
Dmitri Hrybenko
f42d4dba87 Factor out SourceManager::getLocForBufferStart()
Swift SVN r7058
2013-08-08 22:06:21 +00:00
Anna Zaks
aaa4b2c332 [SIL Printer] Add optional source location printing.
Added a -v(verbose) option to swift that will trigger verbose printing in SIL
Printer. SIL Printer will print the location info only in the verbose mode.

Here is the example of the format - only the line and colon are displayed for
brevity:

%24 = apply %13(%22) : $[cc(method), thin] ((), [byref] Bool) -> Builtin.Int1 // user: %26 line:46:10

(This will be used to test the validity of SILLocation info.)

Swift SVN r6991
2013-08-07 18:39:48 +00:00
Joe Groff
4316239f5d Kill Builtin.OpaquePointer.
It's not needed by SIL anymore.

Swift SVN r6873
2013-08-03 01:56:06 +00:00
Argyrios Kyrtzidis
99512e4220 When printing SourceRanges, add an option to not print the text as well.
Swift SVN r6836
2013-08-02 02:50:32 +00:00
Dmitri Hrybenko
5cea4ebf41 Code completion: put CodeCompletionOffset on SourceManager instead of passing
around everywhere

Fixes:
rdar://14585108 Code completion does not work at the beginning of the file
rdar://14592634 Code completion returns zero results at EOF in a function
                without a closing brace


Swift SVN r6820
2013-08-01 22:08:58 +00:00
Enrico Granata
c3d42b5f86 Removing the demangleType() API and the --type flag to swift-demangle
Types now have proper mangled names of the form _Tt<...> so they don't need any special treatment



Swift SVN r6816
2013-08-01 21:00:05 +00:00
Dmitri Hrybenko
e1c4ae3174 Wrap llvm::SourceMgr in swift::SourceManager so that we can add new members
to the source manager.


Swift SVN r6815
2013-08-01 20:39:22 +00:00
Joe Groff
827c516b0c Demangler: Include protocol context when it comes from a substitution.
Swift SVN r6808
2013-08-01 16:42:48 +00:00
Joe Groff
3503ffe4fa IRGen: Set up LinkEntities for protocol witness tables.
We need to handle three cases:

- If a protocol conformance has no associated types, or the associated type witnesses all have statically resolvable metadata, we can expose a *direct* witness table symbol.
- If a protocol conformance has associated types with runtime-instantiated metadata, we need to gate the witness table behind a *lazy* initializer function to fill in the metadata fields.
- If a protocol conformance has associated types where the type or one of its conformances are *dependent* on its parent's generic parameters, we need to instantiate multiple witness tables at runtime.

Swift SVN r6805
2013-08-01 05:25:32 +00:00
Jordan Rose
674a03b085 Replace "oneof" with "union"...everywhere.
We haven't fully updated references to union cases, and enums still are not
their own thing yet, but "oneof" is gone. Long live "union"!

Swift SVN r6783
2013-07-31 21:33:33 +00:00
Adrian Prantl
5b5ba6d78a Name mangling: Add a "_Tt" prefix to all type names that are output in
the debug info, to aid the debugger in figuring out the implementation
language of a given type in multi-language environments.
FYI, where applicable, we also emit the
DW_AT_APPLE_runtime_class(DW_AT_lang_Swift) attribute.
The demangler accepts type names with the "_Tt" prefix without the --type
switch.

Swift SVN r6714
2013-07-29 22:03:15 +00:00
Enrico Granata
c75fe924a1 Moving the Swift demangler from libSIL to libBasic
Plus, a couple of minor cosmetic changes that I had held off for a couple days now



Swift SVN r6691
2013-07-29 17:42:57 +00:00
Argyrios Kyrtzidis
f478157ab4 Revert "Print source ranges of the AST nodes when dumping the AST."
See if it fixes the buildbot.
This reverts commit 5957.

Swift SVN r5960
2013-07-02 16:45:07 +00:00
Argyrios Kyrtzidis
0a3fc1b195 Print source ranges of the AST nodes when dumping the AST.
Swift SVN r5959
2013-07-02 00:42:01 +00:00
Joe Groff
1013781bcc Parse: Allow Unicode identifier characters.
Extend the character set for identifiers according to WG14 N1518, which recommends an extended character set for identifier start and continuation characters in C. Mangle identifiers containing non-ASCII characters by borrowing the Punycode encoding used for international domain names.

No Unicode operators just yet.

Swift SVN r4968
2013-04-28 21:39:02 +00:00
Joe Groff
ddb7ead55c REPL: Contextual completions.
If the completion prefix has a '.' behind it, guesstimate a context expression by lexing backward through an identifier(.identifier)* dotted path, then attempt to parse and typecheck that expression to decide on a base type in which to find completions.

Swift SVN r4063
2013-02-16 20:07:50 +00:00
Chris Lattner
7055cfe43a move DiverseList and DiverseStack to swift/Basic, out of IRGen.
Swift SVN r2784
2012-08-26 20:10:10 +00:00
Chris Lattner
482fce9379 further improvements to SLoc printing: actually print line and column #'s now. This depends on llvm r156243
Swift SVN r1754
2012-05-05 21:40:58 +00:00
Chris Lattner
3ae29d8c82 provide facilities to elide the filename for a sourceloc if it matches the previous sourceloc. We now
print ranges as: [t.swift:22 - :23] instead of [t.swift:22 - t.swift:23].


Swift SVN r1753
2012-05-05 21:14:36 +00:00
Chris Lattner
d77d0d3fe3 refactor SourceRange printing out of Verifier.cpp into methods on SourceRange and SourceLoc.
Swift SVN r1752
2012-05-05 21:08:44 +00:00
Doug Gregor
725298a2da Introduce a DiagnosticConsumer abstract interface that is used to
actually render emitted diagnostics. This is both a useful
generalization (we expect to have a number of other
DiagnosticConsumers down the road, as Clang does) and is also
important now to avoid a layering violation when adjusting the source
location at the end of a SourceRange to the end of the token.

 


Swift SVN r850
2011-11-09 18:59:39 +00:00
Chris Lattner
30b6007b61 move the diagnostics stuff from Basic -> AST to fix layering.
Swift SVN r781
2011-10-22 00:41:24 +00:00
Chris Lattner
2f434d98fb straighten out identifiers in diagnostics a bit.
Swift SVN r780
2011-10-22 00:39:28 +00:00
Chris Lattner
dfd529ce3a rename diags::foo to diag::foo
Swift SVN r779
2011-10-22 00:36:19 +00:00
Chris Lattner
0c0e65e553 violate diagnostic layering harder, making it fine to cram types into diagnostics.
Lets here it for non-pod's in unions.


Swift SVN r773
2011-10-21 23:25:29 +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
f149ab5527 make Identifiers default to be quoted in diagnostic output.
Swift SVN r761
2011-10-19 01:07:31 +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
Chris Lattner
2d43b8812f update for mainline API changes.
Swift SVN r745
2011-10-16 06:17:27 +00:00
Doug Gregor
f97641d84c Add support for %select{option1|option2}idx to the diagnostic formatter, and use it in the parser
Swift SVN r739
2011-09-27 00:56:09 +00:00
Doug Gregor
a60a77bb8e C99 variadic macros suck. Use template metaprogramming tricks so we
aren't forced to rely on extensions.


Swift SVN r738
2011-09-27 00:25:56 +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