Ted Kremenek [Fri, 30 Jan 2009 21:35:30 +0000 (21:35 +0000)]
Fix horrible non-termination bug in LiveVariables. The issue was that
the liveness state of block-level expressions could oscillate because
of two issues:
- The initial value before a merge was not always set to "Top"
- The set of live block-level expressions is a union, not an intersection
Chris Lattner [Fri, 30 Jan 2009 17:41:53 +0000 (17:41 +0000)]
" Attached is a patch for TextDiagnosticPrinter that adds an optional
parameter that allows users to omit the printing of the source
location on a diagnostic. So basically it would omit the "abc.c:5:1: "
at the beginning of the line."
Douglas Gregor [Fri, 30 Jan 2009 17:31:00 +0000 (17:31 +0000)]
Switch Type::isAggregateType to use the C++ definition of "aggregate
type" rather than the C definition. We do this because both C99 and
Clang always use "aggregate type" as "aggregate or union type", and
the C++ definition includes union types.
Douglas Gregor [Fri, 30 Jan 2009 01:04:22 +0000 (01:04 +0000)]
Eliminated LookupCriteria, whose creation was causing a bottleneck for
LookupName et al. Instead, use an enum and a bool to describe its
contents.
Optimized the C/Objective-C path through LookupName, eliminating any
unnecessarily C++isms. Simplify IdentifierResolver::iterator, removing
some code and arguments that are no longer used.
Eliminated LookupDeclInScope/LookupDeclInContext, moving all callers
over to LookupName, LookupQualifiedName, or LookupParsedName, as
appropriate.
All together, I'm seeing a 0.2% speedup on Cocoa.h with PTH and
-disable-free. Plus, we're down to three name-lookup routines.
Ted Kremenek [Fri, 30 Jan 2009 00:08:43 +0000 (00:08 +0000)]
Fix a couple bugs:
- NonLoc::MakeVal() would use sizeof(unsigned) (literally) instead of consulting
ASTContext for the size (in bits) of 'int'. While it worked, it was a
conflation of concepts and using ASTContext.IntTy is 100% correct.
- RegionStore::getSizeInElements() no longer assumes that a VarRegion has the
type "ConstantArray", and handles the case when uses use ordinary variables
as if they were arrays.
- Fixed ElementRegion::getRValueType() to just return the rvalue type of its
"array region" in the case the array didn't have ArrayType.
- All of this fixes <rdar://problem/6541136>
Daniel Dunbar [Thu, 29 Jan 2009 23:54:06 +0000 (23:54 +0000)]
ccc: Embrace destiny as a clang compiler driver.
This redoes the default mode that ccc runs in w.r.t. using clang. Now
ccc defaults to always using clang for any task clang can
handle. However, the following options exist to tweak this behavior:
-ccc-no-clang: Don't use clang at all for compilation (still used for
static analysis).
-ccc-no-clang-cxx: Don't use clang for C++ and Objective-C++ inputs.
-ccc-no-clang-cpp: Don't use clang as a preprocessor.
-ccc-clang-archs <archs>: If present, only use clang for the given
comma separated list of architectures. This only works on Darwin for
now.
Note that all -ccc options must be first on the command line.
Ted Kremenek [Thu, 29 Jan 2009 22:45:13 +0000 (22:45 +0000)]
retain/release checker: When generating summaries for CF/CG functions, allow arguments to "escape" if they are passed to a function containing the terms "InsertValue", "SetValue", or "AddValue". This fixes <rdar://problem/6539791>.
Steve Naroff [Thu, 29 Jan 2009 18:09:31 +0000 (18:09 +0000)]
Hack Sema::LookupDeclInScope() to avoid calling Sema::LookupName() when parsing C/ObjC.
This results in a 1.7% improvement for "Cocoa.h". If we can figure out how to return a "Decl *", rather than a Sema::LookupResult(), we will likely bump the speedup from 1.7%->2.5%. I verified this, however couldn't get it to work without breaking a fair number of C++ test cases. Will discuss with Doug offline.
Douglas Gregor [Thu, 29 Jan 2009 17:44:32 +0000 (17:44 +0000)]
Introduce a new expression node, ImplicitValueInitExpr, that
represents an implicit value-initialization of a subobject of a
particular type. This replaces the (ab)use of CXXZeroValueInitExpr
within initializer lists for the "holes" that occur due to the use of
C99 designated initializers.
The new test case is currently XFAIL'd, because CodeGen's
ConstExprEmitter (in lib/CodeGen/CGExprConstant.cpp) needs to be
taught to value-initialize when it sees ImplicitValueInitExprs.
Daniel Dunbar [Thu, 29 Jan 2009 09:42:07 +0000 (09:42 +0000)]
x86_64 ABI: Handle fields / complex components which straddle
eightbyte boundaries.
- Getting harder to test now that we handle cases gcc & llvm-gcc get
wrong ( { _Complex char; _Complex int; } is a good example). :)
Daniel Dunbar [Thu, 29 Jan 2009 08:13:58 +0000 (08:13 +0000)]
x86_64 ABI: Implement classification for records.
- This is my best initial guess at what the "spec" means, although it is not
particularly clear on a number of points. Will refine through testing.
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.