Commit Graph

24 Commits

Author SHA1 Message Date
Anders Carlsson a426705cc6 When writing file references in a pch, make sure to ask the file manager for the absolute path.
llvm-svn: 127248
2011-03-08 16:04:35 +00:00
Andrew Trick ba266eec79 Putting back safe fixes 116836,116837,116838
llvm-svn: 116866
2010-10-19 21:54:32 +00:00
Andrew Trick b20ed574ab Reverting 116836,116837,116838 until we resolve the getLangStandardForKind failures.
llvm-svn: 116859
2010-10-19 21:14:46 +00:00
Argyrios Kyrtzidis 40338af47d Merge headers into test/PCH/chain-cxx.cpp for convenience.
llvm-svn: 116836
2010-10-19 18:06:43 +00:00
Douglas Gregor 57756eabc9 When performing typo correction, look through the set of known
identifiers to determine good typo-correction candidates. Once we've
identified those candidates, we perform name lookup on each of them
and the consider the results. 

This optimization makes typo correction > 2x faster on a benchmark
example using a single typo (NSstring) in a tiny file that includes
Cocoa.h from a precompiled header, since we are deserializing far less
information now during typo correction.

There is a semantic change here, which is interesting. The presence of
a similarly-named entity that is not visible can now affect typo
correction. This is both good (you won't get weird corrections if the
thing you wanted isn't in scope) and bad (you won't get good
corrections if there is a similarly-named-but-completely-unrelated
thing). Time will tell whether it was a good choice or not.

llvm-svn: 116528
2010-10-14 22:11:03 +00:00
Douglas Gregor 44e5c1f16c Serialize the "inline" bit for namespaces. Fixes <rdar://problem/8515069>.
llvm-svn: 115667
2010-10-05 20:41:58 +00:00
Douglas Gregor 9b3932c0bc Fix a marvelous chained AST writing bug, where we end up with the
following amusing sequence:
  - AST writing schedules writing a type X* that it had never seen
  before
  - AST writing starts writing another declaration, ends up
  deserializing X* from a prior AST file. Now we have two type IDs for
  the same type!
  - AST writer tries to write X*. It only has the lower-numbered ID
  from the the prior AST file, so references to the higher-numbered ID
  that was scheduled for writing go off into lalaland.

To fix this, keep the higher-numbered ID so we end up writing the type
twice. Since this issue occurs so rarely, and type records are
generally rather small, I deemed this better than the alternative: to
keep a separate mapping from the higher-numbered IDs to the
lower-numbered IDs, which we would end up having to check whenever we
want to deserialize any type.

Fixes <rdar://problem/8511624>, I think.

llvm-svn: 115647
2010-10-05 18:37:06 +00:00
Douglas Gregor 93269380e7 Register the __builtin_va_list_type node when we parse it, rather than
waiting until we think we need it: we didn't catch all of the places
where we actually needed it, and we probably wouldn't ever. Fixes a
C++ PCH crasher.

llvm-svn: 115617
2010-10-05 14:55:45 +00:00
Douglas Gregor 3022037787 When we insert a category (or class extension) into an interface, mark
the interface as having changed since it was originally
serialized. This ensures that we see class extensions/categories in
chained PCH files.

llvm-svn: 115421
2010-10-02 21:06:43 +00:00
Douglas Gregor eb114da506 When an identifier that has a macro definition in the original PCH
file is somehow changed in a chained PCH file, make sure that we write
out the macro definition. Fixes part of <rdar://problem/8499034>.

llvm-svn: 115259
2010-10-01 01:03:07 +00:00
Sebastian Redl 401b39a736 AST writer support for having specializations of templates from earlier in the chain. This ought to finish C++ chained PCH support.
llvm-svn: 111986
2010-08-24 22:50:24 +00:00
Sebastian Redl 9617e7e8c7 Add testcase for C++ chained PCH and fix the bugs it uncovered in name lookup.
llvm-svn: 111882
2010-08-24 00:50:16 +00:00
Sebastian Redl 51c79d8740 Activate selectors in chained PCH. Chained PCH now works for Objective-C.
llvm-svn: 110262
2010-08-04 22:21:29 +00:00
Sebastian Redl 78f5177d37 Query only the latest version of an identifier in the PCH chain. Make sure this version holds the entire declaration chain. This is a much saner solution than trying to merge the info from all elements, and makes redeclarations work properly. Expand the declarations test case to cover more compliated cases.
llvm-svn: 110052
2010-08-02 18:30:12 +00:00
Sebastian Redl 671eee9e68 Correctly deal with using names for both functions and structs in chained PCH.
llvm-svn: 109871
2010-07-30 17:25:10 +00:00
Sebastian Redl 07a89a83d4 Make macro weirdness in chained PCH work. This required changing the way PCHReader and PCHWriter are initialized to correctly pick up all initializer. On the upside, this means that there is far less repetition in the dependent PCH now.
llvm-svn: 109823
2010-07-30 00:29:29 +00:00
Sebastian Redl 04f5c31e98 Support extended vector types in chained PCH.
llvm-svn: 109675
2010-07-28 21:38:49 +00:00
Sebastian Redl 887d6b08fd Add a test case for tentative definitions in chained PCH. Fix a bug that completely messed up source locations and thus caused a crash whenever a diagnostic was emitted in chained PCH files.
llvm-svn: 109660
2010-07-28 21:07:02 +00:00
Sebastian Redl 9891212476 Record macros in dependent PCHs. Also add various info tables to dependent PCHs; tests for this to follow.
llvm-svn: 109554
2010-07-27 23:01:28 +00:00
Douglas Gregor 3f4bea0646 Introduce basic support for loading a precompiled preamble while
reparsing an ASTUnit. When saving a preamble, create a buffer larger
than the actual file we're working with but fill everything from the
end of the preamble to the end of the file with spaces (so the lexer
will quickly skip them). When we load the file, create a buffer of the
same size, filling it with the file and then spaces. Then, instruct
the lexer to start lexing after the preamble, therefore continuing the
parse from the spot where the preamble left off.

It's now possible to perform a simple preamble build + parse (+
reparse) with ASTUnit. However, one has to disable a bunch of checking
in the PCH reader to do so. That part isn't committed; it will likely
be handled with some other kind of flag (e.g., -fno-validate-pch).

As part of this, fix some issues with null termination of the memory
buffers created for the preamble; we were trying to explicitly
NULL-terminate them, even though they were also getting implicitly
NULL terminated, leading to excess warnings about NULL characters in
source files.

llvm-svn: 109445
2010-07-26 21:36:20 +00:00
Sebastian Redl ff4a2951d9 Make declarations in the dependent PCH visible, for C at least.
llvm-svn: 109292
2010-07-23 23:49:55 +00:00
Sebastian Redl c67764eb4b Thread bitstream cursors all the way through the AST reading stuff. This way, reading a trivial 2-element chained file actually works.
llvm-svn: 109191
2010-07-22 22:43:28 +00:00
Chris Lattner ca025db769 add PCH support for a bunch of C++ Decls, patch by
Andrew Sutton!

llvm-svn: 103301
2010-05-07 21:43:38 +00:00
Douglas Gregor 8b1d732f85 Add PCH test for C++ namespaces, missing from a previous commit
llvm-svn: 97061
2010-02-24 21:52:55 +00:00