Douglas Gregor
e9db88f991
When using a precompiled preamble, keep track of the top-level
...
declarations that we saw when creating the precompiled preamble, and
provide those declarations in addition to the declarations parsed in
the main source file when traversing top-level declarations. This
makes the use of precompiled preambles a pure optimization, rather
than changing the semantics of the parsed translation unit.
llvm-svn: 110131
2010-08-03 19:06:41 +00:00
Douglas Gregor
d9a30af25b
When using a precompiled preamble, save the diagnostics produced when
...
creating the preamble and "replay" them when reusing the
preamble. Also, fix a thinko in the copying of the preamble when
building the precompiled preamble.
llvm-svn: 110061
2010-08-02 20:51:39 +00:00
Daniel Dunbar
14eb7bd769
tests: Use env instead of assuming bash.
...
llvm-svn: 109864
2010-07-30 16:40:29 +00:00
Ted Kremenek
d5cd0f3fac
Add test case for crash reported in <rdar://problem/8236270> (which has since been fixed in trunk).
...
llvm-svn: 109834
2010-07-30 01:10:48 +00:00
Ted Kremenek
0c7476ad59
Add clang_isPODType() for querying if the CXType is POD. Implements <rdar://problem/8250669>.
...
llvm-svn: 109822
2010-07-30 00:14:11 +00:00
Douglas Gregor
b59d21c22b
Visit the children of CXXOperatorCallExprs in source order within
...
libclang, so that clang_annotateTokens() doesn't get confused and miss
annotations.
llvm-svn: 109706
2010-07-29 00:26:18 +00:00
Douglas Gregor
ce3a8293a0
Implement -fno-validate-pch at the -cc1 level, which suppresses most
...
of the usual consistency checks used to determine when a precompiled
header is incompatible with the translation unit it's being loaded
into.
Enable this option when loading a precompiled preamble, because the
preamble loader will be performing all of this checking itself. Enable
the preamble-based test now that it's working.
This option is also useful for debugging Clang's PCH
(<rdar://problem/7532213>).
llvm-svn: 109475
2010-07-27 00:27:13 +00:00
Douglas Gregor
81c000fb6d
When remapping a virtual file, also make an entry for the file with
...
its absolute path on disk. Also, introduce a fun test for the
precompiled preamble, which almost works...
llvm-svn: 109470
2010-07-26 23:54:23 +00:00
Ted Kremenek
2238bc156e
Update test case to include USRs containing offsets instead of line/columns.
...
llvm-svn: 109096
2010-07-22 11:30:17 +00:00
Ted Kremenek
1eb888e9c3
Switch USR generation to use file offsets instead of line/columns for anonymous symbols. Fixes <rdar://problem/8221557>.
...
llvm-svn: 109095
2010-07-22 11:14:15 +00:00
Douglas Gregor
aa21cc401b
Introduce a new libclang API, clang_reparseTranslationUnit(), which
...
reparses an already-parsed translation unit. At the moment it's just a
convenience function, but we hope to use it for performance
optimizations.
llvm-svn: 108756
2010-07-19 21:46:24 +00:00
Douglas Gregor
261793bb73
Add test case that was causing an infinite loop when reading PCH files. The test works with ToT Clang already
...
llvm-svn: 108318
2010-07-14 04:45:33 +00:00
Douglas Gregor
4587969555
Support code completion for parameter names in Objective-C method
...
declarations.
llvm-svn: 107933
2010-07-08 23:37:41 +00:00
Douglas Gregor
95887f9c5b
Introduce a new code-completion point prior to an identifier in the
...
selector of an Objective-C method declaration, e.g., given
- (int)first:(int)x second:(int)y;
this code completion point triggers at the location of "second". It
will provide completions that fill out the method declaration for any
known method, anywhere in the translation unit.
llvm-svn: 107929
2010-07-08 23:20:03 +00:00
Douglas Gregor
55b037b9f3
During code completion, give the "nil" and "NULL" macros the same
...
priority as other constants. And, if we're in a place where we prefer
a pointer type, consider "nil" and "NULL" to be close matches.
llvm-svn: 107910
2010-07-08 20:55:51 +00:00
Ted Kremenek
7fe8e2d770
Add USR tests for ObjC class extensions.
...
llvm-svn: 106640
2010-06-23 18:10:30 +00:00
Ted Kremenek
c62ab8d064
Add CXType support for querying the return type of Objective-C methods. This is done by
...
adding a clang_getCursorResultType() function (which complements clang_getResultType()).
llvm-svn: 106473
2010-06-21 20:48:56 +00:00
Ted Kremenek
c150887fef
Add CXType support for FunctionNoProto and FunctionProto types. This includes adding a new
...
function, clang_getResultType(), which returns the result type of the function type.
llvm-svn: 106459
2010-06-21 20:15:39 +00:00
Ted Kremenek
d34da45a83
Add clang_getCursorType() support for @property declarations.
...
llvm-svn: 106451
2010-06-21 19:41:40 +00:00
Douglas Gregor
13d0568ecc
Make the "extra ';' inside a struct or union" diagnostic more
...
precise. Fixes PR7336.
llvm-svn: 106170
2010-06-16 23:08:59 +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
John McCall
a3cecb628f
Add indexing support for the block and @property type location information
...
I just implemented.
llvm-svn: 105491
2010-06-04 22:33:30 +00:00
Douglas Gregor
fe4a4107d8
Improve our handling of NULL after an escaping '\' in a string
...
literal. Fixes <rdar://problem/8044135>.
llvm-svn: 105181
2010-05-30 22:59:50 +00:00
Douglas Gregor
2683c28ff6
Improve parser recovery when we try to parse a call expression but the
...
called function itself is invalid (e.g., because of a semantic error
referring to that declaration). Fixes <rdar://problem/8044142>.
llvm-svn: 105175
2010-05-30 22:23:08 +00:00
Douglas Gregor
ad98fc9733
Unbreak non-Darwin builds
...
llvm-svn: 105137
2010-05-30 04:00:50 +00:00
Douglas Gregor
7aa6b229fe
Teach code completion to adjust its completion priorities based on the
...
type that we expect to see at a given point in the grammar, e.g., when
initializing a variable, returning a result, or calling a function. We
don't prune the candidate set at all, just adjust priorities to favor
things that should type-check, using an ultra-simplified type system.
llvm-svn: 105128
2010-05-30 01:49:25 +00:00
Douglas Gregor
d37c59dae7
Don't put method bodies into code completions unless code patterns are
...
turned on.
llvm-svn: 104909
2010-05-28 00:57:46 +00:00
Douglas Gregor
70febae768
Do not produce types as valid code completions when we're in an
...
expression context in C/Objective-C, or when we're in an
@interface/@implementation/@protocol in Objective-C(++).
llvm-svn: 104908
2010-05-28 00:49:12 +00:00
Douglas Gregor
f4c33349b5
Make -code-completion-patterns only cover multi-line code
...
completions. Plus, tweak a few completion patterns to better reflect
the language grammar.
llvm-svn: 104905
2010-05-28 00:22:41 +00:00
Douglas Gregor
a817a19bc6
Implement a code-completion hook for the receiver of an Objective-C
...
message. This completion gives better results than just using the
"expression" completion, which is effectively what happened before.
llvm-svn: 104895
2010-05-27 23:06:34 +00:00
Douglas Gregor
a2db793ff0
Introduce priorities into the code-completion results.
...
llvm-svn: 104751
2010-05-26 22:00:08 +00:00
Douglas Gregor
f64acca2f5
Only enable code patterns (e.g., try { statements } catch (...) {
...
statements }) in the code-completion results if explicitly requested.
llvm-svn: 104637
2010-05-25 21:41:55 +00:00
Douglas Gregor
6da3db4af3
Improve code completion in failure cases in two ways:
...
1) Suppress diagnostics as soon as we form the code-completion
token, so we don't get any error/warning spew from the early
end-of-file.
2) If we consume a code-completion token when we weren't expecting
one, go into a code-completion recovery path that produces the best
results it can based on the context that the parser is in.
llvm-svn: 104585
2010-05-25 05:58:43 +00:00
Ted Kremenek
26bde774df
Add clang support for IBOutletCollection.
...
llvm-svn: 104135
2010-05-19 17:38:06 +00:00
Ted Kremenek
49be9e0819
Teach CursorVisitor about duplicate ObjCPropertyDecls that can arise because of a current
...
design limitation in how we handle Objective-C class extensions. This was causing the CursorVisitor
to essentially visit an @property twice (once in the @interface, the other in the class extension).
Fixes <rdar://problem/7410145>.
llvm-svn: 104055
2010-05-18 21:09:07 +00:00
Ted Kremenek
6bca984b54
Add CXType and an initial set of supporting functions to libclang. This exposes details of
...
Clang's representation of the C type system to clients. It is nowhere near complete, and will
be expanded on demand.
llvm-svn: 103809
2010-05-14 21:29:26 +00:00
Ted Kremenek
12e0f2937e
Specially handle CaseStmts in CursorVisitor because they can be nested and walking them
...
can blow out the stack.
llvm-svn: 103687
2010-05-13 00:25:00 +00:00
Daniel Dunbar
6399208c14
Revert "Move macro definitions for IBOutlet and IBAction into the source
...
code. ...", this was a lit bug which should be fixed in r103652.
llvm-svn: 103654
2010-05-12 21:54:41 +00:00
Ted Kremenek
6cdc2c1bc8
Move macro definitions for IBOutlet and IBAction into the source code. This hopefully
...
unbreaks the test with lit+Windows.
llvm-svn: 103650
2010-05-12 21:44:56 +00:00
Daniel Dunbar
0856bf7b13
Yes another annotate-tokens tweak.
...
llvm-svn: 103615
2010-05-12 15:10:09 +00:00
Daniel Dunbar
c5f10c8d48
Increase test portability.
...
llvm-svn: 103614
2010-05-12 14:46:02 +00:00
Ted Kremenek
c316e4ef50
Make test portable.
...
llvm-svn: 103588
2010-05-12 07:24:45 +00:00
Ted Kremenek
d58be13b68
Make test case invariant to macro definition location.
...
llvm-svn: 103587
2010-05-12 07:21:07 +00:00
Ted Kremenek
8278a32802
Re-apply r103581 with updated tests. It turns out we were computing bogus locations for
...
many things.
llvm-svn: 103583
2010-05-12 06:16:13 +00:00
Ted Kremenek
a53bead8db
Temporarily revert r103581 so I can fix the failing tests.
...
llvm-svn: 103582
2010-05-12 06:03:33 +00:00
Ted Kremenek
847941b1f4
Correctly check if a cursor is a declaration before returning its location/range in clang_getCursorLocation()/clang_getCursorExtent(). This fixes a horrible bug reported in
...
<rdar://problem/7961995> and <rdar://problem/7967123> where declarations with attributes
would get grossly annotated with the wrong tokens because the attribute would be interpreted
as if it was a Decl*.
llvm-svn: 103581
2010-05-12 06:00:25 +00:00
Ted Kremenek
5d61614eab
Adjust clang_annotateTokens() to correctly account for the TypeSourceInfo for DeclaratorDecls
...
when annotating tokens. Fixes <rdar://problem/7971430>.
llvm-svn: 103577
2010-05-12 05:29:33 +00:00
Ted Kremenek
37c220c8ed
Extend C++ usrs to include type mangling for tag decl arguments, indicating whether a method
...
is static, and mangling in the qualifers of the method.
llvm-svn: 103289
2010-05-07 20:39:40 +00:00
Ted Kremenek
586ff60cfc
Add initial USR support for mangling in the types of C++ functions and methods.
...
llvm-svn: 103225
2010-05-07 01:04:32 +00:00
Ted Kremenek
fca5afb421
Add USR test case for C++ operator methods.
...
llvm-svn: 103223
2010-05-07 01:04:23 +00:00