Chris Lattner [Thu, 29 Jan 2009 05:10:57 +0000 (05:10 +0000)]
fix an absolutely inscrutible gcc 4.0 error:
llvm[0]: Compiling SemaInit.cpp for Debug build
SemaInit.cpp:171: error: ‘InitListChecker’ has not been declared
SemaInit.cpp:171: error: ISO C++ forbids declaration of ‘InitListChecker’ with no type
SemaInit.cpp: In function ‘int InitListChecker(clang::Sema*, clang::InitListExpr*, clang::QualType&)’:
SemaInit.cpp:172: error: ‘hadError’ was not declared in this scope
SemaInit.cpp:173: error: ‘SemaRef’ was not declared in this scope
SemaInit.cpp:177: error: ‘FullyStructuredList’ was not declared in this scope
Daniel Dunbar [Thu, 29 Jan 2009 01:32:56 +0000 (01:32 +0000)]
Add folding for complex mul and fix some major bugs in complex float
evaluation (alternate part of real/imag init was being set to 3 not 0
because the wrong APFloat constructor was being called).
- Test cases coming once some more support is in.
Douglas Gregor [Thu, 29 Jan 2009 00:39:20 +0000 (00:39 +0000)]
Eliminate infinite looping in a wacky case with designated initializers. Simplifies (somewhat) the actually checking of the initializer expression following the designators
Douglas Gregor [Wed, 28 Jan 2009 23:36:17 +0000 (23:36 +0000)]
Improvements to code-generation and semantic analysis of designated
initializers.
- We now initialize unions properly when a member other than the
first is named by a designated initializer.
- We now provide proper semantic analysis and code generation for
GNU array-range designators *except* that side effects will occur
more than once. We warn about this.
Daniel Dunbar [Wed, 28 Jan 2009 22:24:07 +0000 (22:24 +0000)]
Implement basic _Complex integer constant folding.
- Merged into single ComplexEvaluator, these share too much logic to
be worth splitting for float/int (IMHO). Will split on request.
Douglas Gregor [Wed, 28 Jan 2009 21:54:33 +0000 (21:54 +0000)]
Code generation support for C99 designated initializers.
The approach I've taken in this patch is relatively straightforward,
although the code itself is non-trivial. Essentially, as we process
an initializer list we build up a fully-explicit representation of the
initializer list, where each of the subobject initializations occurs
in order. Designators serve to "fill in" subobject initializations in
a non-linear way. The fully-explicit representation makes initializer
lists (both with and without designators) easy to grok for codegen and
later semantic analyses. We keep the syntactic form of the initializer
list linked into the AST for those clients interested in exactly what
the user wrote.
Known limitations:
- Designating a member of a union that isn't the first member may
result in bogus initialization (we warn about this)
- GNU array-range designators are not supported (we warn about this)
Ted Kremenek [Wed, 28 Jan 2009 21:44:40 +0000 (21:44 +0000)]
retain/release checker: Always generate an "autorelease" summary for an "autorelease" message, and have the summary processing logic treat it as a no-op in GC mode. This change is motivated to encode more of the semantics in the summaries themselves for eventual better diagnostics.
Sebastian Redl [Wed, 28 Jan 2009 18:33:18 +0000 (18:33 +0000)]
Implement pointer to member handling in static_cast.
Fix a stupid mistake in UnwrapSimilarPointers that made any two member pointers compatible as long as the pointee was the same.
Make a few style corrections as suggested by Chris.
Steve Naroff [Wed, 28 Jan 2009 16:09:22 +0000 (16:09 +0000)]
Remove 'NamespaceNameOnly' argument to Sema::LookupDecl(). It is unused.
Even though Sema::LookupDecl() is deprecated, it's still used all over the place. Simplifying the interface will make it easier to understand/optimize/convert.
Steve Naroff [Wed, 28 Jan 2009 15:51:12 +0000 (15:51 +0000)]
Remove 'enableLazyBuiltinCreation' argument to Sema::LookupDecl(). It is unused.
Even though Sema::LookupDecl() is deprecated, it's still used all over the place. Simplifying the interface will make it easier to understand/optimize/convert.
Ted Kremenek [Wed, 28 Jan 2009 05:56:51 +0000 (05:56 +0000)]
retain/release checker: Embed an "object type" into the RetEffect/RetVal objects to help distinguish between Objective-C and Core Foundation objects (for better diagnostics).
Ted Kremenek [Wed, 28 Jan 2009 04:29:29 +0000 (04:29 +0000)]
Patch by Alexei Svitkine: Refactor Sema::ParseAST API to allow clients to pass as an argument a TranslationUnit object whose contents live beyond the call to ParseAST.
Steve Naroff [Tue, 27 Jan 2009 22:08:43 +0000 (22:08 +0000)]
Convert types over to placement new() that takes an ASTContext.
Also changed FunctionTypeProto to be allocated with 8-byte alignment (noticed by Doug). I couldn't think of any reason to allocate on 16-byte boundaries. If anyone remembers why we were doing this, let me know!
Steve Naroff [Tue, 27 Jan 2009 21:25:57 +0000 (21:25 +0000)]
Remove many references to ASTContext::getAllocator(), replacing them with calls to the recently added placement new (which uses ASTContext's allocator for memory). Also added ASTContext::Deallocate().
This will simplify runtime replacement of ASTContext's allocator. Keeping the allocator private (and removing getAllocator() entirely) is also goodness.
Chris Lattner [Tue, 27 Jan 2009 18:30:58 +0000 (18:30 +0000)]
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.
Ted Kremenek [Tue, 27 Jan 2009 18:29:03 +0000 (18:29 +0000)]
Fix bug in BasicStore::getLValueElement where if the base of an array subscript expression was an ElementRegion we stacked another ElementRegion on top of that.
Chris Lattner [Tue, 27 Jan 2009 18:08:34 +0000 (18:08 +0000)]
add a new "getPreferredTypeAlign" method to return the preferred alignment
of a type. The implementation is currently something of a hack, but is
sufficient for now and allows clients to be built on it.
Chris Lattner [Tue, 27 Jan 2009 07:57:44 +0000 (07:57 +0000)]
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.
Ted Kremenek [Tue, 27 Jan 2009 01:53:39 +0000 (01:53 +0000)]
PathDiagnostics:
- Add the distinction between the 'bug type' and the 'bug description'
HTMLDiagnostics:
- Output the bug type field as HTML comments
scan-build:
- Use the bug type field instead of the bug description for the HTML table.
- Radar filing now automatically picks up the bug description in the title (addresses <rdar://problem/6265970>)
Ted Kremenek [Tue, 27 Jan 2009 00:01:05 +0000 (00:01 +0000)]
PTH: Use Token::setLiteralData() to directly store a pointer to cached spelling data in the PTH file. This removes a ton of code for looking up spellings using sourcelocations in the PTH file. This simplifies both PTH-generation and reading.
Performance impact for -fsyntax-only on Cocoa.h (with Cocoa.h in the PTH file):
- PTH generation time improves by 5%
- PTH reading improves by 0.3%.