Commit Graph

228 Commits

Author SHA1 Message Date
Anders Carlsson 6774b1f1c1 Add -fcxx-exceptions to all tests that use C++ exceptions.
llvm-svn: 126599
2011-02-28 00:40:07 +00:00
Anders Carlsson 3320e1575f Make clang -cc1 disable Objective-C exceptions by default, and add a -fobjc-exceptions flag to turn them on.
Update all tests accordingly.

llvm-svn: 126177
2011-02-22 01:52:06 +00:00
Anders Carlsson 479d6f51e3 Pass -fexceptions to all tests that use try/catch/throw.
llvm-svn: 126037
2011-02-19 19:23:03 +00:00
Francois Pichet b3e0886599 test/PCH/headersearch.cpp fails on Win32. Not trivial to fix.
llvm-svn: 125644
2011-02-16 02:29:43 +00:00
Peter Collingbourne 5df20e02af Serialization/deserialization support for floating point #pragma
options, enabled OpenCL extensions and default FP_CONTRACT setting.

llvm-svn: 125589
2011-02-15 19:46:30 +00:00
Argyrios Kyrtzidis 10b2368e9f Allow resolving headers from a PCH even after headers+PCH were moved to another path.
Store in PCH the directory that the PCH was originally created in.
If a header file is not found at the path that we expect it to be and the PCH file
was moved from its original location, try to resolve the file by assuming that
header+PCH were moved together and the header is in the same place relative to the PCH.

llvm-svn: 125576
2011-02-15 17:54:22 +00:00
Douglas Gregor 68051a74ec Implement AST/PCH chaining support for macro definitions. Previously,
we would deserialize all of the macro definitions we knew about while
serializing the macro definitions at the end of the AST/PCH file. Even
though we skipped most of them (since they were unchanged), it's still
a performance problem.

Now, we do the standard AST/PCH chaining trick: watch what identifiers
are deserialized as macro names, and consider only those identifiers
(along with macro definitions that have been deserialized/written in
the source) when serializing the preprocessor state.

llvm-svn: 125324
2011-02-11 00:26:14 +00:00
Douglas Gregor 2e5571d0fb When we're writing macro definitions to an AST/PCH File, sort the
macro definitions by macro name first. That way, we'll get a stable
ordering in the AST/PCH file.

llvm-svn: 125297
2011-02-10 18:20:09 +00:00
Peter Collingbourne 5eec5f0422 Parse: add support for parsing CUDA kernel calls
llvm-svn: 125219
2011-02-09 21:12:02 +00:00
Douglas Gregor 87866ceda7 Implement proper (de-)serialization for explicit template argument
lists with zero template arguments. Fixes some seriously scary
crashers in C++ PCH.

llvm-svn: 124862
2011-02-04 12:01:24 +00:00
Axel Naumann 6cff969eec Remove unnecessary RUN: directive.
llvm-svn: 124795
2011-02-03 14:05:55 +00:00
Matt Beaumont-Gay 06cebfd9a5 Use tempfiles for the .o outputs.
llvm-svn: 124697
2011-02-01 22:44:06 +00:00
Douglas Gregor 1732850158 Fix a thinko where I didn't update a consistency check for
PackExpansionType in the AST reader. We need more testing for variadic
templates + PCH, but this fixes PR9073.

llvm-svn: 124662
2011-02-01 15:24:58 +00:00
John McCall 4fff8f6cff Perform the bad-address-space conversions check as part of
CheckPointerTypesForAssignment.

llvm-svn: 124632
2011-02-01 00:10:29 +00:00
Axel Naumann 63fbaeda29 TextDiagnosticPrinter.cpp: Show diagnostics as far as possible even with invalid PresomedLoc, instead of just silencing it.
FileManager.cpp: Allow virtual files in nonexistent directories.
FileManager.cpp: Close FileDescriptor for virtual files that correspond to actual files.
FileManager.cpp: Enable virtual files to be created even for files that were flagged as NON_EXISTENT_FILE, e.g. by a prior (unsuccessful) addFile().

ASTReader.cpp: Read a PCH even if the original source files cannot be found.

Add a test for reading a PCH of a file that has been removed and diagnostics referencing that file.

llvm-svn: 124374
2011-01-27 10:55:51 +00:00
Argyrios Kyrtzidis 243aedb6ec Properly propagate #pragma diagnostic mappings from PCH but not command-line warning flags.
Addresses rdar://8435969&8852495

llvm-svn: 123462
2011-01-14 20:54:07 +00:00
Francois Pichet 9b45fdf060 Adding a line for XFAIL win32 broke the test.
Remove a line: this test is line position sensitive.

llvm-svn: 122231
2010-12-20 05:53:40 +00:00
Francois Pichet e919ba6516 test/PCH/reloc.c fails on Win32.
XFAIL for now, I'll investigate why later.

llvm-svn: 122229
2010-12-20 04:36:21 +00:00
Argyrios Kyrtzidis 452707c125 Read/write from/to PCH the diagnostic mappings that the user set so that e.g. #pragma clang diagnostic can be used in a PCH.
Fixes rdar://8435969.

llvm-svn: 118303
2010-11-05 22:10:18 +00:00
Douglas Gregor d4c5ed038c Make the deserialization of C++ base class specifiers lazy, improving
the performance of C++ PCH and reducing stack depth in the reader.

llvm-svn: 117732
2010-10-29 22:39:52 +00:00
Douglas Gregor f86c939bff When de-serializing a type that is supposed to be canonical, call
getCanonicalType() to make sure that the type we got back is actually
canonical. This is the case for most types, which always build a
canonical type when given canonical components. However, some types that
involve expressions in their canonicalization (e.g., array types with
dependent sizes) don't always build canonical types from canonical
components, because there is no such thing as a "canonical"
expression. Therefore, we do this extra mapping to ensure that the
canonical types we store are actually canonical.

llvm-svn: 117344
2010-10-26 00:51:02 +00:00
Argyrios Kyrtzidis d170d844c4 Start fleshing out ASTMutationListener; notify when a tag definition is completed.
In that case a chained PCH will record the updates to the DefinitionData pointer of forward references.
If a forward reference mutated into a definition re-write it into the chained PCH, this is too big of a change.

llvm-svn: 117239
2010-10-24 17:26:50 +00:00
Argyrios Kyrtzidis ad5f95cc4b Simplify and "robust-ify" the way that CXXRecord references point to the definition data when loaded from PCH.
Temporary disable 'test/PCH/chain-cxx.cpp' until a better way to fix it is in place.

llvm-svn: 117234
2010-10-24 17:26:31 +00:00
Argyrios Kyrtzidis a41f66064f Fix issue with chained PCH where forward references did not pick up later definition in the chained PCH.
llvm-svn: 116887
2010-10-20 00:11:15 +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
Argyrios Kyrtzidis 9beef8e53d Read/write declaration attributes from/to PCH properly. Embed them in the declaration block instead of trying to create another block.
The new block was messing with the assumption that after decls block comes the stmts block.
Fixes http://llvm.org/PR8406

llvm-svn: 116737
2010-10-18 19:20:11 +00:00
Argyrios Kyrtzidis 754fb5ffb3 Merge header & cpp for test/PCH/attrs.c - more convenient to keep the tests in one source file.
llvm-svn: 116736
2010-10-18 19:20:05 +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
Argyrios Kyrtzidis 6843141d39 Store in PCH the key function of C++ class to avoid deserializing the complete declaration context in order to compute it.
Progress for rdar://7260160.

llvm-svn: 116508
2010-10-14 20:14:38 +00:00
Argyrios Kyrtzidis 0e88a565c0 Allow deserialization of just the fields of a record, when we want to iterate over them,
instead of deserializing the complete declaration context of the record.

Iterating over the fields of a record is very common (e.g to determine the layout), unfortunately we needlessly deserialize every declaration
that the declaration context of the record contains; this can be bad for large C++ classes that contain a lot of methods.
Fix this by allow deserialization of just the fields when we want to iterate over them.
Progress for rdar://7260160.

llvm-svn: 116507
2010-10-14 20:14:34 +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 9109629e55 Implement chained PCH support for the macro definitions stored within
the "detailed" preprocessing record.

llvm-svn: 115417
2010-10-02 19:29:26 +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
Argyrios Kyrtzidis 1664634cbb Add test case I forgot for r115159 (support implicit includes along with PCH).
llvm-svn: 115247
2010-10-01 00:00:18 +00:00
Argyrios Kyrtzidis f24d569f9e Fix C++ PCH issue.
The canonical FunctionTemplateDecl contains the specializations but we cannot use getCanonicalDecl on Template because it may still be initializing.
Write and read it from PCH.
Fixes http://llvm.org/PR8134

llvm-svn: 113744
2010-09-13 11:45:48 +00:00
Argyrios Kyrtzidis d05f3e3730 Fix a C++ PCH problem which was exposed by r113019. CXXBaseOrMemberInitializer's IsWritten and source order is not set.
llvm-svn: 113161
2010-09-06 19:04:27 +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
Argyrios Kyrtzidis d32ee89ea2 Fix an issue with writing to PCH another included PCH, introduced by the "using an AST on-disk hash table for name lookup" commit.
When including a PCH and later re-emitting to another PCH, the name lookup tables of DeclContexts
may be incomplete, since we now lazily deserialize the visible decls of a particular name.
Fix the issue by iterating over the un-deserialized visible decls and completing the lookup tables
of DeclContexts before writing them out.

llvm-svn: 111698
2010-08-20 23:35:55 +00:00
Sebastian Redl e7c1fe6ab7 Instead of modifying the ObjC AST to not modify existing declarations, teach chained PCH to overwrite declarations from earlier PCH files in dependent ones. Tell Sema to note when it changes AST nodes so that they have to be reserialized. Finally, the ObjCProtocolDecls created in forward decls, like the ObjCInterfaceDecls in @class forward decls, are not lexically part of the decl context; only the definition is.
llvm-svn: 110989
2010-08-13 00:28:03 +00:00
Argyrios Kyrtzidis 3084a61e98 -Make TokenID of IdentifierInfo read-only, remove setTokenID().
-There are 2 instances that change the TokenID for GNU libstdc++ 4.2 compatibility.
  To handler those cases introduce a RevertedTokenID bitfield, RevertTokenIDToIdentifier() and hasRevertedTokenIDToIdentifier() methods.
  Store the bitfield in PCH.

llvm-svn: 110868
2010-08-11 22:55:12 +00:00
Daniel Dunbar 00012c869f tests: Add a missing -Xclang.
llvm-svn: 110776
2010-08-11 02:32:03 +00:00
Daniel Dunbar 4c60857426 tests: Avoid unnecessary redirection.
llvm-svn: 110709
2010-08-10 19:33:56 +00:00
Daniel Dunbar 656f3bd3e2 tests: Tests which include system headers must use the driver, not -cc1.
llvm-svn: 110708
2010-08-10 19:32:44 +00:00
Argyrios Kyrtzidis f355e0cacd Remove a FIXME.
llvm-svn: 110571
2010-08-09 10:59:17 +00:00