Commit Graph

450 Commits

Author SHA1 Message Date
Richard Smith a4ba74c5f5 Don't eagerly load all conversion operators when loading a class declaration
from a PCH/module.

llvm-svn: 189646
2013-08-30 04:46:40 +00:00
Richard Smith 676c404dec Be lazier when loading KeyFunctions from PCH/modules. We don't need to load
these in eagerly if we're not actually processing a translation unit. The added
laziness here also avoids us loading in parts of a CXXRecordDecl earlier than an
upcoming class template specialization merging patch would like.

Ideally, we should mark the vtable as used when we see a definition for the key
function, rather than having a separate pass over dynamic classes at the end of
the TU. The existing approach is pretty bad for PCH/modules, since it forcibly
loads the declarations of all key functions in all imported modules, whether or
not those key functions are defined.

llvm-svn: 189627
2013-08-29 23:59:27 +00:00
Eli Friedman 0718591771 Adjust clang for change to APFloat::toString.
I changed the diagnostic printing code because it's probably better
to cut off a digit from DBL_MAX than to print something like
1.300000001 when the user wrote 1.3.

llvm-svn: 189625
2013-08-29 23:44:43 +00:00
Larisse Voufo d8dd97c0a2 Bug fix: disallow a variable template to be redeclared as a non-templated variable
llvm-svn: 188350
2013-08-14 03:09:19 +00:00
Richard Smith 1c34fb78e7 Fix implementation of C11 6.2.7/4 and C++11 [dcl.array]p3:
When a local extern declaration redeclares some other entity, the type of that
entity is merged with the prior type if the prior declaration is visible (in C)
or is declared in the same scope (in C++).

 - Make LookupRedeclarationWithLinkage actually work in C++, use it in the right
   set of cases, and make it track whether it found a shadowed declaration.
 - Track whether we found a declaration in the same scope (for C++) including
   across serialization and template instantiation.

llvm-svn: 188307
2013-08-13 18:18:50 +00:00
Larisse Voufo a11bd8a7dc variable templates updated for PCH serialization... Still working on test cases...
llvm-svn: 188249
2013-08-13 02:02:26 +00:00
Tim Northover 19ae1175ae Fix FileCheck --check-prefix lines.
Various tests had sprung up over the years which had --check-prefix=ABC on the
RUN line, but "CHECK-ABC:" later on. This happened to work before, but was
strictly incorrect. FileCheck is getting stricter soon though.

Patch by Ron Ofir.

llvm-svn: 188174
2013-08-12 12:51:05 +00:00
Richard Smith e40f2baa5d PR9992: Serialize and deserialize the token sequence for a function template in
-fdelayed-template-parsing mode. Patch by Will Wilson!

llvm-svn: 187916
2013-08-07 21:41:30 +00:00
Rafael Espindola 5150f2f558 Avoid crashing if a directory has no pch files.
Should fix some of the bots that have assertions disabled.

llvm-svn: 187329
2013-07-28 13:23:37 +00:00
Rafael Espindola db267e2a7c Don't pass %s twice to clang -cc1.
The reason this clang invocation was failing is that it had two %s. We would
close stdout after the first one and report a fatal error when trying to
print the second.

llvm-svn: 187122
2013-07-25 13:45:29 +00:00
David Blaikie f168f582a5 Test case for r18266 (serialization support for TagDecl:IsCompleteDefinitionRequired)
llvm-svn: 186351
2013-07-15 21:33:26 +00:00
Richard Smith 95d99308c4 C++ modules: Don't call DeclContext::lookup when half-way through deserializing
decls. That can reenter deserialization and explode horribly by trying to merge
a declaration that we've not got very far through deserializing yet.

llvm-svn: 186236
2013-07-13 02:00:19 +00:00
Rafael Espindola c8c995a2bd Use the new --crash option in commands that are expected to crash.
llvm-svn: 185679
2013-07-05 02:53:30 +00:00
Rafael Espindola 925213b0fa Add 'not' to commands that are expected to fail.
This is at least good documentation, but also opens the possibility of
using pipefail.

llvm-svn: 185652
2013-07-04 16:16:58 +00:00
Rafael Espindola be8a91b771 Replace 'grep foo | count 0' with 'not grep foo'.
This avoids depending on pipefail not being used.

llvm-svn: 185648
2013-07-04 15:22:16 +00:00
Richard Smith feb3e1a1e3 Lazily deserialize function template specializations. This fixes a cycle in
module deserialization / merging, and more laziness here is general goodness.

llvm-svn: 185132
2013-06-28 04:37:53 +00:00
Richard Smith 68ad0e7154 Lazily deserialize the "first' friend declaration when deserializing a class
declaration. This PCH a little lazier, and breaks a deserialization cycle that
causes crashes with modules enabled.

llvm-svn: 184904
2013-06-26 02:41:25 +00:00
Faisal Vali 18d3598ed0 Fix PCH bug with member templates of local classes in nontemplate functions.
As noted by Richard in the post:
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130624/082605.html, the following code should not add an entry
into PendingLocalImplicitInstantiations, since local instantiations
should only occur within the context of other instantiations:

int foo(double y) {
   struct Lambda {
      template<class T> T operator()(T t) const { return t; };
   } lambda;
   return lambda(y);
}

Hence the attached code does the following:
  1) In MarkFunctionReferenced, check if ActiveInstantiations.size() 
      is non-zero before adding to PendingLocalImplicitInstantiations.
  2) In InstantiateFunctionDefinition, we swap out/in
      PendingLocalImplicitInstantiations so that only those 
      pending local instantiations that are added during the instantiation
      of the current function are instantiated recursively.

llvm-svn: 184903
2013-06-26 02:34:24 +00:00
Richard Smith 51445cd307 When setting the external visible declarations for a decl context, check
whether they replace any existing lookups in the context, rather than
accumulating a bunch of lookup results referring to the same entity.

llvm-svn: 184679
2013-06-24 01:46:41 +00:00
Eli Friedman f796cf1ade Add test coverage for serialization of dependent function template specializations.
llvm-svn: 184275
2013-06-19 01:38:21 +00:00
Argyrios Kyrtzidis dd7106375c When declaring an ObjC interface decl with a @compatibility_alias alias name, change the class name to the "real" one.
If we have something like

  @class NewImage;
  @compatibility_alias OldImage NewImage;
  @class OldImage;

the lookup for 'OldImage' will return the 'NewImage' decl ("@class NewImage").
In such a case, when creating the decl for "@class OldImage" use the real declaration name ("NewImage"),
instead of the alias one ("OldImage"), otherwise we will break IdentifierResolver and redecls-chain invariants.

Fixes crash of rdar://14112291.

llvm-svn: 184238
2013-06-18 21:26:33 +00:00
Argyrios Kyrtzidis 794671dc2f [PCH] Fix crash with valid code, related to anonymous field initializers.
In a certain code-path we were not deserializing an anonymous field initializer correctly,
leading to a crash when trying to IRGen it.

This is a simpler version of a patch by Yunzhong Gao!

llvm-svn: 182974
2013-05-30 23:59:46 +00:00
Fariborz Jahanian 42f89384f5 Objective-C: Implements gcc's -Wselector option
which diagnoses type mismatches of identical 
selectors declared in classes throughout.
// rdar://14007194

llvm-svn: 182964
2013-05-30 21:48:58 +00:00
Fariborz Jahanian 7325c27468 Objective-C [qoi]: Improve on diagnostic when a method used
in an @selector expression has no implementation.
// rdar://14002507

llvm-svn: 182812
2013-05-28 23:49:32 +00:00
Richard Smith 1d209d075b Fix bitcode desynchronization when loading a PCH containing a class template
specialization with modules enabled. Just don't merge them at all for now;
we'll revisit this when support for template merging is added.

In passing, make Decl::dump() a little safer to use with PCH/modules, by making
it not deserialize any additional declarations. From a debugger you can call
decls_begin() or similar first if you want to dump all child decls.

llvm-svn: 182544
2013-05-23 01:49:11 +00:00
Richard Smith ba71c08523 First pass of semantic analysis for init-captures: check the initializer, build
a FieldDecl from it, and propagate both into the closure type and the
LambdaExpr.

You can't do much useful with them yet -- you can't use them within the body
of the lambda, because we don't have a representation for "the this of the
lambda, not the this of the enclosing context". We also don't have support or a
representation for a nested capture of an init-capture yet, which was intended
to work despite not being allowed by the current standard wording.

llvm-svn: 181985
2013-05-16 06:20:58 +00:00
Fariborz Jahanian 478536b1c1 improve of note message and minor refactoring of my last
patch (r181847).

llvm-svn: 181896
2013-05-15 15:27:35 +00:00
Fariborz Jahanian 773df4a11f Objective-C [diagnostics] [QOI], when method is not
found for a receiver, note where receiver class
is declaraed (this is most common when receiver is a forward
class). // rdar://3258331

llvm-svn: 181847
2013-05-14 23:24:17 +00:00
Richard Smith 1fa5d64b76 C++1y deduced return types: when we deduce a return type for a function which
we loaded from PCH, if we're building another PCH, create an update record to
patch the return type of the earlier declaration.

llvm-svn: 181659
2013-05-11 05:45:24 +00:00
Ben Langmuir ce914fc84b Serialization for captured statements
Add serialization for captured statements and captured decls.  Also add
a const_capture_iterator to CapturedStmt.

Test contributed by Wei Pan

Differential Revision: http://llvm-reviews.chandlerc.com/D727

llvm-svn: 181048
2013-05-03 19:20:19 +00:00
Richard Smith 74aeef50a0 Implement C++1y decltype(auto).
llvm-svn: 180610
2013-04-26 16:15:35 +00:00
Richard Smith 51fe3a48aa Add another test I forgot to svn add.
llvm-svn: 179959
2013-04-20 22:23:29 +00:00
Andy Gibbs fcc699aee8 Extended VerifyDiagnosticConsumer to also verify source file for diagnostic.
VerifyDiagnosticConsumer previously would not check that the diagnostic and
its matching directive referenced the same source file.  Common practice was
to create directives that referenced other files but only by line number,
and this led to problems such as when the file containing the directive
didn't have enough lines to match the location of the diagnostic in the
other file, leading to bizarre file formatting and other oddities.

This patch causes VerifyDiagnosticConsumer to match source files as well as
line numbers.  Therefore, a new syntax is made available for directives, for
example:

// expected-error@file:line {{diagnostic message}}

This extends the @line feature where "file" is the file where the diagnostic
is generated.  The @line syntax is still available and uses the current file
for the diagnostic.  "file" can be specified either as a relative or absolute
path - although the latter has less usefulness, I think!  The #include search
paths will be used to locate the file and if it is not found an error will be
generated.

The new check is not optional: if the directive is in a different file to the
diagnostic, the file must be specified.  Therefore, a number of test-cases
have been updated with regard to this.

This closes out PR15613.

llvm-svn: 179677
2013-04-17 08:06:46 +00:00
Rafael Espindola 05976798dc Remove XFAIL now that the test is standalone.
llvm-svn: 179538
2013-04-15 17:06:15 +00:00
Argyrios Kyrtzidis 7134bb4531 [PCH/test] Make test/PCH/cxx-typeid.cpp self-contained by including the relevant standard library declarations
instead of depending on a system header inclusion.

llvm-svn: 179537
2013-04-15 16:52:57 +00:00
Richard Smith 643a2869b3 Add triples to these tests since they're now using TLS, which isn't available on all targets.
llvm-svn: 179514
2013-04-15 08:00:15 +00:00
Richard Smith fd3834f7a1 Annotate flavor of TLS variable (statically or dynamically initialized) onto the AST.
llvm-svn: 179447
2013-04-13 02:43:54 +00:00
Jyotsna Verma 2249e9cfa8 Disable following tests for Hexagon:
1) Driver/output-file-is-dir.c - Checks for object file which can't
be created for Hexagon since assembler is unavailable.
2) PCH/cxx-typeid.cpp - 'typeinfo' include file is unavailable for Hexagon.

llvm-svn: 179385
2013-04-12 17:25:02 +00:00
Argyrios Kyrtzidis e055d27e65 [PCH] Change test/PCH/headersearch.cpp to use -emit-llvm-only instead of -emit-obj
llvm-svn: 179301
2013-04-11 17:37:48 +00:00
Richard Smith 86c0d06194 Fix 41 of the 61 tests which fail with modules enabled: we were computing and
caching the linkage for a declaration before we set up its redeclaration chain,
when determining whether a declaration could be a redeclaration of something
from an unimported submodule. We actually want to look at the declaration as if
it were not a redeclaration here, so compute the linkage but don't cache it.

llvm-svn: 178733
2013-04-04 01:51:11 +00:00
Richard Smith 5205a8cfd8 Don't eagerly deserialize every templated function (and every static data
member inside a class template) when loading a PCH file or module.

llvm-svn: 178496
2013-04-01 20:22:16 +00:00
Argyrios Kyrtzidis ca370b0d1f [PCH] Fix assertion hit related to enum decls inside templated funtions.
Report and suggested fix by Tom Honermann!
http://llvm.org/bugs/show_bug.cgi?id=13020

llvm-svn: 177330
2013-03-18 22:23:49 +00:00
Argyrios Kyrtzidis c4720399ec [PCH] When complaining that a header from the PCH was modified, also mention
the filename of the PCH file.

llvm-svn: 176717
2013-03-08 20:42:38 +00:00
Argyrios Kyrtzidis 397ef40f6b Add a test case, to make sure there is no crash on IRGen when using PCH
Related to rdar://13114142

llvm-svn: 176227
2013-02-28 01:13:53 +00:00
Bill Wendling c33fc4c004 Modify the tests to use attribute group references instead of listing the
function attributes.

llvm-svn: 175606
2013-02-20 07:22:19 +00:00
Argyrios Kyrtzidis 83a6e3bfab [PCH] Deserializing the DeclContext of a template parameter is not safe
until recursive loading is finished.

Otherwise we may end up with a template trying to deserialize a template
parameter that is in the process of getting loaded.

rdar://13135282

llvm-svn: 175329
2013-02-16 00:48:59 +00:00
Guy Benyei 610541989a Add OpenCL samplers as Clang builtin types and check sampler related restrictions.
llvm-svn: 174601
2013-02-07 10:55:47 +00:00
Argyrios Kyrtzidis 48b72d81c8 [frontend] Don't put a PCH/PTH filename into the set of includes in the preprocessor options;
since only one of them is allowed in command-line, process them separately.

Otherwise, if more than one is specified in the command-line, one is processed normally
and the others are going to be treated and included as header files.

Related to radar://13140508

llvm-svn: 174385
2013-02-05 16:36:52 +00:00
Nick Lewycky 8334af8c2a Preserve Sema::UndefinedInternals across PCH boundaries. Fixes
-Wundefined-internal warnings with PCH.

llvm-svn: 173538
2013-01-26 00:35:08 +00:00
NAKAMURA Takumi e83aea35ba clang/test/PCH/modified-header-error.c: Disable it again. It had been problematic on win32 for while.
llvm-svn: 173439
2013-01-25 11:07:42 +00:00