Граф коммитов

1017 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor 894719bf99 ASTReader and profiling statistics indicate that implementing a method
pool in the global module index is not worthwhile. Update comments to
limit the scope of the global module index to identifiers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173705 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28 18:29:39 +00:00
Douglas Gregor 95fb36ebdd Add some more ASTReader statistics for global method pool lookups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173702 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28 17:54:36 +00:00
Douglas Gregor d3cf5fba33 Eliminate memory allocation from most invocations of
ModuleManager::visit() by keeping a free list of the two data
structures used to store state (a preallocated stack and a visitation
number vector). Improves -fsyntax-only performance for my modules test
case by 2.8%. Modules has pulled ahead by almost 10% with the global
module index.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173692 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28 16:46:33 +00:00
Nick Lewycky 01a41140cd Preserve Sema::UndefinedInternals across PCH boundaries. Fixes
-Wundefined-internal warnings with PCH.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173538 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-26 00:35:08 +00:00
Fariborz Jahanian 3ac83d69c6 patch for PR9027 and // rdar://11861085
Title: [PR9027] volatile struct bug: member is not loaded at -O;
This is caused by last flag passed to @llvm.memcpy being false, 
not honoring that aggregate has at least one 'volatile' data member 
(even though aggregate itself has not been qualified as 'volatile'. 
As a result, optimization optimizes away the memcpy altogether.
Patch review by John MaCall (I still need to fix up a test though).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173535 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 23:57:05 +00:00
Douglas Gregor 188bdcd1aa Improve coordination between the module manager and the global module
index, optimizing the operation that skips lookup in modules where we
know the identifier will not be found. This makes the global module
index optimization actually useful, providing an 8.5% speedup over
modules without the global module index for -fsyntax-only.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173529 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 23:32:03 +00:00
John McCall d5617eeafc The standard ARM C++ ABI dictates that inline functions are
never key functions.  We did not implement that rule for the
iOS ABI, which was driven by what was implemented in gcc-4.2.
However, implement it now for other ARM-based platforms.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173515 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 22:31:03 +00:00
Douglas Gregor d07865b42d Optimize ModuleManager::visit() by precomputing the visitation order
and limiting ourselves to two memory allocations. 10% speedup in
-fsyntax-only time for modules.

With this change, we can actually see some performance different from
the global module index, but it's still about 1%.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173512 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 22:25:23 +00:00
Daniel Dunbar eab6652b7e [Frontend] Remove another IsUserSpecified member variable that is now unused.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173412 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 01:50:47 +00:00
NAKAMURA Takumi 1d32133b44 Serialization/GlobalModuleIndex.cpp: Fixup r173405, <cstdio>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173408 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 01:47:07 +00:00
Douglas Gregor 1a49d97d76 Implement the reader of the global module index and wire it into the
AST reader.

The global module index tracks all of the identifiers known to a set
of module files. Lookup of those identifiers looks first in the global
module index, which returns the set of module files in which that
identifier can be found. The AST reader only needs to look into those
module files and any module files not known to the global index (e.g.,
because they were (re)built after the global index), reducing the
number of on-disk hash tables to visit. For an example source I'm
looking at, we go from 237844 total identifier lookups into on-disk
hash tables down to 126817.

Unfortunately, this does not translate into a performance advantage.
At best, it's a wash once the global module index has been built, but
that's ignore the cost of building the global module index (which
is itself fairly large). Profiles show that the global module index
code is far less efficient than it should be; optimizing it might give
enough of an advantage to justify its continued inclusion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173405 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 01:03:03 +00:00
Douglas Gregor f575d6e7c3 Rename the -cc1 option "-generate-module-index" to
"-fmodules-global-index" and expand its behavior to include both the
use and generation of the global module index.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173404 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 00:45:27 +00:00
Douglas Gregor e169807aae Track the number of lookups and hits into the on-disk hash tables for
identifiers within the AST file reader.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173403 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 00:38:33 +00:00
NAKAMURA Takumi d2db16f596 clang/GlobalModuleIndex: Don't open the same file twice. Use raw_fd_ostream(fd, ...) instead.
FIXME: PathV2::unique_file() is assumed to open the file with binary mode on win32.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173330 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-24 08:20:11 +00:00
Douglas Gregor 5100135ecf Fix for case-sensitive file systems. Ugh
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173303 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 22:45:24 +00:00
Douglas Gregor a6b00fc976 Implement the writer side of the global module index.
The global module index is a "global" index for all of the module
files within a particular subdirectory in the module cache, which
keeps track of all of the "interesting" identifiers and selectors
known in each of the module files. One can perform a fast lookup in
the index to determine which module files will have more information
about entities with a particular name/selector. This information can
help eliminate redundant lookups into module files (a serious
performance problem) and help with creating auto-import/auto-include
Fix-Its.

The global module index is created or updated at the end of a
translation unit that has triggered a (re)build of a module by
scraping all of the .pcm files out of the module cache subdirectory,
so it catches everything. As with module rebuilds, we use the file
system's atomicity to synchronize.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173301 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 22:38:11 +00:00
Douglas Gregor 479633ced7 Factor the trait for lookup into the on-based hash table of
identifiers into two parts: the part that involves dealing with the
key (which can be re-used) and the ASTReader-specific part that
creates the IdentifierInfos. While I'm at it, StringRef'ify this code,
which was using pair<const char*, unsigned>. No functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173283 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 18:53:14 +00:00
Douglas Gregor e0d2066ab8 Make getDefinitiveDeclContext() actually return a DeclContext, as one
would expect, and clean up the return/break inconsistencies. Thanks,
Sebastian!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173171 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22 17:08:30 +00:00
Tim Northover 9ec55f24b8 Switch to APFloat constructor taking fltSemantics.
This change also makes the serialisation store the required semantics,
fixing an issue where PPC128 was always assumed when re-reading a
128-bit value.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173139 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22 09:46:51 +00:00
Douglas Gregor cc71dbee44 Give ModuleFiles an index, so that we can use indexed vectors rather
than DenseMaps and SmallPtrSets for module-visitation data. ~2.6%
speedup for modules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173081 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-21 20:07:12 +00:00
Chris Lattner 125eb3e3b6 ReadSourceManagerBlock is skipping over records that can contain Blobs. Not passing
in a StringRef to bind to them forces them to be unpacked into the Record as individual
bytes.  This is wasteful, but not likely to be measurable in this instance.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173066 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-21 18:28:26 +00:00
Douglas Gregor 8222b8951d Revert r173056; it breaks one of the CodeGen-with-PCH tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173058 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-21 16:52:34 +00:00
Douglas Gregor c44cc015a8 When loading an identifier from an AST file solely for the purpose of
forming the identifier, e.g., as part of a selector or a declaration
name, don't actually deserialize any information about the
identifier. Instead, simply mark it "out-of-date" and we'll load the
the information on demand. 2% speedup on the modules testcase I'm
looking at; should also help PCH.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173056 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-21 16:47:11 +00:00
Douglas Gregor 9cfdc03fe7 When deserializing a declaration, don't look for redeclarations if its
kind indicates that it can never be redeclared. Good for a 1% speedup,
and redeclaration searching drops off the profile.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173054 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-21 16:16:40 +00:00
Douglas Gregor 5a04f9fc2b Introduce a fast path for the ASTReader's name lookup within a
DeclContext. When the DeclContext is of a kind that can only be
defined once and never updated, we limit the search to the module file
that conatins the lookup table. Provides a 15% speedup in one
modules-heavy source file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173050 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-21 15:25:38 +00:00
Guy Benyei e6b9d802fb Implement OpenCL event_t as Clang builtin type, including event_t related OpenCL restrictions (OpenCL 1.2 spec 6.9)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172973 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-20 12:31:11 +00:00
Chris Lattner b3ce35764a update to use the new BitcodeCursor readRecord that takes a StringRef blob parameter,
and adopt "advance" in more places.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172951 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-20 02:38:54 +00:00
Chris Lattner e4e4a88eb6 add back a #include needed on some builders.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172938 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-20 00:57:52 +00:00
Chris Lattner 8f9a1eb6dd finish converting the normal cases in ASTReader to use the new BitstreamCursor APIs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172937 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-20 00:56:42 +00:00
Chris Lattner 99a5af0088 convert some more stuff over to use new cursor APIs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172932 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-20 00:00:22 +00:00
Chris Lattner 88bde50fa3 switch a bunch of ASTReader to use the new BitstreamCursor::advance* methods,
which hide a bunch of private details of the cursor from clients and simplify
their code.  More to come.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172922 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-19 21:39:22 +00:00
Benjamin Kramer e38c339ca4 libclangSerialization also depends on the bitreader.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172910 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-19 19:10:12 +00:00
Argyrios Kyrtzidis dc1088f620 [PCH/Modules] Revert r172843, it caused a module to fail building.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172884 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-19 03:14:56 +00:00
Matt Beaumont-Gay 8dc3c80c3f Remove unused variable
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172862 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-18 22:34:17 +00:00
Argyrios Kyrtzidis f953276b61 [PCH/Modules] Re-apply r172620 and r172629, now with 100% less infinite loops!
Makes sure that a deserialized macro is only added to the preprocessor macro definitions only once.
Unfortunately I couldn't get a reduced test case.

rdar://13016031

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172843 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-18 20:59:01 +00:00
Will Dietz 4f45bc099f [ubsan] Add support for -fsanitize-blacklist
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172808 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-18 11:30:38 +00:00
Douglas Gregor d3b036efdf Revert Clang r172620 and r172629, which caused a hang when building
complicated modules (<rdar://problem/13038265>). Unfortunately, this
un-fixes <rdar://problem/13016031>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172783 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-18 04:34:14 +00:00
Douglas Gregor d329724745 Rework the traversal of Objective-C categories and extensions to
consider (sub)module visibility.

The bulk of this change replaces myriad hand-rolled loops over the
linked list of Objective-C categories/extensions attached to an
interface declaration with loops using one of the four new category
iterator kinds:

  visible_categories_iterator: Iterates over all visible categories
  and extensions, hiding any that have their "hidden" bit set. This is
  by far the most commonly used iterator.

  known_categories_iterator: Iterates over all categories and
  extensions, ignoring the "hidden" bit. This tends to be used for
  redeclaration-like traversals.

  visible_extensions_iterator: Iterates over all visible extensions,
  hiding any that have their "hidden" bit set.

  known_extensions_iterator: Iterates over all extensions, whether
  they are visible to normal name lookup or not.

The effect of this change is that any uses of the visible_ iterators
will respect module-import visibility. See the new tests for examples.

Note that the old accessors for categories and extensions are gone;
there are *Raw() forms for some of them, for those (few) areas of the
compiler that have to manipulate the linked list of categories
directly. This is generally discouraged.

Part two of <rdar://problem/10634711>.
 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172665 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 23:00:23 +00:00
Argyrios Kyrtzidis f7f12646e8 [PCH/Modules] The iterator may become invalidated because a new macro can be added
while deserializing a macro, make sure to copy/move what we need from it.

Fixes clang-x86_64-debian-fast bot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172629 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 17:42:07 +00:00
Argyrios Kyrtzidis 7f69b1ab4f [PCH/Modules] Change how macro [re]definitions are de/serialized.
Previously we would serialize the macro redefinitions as a list, part of
the identifier, and try to chain them together across modules individually
without having the info that they were already chained at definition time.

Change this by serializing the macro redefinition chain and then try
to synthesize the chain parts across modules. This allows us to correctly
pinpoint when 2 different definitions are ambiguous because they came from
unrelated modules.

Fixes bogus "ambiguous expansion of macro" warning when a macro in a PCH
is redefined without undef'ing it first.

rdar://13016031

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172620 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 16:19:38 +00:00
David Greene 644448393e Fix Casting
Make the const_cast explicit to silence a compiler warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172560 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 22:09:43 +00:00
Douglas Gregor b6cbe51723 Implement parsing, AST, (de-)serialization, and placeholder global
metadata for linking against the libraries/frameworks for imported
modules.

The module map language is extended with a new "link" directive that
specifies what library or framework to link against when a module is
imported, e.g.,

  link "clangAST"

or

  link framework "MyFramework"

Importing the corresponding module (or any of its submodules) will
eventually link against the named library/framework.

For now, I've added some placeholder global metadata that encodes the
imported libraries/frameworks, so that we can test that this
information gets through to the IR. The format of the data is still
under discussion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172437 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14 17:21:00 +00:00
Dmitri Gribenko cfa88f8939 Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172323 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-12 19:30:44 +00:00
Douglas Gregor ca2ab45341 Provide Decl::getOwningModule(), which determines the (sub)module in
which a particular declaration resides. Use this information to
customize the "definition of 'blah' must be imported from another
module" diagnostic with the module the user actually has to
import. Additionally, recover by importing that module, so we don't
complain about other names in that module.

Still TODO: coming up with decent Fix-Its for these cases, and expand
this recovery approach for other name lookup failures.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172290 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-12 01:29:50 +00:00
Argyrios Kyrtzidis e8b61cfc0c [PCH] Make the const_cast explicit to silence a compiler warning.
Patch by David Greene.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172262 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-11 22:29:49 +00:00
Richard Smith 5ea6ef4905 Truth in advertising: LocallyScopedExternalDecls actually only contains
external declarations with C language linkage.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172150 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-10 23:43:47 +00:00
Argyrios Kyrtzidis 8169b67197 [PCH] (De)serialize the end location of MacroInfo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171772 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 19:16:23 +00:00
Douglas Gregor 589dae7d52 updateOutOfDateIdentifier() can cause the identifier table to be
rehashed, invaliding the iterator walking through the identifier
table. Separate out the identification of out-of-date identifiers from
updating them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171756 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 16:56:53 +00:00
Argyrios Kyrtzidis 81cc2f1ecd Move the common source locations of CastStmt & DefaultStmt into their base class, SwitchCase.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171483 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-04 18:30:04 +00:00
Argyrios Kyrtzidis ca40f30a20 [PCH/Modules] In ASTReader::completeVisibleDeclsMap, make sure to visit all
modules when getting the decls for a namespace or translation unit.

Otherwise the code-completion results will not be complete.

rdar://12889089

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170596 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-19 22:21:18 +00:00