Allow anonymous and local types. The support was already in place for these,
but this makes them work even as an extension in C++98. This resolves PR8077.
John McCall [Fri, 3 Sep 2010 18:58:50 +0000 (18:58 +0000)]
A constant initializer never matches the type of the variable it's
initializing; it at best matches the element type of the variable
it's initializing. Fixes PR8073.
Douglas Gregor [Fri, 3 Sep 2010 18:01:25 +0000 (18:01 +0000)]
Implement libclang visitation for UnresolvedMemberExpr. This is the
last of the C++-specific expressions where we have decent source
information in the AST already. In particular, various
object-construction expressions (CXXNewExpr, CXXTemporaryObjectExpr)
still have poor source-location information that needs to be addressed.
John McCall [Fri, 3 Sep 2010 04:56:05 +0000 (04:56 +0000)]
Add a quick-and-dirty hack to give a better diagnostic for [class.protected]
restrictions. The note's not really on the right place given its wording,
but putting a second note on the call site (or muddying the wording) doesn't
appeal.
There are corner cases where this can be wrong, but I'm not concerned.
Chris Lattner [Fri, 3 Sep 2010 04:34:38 +0000 (04:34 +0000)]
"I see dead code". IdempotentOperationChecker::isTruncationExtensionAssignment
should probably be removed if it has no purpose, but I just #if'd it out
in case it's usefulIdempotentOperationChecker::isTruncationExtensionAssignment
should probably be removed if it has no purpose, but I just #if'd it out
in case it's useful
Daniel Dunbar [Fri, 3 Sep 2010 02:07:00 +0000 (02:07 +0000)]
IRgen: Fix silly thinko in r112021, which was generating code for the same expr
twice. This showed up as an assert on the odd test case because we generated the
decl map entry twice.
Dawn Perchik [Fri, 3 Sep 2010 01:29:35 +0000 (01:29 +0000)]
Add symantic support for the Pascal calling convention via
"__attribute((pascal))" or "__pascal" (and "_pascal" under
-fborland-extensions). Support still needs to be added to llvm.
Add optional record of "location" SVals in the environment. When we analyzing loads/stores, we lose the location SVal, which makes it difficult to recover in some cases (e.g., for post diagnostics). This is prep for pending changes to GRExprEngine.
Add GRState::getSimplifiedSVal(), which provides an API hook for doing symbol -> constant folding. This isn't used yet, but
is prep for some pending optimizations in GRExprEngine.
Anders Carlsson [Fri, 3 Sep 2010 00:25:02 +0000 (00:25 +0000)]
Get rid of the "functions declared 'noreturn' should have a 'void' result type" warning.
The rationale behind this is that it is normal for callback functions to have a non-void return type
and it should still be possible to mark them noreturn. (JavaScriptCore is a good example of this).
John McCall [Fri, 3 Sep 2010 00:01:57 +0000 (00:01 +0000)]
It's not safe to use the generic CXXMethodDecl overload of CGT::getFunctionInfo
to set up a destructor call, because ABIs can tweak these conventions.
Fixes rdar://problem/8386802.
Daniel Dunbar [Thu, 2 Sep 2010 23:53:31 +0000 (23:53 +0000)]
IRgen/Obj-C: Rewrite Objective-C bit-field access to compute the access strategy
using the same methods as used for normal structures.
- This fixes problems with reading past the end of the structure and with
handling straddled bit-field access.
Tom Care [Thu, 2 Sep 2010 23:30:22 +0000 (23:30 +0000)]
Reapply 112850 and 112839 with a constructor for the BinaryOperatorData struct. Clang would zero out the enum and pointer in the struct in some conditions, but GCC would never zero out the values.
Chris Lattner [Thu, 2 Sep 2010 22:43:55 +0000 (22:43 +0000)]
remove some tests that aren't adding any value: the check lines don't
make it clear what they're testing so there is no way to know it's right
or to update it.
John McCall [Thu, 2 Sep 2010 22:18:59 +0000 (22:18 +0000)]
Experimentally move the tautological comparison warnings from -Wsign-compare
to -Wtautological-compare. This implies that they're now on by default.
If this causes chaos, I'll figure something else out.
Tom Care [Thu, 2 Sep 2010 17:49:20 +0000 (17:49 +0000)]
Improved error reporting in IdempotentOperationChecker
- SourceRange highlighting is only given for the relevant side of the operator (assignments give both)
- Added PostVisitBinaryOperator hook to retrieve the ExplodedNode for an operator
- Added a BugReporterVisitor to display the last store to every VarDecl in a Stmt
- Changed bug reporting to use the new BugReporterVisitor
Douglas Gregor [Thu, 2 Sep 2010 17:35:32 +0000 (17:35 +0000)]
Implement basic visitation for nested name specifiers via libclang
cursors. Sadly, this visitation is a hack, because we don't have
proper source-location information for nested-name-specifiers in the
AST. It does improve on the status quo, however.
David Chisnall [Thu, 2 Sep 2010 17:16:32 +0000 (17:16 +0000)]
Use the unmangled name for the display name in Objective-C debug info. This should have no effect with the Mac runtime where clang (unlike GCC) uses the display name symbol name.
Douglas Gregor [Thu, 2 Sep 2010 15:34:35 +0000 (15:34 +0000)]
Fix more i1/i8 pointer madness. Here, an overactive assertion
complains when the element type of a C++ "delete" expression is
different from what we would expect from the pointer type. When
deleting a bool*, we end up with an i1 on one side (where we compute
the LLVM type from the Clang bool type) and i8 on the other (where we
grab the LLVM type from the LLVM pointer type). I've weakened the
assertion appropriately, and the Boost Parallel Graph Library now
passes its regression tests.
Douglas Gregor [Thu, 2 Sep 2010 15:00:29 +0000 (15:00 +0000)]
Fix a crash involving pointer-to-data-members of boolean type. We were
constructing an LLVM PointerType directly from the "bool"'s LLVM type
(i1), which resulted in unfortunate pointer type i1*. The fix is to
build the LLVM PointerType from the corresponding Clang PointerType,
so that we get i8* in the case of a bool.
John, please review. I also left a FIXME there because we seem to be
dropping "volatile", which would be rather unfortunate.
John McCall [Thu, 2 Sep 2010 09:58:18 +0000 (09:58 +0000)]
Abstract IR generation of array cookies into the C++ ABI class and
implement ARM array cookies. Also fix a few unfortunate bugs:
- throwing dtors in deletes prevented the allocation from being deleted
- adding the cookie to the new[] size was not being considered for
overflow (and, more seriously, was screwing up the earlier checks)
- deleting an array via a pointer to array of class type was not
causing any destructors to be run and was passing the unadjusted
pointer to the deallocator
- lots of address-space problems, in case anyone wants to support
free store in a variant address space :)
For GRExprEngine::EvalBind() (and called visitors), unifiy StoreE and AssignE. Now StoreE (const Stmt*) represents the expression where the store took place, which is the assignment expression if it takes place in an assignment. This removes some conceptual dissidence as well as removes an extra parameter from the Checker::PreVisitBind() visitor. It also improves ranges and source location information in analyzer diagnostics.
Douglas Gregor [Thu, 2 Sep 2010 00:07:54 +0000 (00:07 +0000)]
Introduce a new libclang function,
clang_getSpecializedCursorTemplate(), which determines the template
(or member thereof) that the given cursor specializes or from which it
was instantiated. This routine can be used to establish a link between
templates and their instantiations/specializations.
Zhanyong Wan [Wed, 1 Sep 2010 23:54:22 +0000 (23:54 +0000)]
Make RecursiveASTVisitor not crash when a TemplateArgumentLoc object has a NULL TypeSourceInfo*. This fixes the symptom of http://llvm.org/PR8043. Reviewed by csilvers.
Bill Wendling [Wed, 1 Sep 2010 23:54:16 +0000 (23:54 +0000)]
Add some MMX builtins to correspond with the intrinsics now accepted by
LLVM. This will be used by the mmintrin.h header, but that bit still needs to be
worked out.
Add yet another test case for PR 8015, showing how reasoning over symbolic indices should exactly resolve over multiple index possibilities (and thus suppress the false positive in the test).
Partial fix for PR 8015 (fix is actually by Jordy Rose, and I added a test case for follow-on work). This patch adds a bandaid for RegionStore's limited reasoning about symbolic array values.
Bob Wilson [Wed, 1 Sep 2010 23:20:27 +0000 (23:20 +0000)]
Translate NEON vmull, vmlal, and vmlsl builtins to llvm multiply-add/sub
with zext/sext operations, instead of to llvm intrinsics. I have a plan to
avoid the clang builtins for these, but it is going to take a little longer
and I want to get the NEON intrinsics updated before the 2.8 release.