Commit Graph

74471 Commits

Author SHA1 Message Date
Chris Lattner 5c0917c175 factor out the grow() method for all pod implementations into one
common function.  It is still an inline method, which will be fixed next.

llvm-svn: 91526
2009-12-16 08:34:40 +00:00
John McCall d681c3959f Introduce a centralized routine in Sema for diagnosing failed lookups (when
used as expressions).  In dependent contexts, try to recover by doing a lookup
in previously-dependent base classes.  We get better diagnostics out, but    
unfortunately the recovery fails:  we need to turn it into a method call  
expression, not a bare call expression.  Thus this is still a WIP.

llvm-svn: 91525
2009-12-16 08:11:27 +00:00
Victor Hernandez 2003b90807 Use different name for argument and field
llvm-svn: 91524
2009-12-16 08:10:57 +00:00
Chris Lattner f684b9039d pull destroy_range and uninitialized_copy up to the
SmallVectorTemplateBase class, which allows us to statically
dispatch on isPodLike instead of dynamically.

llvm-svn: 91523
2009-12-16 08:09:23 +00:00
Chris Lattner acc0e62625 sink most of the meat in smallvector back from SmallVectorTemplateCommon
down into SmallVectorImpl.  This requires sprinking a ton of this->'s in,
but gives us a place to factor.

llvm-svn: 91522
2009-12-16 08:05:48 +00:00
Nick Lewycky 23fbd54cfe Make this test pass on Linux.
llvm-svn: 91521
2009-12-16 07:35:25 +00:00
Anders Carlsson 07863b8b6e Use GetAddrOfRTTI everywhere and remove GenerateRTTI and GenerateRTTIRef. With this change, we can now compile and link TableGen.
llvm-svn: 91520
2009-12-16 07:05:41 +00:00
Anders Carlsson 18ada9856f Handle ImplicitValueInitExpr in AggExprEmitter.
llvm-svn: 91519
2009-12-16 06:57:54 +00:00
Chris Lattner 8b8d01829e substantial refactoring of SmallVector, now most code is in SmallVectorTemplateCommon,
and there is a new SmallVectorTemplateBase class in between it and SmallVectorImpl.
SmallVectorTemplateBase can be specialized based on isPodLike.

llvm-svn: 91518
2009-12-16 06:55:45 +00:00
Zhongxing Xu 82a7beb2e0 remove dead code.
llvm-svn: 91517
2009-12-16 06:39:03 +00:00
Douglas Gregor 723796af7a Eliminate Sema::CheckValueInitialization; its callers now use
InitializationSequence to perform the actual initialization.

Also, introduced the notion of a tree of initialized entities, so that
we can know where an initialization began when dealing with nested
initializations (as occur when performing list initialization). This
will, eventually, be useful for producing better diagnostics when list
initialization fails, because we can show the path from the top-level
object being initialized down to the actual subobject where
initialization failed.

llvm-svn: 91516
2009-12-16 06:35:08 +00:00
Eli Friedman 53b3cde60f Add abort() as a builtin. This has two effects: one, we warn for incorrect
declarations of abort(), and two, we mark it noreturn.  Missing the latter
shows up in one of the "embarassing" tests (from the thread on llvmdev
"detailed comparison of generated code size for LLVM and other compilers").

llvm-svn: 91515
2009-12-16 06:28:21 +00:00
Anders Carlsson ce5b95c05a More FullExpr work.
llvm-svn: 91514
2009-12-16 06:21:35 +00:00
Anders Carlsson a5ca598ce6 More work on the FullExpr class.
llvm-svn: 91513
2009-12-16 06:10:22 +00:00
Ted Kremenek 9bcc264494 Teach RetainSummaryManager::getSummary(FunctionDecl* FD) that 'FD->getIdentifier()' will not always return a non-null IdentifierInfo*.
llvm-svn: 91512
2009-12-16 06:06:43 +00:00
Ted Kremenek 2d251557ef Teach OSAtomicChecker that a FunctionDecl's name isn't always a simple IdentifierInfo*.
llvm-svn: 91511
2009-12-16 06:03:24 +00:00
Ted Kremenek 85763180e7 Teach NoReturnFunctionChecker that FunctionDecl::getIdentifier() is not guaranteed to return a non-null IdentifierInfo*.
llvm-svn: 91510
2009-12-16 05:58:28 +00:00
Ted Kremenek 73aad9af2d Teach CheckerVisitor about CXXOperatorCallExpr.
llvm-svn: 91509
2009-12-16 05:52:19 +00:00
Ted Kremenek 0de851a4f2 Teach CFRecStmtDeclVisitor about CXXMethodDecl.
llvm-svn: 91508
2009-12-16 05:50:26 +00:00
Anders Carlsson b7e93e268f Mangle CXXOperatorCallExprs, fixes PR5796.
llvm-svn: 91507
2009-12-16 05:48:46 +00:00
Zhongxing Xu 686b8458f4 Expose C++ methods to GRExprEngine.
llvm-svn: 91506
2009-12-16 05:29:59 +00:00
Ted Kremenek dca6816d6a Add logic for computing preprocessor file extensions for C++ files.
llvm-svn: 91505
2009-12-16 05:02:47 +00:00
Douglas Gregor 2610ea4da9 Make GRSubEngine.h standalone
llvm-svn: 91504
2009-12-16 03:49:50 +00:00
Douglas Gregor 7c3bbdfd28 Fix semantic diagnostics that embed English works, from Nicola Gigante!
llvm-svn: 91503
2009-12-16 03:45:30 +00:00
Mike Stump 64a03454c6 Refine a little. WIP.
llvm-svn: 91502
2009-12-16 03:25:12 +00:00
Ted Kremenek 4cad5fc035 Add (initial?) static analyzer support for handling C++ references.
This change was a lot bigger than I originally anticipated; among
other things it requires us storing more information in the CFG to
record what block-level expressions need to be evaluated as lvalues.

The big change is that CFGBlocks no longer contain Stmt*'s by
CFGElements.  Currently CFGElements just wrap Stmt*, but they also
store a bit indicating whether the block-level expression should be
evalauted as an lvalue.  DeclStmts involving the initialization of a
reference require us treating the initialization expression as an
lvalue, even though that information isn't recorded in the AST.
Conceptually this change isn't that complicated, but it required
bubbling up the data through the CFGBuilder, to GRCoreEngine, and
eventually to GRExprEngine.

The addition of CFGElement is also useful for when we want to handle
more control-flow constructs or other data we want to keep in the CFG
that isn't represented well with just a block of statements.

In GRExprEngine, this patch introduces logic for evaluating the
lvalues of references, which currently retrieves the internal "pointer
value" that the reference represents.  EvalLoad does a two stage load
to catch null dereferences involving an invalid reference (although
this could possibly be caught earlier during the initialization of a
reference).

Symbols are currently symbolicated using the reference type, instead
of a pointer type, and special handling is required creating
ElementRegions that layer on SymbolicRegions (see the changes to
RegionStoreManager).

Along the way, the DeadStoresChecker also silences warnings involving
dead stores to references.  This was the original change I introduced
(which I wrote test cases for) that I realized caused GRExprEngine to
crash.

llvm-svn: 91501
2009-12-16 03:18:58 +00:00
Mike Stump 11ba8d989c Add some documentation for recent checkins. WIP.
llvm-svn: 91500
2009-12-16 03:18:14 +00:00
Mike Stump b85ffb689e Add an addition check for undefined behavior for when we hit a
__builtin_unreachable.  WIP.

llvm-svn: 91499
2009-12-16 03:07:12 +00:00
Mike Stump 3f6f9febad Implement additional undefined checks for additional loads and stores. WIP.
llvm-svn: 91498
2009-12-16 02:57:00 +00:00
Victor Hernandez dd7418ae3f MDNodes that refer to an instruction are local to a function; in that case, explicitly keep track of the function they are local to
llvm-svn: 91497
2009-12-16 02:52:09 +00:00
Johnny Chen 466231ab92 Add encoding bits for some Thumb instructions. Plus explicitly set the top two
bytes of Inst to 0x0000 for the benefit of the Thumb decoder.

llvm-svn: 91496
2009-12-16 02:32:54 +00:00
Devang Patel c69d9607f8 XFAIL on ppc-darwin.
llvm-svn: 91495
2009-12-16 02:11:38 +00:00
Anders Carlsson afb2dade0c Check in a rudimentary FullExpr class that isn't used anywhere yet. Rename Action::FullExpr to Action::MakeFullExpr to avoid name clashes.
llvm-svn: 91494
2009-12-16 02:09:40 +00:00
John McCall 0db42252f7 Successive anonymous namespaces name the same scope. I misinterpreted the
standard the last time.  Fixes PR5766.

llvm-svn: 91493
2009-12-16 02:06:49 +00:00
Douglas Gregor 85dabae6ad Switch the C++ new expression over to InitializationSequence, rather
than using its own partial implementation of initialization. 

Switched CheckInitializerTypes over to
InitializedEntity/InitializationKind, to help move us closer to
InitializationSequence.

Added InitializedEntity::getName() to retrieve the name of the entity,
for diagnostics that care about such things.

Implemented support for default initialization in
InitializationSequence.

Clean up the determination of the "source expressions" for an
initialization sequence in InitializationSequence::Perform.

Taught CXXConstructExpr to store more location information.

llvm-svn: 91492
2009-12-16 01:38:02 +00:00
Evan Cheng 1be6286028 Re-enable 91381 with fixes.
llvm-svn: 91489
2009-12-16 00:53:11 +00:00
Chris Lattner 177be32334 revert my strstr optimization, I'm told it breaks x86-64 bootstrap.
Will reapply with a fix when I get a chance.

llvm-svn: 91486
2009-12-16 00:46:02 +00:00
Dale Johannesen 56f041406d Do better with physical reg operands (typically, from inline asm)
in local register allocator.  If a reg-reg copy has a phys reg
input and a virt reg output, and this is the last use of the phys
reg, assign the phys reg to the virt reg.  If a reg-reg copy has
a phys reg output and we need to reload its spilled input, reload
it directly into the phys reg than passing it through another reg.

Following 76208, there is sometimes no dependency between the def of
a phys reg and its use; this creates a window where that phys reg
can be used for spilling (this is true in linear scan also).  This
is bad and needs to be fixed a better way, although 76208 works too
well in practice to be reverted.  However, there should normally be
no spilling within inline asm blocks.  The patch here goes a long way
towards making this actually be true.

llvm-svn: 91485
2009-12-16 00:29:41 +00:00
John McCall 826ca5630e Every anonymous namespace is different. Caught by clang++.
llvm-svn: 91481
2009-12-16 00:15:28 +00:00
John McCall 323c30c5f4 Explicit template instantiations must happen in the template's immediately
enclosing namespace.  Caught by clang++.

llvm-svn: 91480
2009-12-16 00:13:24 +00:00
Bill Wendling 2d5967d005 Helpful comment added. Some code cleanup. No functional change.
llvm-svn: 91479
2009-12-16 00:08:36 +00:00
Bill Wendling 3766491eee Initialize uninitialized variables.
llvm-svn: 91477
2009-12-16 00:01:27 +00:00
Bill Wendling 776ef4dd32 Initialize uninitialized variables.
llvm-svn: 91475
2009-12-16 00:00:18 +00:00
Fariborz Jahanian e8d28904b0 Diagnose attempting to assign to a sub-structure of an ivar
using objective-c property. (fixes radar 7449707)

llvm-svn: 91474
2009-12-15 23:59:41 +00:00
Ted Kremenek 9158fb748c Remove ValueManager::getRegionValueSymbolValOrUnknown(). It was just extra veneer on top of getRegionValueSymbolVal().
llvm-svn: 91471
2009-12-15 23:23:27 +00:00
Jeffrey Yasskin e0d8e14e11 Change indirect-globals to use a dedicated allocIndirectGV. This lets us
remove start/finishGVStub and the BufferState helper class from the
MachineCodeEmitter interface.  It has the side-effect of not setting the
indirect global writable and then executable on ARM, but that shouldn't be
necessary.

llvm-svn: 91464
2009-12-15 22:42:46 +00:00
Bill Wendling 098a38b5ce Some command lines don't like numbers with leading zeros. Remove them.
llvm-svn: 91463
2009-12-15 22:42:19 +00:00
John McCall e9f92a017c Link up member-class redeclarations during template instantiation.
This test courtesy of LLVM.

llvm-svn: 91462
2009-12-15 22:29:06 +00:00
Daniel Dunbar 5618e98f33 Update tests to use %clang instead of 'clang', and forcibly disable use of '
clang ' or ' clang -cc1 ' or ' clang-cc ' in test lines (by substituting them to
garbage).

llvm-svn: 91460
2009-12-15 22:01:24 +00:00
Bob Wilson e44756d7c2 Reapply 91184 with fixes and an addition to the testcase to cover the problem
found last time.  Instead of trying to modify the IR while iterating over it,
I've change it to keep a list of WeakVH references to dead instructions, and
then delete those instructions later.  I also added some special case code to
detect and handle the situation when both operands of a memcpy intrinsic are
referencing the same alloca.

llvm-svn: 91459
2009-12-15 22:00:51 +00:00