Sebastian Redl [Mon, 16 Nov 2009 21:03:45 +0000 (21:03 +0000)]
Repair broken FindCompositePointerType. Correct early termination condition. Get CVR qualifiers from canonical types. Traverse collected qualifiers in reverse order on rebuilding the pointer, so that we don't swap inner and outer qualifiers. That last one fixes PR5509.
Handle case of missing '@end' in implementation context
gracefully, on par with gcc, by: Issuing a warning,
doing final sematinc check of its definitions and generating
its meta-data.
Ken Dyck [Mon, 16 Nov 2009 16:36:33 +0000 (16:36 +0000)]
Parameterize the constant-generating macros in stdint.h with new built-in
__INTn_C_SUFFIX__ macros that are defined for types with corresponding
constant suffixes (i.e. long and long long).
Eli Friedman [Mon, 16 Nov 2009 05:55:46 +0000 (05:55 +0000)]
Make GetAddrOfConstantStringFromLiteral return a constant of the correct type.
This doesn't have any visible effects at the moment because normally the
implicit cast code forces the type to the expected type.
Zhongxing Xu [Mon, 16 Nov 2009 04:49:44 +0000 (04:49 +0000)]
* Do the same thing to the basicstore as in r84163.
* Add a load type to GRExprEngine::EvalLoad().
* When retrieve from 'theValue' of OSAtomic funcitions, use the type of the
region instead of the argument expression as the load type.
* Then we can convert CastRetrievedSVal to a pure assertion. In the future
we can let all Retrieve() methods simply return SVal.
Anders Carlsson [Sun, 15 Nov 2009 16:43:15 +0000 (16:43 +0000)]
If we find a deallocation function in the class scope, but it is a placement function we should not look for a deallocation function in the global scope.
Douglas Gregor [Sun, 15 Nov 2009 09:20:52 +0000 (09:20 +0000)]
When performing a static downcast as part of a static_cast, make sure
that we're dealing with canonical types like the documentation say
(yay, CanQualType). Alas, this is another instance where using
getQualifiers() on a non-canonical QualType got us in trouble.
Good news: with this fix, Clang can now parse all of its own headers!
Douglas Gregor [Sun, 15 Nov 2009 08:11:13 +0000 (08:11 +0000)]
When adding the underlying declaration of a decl to a lookup-results
set, expand overloaded function declarations. Long-term, this should
actually be done by the name-lookup code rather than here, but this
part of the code (involving using declarations) is getting a makeover
now and the test-case is useful.
Douglas Gregor [Sun, 15 Nov 2009 07:48:03 +0000 (07:48 +0000)]
When looking for operator() to type-check a call to an object of class
type, use full qualified name lookup rather than the poking the
declaration context directly. This makes sure that we see operator()'s
in superclasses. Also, move the complete-type check before this name
lookup.
Daniel Dunbar [Sun, 15 Nov 2009 00:27:43 +0000 (00:27 +0000)]
Add a trivial example plugin, which prints the names of the top-level decls.
- The build scriptage is about twice as long as the code, which is nice. :)
Daniel Dunbar [Sun, 15 Nov 2009 00:12:04 +0000 (00:12 +0000)]
Add pluggable action support to clang-cc, via -plugin command line option.
- Expects the plugin has been loaded with -load.
- Using this may require disabling TOOL_NO_EXPORTS in the clang-cc Makefile, this breaks the llvm::Registry way of working (static constructors are bad, kids). This should be replaced with a "real" plugin model that has explicit plugin interfaces.
Daniel Dunbar [Sat, 14 Nov 2009 22:04:54 +0000 (22:04 +0000)]
Add clang -mcpu=native support, patch by Roman Divacky, varioustweaks by me.
- We still need support for detecting the target features, since the name
doesn't actually do a good job of decribing what the CPU supports (for LLVM).
Sebastian Redl [Sat, 14 Nov 2009 21:15:49 +0000 (21:15 +0000)]
- Have TryStaticImplicitCast set the cast kind to NoOp when binding a reference. CheckReferenceInit already inserts implicit casts to the necessary types. This fixes an assertion in CodeGen for some casts and brings a fix for PR5453 close, if I understand that bug correctly.
- Also, perform calculated implicit cast sequences if they're determined to work. This finally diagnoses static_cast to ambiguous or implicit bases and fixes two long-standing fixmes in the test case. For the C-style cast, this requires propagating the access check suppression pretty deep into other functions.
- Pass the expressions for TryStaticCast and TryStaticImplicitCast by reference. This should lead to a better AST being emitted for such casts, and also fixes a memory leak, because CheckReferenceInit and PerformImplicitConversion wrap the node passed to them. These wrappers were previously lost.
Benjamin Kramer [Sat, 14 Nov 2009 12:08:24 +0000 (12:08 +0000)]
Change *BugReport constructors to take StringRefs.
- Eliminates many calls to std::string.c_str()
- Fixes an invalid read in ReturnStackAddressChecker due to an unsafe call to
StringRef.data() which doesn't guarantee null-termination.
Eli Friedman [Sat, 14 Nov 2009 08:51:33 +0000 (08:51 +0000)]
Avoid assert-crash in a case where the expression passed to EmitConstantExpr
legitimately has side-effects (and needs to be generated as a non-constant).
Daniel Dunbar [Sat, 14 Nov 2009 04:39:29 +0000 (04:39 +0000)]
Turn -fixit it back into a mode, but make -fixit-at imply that mode this time
(instead of running it with arbitrary consumers).
- Also, turn any -fixit-at lookup failure into an error.
Eli Friedman [Sat, 14 Nov 2009 04:19:37 +0000 (04:19 +0000)]
PR5483: Generate missing form of destructor when it is virtual. (Someone
more familiar with this stuff should double-check that there isn't some more
general rule; this is purely from inspecting g++ output.)
Douglas Gregor [Sat, 14 Nov 2009 03:27:21 +0000 (03:27 +0000)]
When type-checking a static cast (or the static_cast part of a C-style
cast) that is converting to a class type, enumerate its constructors
as in any other direct initialization. This ensures that we get the
proper conversion sequence.
Daniel Dunbar [Sat, 14 Nov 2009 03:23:19 +0000 (03:23 +0000)]
Add VerifyDiagnosticsClient, to replace old -verify.
- This reimplements -verify as just another DiagnosticClient, which buffers the diagnostics and checks them when the source file is complete. There are some hacks to make this work, but they are all internal, and this exposes a better external interface.
- This also tweaks a few things:
o Errors are now just regular diagnostics.
o Frontend diagnostics are now caught (for example, errors in command line arguments), although there isn't yet a way to specify that they are expected. That would be nice though.
Douglas Gregor [Sat, 14 Nov 2009 01:20:54 +0000 (01:20 +0000)]
If we attempt to add a constructor template specialization that looks
like a copy constructor to the overload set, just ignore it. This
ensures that we don't try to use such a constructor as a copy
constructor *without* triggering diagnostics at the point of
declaration.
Note that we *do* diagnose such copy constructors when explicitly
written by the user (e.g., as an explicit specialization).