Commit Graph

3065 Commits

Author SHA1 Message Date
Douglas Gregor 2d9dde0e0f EXTWARNify the warning about unnamed typedefs of enums
llvm-svn: 62766
2009-01-22 16:23:54 +00:00
Mike Stump f7444aa8df Avoid creating .dir files in the installation area.
llvm-svn: 62744
2009-01-22 02:53:03 +00:00
Douglas Gregor e4a0bb7a20 Initial implementation of semantic analysis and ASTs for C99
designated initializers. This implementation should cover all of the
constraints in C99 6.7.8, including long, complex designations and
computing the size of incomplete array types initialized with a
designated initializer. Please see the new test-case and holler if you
find cases where this doesn't work.

There are still some wrinkles with GNU's anonymous structs and
anonymous unions (it isn't clear how these should work; we'll just
follow GCC's lead) and with designated initializers for the members of a
union. I'll tackle those very soon.

CodeGen is still nonexistent, and there's some leftover code in the
parser's representation of designators that I'll also need to clean up.

llvm-svn: 62737
2009-01-22 00:58:24 +00:00
Fariborz Jahanian eee54df5b6 More refactoring of common API to the common class for
the two Next's objc runtimes. More comments.

llvm-svn: 62735
2009-01-22 00:37:21 +00:00
Daniel Dunbar 56493b0d54 Allow creation of "dummy" compile units for debug information.
- Although gross, this is needed currently to ensure that we produce
   well formed debug information (to match pace with the assertions
   being added to DebugInfo in LLVM).

llvm-svn: 62734
2009-01-22 00:09:25 +00:00
Fariborz Jahanian 0b1ccdce88 Moved whole bunch of common APIs to the common class.
No change in functionality.

llvm-svn: 62729
2009-01-21 23:34:32 +00:00
Ted Kremenek 1322ca1364 Combine two branches into one. No functionality change.
llvm-svn: 62727
2009-01-21 22:58:50 +00:00
Ted Kremenek ae54f2f590 Fix <rdar://problem/6512717> by correctly reading the right offset in the token data in PTHLexer::getSourceLocation().
llvm-svn: 62725
2009-01-21 22:41:38 +00:00
Steve Naroff d512956f6f Fix Sema::Owned(ExprResult) to not use a ternary operator. Necessary to work around a Visual Studio compiler bug.
Thanks to Doug Gregor for the suggestion.

llvm-svn: 62723
2009-01-21 22:32:33 +00:00
Ted Kremenek 16fbfe699e Static Analyzer: Replace LiveSymbols/DeadSymbols sets with a new object called "SymbolReaper". Right now it just consolidates the two and cleans up some client code, but shortly it will be used to enable "lazy computation" of live symbols for use with RegionStore.
llvm-svn: 62722
2009-01-21 22:26:05 +00:00
Fariborz Jahanian 279eda6275 Refactoring ObjC Next's runtime classes in preparation for
the new ObjC's abi.

llvm-svn: 62721
2009-01-21 22:04:16 +00:00
Chris Lattner e387d9ed5b Inline ParseOptionalTypeSpecifier into ParseDeclarationSpecifiers.
This avoids call overhead and extraneous switches when parsing
very simple declspecs like "int" "void" etc, which are pretty common :)

llvm-svn: 62711
2009-01-21 19:48:37 +00:00
Chris Lattner 80261b30b7 revert the gnu objc patches, they regress codegen-gnu.m
llvm-svn: 62708
2009-01-21 19:37:47 +00:00
Chris Lattner 1d09218b98 switch from getTypeAtIndex to getElementType. It is non-virtual
and more idiomatic.

llvm-svn: 62705
2009-01-21 19:21:36 +00:00
Chris Lattner 78ecd4f61e ParseOptionalTypeSpecifier should consume a token if it returns true.
llvm-svn: 62704
2009-01-21 19:19:26 +00:00
Chris Lattner d1760b7837 Fix objc type conversion issues with the GNU runtime, patch by
David Chisnall

llvm-svn: 62703
2009-01-21 18:52:19 +00:00
Chris Lattner 3029b35faa merge two checks for identifiers in the pth loop into one.
llvm-svn: 62677
2009-01-21 07:50:06 +00:00
Chris Lattner 8256b970a3 a trivial micro optimization to save a load.
llvm-svn: 62676
2009-01-21 07:45:14 +00:00
Chris Lattner ad89ec013f 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.

llvm-svn: 62675
2009-01-21 07:43:11 +00:00
Chris Lattner 66c6562e24 silence a couple unused variable 'result' warnings.
llvm-svn: 62674
2009-01-21 07:35:26 +00:00
Ted Kremenek 8d6c828728 Don't crash on empty PTH files. This fixes <rdar://problem/6512714>.
llvm-svn: 62673
2009-01-21 07:34:28 +00:00
Chris Lattner c950296006 really we only need on Read24!
llvm-svn: 62672
2009-01-21 07:28:57 +00:00
Chris Lattner 47def9787e revert my previous patch, it assumed endianness.
llvm-svn: 62671
2009-01-21 07:21:56 +00:00
Chris Lattner a74f7cbb9d minor cleanups: now that tokens are 4-byte aligned in a PTH
file, just load them directly as ints.

llvm-svn: 62668
2009-01-21 07:06:08 +00:00
Ted Kremenek fe32cc0ba6 Get RegionStore to work with the retain/release checker and its test cases.
Because the RegionStore can reason about values beyond the reasoning power of BasicStore, this patch splits some of the test cases for the retain/release checker to have versions that are handled by RegionStore (more warnings) and BasicStore (less warnings).

llvm-svn: 62667
2009-01-21 06:57:53 +00:00
Anders Carlsson dc6ceca4ba Fix an inline asm sema bug that I introduced.
llvm-svn: 62666
2009-01-21 06:27:20 +00:00
Chris Lattner d9773516e7 Don't look up decls with no name (such as parameters and unnamed tagged types),
this removes 4266 calls to LookupDecl.

llvm-svn: 62662
2009-01-21 02:38:50 +00:00
Anders Carlsson 43c2bab6d3 Fix more bugs I discovered
llvm-svn: 62656
2009-01-21 01:49:39 +00:00
Ted Kremenek 13747167ca Static Analyzer: When generating plists for errors reports, generate one plist file per translation unit that contains all of the diagnostics.
llvm-svn: 62647
2009-01-21 00:42:24 +00:00
Fariborz Jahanian 4b4c826999 Commented objective-c's metadata types. Minor clean up.
No change in functionality.

llvm-svn: 62646
2009-01-21 00:39:53 +00:00
Steve Naroff f6009ed969 Convert expressions over to Sebastian's spiffy ASTContext::new() operator.
No functionality change.

llvm-svn: 62640
2009-01-21 00:14:39 +00:00
Ted Kremenek 52f73cad4a 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.

llvm-svn: 62636
2009-01-20 23:28:34 +00:00
Sebastian Redl 20614a7c14 Provide a placement new taking an ASTContext argument.
This allows more concise syntax when allocating an object using the ASTContext's allocator.
Convert a few allocations to this operator to for test purposes.

llvm-svn: 62623
2009-01-20 22:23:13 +00:00
Anders Carlsson 7322ea25a5 Fix some errors I noticed
llvm-svn: 62620
2009-01-20 21:51:44 +00:00
Chris Lattner 5742c1edc4 Fix a crash Anders' was seeing due to free'ing an invalid pointer
caused by my previous commit.

llvm-svn: 62613
2009-01-20 21:06:38 +00:00
Steve Naroff e5564628b4 Convert more exprs to use ASTContext's Allocator.
When using a BumpPtrAllocator, this reduces malloc overhead from 2.2->1.9% (for Cocoa.h).

At this point, malloc() has dropped the fourth most expensive routine (behind Preprocessor::HandleIdentifier()).

llvm-svn: 62612
2009-01-20 21:06:31 +00:00
Douglas Gregor 82c1fe1cfc Use the ASTContext's allocator for FunctionTypeNoProto and TypeOfExpr
llvm-svn: 62611
2009-01-20 21:02:13 +00:00
Anders Carlsson 224fca8982 Improvements to Sema of asm statements. Fixes <rdar://problem/6156893>
llvm-svn: 62609
2009-01-20 20:49:22 +00:00
Fariborz Jahanian 2f85a6450a Detailed documentation for encoding of properties and a test
case.

llvm-svn: 62607
2009-01-20 20:04:12 +00:00
Steve Naroff 5faaef7692 Allocate expresssions through ASTContext (still more work to do).
Add debug hook to DeclContext.

llvm-svn: 62605
2009-01-20 19:53:53 +00:00
Fariborz Jahanian 218c630171 Improving on encoding of objective-c's property types. More to come.
llvm-svn: 62601
2009-01-20 19:14:18 +00:00
Chris Lattner 1ce41edd8d Optimize Declarator to avoid malloc/free traffic for the argument list of a
function DeclaratorChunk in common cases.  This uses a fixed array in 
Declarator when it is small enough for the first function declarator chunk
in a declarator.

This eliminates all malloc/free traffic from DeclaratorChunk::getFunction
when running on Cocoa.h except for five functions: signal/bsd_signal/sigset,
which have multiple Function DeclChunk's, and 
CFUUIDCreateWithBytes/CFUUIDGetConstantUUIDWithBytes, which take more than
16 arguments.

This patch was pair programmed with Steve.

llvm-svn: 62599
2009-01-20 19:11:22 +00:00
Eli Friedman ddea0ade30 Slight cleanup, and fix for va_arg on architectures where va_list is a
struct.

llvm-svn: 62585
2009-01-20 17:46:04 +00:00
Eli Friedman 8687a09fd0 Do codegen correctly for va_start/end/copy on architectures where
va_list is a struct, like x86-64.

If anyone has a better idea for how to do the check in the if 
statements, suggestions are welcome.

llvm-svn: 62582
2009-01-20 17:25:25 +00:00
Douglas Gregor 0da5ac8499 Rename DeclContext::insert to DeclContext::makeDeclVisibleInContext and document both it and DeclContext::addDecl properly
llvm-svn: 62581
2009-01-20 16:54:50 +00:00
Eli Friedman 08c5dabf1b Fix for PR3350: add special-casing for "references" to va_lists in
builtins.

Also, a minor tweak to va_copy for consistency.

llvm-svn: 62574
2009-01-20 07:46:22 +00:00
Douglas Gregor 00447933f6 Remove the TopLevelDecls from TranslationUnit, since all of those decls are owned by the ASTContext's TranslationUnitDecl. There are definitely some leaking Decls now that I'll tackle tomorrow
llvm-svn: 62568
2009-01-20 04:25:11 +00:00
Douglas Gregor 6e6ad602e5 Remove ScopedDecl, collapsing all of its functionality into Decl, so
that every declaration lives inside a DeclContext.

Moved several things that don't have names but were ScopedDecls (and,
therefore, NamedDecls) to inherit from Decl rather than NamedDecl,
including ObjCImplementationDecl and LinkageSpecDecl. Now, we don't
store empty DeclarationNames for these things, nor do we try to insert
them into DeclContext's lookup structure.

The serialization tests are temporarily disabled. We'll re-enable them
once we've sorted out the remaining ownership/serialiazation issues
between DeclContexts and TranslationUnion, DeclGroups, etc.

llvm-svn: 62562
2009-01-20 01:17:11 +00:00
Daniel Dunbar 9789e1ebcb Update for new SourceLocation API.
llvm-svn: 62556
2009-01-20 01:06:30 +00:00
Ted Kremenek e5fe617e2b Dead stores checker: Fix <rdar://problem/6506065> by being more selective when say that a store is dead even though the computed value is used in the enclosing expression.
llvm-svn: 62552
2009-01-20 00:47:45 +00:00