Commit Graph

7832 Commits

Author SHA1 Message Date
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
Eric Christopher 1de8562866 APIs that take different sized arguments than the instruction
should be taken out and shot.

llvm-svn: 109531
2010-07-27 19:11:16 +00:00
Ted Kremenek 162ab86d22 Add non-static version of BinaryOperator::getOpcodeStr().
llvm-svn: 109526
2010-07-27 18:49:04 +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
Michael J. Spencer 2c35bc1232 Revert r109428 "Hoist argument type checking into CheckFormatHandler. This is prep for scanf format"
Got errors about ASTContext being undefined with Visual Studio 2010.

llvm-svn: 109491
2010-07-27 04:46:02 +00:00
Ted Kremenek 2bd41d1e30 Add PTHLexer::LexEndOfFile() to emit diagnostics at end-of-file similar to those by Lexer::LexEndOfFile().
llvm-svn: 109486
2010-07-27 02:59:02 +00:00
Ted Kremenek 3d625eb2bf Fix predicate in 'InCachingLexMode' to include 'CurPTHLexer'.
llvm-svn: 109485
2010-07-27 02:58:59 +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
Benjamin Kramer e93c39045a Mark __builtin_eh_return as noreturn. Patch by Dimitry Andric.
llvm-svn: 109452
2010-07-26 22:04:15 +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
Ted Kremenek df4472bca0 Hoist argument type checking into CheckFormatHandler. This is prep for scanf format
string argument type checking.

llvm-svn: 109428
2010-07-26 19:45:54 +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 d6009ffb8e When LIBCLANG_CODE_COMPLETION_LOGGING is set in the environment, log code-completion command lines to stderr
llvm-svn: 109395
2010-07-26 16:29:14 +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
Benjamin Kramer f5c4b49278 Wrap bit mangling logic for DiagMappings in its own class so it doesn't leak
into other code. Make it an array instead of a constant-length vector.

llvm-svn: 109384
2010-07-25 21:40:48 +00:00
Douglas Gregor 29b8e3d91c Remove a bunch of trivial destructors
llvm-svn: 109382
2010-07-25 18:44:37 +00:00
Douglas Gregor 5a9310cfb9 Move Type destructor out-of-line
llvm-svn: 109381
2010-07-25 18:39:40 +00:00
Douglas Gregor 9c832f75c0 Remove destructors from declaration nodes
llvm-svn: 109380
2010-07-25 18:38:02 +00:00
Douglas Gregor 717ceeae76 I lied. Kill off a few more Destroy methods
llvm-svn: 109379
2010-07-25 18:32:30 +00:00
Douglas Gregor a9b2dbc1a4 Kill off the last Destroy method in the AST library
llvm-svn: 109378
2010-07-25 18:23:53 +00:00
Douglas Gregor b412e174db Remove the vast majority of the Destroy methods from the AST library,
since we aren't going to be calling them ever.

llvm-svn: 109377
2010-07-25 18:17:45 +00:00
Douglas Gregor 5b11d49a7c Make ASTContext always use the BumpPtrAllocator.
llvm-svn: 109375
2010-07-25 17:53:33 +00:00
Douglas Gregor f2430ba223 Start removing the use of smart pointers from the Parse/Sema
interaction, by effectively defaulting to
DISABLE_SMART_POINTERS. We're embracing the model where all AST nodes
are ASTContext-allocated and live as long as the ASTContext lives.

llvm-svn: 109374
2010-07-25 17:39:21 +00:00
Nick Lewycky c863c0fa75 Fix sort order.
llvm-svn: 109319
2010-07-24 02:58:13 +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
John McCall 2ca705eb13 Support catching Objective C pointers in C++ under the non-fragile NeXT runtime.
Diagnose attempts to do this under the GNU or fragile NeXT runtimes.

llvm-svn: 109298
2010-07-24 00:37:23 +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
Ted Kremenek ac9ca01a80 Dataflow solver: Don't overrwite the initial value of a block with top unless new values are available. Patch by Simone Pellegrini!
llvm-svn: 109243
2010-07-23 18:15:17 +00:00
Douglas Gregor 5cc2c8b9c3 Vectors are not integer types, so the type system should not classify
them as such. Type::is(Signed|Unsigned|)IntegerType() now return false
for vector types, and new functions
has(Signed|Unsigned|)IntegerRepresentation() cover integer types and
vector-of-integer types. This fixes a bunch of latent bugs.

Patch from Anton Yartsev!

llvm-svn: 109229
2010-07-23 15:58:24 +00:00
Zhongxing Xu 73ede01cad Change arg type.
llvm-svn: 109218
2010-07-23 05:55:01 +00:00
Zhongxing Xu cabfb72654 AnalysisContext is not const.
llvm-svn: 109210
2010-07-23 02:49:07 +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
Fariborz Jahanian 86151343b4 Warn when property ivar lookup finds a global variable
of same name. In nonfragile-abi2, lookup accesses a synthesized
ivar. This is a transition warning.  Radar 8225011.

llvm-svn: 109197
2010-07-22 23:33:21 +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
Douglas Gregor cd8bdd025f Improve performance during cursor traversal when a region of interest
is present. 

Rather than using clang_getCursorExtent(), which requires
us to lex the token at the ending position to determine its
length. Then, we'd be comparing [a, b) source ranges that cover the
characters in the range rather than the normal behavior for Clang's
source ranges, which covers the tokens in the range. However, relexing
causes us to read the source file (which may come from a precompiled
header), which is rather unfortunate and affects performance.

In the new scheme, we only use Clang-style source ranges that cover
the tokens in the range. At the entry points where this matters
(clang_annotateTokens, clang_getCursor), we make sure to move source
locations to the start of the token.

Addresses most of <rdar://problem/8049381>.

llvm-svn: 109134
2010-07-22 20:22:31 +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
Nick Lewycky a11b4bfcbe Don't crash when an explicit template instantiation has no user-written
arguments. This happens in clang itself where template:

  template <typename T> T const *getAs();

gets specialized with:

  template<> inline clang::TypedefType const *getAs() { ... }

and there's no TemplateArgumentList.

llvm-svn: 109127
2010-07-22 17:56:53 +00:00
Argyrios Kyrtzidis 7609bca74c Serialization is implemented, fix comments.
llvm-svn: 109124
2010-07-22 17:28:27 +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
Zhongxing Xu adf644d05e Make a bunch of new data structures for the new analysis
engine of the new translation unit. State marshal is there but no real
work is done. End nodes are passed back.

llvm-svn: 109105
2010-07-22 13:52:13 +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