Commit Graph

1438 Commits

Author SHA1 Message Date
Douglas Gregor a5fd522992 Turn off precompiled preamble support for C++
llvm-svn: 109680
2010-07-28 22:12:37 +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 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
Argyrios Kyrtzidis c0279a9826 Revert r109546, it broke linux build.
llvm-svn: 109550
2010-07-27 22:37:14 +00:00
Argyrios Kyrtzidis 4fac280618 Merge PCHWriterDecl.cpp's isRequiredDecl and CodeGenModule::MayDeferGeneration into a new function,
DeclIsRequiredFunctionOrFileScopedVar.

This function is part of the public CodeGen interface since it's essentially a CodeGen predicate that is also
needed by the PCH mechanism to determine whether a decl needs to be deserialized during PCH loading for codegen purposes.
This fixes current (and avoids future) codegen-from-PCH bugs.

llvm-svn: 109546
2010-07-27 22:01:17 +00:00
Sebastian Redl 4b1f490860 Update the list of lexical decls in the TU for chained PCHs. This makes -ast-print show the decls from the dependent PCH.
llvm-svn: 109524
2010-07-27 18:24:41 +00:00
Douglas Gregor 96c042616e Fix use-after-free with precompiled preambles
llvm-svn: 109505
2010-07-27 14:52:07 +00:00
Argyrios Kyrtzidis 76314d1ea8 Always deserialize from PCH file scoped variables with non trivial constructor/destructor.
Fixes http://llvm.org/PR7692

llvm-svn: 109501
2010-07-27 12:56:10 +00:00
Ted Kremenek fee882ac95 PTH generation: Don't save the leading '#' token in a null directive. This unbreaks using PTH with Boost (<rdar://problem/8227989>).
llvm-svn: 109484
2010-07-27 02:58:57 +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
Sebastian Redl 66c5eef182 - Fix recording of offsets of types in dependent PCHs.
- Stop reading in (and thus deserializing) every declaration in the TU when creating a dependent PCH.
- Switch the storage of a decl context's lexical declarations to a blob containing the IDs instead of a record. This is the only sane way of supporting update records later on.

llvm-svn: 109474
2010-07-27 00:17:23 +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
Dan Gohman 0eb9c124a7 It's not necessary to call flush() on a raw_ostream immediately prior
to deleting it.

llvm-svn: 109441
2010-07-26 21:29:50 +00:00
Nick Lewycky 19b9f958e1 Add source location information to C++ base specifiers.
llvm-svn: 109396
2010-07-26 16:56:01 +00:00
Douglas Gregor 67ca40c419 Eliminate the "minimal" and printing parser actions, which only ever
worked for C anyway. Also kills the -cc1 options -parse-noop and
-parse-print-callbacks.

llvm-svn: 109392
2010-07-26 04:08:02 +00:00
Douglas Gregor 5b11d49a7c Make ASTContext always use the BumpPtrAllocator.
llvm-svn: 109375
2010-07-25 17:53:33 +00:00
Nick Lewycky e602efc6f6 Remove emacs file mode marker on file with .cpp extension.
llvm-svn: 109366
2010-07-25 03:12:58 +00:00
Nick Lewycky 84a11fdf57 Add header searching for llvm-gcc trunk on Gentoo AMD64. Patch by Mark Wood!
llvm-svn: 109357
2010-07-24 21:33:13 +00:00
Douglas Gregor f5275a8339 Put a newline at the end of the padded buffers used for the
precompiled preamble. This will suppress the -pedantic "no newline at
end of file" warning.

llvm-svn: 109301
2010-07-24 00:42:07 +00:00
Douglas Gregor 6481ef1f9c Once we've built (or reused) a precompiled preamble, create the
appropriately-padded main file buffer (that has spaces in the extra
"reserved" space) and thread that buffer through to the parsing
function. This still does nothing.

llvm-svn: 109299
2010-07-24 00:38:13 +00:00
Douglas Gregor 4dde74988e Once we've built a precompiled preamble, keep track of the details of
that preamble (the preamble text, preamble file, reserved main file
size). Check these details when we try to rebuild the precompiled
preamble, and when nothing has changed, re-use the precompiled
preamble.

This code is still very much a WIP, and can't even properly be tested
because we have no way to use the precompiled preamble yet. "Trust me"

llvm-svn: 109294
2010-07-23 23:58:40 +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
Fariborz Jahanian c51609a0b5 PCH read/write for selector reference pool.
Finishes off radar 6507158.

llvm-svn: 109256
2010-07-23 19:11:11 +00:00
Zhongxing Xu 318e40360d Fix build on Ubuntu 10.04.
llvm-svn: 109208
2010-07-23 02:15:08 +00:00
Douglas Gregor be2d8c6096 Basic plumbing for generating a precompiled preamble for an
ASTUnit/CXTranslationUnit. We can't actually use this preamble yet,
however.

llvm-svn: 109202
2010-07-23 00:33:23 +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
Fariborz Jahanian 6e7e8cc19d atch for implementation of objective-c's -Wselector
warning flag in clang. Little more to do
for a PCH issue. Radar 6507158.

llvm-svn: 109129
2010-07-22 18:24:20 +00:00
Argyrios Kyrtzidis 2d8891cd5d Read/write C++0x static_assert for PCH.
llvm-svn: 109123
2010-07-22 17:28:12 +00:00
Sebastian Redl 5c415f3e32 Allow loading declcontext information from any file in the chain. Properly write source locations to dependent files. WIP
llvm-svn: 109119
2010-07-22 17:01:13 +00:00
Argyrios Kyrtzidis 165b58181f Read/write FriendTemplateDecl for PCH.
llvm-svn: 109113
2010-07-22 16:04:10 +00:00
Argyrios Kyrtzidis 47cd7a91f4 Support C++ try/catch statements for PCH.
llvm-svn: 109112
2010-07-22 16:03:56 +00:00
Sebastian Redl 4e6c567653 Allow loading macros from any file in the chain. WIP
llvm-svn: 109048
2010-07-21 22:31:37 +00:00
Sebastian Redl fa0614458a Promote some macro-related stuff to per-file data. Fix a cache-inefficient nested loop by inverting the nesting. Store the size of each file in the chain; will need this later for statement offsets.
llvm-svn: 109030
2010-07-21 20:07:32 +00:00
Sebastian Redl c713b9665b Allow loading identifiers from any file in the chain. WIP
llvm-svn: 108974
2010-07-21 00:46:22 +00:00
Sebastian Redl b2831dbff7 Apparently not every system thinks that references in pairs are as cool as I think.
llvm-svn: 108959
2010-07-20 22:55:31 +00:00
Sebastian Redl 3462779369 Allow loading declarations from any file in the chain. WIP
llvm-svn: 108956
2010-07-20 22:46:15 +00:00
Sebastian Redl 837a6cbe03 Allow loading types from any file in the chain. WIP
llvm-svn: 108954
2010-07-20 22:37:49 +00:00
Sebastian Redl 0675030cf9 Allow loading source locations from any file in the chain. WIP
llvm-svn: 108942
2010-07-20 21:50:20 +00:00
Sebastian Redl b293a45d28 More work on getting PCHReader to handle multiple files. Promote SLocOffsets to per-file data. WIP
llvm-svn: 108930
2010-07-20 21:20:32 +00:00
Douglas Gregor af82e3510b Introduce a new lexer function to compute the "preamble" of a file,
which is the part of the file that contains all of the initial
comments, includes, and preprocessor directives that occur before any
of the actual code. Added a new -print-preamble cc1 action that is
only used for testing.

llvm-svn: 108913
2010-07-20 20:18:03 +00:00
Argyrios Kyrtzidis dde5790562 Hide FunctionTemplateDecl's specializations folding set as implementation detail and introduce
FunctionTemplateDecl::findSpecialization.

Redeclarations of specializations will not cause the previous decl to be removed from the set,
the set will keep the canonical decl. findSpecialization will return the most recent redeclaration.

llvm-svn: 108834
2010-07-20 13:59:58 +00:00
Argyrios Kyrtzidis c1624e9eda Whether the specialization should be added to template's folding set when read from PCH,
is determined by a isCanonicalDecl check.

llvm-svn: 108833
2010-07-20 13:59:40 +00:00
Sebastian Redl c57d34bc35 Update ImplicitCastExpr to be able to represent an XValue.
llvm-svn: 108807
2010-07-20 04:20:21 +00:00
Sebastian Redl 3d3f0b1039 Remove PCHReader::getStream(), it was unused. Inline PCHReader::getDelsCursor() into its sole caller and remove it. This reduces the attack surface of multiple PCH files towards code outside the PCH implementation.
llvm-svn: 108763
2010-07-19 22:38:35 +00:00
Sebastian Redl bd1b5befee Promote IdentifierOffsets to per-file data.
llvm-svn: 108762
2010-07-19 22:28:42 +00:00
Sebastian Redl 9e687994f3 Promote DeclOffsets and TypeOffsets to per-file data.
llvm-svn: 108760
2010-07-19 22:06:55 +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
Sebastian Redl 393f8b76c0 Promote the identifier table to per-file data. Also, if a CHAINED_METADATA record exists, it has to be the first thing in the PCH file.
llvm-svn: 108748
2010-07-19 20:52:06 +00:00
Daniel Dunbar e38764c66c Driver: Change the driver to take the path to the main executable, instead of
taking it in pieces.
 - Fixes a problem where the Clang executable path was not initialized properly
   on Win32, because sys::Path::getBasename() doesn't do what I always think it
   does. Imagine that, a sys::Path interface that is confusing!

llvm-svn: 108667
2010-07-19 00:44:04 +00:00
Chris Lattner ad4f38b1a9 BUILD_ARCHIVE is the default for libraries, no need to set it.
llvm-svn: 108633
2010-07-18 00:14:47 +00:00