Douglas Gregor [Fri, 31 Oct 2008 16:23:19 +0000 (16:23 +0000)]
Implement basic support for converting constructors in user-defined
conversions.
Notes:
- Overload resolution for converting constructors need to prohibit
user-defined conversions (hence, the test isn't -verify safe yet).
- We still use hacks for conversions from a class type to itself.
This will be the case until we start implicitly declaring the appropriate
special member functions. (That's next on my list)
Sanjiv Gupta [Fri, 31 Oct 2008 09:52:39 +0000 (09:52 +0000)]
Made the mechanism of defining preprocessor defs for maxint, ptrdiff_t, wchar
etc more generic. For some targets, long may not be equal to pointer size. For
example: PIC16 has int as i16, ptr as i16 but long as i32.
Also fixed a few build warnings in assert() functions in CFRefCount.cpp,
CGDecl.cpp, SemaDeclCXX.cpp and ParseDeclCXX.cpp.
Douglas Gregor [Fri, 31 Oct 2008 09:07:45 +0000 (09:07 +0000)]
Add support for parsing and representing C++ constructor declarations.
Notes:
- Constructors are never found by name lookup, so they'll never get
pushed into any scope. Instead, they are stored as an
OverloadedFunctionDecl in CXXRecordDecl for easy overloading.
- There's a new action isCurrentClassName that determines whether an
identifier is the name of the innermost class currently being defined;
we use this to identify the declarator-id grammar rule that refers to
a type-name.
- MinimalAction does *not* support parsing constructors.
- We now handle virtual and explicit function specifiers.
Daniel Dunbar [Fri, 31 Oct 2008 08:56:51 +0000 (08:56 +0000)]
"One" line fix for -parse-noop failure, "id" and several other things
were being treated as type names for non-Objective-C files.
- Other lines are just because MinimalAction didn't have access to
the LangOptions.
Ted Kremenek [Fri, 31 Oct 2008 05:48:42 +0000 (05:48 +0000)]
On Mac OS X, use TMPDIR as the default location to place analysis results. This is a more secure location for such files, and addresses <rdar://problem/6334220>.
Ted Kremenek [Fri, 31 Oct 2008 00:13:20 +0000 (00:13 +0000)]
Enhance path-sensitive return-of-stack-address check to print out the line number of a compound literal (whose address is being returned) instead of printing out the hex representation of the pointer address of the CompoundLiteralExpr.
Ted Kremenek [Thu, 30 Oct 2008 17:45:53 +0000 (17:45 +0000)]
Add iterator/reverse_iterator to InitListExpr for iteration over the subexpressions of an initializer list. This is basically the same as child_iterator except reverse iteration is possible (which will be used by GRExprEngine::VisitInitListExpr).
Ted Kremenek [Thu, 30 Oct 2008 17:44:46 +0000 (17:44 +0000)]
CompoundVal now uses an ImmutableList<SVal> to store its set of SVals. This change was motivated by the need to allow state-splitting in GRExprEngine::VisitInitListExpr. As a side-benefit, we no longer need to perform any copies of SVals when creating a CompoundSVal, and the profiling of CompoundSVal is now constant time.
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.