Commit Graph

1464 Commits

Author SHA1 Message Date
David Blaikie 49cc3181a2 Overload SourceManager::overrideFileContents so that unconditionally passing ownership is explicitly done using unique_ptr.
Only those callers who are dynamically passing ownership should need the
3 argument form. Those accepting the default ("do pass ownership")
should do so explicitly with a unique_ptr now.

llvm-svn: 216614
2014-08-27 20:54:45 +00:00
Rafael Espindola d87f8d76e0 Update for LLVM api change.
llvm-svn: 216585
2014-08-27 20:03:29 +00:00
Richard Smith b1108739e4 [modules] Don't assert when merging virtual functions that override other
functions. Also don't needlessly pull in non-canonical declarations of the
overridden virtual functions.

llvm-svn: 216503
2014-08-26 23:29:11 +00:00
Rafael Espindola 6406f7b8e0 Return a std::unique_ptr from getBufferForFile. NFC.
llvm-svn: 216476
2014-08-26 19:54:40 +00:00
Richard Smith 43ccec8e53 [modules] Track the described template in an alias declaration that is the
pattern of an alias template declaration. Use this to merge alias templates
properly when they're members of class template specializations.

llvm-svn: 216437
2014-08-26 03:52:16 +00:00
Richard Smith 87dacc7922 Fix typo.
llvm-svn: 216417
2014-08-25 23:33:46 +00:00
Rafael Espindola dae941a6c8 Update for llvm api change.
llvm-svn: 216397
2014-08-25 18:17:04 +00:00
Craig Topper c6914d068f Use range based for loops to avoid needing to re-mention SmallPtrSet size.
llvm-svn: 216370
2014-08-25 04:15:02 +00:00
Richard Smith 88126a25eb [modules] Fix false report of an ODR violation when merging friend
declarations. We can't expect to find them in the canonical definition
of the class, because that's not where they live.

This means we no longer reject real ODR violations with friend declarations,
but we weren't consistently doing so anyway.

llvm-svn: 216369
2014-08-25 02:10:01 +00:00
Richard Smith 88ebade8d9 [modules] When merging a tag declaration that has a typedef name for linkage
purposes, look for other typedefs with that same name and merge into their
named tag declaration if there is one.

llvm-svn: 216312
2014-08-23 01:45:27 +00:00
Alexander Musman 3aaab669c8 [OPENMP] Extract common superclass from all the loop directives. No functional changes (having common superclass is convenient for future loop directives CodeGen implementation)
llvm-svn: 215975
2014-08-19 11:27:13 +00:00
Ben Langmuir e13fd1c430 Fix the rececl chain for redeclarations of predefined decls
Predefined decls like 'Protocol' in objc are not loaded from AST files,
so we cannot rely on loading the canonical decl to complete the redecl
chain for redeclarations of these decls.  The broken redecl chain was
non-circular, so looping over redecls() would hang.

llvm-svn: 215929
2014-08-18 19:32:45 +00:00
Rafael Espindola 5cd06f26ae Store std::unique_ptr in InMemoryBuffers. NFC.
llvm-svn: 215928
2014-08-18 19:16:31 +00:00
Craig Topper 4dd9b43c8d Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needing to mention the size.
llvm-svn: 215869
2014-08-17 23:49:53 +00:00
Ben Langmuir fe971d9894 When loading a module with no local entities, still bump the size of the
tables that correspond to ContinuousRangeMaps, since the keys to those
maps need to be unique, or we may map to the wrong offset.

This fixes a crash + malformed AST file seen when loading some modules
that import Cocoa on Darwin, which is a module with no contents except
imports of other modules. Unfortunately I have not been able to find a
reduced test case that reproduces this problem.

Also add an assert that we aren't mapping one key to multiple values
in CRM.  We ought to be able to say there are no duplicate keys at all,
but there are a bunch of 0 -> 0 mappings that are showing up, probably
coming from the source location table.

llvm-svn: 215810
2014-08-16 04:54:18 +00:00
Richard Smith 462b6fc6dc [modules] Turn off a broken optimization: we need to pick up implicit special
members from all redefinitions of a class that have them, in case the special
member is defined in one module but only declared in another.

llvm-svn: 215675
2014-08-14 20:30:52 +00:00
Richard Smith 72544f875b [modules] Don't assert if the same imported class template specialization
declaration has its definition instantiated in two sibling modules and they use
a partial specialization.

llvm-svn: 215616
2014-08-14 03:30:27 +00:00
Richard Smith 8c913ecd15 [modules] When we merge together multiple class template specialization
definitions (because some other declaration declares a special member that
isn't present in the canonical definition), we need to search *all* of them; we
can't just stop when we find the requested name in any of the definitions,
because that can fail to find things (and in particular, it can fail to find
the member of the canonical declaration and return a bogus ODR failure).

llvm-svn: 215612
2014-08-14 02:21:01 +00:00
Benjamin Kramer 2f5db8b3db Header guard canonicalization, clang part.
Modifications made by clang-tidy with minor tweaks.

llvm-svn: 215557
2014-08-13 16:25:19 +00:00
Richard Smith bb853c79c0 [modules] When performing a lookup into a namespace, ensure that any later
redefinitions of that namespace have already been loaded. When writing out the
names in a namespace, if we see a name that is locally declared and had
imported declarations merged on top of it, export the local declaration as the
lookup result, because it will be the most recent declaration of that entity in
the redeclaration chain of an importer of the module.

llvm-svn: 215518
2014-08-13 01:23:33 +00:00
Ben Langmuir 4b8a9e951e Verify all the module map files for a pcm are the same on load
We already verified the primary module map file (either the one that
defines the top-level module, or the one that allows inferring it if it
is an inferred framework module). Now we also verify any other module
map files that define submodules, such as when there is a
module.private.modulemap file.

llvm-svn: 215455
2014-08-12 16:42:33 +00:00
Manuel Klimek 9af34aeac1 Correctly implement -include search logic.
According to the gcc docs, -include uses the current working directory
for the lookup instead of the main source file.

This patch gets rid of NormalizeIncludePath (which relied on an
implementation detail of FileManager / FileEntry for the include path
logic to work), and instead hands the correct lookup information down to
LookupFile.

This will allow us to change the FileEntry's behavior regarding its Name
caching.

llvm-svn: 215433
2014-08-12 08:25:57 +00:00
David Blaikie afa10d3eda unique_ptr-ify the MemoryBuffer parameter of GlobalModuleIndex
llvm-svn: 215376
2014-08-11 18:47:26 +00:00
Richard Smith 2516ba27b1 Add some FIXMEs.
llvm-svn: 215375
2014-08-11 18:35:44 +00:00
Ben Langmuir 9d6448b137 Refactor the module map file used for uniquing a module name out of
class Module. It's almost always going to be the same as
getContainingModule() for top-level modules, so just add a map to cover
the remaining cases.  This lets us do less bookkeeping to keep the
ModuleMap fields up to date.

llvm-svn: 215268
2014-08-09 00:57:23 +00:00
Richard Smith d6db68c181 [modules] Don't defer performing updates if we have incomplete redecl chains.
Instead, perform them carefully immediately.

llvm-svn: 215147
2014-08-07 20:58:41 +00:00
Richard Smith 4d2357948b [modules] When emitting an update record containing the body of a destructor,
also emit the updated 'operator delete' looked up for that destructor. Switch
from UpdateDecl to an actual update record when this happens due to implicitly
defining a special member function and unify this code path and the one for
instantiating a function definition.

llvm-svn: 215132
2014-08-07 18:53:08 +00:00
Richard Smith 3be1cb294f Use -Rblah, not -Wblah, to control remark diagnostics. This was always the
intent when we added remark support, but was never implemented in the general
case, because the first -R flags didn't need it. (-Rpass= had special handling
to accomodate its argument.)

-Rno-foo, -Reverything, and -Rno-everything can be used to turn off a remark,
or to turn on or off all remarks. Per discussion on cfe-commits, -Weverything
does not affect remarks, and -Reverything does not affect warnings or errors.

The only "real" -R flag we have right now is -Rmodule-build; that flag is
effectively renamed from -Wmodule-build to -Rmodule-build by this change.

-Wpass and -Wno-pass (and their friends) are also renamed to -Rpass and
-Rno-pass by this change; it's not completely clear whether we intended to have
a -Rpass (with no =pattern), but that is unchanged by this commit, other than
the flag name. The default pattern is effectively one which matches no passes.
In future, we may want to make the default pattern be .*, so that -Reverything
works for -Rpass properly.

llvm-svn: 215046
2014-08-07 00:24:21 +00:00
Fariborz Jahanian 413297c53d Objective-C ARC. First patch toward generating new APIs
for Objective-C's array and dictionary literals.
rdar://17554063. This is wip.

llvm-svn: 214983
2014-08-06 18:13:46 +00:00
Richard Smith 46bb581a03 [modules] Remove IRGen special case for emitting implicit special members if
they're somehow missing a body. Looks like this was left behind when the loop
was generalized, and it's not been problematic before because without modules,
a used, implicit special member function declaration must be a definition.

This was resulting in us trying to emit a constructor declaration rather than
a definition, and producing a constructor missing its member initializers.

llvm-svn: 214473
2014-08-01 01:56:39 +00:00
Richard Smith 24d166ca77 Fix buildbot: work around missing GCC C++11 feature.
llvm-svn: 214459
2014-07-31 23:52:38 +00:00
Richard Smith 6de7a24782 [modules] Maintain an AST invariant across module load/save: if any declaration
of a function has a resolved exception specification, then all declarations of
the function do.

We should probably improve the AST representation to make this implicit (perhaps
only store the exception specification on the canonical declaration), but this
fixes things for now.

The testcase for this (which used to assert) also exposes the actual bug I was
trying to reduce here: we sometimes fail to emit the body of an imported
special member function definition. Fix for that to follow.

llvm-svn: 214458
2014-07-31 23:46:44 +00:00
Richard Smith 8acb4280c5 Factor out exception specification information from
FunctionProtoType::ExtProtoInfo. Most of the users of these fields don't care
about the other ExtProtoInfo bits and just want to talk about the exception
specification.

llvm-svn: 214450
2014-07-31 21:57:55 +00:00
Richard Smith a0ce9c4651 [modules] Factor out ODR checking, to avoid unnecessary repeated work in
finishPendingActions loop.

llvm-svn: 214246
2014-07-29 23:23:27 +00:00
Richard Smith f59b735a80 [modules] PR20475: merging support for alias template declarations.
llvm-svn: 214124
2014-07-28 21:16:37 +00:00
Richard Smith f1b4b8bf79 [modules] Add some missing record names. We really should be generating this from a .def file or similar...
llvm-svn: 214049
2014-07-27 04:29:04 +00:00
Richard Smith a27c26e7d8 [modules] Add abbreviation for ImplicitCastExpr. This is the most common
record type in LLVM's IR module.

llvm-svn: 214048
2014-07-27 04:19:32 +00:00
Richard Smith 01b2cb4772 [modules] Improve abbreviations for C++:
* Add abbreviation for CXXMethodDecl and for FunctionProtoType. These come up
   a *lot* in C++ modules.
 * Allow typedef declarations to use the abbreviation if they're class members,
   or if they're used.

In passing, add more record name records for Clang AST node kinds.

The downside is that we had already used up our allotment of 12 abbreviations,
so this pushes us to an extra bit on each record to support the extra abbrev
kinds, which increases file size by ~1%. This patch *barely* pays for that
through the other improvements, but we've got room for another 18 abbrevs,
so we should be able to make it much more profitable with future changes.

llvm-svn: 214024
2014-07-26 06:37:51 +00:00
Richard Smith daa69e00f5 [modules] Substantially improve handling of #undef:
* Track override set across module load and save
 * Track originating module to allow proper re-export of #undef
 * Make override set properly transitive when it picks up a #undef

This fixes nearly all of the remaining macro issues with self-host.

llvm-svn: 213922
2014-07-25 04:40:03 +00:00
Alexey Bataev 82bad8b026 [OPENMP] Initial parsing and sema analysis for clause 'seq_cst' of 'atomic' directive.
llvm-svn: 213846
2014-07-24 08:55:34 +00:00
Alexey Bataev 459dec0ca2 [OPENMP] Initial parsing and sema analysis for clause 'capture' in 'atomic' directive.
llvm-svn: 213842
2014-07-24 06:46:57 +00:00
Alexey Bataev 67a4f22f12 [OPENMP] Initial parsing and sema analysis for 'update' clause of 'atomic' directive.
llvm-svn: 213735
2014-07-23 10:25:33 +00:00
Alexey Bataev dea4761c06 [OPENMP] Initial parsing an sema analysis for 'write' clause of 'atomic' directive.
llvm-svn: 213728
2014-07-23 07:46:59 +00:00
Alexey Bataev f98b00c33e [OPENMP] Initial parsing and sema analysis for 'read' clause in 'atomic' directive.
llvm-svn: 213717
2014-07-23 02:27:21 +00:00
Alexey Bataev 0162e459ef [OPENMP] Initial parsing and sema analysis for 'atomic' directive.
llvm-svn: 213639
2014-07-22 10:10:35 +00:00
Alexey Bataev 9fb6e647e7 [OPENMP] Initial parsing and sema analysis for 'ordered' directive.
llvm-svn: 213616
2014-07-22 06:45:04 +00:00
Alexey Bataev 6125da9258 [OPENMP] Initial parsing and sema analysis for 'flush' directive.
llvm-svn: 213512
2014-07-21 11:26:11 +00:00
Alexander Musman d9ed09f7a5 [OPENMP] Parsing/Sema of the OpenMP directive 'critical'.
llvm-svn: 213510
2014-07-21 09:42:05 +00:00
Richard Smith 57721ac591 [modules] Fix some of the confusion when computing the override set for a macro
introduced by finalization. This is still not entirely correct; more fixes to
follow.

llvm-svn: 213498
2014-07-21 04:10:40 +00:00
Richard Smith e657bbdcbc Reinstate r213348, reverted in r213395, with an additional bug fix and more
thorough tests.

Original commit message:

[modules] Fix macro hiding bug exposed if:

 * A submodule of module A is imported into module B
 * Another submodule of module A that is not imported into B exports a macro
 * Some submodule of module B also exports a definition of the macro, and
   happens to be the first submodule of B that imports module A.

In this case, we would incorrectly determine that A's macro redefines B's
macro, and so we don't need to re-export B's macro at all.

This happens with the 'assert' macro in an LLVM self-host. =(

llvm-svn: 213416
2014-07-18 22:13:40 +00:00