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

154 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner 19e8e2cffc next round of diagnostics cleanups, moving some
diags around, eliminating #defines, etc.  Patch by
Anders Johnsen!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63318 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 17:46:13 +00:00
Chris Lattner 88eccaf06f Fix -Wimplicit-function-declaration, which required some refactoring and
changes in various diagnostics code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63282 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 06:55:46 +00:00
Ted Kremenek 3632a35e81 Add method FullSourceLoc::getBufferData().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63229 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 20:46:26 +00:00
Chris Lattner 778601f8d3 long long and double have 64-bit alignment on x86-64.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63191 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 06:58:19 +00:00
Ted Kremenek 7536889333 On Windows use a BumpPtrAllocator for the UniqueFileContainer's StringMap.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63162 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 01:01:07 +00:00
Ted Kremenek f3eb9219cf FileManager: Use a BumpPtrAllocator for the StringMaps DirEntries and FileEntries.
Performance impact (clang -fsyntax-only INPUTS/Cocoa_h.m):
  non-PTH: 0.4% improvement
  PTH: 0.8% improvement



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63159 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 00:44:12 +00:00
Ted Kremenek cb8d58b828 Add a some comments to designate Windows-specific/Unix-specific code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63157 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 00:27:31 +00:00
Anders Carlsson 03eb543cf7 If an input constraint refers to an output constraint, it should have the same constraint info as the output constraint. Fixes PR3417
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63127 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 20:38:24 +00:00
Chris Lattner 20c6b3b85e Split the single monolithic DiagnosticKinds.def file into one
.def file for each library.  This means that adding a diagnostic
to sema doesn't require all the other libraries to be rebuilt.

Patch by Anders Johnsen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63111 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 18:30:58 +00:00
Chris Lattner b9c3f966b1 Introduce a new PresumedLoc class to represent the concept of a location
as reported to the user and as manipulated by #line.  This is what __FILE__,
__INCLUDE_LEVEL__, diagnostics and other things should follow (but not 
dependency generation!).  

This patch also includes several cleanups along the way: 

- SourceLocation now has a dump method, and several other places 
  that did similar things now use it.
- I cleaned up some code in AnalysisConsumer, but it should probably be
  simplified further now that NamedDecl is better.
- TextDiagnosticPrinter is now simplified and cleaned up a bit.

This patch is a prerequisite for #line, but does not actually provide 
any #line functionality.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63098 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 07:57:44 +00:00
Chris Lattner 08c375cd52 make -print-stats print stats about the amount of the SLoc
address space we used up.  Some interesting data:

For c99-intconst-1.c:
6912762 SLocEntry's allocated, 25592386B of Sloc address space used.

For cocoa.h:
26469 SLocEntry's allocated, 10278752B of Sloc address space used.

For carbon.h:
27364 SLocEntry's allocated, 12398141B of Sloc address space used.

Clearly 2G of sloc address space should be enough for anyone?!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63093 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 05:22:43 +00:00
Chris Lattner e957f53745 add SparcV8 asm register info support. Patch by Ben Lickly!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63085 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 01:58:38 +00:00
Chris Lattner 3c125576d9 now that everything properly handles multiply instantiated
source locations, allow creation of them.  We can now say that
a token was instantiated here, then here, then here.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63034 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 20:08:26 +00:00
Chris Lattner addb797ca2 make getInstantiationLoc and getSpellingLoc handle multiply instantiated
locations, and move the slow case out of line.  No perf change on cocoa.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63033 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 20:04:19 +00:00
Chris Lattner bcd1a1b5af fix a negated conditional in getDecomposedInstantiationLocSlowCase,
which I think is rdar://6527005, and make getDecomposedSpellingLocSlowCase
handle nested spelling locations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63030 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 19:41:58 +00:00
Chris Lattner 5b9a504720 start plumbing together the line table information. So far we just
unique the Filenames in #line directives, assigning them UIDs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63010 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 07:57:50 +00:00
Chris Lattner 987cd3da36 Lazily paging in file contents is a big win for PTH, strip out the old
testing code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63006 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 07:37:49 +00:00
Chris Lattner de7aeefc55 Check in the long promised SourceLocation rewrite. This lays the
ground work for implementing #line, and fixes the "out of macro ID's" 
problem.

There is nothing particularly tricky about the code, other than the
very performance sensitive SourceManager::getFileID() method.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62978 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 00:43:02 +00:00
Anders Carlsson 79bc64ceb2 Handle the 'e' constraint. Fixes PR3385
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62923 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-24 18:03:09 +00:00
Ted Kremenek cabe66811f Added virtual method DiagnosticClient::IncludeInDiagnosticCounts(). This is used by Diagnostics to determine if a diagnostic sent to a given DiagnosticClient should be included in the count of diagnostics. The default implementation of this method returns 'true'.
Implemented DiagCollector::IncludeInDiagnosticCounts() to return 'false' so that the batching of diagnostics for use with BugReporter doesn't mess up the count of real diagnostics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62873 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 20:28:53 +00:00
Chris Lattner 6a170eb3ea Add a bit to IdentifierInfo that acts as a simple predicate which
tells us whether Preprocessor::HandleIdentifier needs to be called.
Because this method is only rarely needed, this saves a call and a
bunch of random checks.  This drops the time in HandleIdentifier 
from 3.52ms to .98ms on cocoa.h on my machine.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62675 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-21 07:43:11 +00:00
Ted Kremenek ea9c26b3db Fix: <rdar://problem/6510344> [pth] PTH slows down regular lexer considerably (when it has substantial work)
Changes to IdentifierTable:
- High-level summary: StringMap never owns IdentifierInfos.  It just
references them.
- The string map now has StringMapEntry<IdentifierInfo*> instead of
  StringMapEntry<IdentifierInfo>.  The IdentifierInfo object is
  allocated using the same bump pointer allocator as used by the
  StringMap.

Changes to IdentifierInfo:
- Added an extra pointer to point to the
  StringMapEntry<IdentifierInfo*> in the string map.  This pointer
  will be null if the IdentifierInfo* is *only* used by the PTHLexer
  (that is it isn't in the StringMap).

Algorithmic changes:
- Non-PTH case:
   IdentifierInfo::get() will always consult the StringMap first to
   see if we have an IdentifierInfo object.  If that StringMapEntry
   references a null pointer, we allocate a new one from the BumpPtrAllocator
   and update the reference in the StringMapEntry.
- PTH case:
   We do the same lookup as with the non-PTH case, but if we don't get
   a hit in the StringMap we do a secondary lookup in the PTHManager for
   the IdentifierInfo.  If we don't find an IdentifierInfo we create a
   new one as in the non-PTH case.  If we do find and IdentifierInfo
   in the PTHManager, we update the StringMapEntry to refer to it so
   that the IdentifierInfo will be found on the next StringMap lookup.
   This way we only do a binary search in the PTH file at most once
   for a given IdentifierInfo.  This greatly speeds things up for source
   files containing a non-trivial amount of code.

Performance impact:
   While these changes do add some extra indirection in
   IdentifierTable to access an IdentifierInfo*, I saw speedups even
   in the non-PTH case as well.

   Non-PTH: For -fsyntax-only on Cocoa.h, we see a 6% speedup.
   PTH (with Cocoa.h in token cache): 11% speedup.

   I also did an experiment where we did -fsyntax-only on a source file
   including a large header and Cocoa.h, but the token cache did not
   contain the larger header.  For this file, we were seeing a performance
   *regression* when using PTH of 3% over non-PTH.  Now we are seeing
   a performance improvement of 9%!

Tests:
   The serialization tests are now failing.  I looked at this extensively,
   and I my belief is that this change is unmasking a bug rather than
   introducing a new one.  I have disabled the serialization tests for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62636 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-20 23:28:34 +00:00
Chris Lattner a11d617933 Rename SourceManager::getCanonicalFileID -> getFileID. There is
no longer such thing as a non-canonical FileID.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62499 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-19 07:46:45 +00:00
Chris Lattner 2fa3ec888a remove the public SourceManager::getContentCacheForLoc method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62497 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-19 07:40:40 +00:00
Chris Lattner b21e5a0fdd remove the SourceManager:: and FullSourceLoc::getFileEntryForLoc methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62496 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-19 07:36:42 +00:00
Chris Lattner 31530bae78 SourceManager::getBufferData(SourceLocation) is dead, delete it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62495 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-19 07:32:13 +00:00
Chris Lattner a90a4d4a0a some minor cleanups to SourceManager, and eliminate the
SourceManager::getBuffer(SourceLocation) method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62494 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-19 07:30:29 +00:00
Anders Carlsson 775841fd76 Handle the 'X' constraint. Fixes <rdar://problem/6504897>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62446 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-18 02:12:04 +00:00
Anders Carlsson 42e1ee0702 Add sema support for symbolic names in inline asm statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62441 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-18 01:56:57 +00:00
Nate Begeman ca0134259b Fit in 80 cols
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62439 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-18 01:08:03 +00:00
Nate Begeman 22b9d5a1fd Allow targets to override IntMaxTWidth
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62434 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17 23:56:13 +00:00
Anders Carlsson 45b050e72d Change TargetInfo::validateInputConstraint to take begin/end name iterators instead of the number of outputs. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62433 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17 23:36:15 +00:00
Chris Lattner 3b4d5e955e Rename SourceLocation::getFileID to getChunkID, because it returns
the chunk ID not the file ID.  This exposes problems in 
TextDiagnosticPrinter where it should have been using the canonical
file ID but wasn't.  Fix these along the way.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62427 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17 08:45:21 +00:00
Chris Lattner 2b2453a7d8 this massive patch introduces a simple new abstraction: it makes
"FileID" a concept that is now enforced by the compiler's type checker
instead of yet-another-random-unsigned floating around.

This is an important distinction from the "FileID" currently tracked by
SourceLocation.  *That* FileID may refer to the start of a file or to a
chunk within it.  The new FileID *only* refers to the file (and its 
#include stack and eventually #line data), it cannot refer to a chunk.

FileID is a completely opaque datatype to all clients, only SourceManager
is allowed to poke and prod it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17 06:22:33 +00:00
Chris Lattner 05816591ec make "ContentCache::Buffer" mutable to avoid a const_cast.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62403 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17 03:54:16 +00:00
Chris Lattner a50bd54164 Make FullSourceLoc derive from SourceLocation instead of
containing one.  Containment is generally better than derivation,
but in this case FullSourceLoc really 'isa' SourceLocation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62375 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 23:03:56 +00:00
Chris Lattner 4abb87ef14 elimiante FullSourceLoc::getCanonicalFileID
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62374 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 22:59:51 +00:00
Chris Lattner 0cf7bb937d remove FullSourceLoc::isFileID
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62371 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 22:53:56 +00:00
Chris Lattner f7cf85b330 more SourceLocation lexicon change: instead of referring to the
"logical" location, refer to the "instantiation" location.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62316 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 07:36:28 +00:00
Chris Lattner 88054dee04 rename "virtual location" of a macro to "instantiation location".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62315 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 07:15:35 +00:00
Chris Lattner df7c17a8d0 Change some terminology in SourceLocation: instead of referring to
the "physical" location of tokens, refer to the "spelling" location.
This is more concrete and useful, tokens aren't really physical objects!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62309 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 07:00:02 +00:00
Ted Kremenek 72b1b15ee8 IdentifierInfo:
- IdentifierInfo can now (optionally) have its string data not be
  co-located with itself.  This is for use with PTH.  This aspect is a
  little gross, as getName() and getLength() now make assumptions
  about a possible alternate representation of IdentifierInfo.
  Perhaps we should make IdentifierInfo have virtual methods?

IdentifierTable:
- Added class "IdentifierInfoLookup" that can be used by
  IdentifierTable to perform "string -> IdentifierInfo" lookups using
  an auxilliary data structure.  This is used by PTH.
- Perform tests show that IdentifierTable::get() does not slow down
  because of the extra check for the IdentiferInfoLookup object (the
  regular StringMap lookup does enough work to mitigate the impact of
  an extra null pointer check).
- The upshot is that now that some IdentifierInfo objects might be
  owned by the IdentiferInfoLookup object.  This should be reviewed.

PTH:
- Modified PTHManager::GetIdentifierInfo to *not* insert entries in
  IdentifierTable's string map, and instead create IdentifierInfo
  objects on the fly when mapping from persistent IDs to
  IdentifierInfos.  This saves a ton of work with string copies,
  hashing, and StringMap lookup and resizing.  This change was
  motivated because when processing source files in the PTH cache we
  don't need to do any string -> IdentifierInfo lookups.
- PTHManager now subclasses IdentifierInfoLookup, allowing clients of
  IdentifierTable to transparently use IdentifierInfo objects managed
  by the PTH file.  PTHManager resolves "string -> IdentifierInfo"
  queries by doing a binary search over a sorted table of identifier
  strings in the PTH file (the exact algorithm we use can be changed
  as needed).

These changes lead to the following performance changes when using PTH on Cocoa.h:
- fsyntax-only: 10% performance improvement
- Eonly: 30% performance improvement


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62273 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-15 18:47:46 +00:00
Anders Carlsson 0e936db474 Make sure to initialize the ConstraintInfo to 0
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62068 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-12 02:15:29 +00:00
Ted Kremenek 5b034ad3ec SourceManager: Implement "lazy" creation of MemBuffers for source files.
- Big Idea:
   Source files are now mmaped when ContentCache::getBuffer() is first called.
   While this doesn't change the functionality when lexing regular source files,
   it can result in source files not being paged in when using PTH.

- Performance change:
  - No observable difference (-fsyntax-only/-Eonly) on Cocoa.h when doing
    regular source lexing.
  - No observable time difference (-fsyntax-only/-Eonly) on Cocoa.h when using
    PTH. We do observe, however, a reduction of 279K in memory mapped source
    code (3% reduction). The majority of pages from Cocoa.h (and friends) are
    still being pulled in, however, because any literal will cause
    Preprocessor::getSpelling() to be called (causing the source for the file to
    get pulled in). The next possible optimization is to cache literal strings
    in the PTH file to avoid the need for the original header sources entirely.

- Right now there is a preprocessor directive to toggle between "lazy" and
  "eager" creation of MemBuffers. This is not permanent, and is there in the
  short term to just test additional optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61827 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-06 22:43:04 +00:00
Ted Kremenek c16c208e85 Misc changes to SourceManager::ContentCache:
- 'Buffer' is now private and must be accessed via 'getBuffer()'.
   This paves the way for lazily mapping in source files on demand.
- Added 'getSize()' (which gets the size of the content without
   necessarily accessing the MemBuffer) and 'getSizeBytesMapped()'.
- Modifed SourceManager to use these new methods.  This reduces the
  number of places that actually access the MemBuffer object for a file
  to those that actually look at the character data.

These changes result in no performance change for -fsyntax-only on Cocoa.h.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61782 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-06 01:55:26 +00:00
Chris Lattner ae0ee03fd9 instead of forcing blocks on by default, make them default to off, but let
specific targets default them to on.  Default blocks to on on 10.6 and later.
Add a -fblocks option that allows the user to override the target's default.
Use -fblocks in the various testcases that use blocks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60563 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 23:20:07 +00:00
Chris Lattner 8fc4dfb30e replace useNeXTRuntimeAsDefault with a generic hook that allows targets
to specify their default language options.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60561 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 22:54:33 +00:00
Sebastian Redl e206532197 Fix order of evaluation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60160 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 07:28:14 +00:00
Chris Lattner 077bf5e2f4 Rename Selector::getName() to Selector::getAsString(), and add
a new NamedDecl::getAsString() method.

Change uses of Selector::getName() to just pass in a Selector 
where possible (e.g. to diagnostics) instead of going through
an std::string.

This also adds new formatters for objcinstance and objcclass
as described in the dox.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59933 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 03:33:13 +00:00
Chris Lattner 08631c5fa0 Convert IdentifierInfo's to be printed the same as DeclarationNames
with implicit quotes around them.  This has a bunch of follow-on 
effects and requires tweaking to a whole lot of code.  This causes
a regression in two tests (xfailed) by causing it to emit things like:

  Line 10: duplicate interface declaration for category 'MyClass1' ('Category1')

instead of:

  Line 10: duplicate interface declaration for category 'MyClass1(Category1)'

I will fix this in a follow-up commit.

As part of this, I had to start switching stuff to use ->getDeclName() instead
of Decl::getName() for consistency.  This is good, but I was planning to do this
as an independent patch.  There will be several follow-on patches
to clean up some of the mess, but this patch is already too big.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59917 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23 21:45:46 +00:00