Daniel Dunbar [Wed, 29 Oct 2008 22:36:39 +0000 (22:36 +0000)]
NeXT: Emit protocol objects lazily.
- That is, the metadata for a protocol is only emitted if that
protocol is actually used in the translation unit. This is
important because Objective-C headers frequently contain a large
number of protocol definitions, only a few of which will be used in
any given file.
Ted Kremenek [Wed, 29 Oct 2008 18:41:34 +0000 (18:41 +0000)]
Fix crash reported in PR2923 where a function declared using typeof(another_function) would have FunctionDecl::getNumParams() return the number of parameters in the original function type and not the number of parameters in the actual FunctionDecl.
Douglas Gregor [Wed, 29 Oct 2008 15:10:40 +0000 (15:10 +0000)]
Simplify and correct the check for function redefinitions. This does two things:
- Allows definitions of overloaded functions :)
- Eliminates extraneous error messages when we have a definition of a
function that isn't an overload but doesn't have exactly the same type
as the original.
Daniel Dunbar [Wed, 29 Oct 2008 08:50:02 +0000 (08:50 +0000)]
Workaround an LLVM bug where inlining functions with debug info breaks
code generation.
- For now, disable running the always inliner pass (at -O0) if we are
also generating debug information.
Daniel Dunbar [Wed, 29 Oct 2008 05:58:09 +0000 (05:58 +0000)]
Update FindSpecRefs to recognize named section references.
- Unfortunately, I don't have an easy way to map from named sections
to numbers nicely so they don't get page numbers or integrate in
the list well.
Eli Friedman [Wed, 29 Oct 2008 04:39:20 +0000 (04:39 +0000)]
Fix for PR2966: va_start/va_end use the *address* of the
va_list, not the value. Patch fixes an assert on
x86-64 and a wrong-code bug on x86. I'm not completely sure,
but I think it's a regression from r58306.
Does anyone run regression tests regularly on x86-64? The crash should
have been picked up there.
Ted Kremenek [Wed, 29 Oct 2008 04:30:28 +0000 (04:30 +0000)]
Patch by Nikita Zhuk:
The attached patch adds additional checks to -warn-objc-missing-dealloc. It checks that all ivars which are used in implementation of synthesized properties are either
a) released in dealloc if the property has retain" or "copy" attribute OR
b) not released in dealloc if the property has "assign" attribute
Zhongxing Xu [Wed, 29 Oct 2008 02:34:02 +0000 (02:34 +0000)]
Rename: AddDecl => BindDecl
BindDecl better describes what the function does:
- Bind the VarDecl to its memory region
- Bind the memory region to some initial value.
Douglas Gregor [Wed, 29 Oct 2008 02:00:59 +0000 (02:00 +0000)]
Tweak Sema::CheckReferenceInit so that it (optionally) computes an
ImplicitConversionSequence and, when doing so, following the specific
rules of [over.best.ics].
The computation of the implicit conversion sequences implements C++
[over.ics.ref], but we do not (yet) have ranking for implicit
conversion sequences that use reference binding.
Douglas Gregor [Wed, 29 Oct 2008 00:13:59 +0000 (00:13 +0000)]
Implement initialization of a reference (C++ [dcl.init.ref]) as part
of copy initialization. Other pieces of the puzzle:
- Try/Perform-ImplicitConversion now handles implicit conversions
that don't involve references.
- Try/Perform-CopyInitialization uses
CheckSingleAssignmentConstraints for C. PerformCopyInitialization
is now used for all argument passing and returning values from a
function.
- Diagnose errors with declaring references and const values without
an initializer. (Uses a new Action callback, ActOnUninitializedDecl).
We do not yet have implicit conversion sequences for reference
binding, which means that we don't have any overloading support for
reference parameters yet.
I just need make sure the funky cast on objc_msgSend() is converted from "void (^)(int)" to "void (*)(int)". Since the cast doesn't appear in the source code, it needs to be converted in RewriteObjC::SynthMessageExpr().
Douglas Gregor [Tue, 28 Oct 2008 00:22:11 +0000 (00:22 +0000)]
Improve our handling of (C++) references within Clang. Specifically:
- Do not allow expressions to ever have reference type
- Extend Expr::isLvalue to handle more cases where having written a
reference into the source implies that the expression is an lvalue
(e.g., function calls, C++ casts).
- Make GRExprEngine::VisitCall treat the call arguments as lvalues when
they are being bound to a reference parameter.
Daniel Dunbar [Tue, 28 Oct 2008 00:06:25 +0000 (00:06 +0000)]
Mark mmintrin functions static inline, this ensures they don't end up
being emitted unless needed and doesn't inhibit inlining.
- Can be fixed once we implement C99 inline semantics.
Ted Kremenek [Mon, 27 Oct 2008 21:54:31 +0000 (21:54 +0000)]
Added preliminary support for CompoundLiterals in the static analyzer:
- GRExprEngine::VisitCompoundLiteral...
(1) visits the initializer list (generating ExplodedNodes)
(2) creates a CompoundMemRegion for the literal
(3) creates a new state with the bound literal values using
GRStateManager::BindCompoundLiteral
- GRStateManager::BindCompoundLiteral simply calls
StoreManager::BindCompoundLiteral to get a new store and returns a persistent
GRState with that store.
- BasicStore::BindCompoundLiteral simply returns the same store, as it
doesn't handle field sensitivity
- RegionStore::BindCompoundLiteral currently fires an assert (pending discussion
of how to best implement mappings for CompoundLiteralRegion).
Douglas Gregor [Mon, 27 Oct 2008 19:41:14 +0000 (19:41 +0000)]
Refactor the expression class hierarchy for casts. Most importantly:
- CastExpr is the root of all casts
- ImplicitCastExpr is (still) used for all explicit casts
- ExplicitCastExpr is now the root of all *explicit* casts
- ExplicitCCastExpr (new name needed!?) is a C-style cast in C or C++
- CXXFunctionalCastExpr inherits from ExplicitCastExpr
- CXXNamedCastExpr inherits from ExplicitCastExpr and is the root of all
of the C++ named cast expression types (static_cast, dynamic_cast, etc.)
- Added classes CXXStaticCastExpr, CXXDynamicCastExpr,
CXXReinterpretCastExpr, and CXXConstCastExpr to
Also, fixed returned-stack-addr.cpp, which broke once when we fixed
reinterpret_cast to diagnose double->int* conversions and again when
we eliminated implicit conversions to reference types. The fix is in
both testcase and SemaChecking.cpp.
Most of this patch is simply support for the renaming. There's very
little actual change in semantics.
Ted Kremenek [Mon, 27 Oct 2008 18:40:21 +0000 (18:40 +0000)]
- Move ExprIterator to Stmt.h so that it can be used by classes defined in Stmt.h
- Implement child_begin() and child_end() for AsmStmt. Previously these had stub implementations that did not iterate over the input/output operands of an inline assembly statement.
- Use ExprIterator for performing iteration over input/output operands.
Steve Naroff [Mon, 27 Oct 2008 10:33:19 +0000 (10:33 +0000)]
Fix <rdar://problem/6315646> clang on xcode: error: invalid operands to binary expression ('id<NSTableViewDelegate>' and 'XCExtendedArrayController *').
There is still a bug here (as the FIXME in the test case indicates). Prior to this patch, the bug would generate an error. Now, we simply do nothing (which is less harmful until we can get it right). The complete bug fix will require changing ASTContext::mergeTypes(), which I'd like to defer for now.
Chris Lattner [Sun, 26 Oct 2008 22:38:55 +0000 (22:38 +0000)]
inline the decision logic that chooses between an assign expr and brace
initializer, avoiding an extra level of calls for silly things like
'int x = 4'.
Chris Lattner [Sun, 26 Oct 2008 22:36:07 +0000 (22:36 +0000)]
This patch continues parser-level implementation of designators:
1. It introduces new parser level abstractions for designators
that are used to communicate between parser and sema.
2. This fixes a FIXME where "identifier ':'" was considered to be
a designator even if it wasn't the first in a designator list.
3. In the "identifier ':'" case, it actually builds the designator
representation.
Don't give a default argument to ASTContext::getFunctionType for the TypeQuals parameter, it causes subtle bugs where TypeQuals, while necessary, are omitted from the call.
-Remove the default argument.
-Update all call sites of ASTContext::getFunctionType.
Zhongxing Xu [Sun, 26 Oct 2008 02:23:57 +0000 (02:23 +0000)]
Simplify ArrayToPointer conversion. Actually the only thing we need to do is to get the first element region. It is not necessary to care about the kind of the base array region.
Zhongxing Xu [Sat, 25 Oct 2008 14:18:57 +0000 (14:18 +0000)]
Add code for get the lvalue for string literals. Now we return a StringRegion
for StringLiteral lvalue evaluation, instead of directly returning a
loc::StringLiteralVal by the Environment.