Commit Graph

9549 Commits

Author SHA1 Message Date
Daniel Dunbar e46506eaea Pull CodeGenFunction::EmitVAArg into target specific ABIInfo classes.
- Missed this file.

llvm-svn: 64238
2009-02-10 21:44:36 +00:00
Daniel Dunbar 2d0746fb97 Pull CodeGenFunction::EmitVAArg into target specific ABIInfo classes.
llvm-svn: 64235
2009-02-10 20:44:09 +00:00
Fariborz Jahanian 4e7ae06b00 Generate ir for ivar offset. This will pass
type-nsobject-attribute.m in the dejagnu test suite
in the nonfragile abi mode.

llvm-svn: 64233
2009-02-10 20:21:06 +00:00
Mike Stump 74a7647973 Fixup -ast-print so that:
We handle indentation of decls better.
  We Indent extern "C" { } stuff better.
  We print out structure contents more often.
  We handle pass indentation information into the statement printer, so that
  nested things come out more indented.
  We print out FieldDecls.
  We print out Vars.
  We print out namespaces.
  We indent functions better.

llvm-svn: 64232
2009-02-10 20:16:46 +00:00
Mike Stump 1d05068395 Refactor FieldDecls to be ValueDecls instead of NamedDecls.
llvm-svn: 64231
2009-02-10 20:06:48 +00:00
Douglas Gregor 85e8b3eeed Fix a problem with bogus template shadowing warnings
llvm-svn: 64230
2009-02-10 19:52:54 +00:00
Douglas Gregor dba326363c Implement parsing, semantic analysis and ASTs for default template
arguments. This commit covers checking and merging default template
arguments from previous declarations, but it does not cover the actual
use of default template arguments when naming class template
specializations.

llvm-svn: 64229
2009-02-10 19:49:53 +00:00
Fariborz Jahanian 21fc74c15a Some refactoring of Ivar offset code gen.
in preparation for nonfragile ivar offset work.

llvm-svn: 64225
2009-02-10 19:02:04 +00:00
Douglas Gregor 8133879c5e Semantic analysis for non-type template parameter declarations.
llvm-svn: 64223
2009-02-10 17:43:50 +00:00
Daniel Dunbar 9403cd6d85 Tweak x86-64 ABI to allow reuse for vararg handling.
llvm-svn: 64221
2009-02-10 17:06:09 +00:00
Ted Kremenek f83882987e Updated checker build.
llvm-svn: 64208
2009-02-10 07:38:50 +00:00
Anders Carlsson 7325b61e74 Fix an #ifndef that should be an #ifdef instead.
llvm-svn: 64206
2009-02-10 06:18:19 +00:00
Anders Carlsson 33c1b6528f Remove the last remnants of the Obj-C EH stack code.
llvm-svn: 64205
2009-02-10 06:07:49 +00:00
Anders Carlsson 33747b6c41 Start removing the old Obj-C EH stack now that the cleanup stack is used instead.
llvm-svn: 64203
2009-02-10 05:52:02 +00:00
Ted Kremenek a84522088f Fix a crash in GRSimpleVals::EvalCast due not handling transparent unions.
llvm-svn: 64200
2009-02-10 05:42:58 +00:00
Sanjiv Gupta e99ad00fd2 Function parameters for PIC16 are like local variables. So use the keyword ".auto." to mangle their names. The working of PIC16AsmPrinter relies on that keyword currently.
llvm-svn: 64198
2009-02-10 04:17:25 +00:00
Daniel Dunbar 0007961241 Support va_arg on _Complex.
gcc compat test suite results (Darwin x86-32 & -64):
--
# of expected passes		1110
# of unexpected failures	74
# of unresolved testcases	168
# of unsupported tests		2

llvm-svn: 64197
2009-02-10 03:03:30 +00:00
Argyrios Kyrtzidis 2ca8d5dfdf Bring in 'CHAR_BIT' for GCC 4.3.
llvm-svn: 64196
2009-02-10 02:14:34 +00:00
Daniel Dunbar 2daa142765 Enable parameter passing test for x86_64.
llvm-svn: 64195
2009-02-10 01:53:22 +00:00
Daniel Dunbar 9bfb4de38b ABI: Correctly handle load/store of values which have a different LLVM
memory representation (e.g., bool).
 - This upgrades (downgrades) MultiSource/Applications/ClamAV/clamscan
   to a miscompile and fixes
   SingleSource/UnitTests/2003-05-31-CastToBool.

llvm-svn: 64194
2009-02-10 01:51:39 +00:00
Ted Kremenek 351f78822b Rearrange code. No functionality change.
llvm-svn: 64193
2009-02-10 01:14:45 +00:00
Ted Kremenek 5b229bcea8 Fix potential padding error in PTH file and add stub code for emitting an on-disk chained hash table.
llvm-svn: 64192
2009-02-10 01:06:17 +00:00
Daniel Dunbar 1d425460d5 Add util Emit{LoadOf,StoreTo}Scalar methods to encapsulate conversion
from LLVM memory type to/from LLVM temporary type.
 - No intended functionality change.

llvm-svn: 64191
2009-02-10 00:57:50 +00:00
Ted Kremenek a446e95891 Update checker build.
llvm-svn: 64190
2009-02-10 00:53:39 +00:00
Douglas Gregor 97f34576d4 Teach the type-id/expression disambiguator about different
disambiguation contexts, so that we properly parse template arguments
such as

  A<int()>

as type-ids rather than as expressions. Since this can be confusing
(especially when the template parameter is a non-type template
parameter), we try to give a friendly error message.

Almost, eliminate a redundant error message (that should have been a
note) and add some ultra-basic checks for non-type template
arguments.

llvm-svn: 64189
2009-02-10 00:53:15 +00:00
Douglas Gregor 85e0f66250 Check template template arguments against their corresponding template
template parameters.

llvm-svn: 64188
2009-02-10 00:24:35 +00:00
Daniel Dunbar d5f1f55e28 Make sure to initialize local variables, even if they were ignored by
ABI.

llvm-svn: 64187
2009-02-10 00:06:49 +00:00
Douglas Gregor d32e028f79 Rudimentary checking of template arguments against their corresponding
template parameters when performing semantic analysis of a template-id
naming a class template specialization.

llvm-svn: 64185
2009-02-09 23:23:08 +00:00
Anders Carlsson ac0d7bd709 id<Foo> is a POD type.
llvm-svn: 64175
2009-02-09 21:53:01 +00:00
Anders Carlsson d19fd0dd57 Move previously unsupported VLA test to vla.c
llvm-svn: 64173
2009-02-09 21:48:07 +00:00
Daniel Dunbar 8a1ca06456 ccc: -dM wasn't being passed to Darwin/CC1 correctly.
llvm-svn: 64169
2009-02-09 21:22:38 +00:00
Daniel Dunbar 7aa851246e Update test case; VLA's are now supported.
llvm-svn: 64168
2009-02-09 21:19:23 +00:00
Douglas Gregor 0db4ccd7fb Implement Sebastian's idea for simplifying our handling of the greater-than operator/delimiter. Also, clean up after ourselves following a failed parse of a template-argument-list
llvm-svn: 64166
2009-02-09 21:04:56 +00:00
Ted Kremenek d7b4f40b18 CallExpr now uses ASTContext's allocate to allocate/delete its array of subexpressions.
llvm-svn: 64162
2009-02-09 20:51:47 +00:00
Anders Carlsson 15949b3a32 Use the new cleanup infrastructure for VLAs. The next iteration of patches will remove the old Obj-C EH cleanup code.
llvm-svn: 64161
2009-02-09 20:41:50 +00:00
Anders Carlsson bfee7e921b Use the new cleanup infrastructure for @try/@finally
llvm-svn: 64160
2009-02-09 20:38:58 +00:00
Anders Carlsson 1ac6282c5b Replace a bunch of EmitBranch calls with EmitBranchThroughCleanup. No functionality change (yet).
llvm-svn: 64159
2009-02-09 20:31:03 +00:00
Anders Carlsson ff0bb6ce62 Save and restore the DidCallStackSave variable
llvm-svn: 64157
2009-02-09 20:23:40 +00:00
Anders Carlsson f4478e94b8 Add DidCallStackSave variable to CodeGenFunction.
llvm-svn: 64156
2009-02-09 20:20:56 +00:00
Douglas Gregor aef040a28e When handling "the rest" of a designated array subobject, maybe sure
to tell it that it wasn't (directly) designated. This way, we unwind
back to the explicit initializer list properly rather than getting
stuck in the wrong subobject. Fixes llvm.org/PR3519

llvm-svn: 64155
2009-02-09 19:45:19 +00:00
Douglas Gregor 67b556a0da Eliminate TemplateArg so that we only have a single kind of
representation for template arguments. Also simplifies the interface
for ActOnClassTemplateSpecialization and eliminates some annoying
allocations of TemplateArgs.

My attempt at smart pointers for template arguments lists is
relatively lame. We can improve it once we're sure that we have the
right representation for template arguments.

llvm-svn: 64154
2009-02-09 19:34:22 +00:00
Douglas Gregor 8bf4205c70 Start processing template-ids as types when the template-name refers
to a class template. For example, the template-id 'vector<int>' now
has a nice, sugary type in the type system. What we can do now:

  - Parse template-ids like 'vector<int>' (where 'vector' names a
    class template) and form proper types for them in the type system.
  - Parse icky template-ids like 'A<5>' and 'A<(5 > 0)>' properly,
    using (sadly) a bool in the parser to tell it whether '>' should
    be treated as an operator or not.

This is a baby-step, with major problems and limitations:
  - There are currently two ways that we handle template arguments
  (whether they are types or expressions). These will be merged, and,
  most likely, TemplateArg will disappear.
  - We don't have any notion of the declaration of class template
  specializations or of template instantiations, so all template-ids
  are fancy names for 'int' :)

llvm-svn: 64153
2009-02-09 18:46:07 +00:00
Sebastian Redl 1df2bbe7f9 Update new expression to make use of Declarator::getSourceRange().
References are not objects; implement this in Type::isObjectType().

llvm-svn: 64152
2009-02-09 18:24:27 +00:00
Sebastian Redl f6591ca6d9 Implement Declarator::getSourceRange().
llvm-svn: 64151
2009-02-09 18:23:29 +00:00
Ted Kremenek 0203db73ee Fix PR 2514: Do not flag dead initializations for variables initialized to a constant global variable.
llvm-svn: 64149
2009-02-09 18:01:00 +00:00
Ted Kremenek e2559b22d0 Deallocate the StringLiteral itself in StringLiteral::Destroy() and deallocate the string data before running StringLiteral's destructor.
llvm-svn: 64146
2009-02-09 17:10:09 +00:00
Ted Kremenek 5b0d90fa79 Allocate the subexpression array for OberloadExpr from ASTContext's allocator.
llvm-svn: 64145
2009-02-09 17:08:14 +00:00
Ted Kremenek 42bdbef222 Refine PostStmtCustom to reference a tagged data pair with the tag to indicate the checker.
llvm-svn: 64144
2009-02-09 16:59:59 +00:00
Ted Kremenek a4bebd0c69 Added a new ProgramPoint 'PostStmtCustom' to enable checker-specific ProgramPoints.
llvm-svn: 64143
2009-02-09 16:52:31 +00:00
Douglas Gregor 9817f4a717 Make Sema::getTypeName return the opaque pointer of a QualType rather
than a Decl, which gives us some more flexibility to express the
results with the type system. There are no clients using this
flexibility yet, but it's meant to be able to describe qualified names
as written in the source (e.g., "foo::type") or template-ids that name
a class template specialization (e.g., "std::vector<INT>").

DeclSpec's TST_typedef has become TST_typename, to reflect its use to
describe types found by name (that may or may not be typedefs). The
type representation of a DeclSpec with TST_typename is an opaque
QualType pointer. All users of TST_typedef, both direct and indirect,
have been updated for these changes.

llvm-svn: 64141
2009-02-09 15:09:02 +00:00
Chris Lattner 10c16ca0b9 spell out explicitly
llvm-svn: 64129
2009-02-09 08:47:44 +00:00
Chris Lattner f5e9242dd4 add doc
llvm-svn: 64128
2009-02-09 08:47:17 +00:00
Chris Lattner b8ec6bbb6a new document.
llvm-svn: 64127
2009-02-09 08:46:11 +00:00
Mike Stump fc49682f20 Add some more documentation. Also reflowed comments to 80 col.
llvm-svn: 64105
2009-02-08 23:14:22 +00:00
Anders Carlsson 9c964ac272 Reuse case destinations.
llvm-svn: 64100
2009-02-08 22:46:50 +00:00
Anders Carlsson f57b9eef62 Always check if we can remove branch fixups, even if the cleanup stack is empty.
llvm-svn: 64099
2009-02-08 22:45:15 +00:00
Anders Carlsson dcb149cbef Add a simplified EmitJumpThroughFinally and use it in CGObjC in preparation of making it use the cleanup stack.
llvm-svn: 64098
2009-02-08 22:25:30 +00:00
Anders Carlsson 76180ea456 Misc fixes to the cleanup stack code.
llvm-svn: 64096
2009-02-08 22:13:37 +00:00
Mike Stump a6dbd7b25a When we're at the stack depth we want, there isn't anything to do.
llvm-svn: 64095
2009-02-08 22:00:53 +00:00
Chris Lattner cd2b504d5f add another crazy idea :)
llvm-svn: 64092
2009-02-08 20:41:34 +00:00
Chris Lattner f7ae0d1fb2 just remove this insane testcase :)
llvm-svn: 64087
2009-02-08 19:44:51 +00:00
Sebastian Redl c9ab3d430b Teach the constant evaluator about C++ const integral variables.
llvm-svn: 64086
2009-02-08 15:51:17 +00:00
Sebastian Redl df0913ba70 Fix redundant errors with missing default arguments in member declarations.
llvm-svn: 64085
2009-02-08 14:56:26 +00:00
Sebastian Redl 95ea38fa1a Fix redundant errors for redefinitions with multiple existing definitions.
llvm-svn: 64081
2009-02-08 10:49:44 +00:00
Sebastian Redl aa400d83e6 Make the test cases failing due to exact diagnostic matching XFAIL.
llvm-svn: 64080
2009-02-08 10:28:44 +00:00
Mike Stump 284d177c7f Wire up break and continue processing to the new stack depth adjuster.
If people could beat on it and let me know if there are any new
semantics required by newer language standards or DRs or any little
details I goofed on, I'd be happy to fix any issues found.

llvm-svn: 64079
2009-02-08 09:22:19 +00:00
Mike Stump f876bc9388 Fixup expected errors.
llvm-svn: 64074
2009-02-08 07:59:54 +00:00
Anders Carlsson 66c384ac2e More cleanup stack work, PopCleanupBlock now returns a struct with the switch block and end block.
llvm-svn: 64072
2009-02-08 07:46:24 +00:00
Ted Kremenek beb1ce6504 Updated checker build.
llvm-svn: 64071
2009-02-08 05:05:02 +00:00
Anders Carlsson ae91d9b140 Split some functions up
llvm-svn: 64069
2009-02-08 03:55:35 +00:00
Anders Carlsson a586ad7f85 CleanupScope needs to push the cleanup block in its destructor
llvm-svn: 64068
2009-02-08 03:22:36 +00:00
Anders Carlsson 3c21dd5a80 Implement support for branch fixups.
llvm-svn: 64064
2009-02-08 01:23:05 +00:00
Chris Lattner 24c911e25a use some references to simplify code.
llvm-svn: 64063
2009-02-08 01:00:10 +00:00
Chris Lattner bf20a9a57d Genericize the existing logic for removing duplicate header dirs to apply
the "system dirs win over user dirs" logic to framework and headermap
search locations as well as normal directories.  This means that
clang t.m -F/System/Library/Frameworks  will treat /System/Library/Frameworks
as a system directory not a user directory.  If you use -v, the difference is:

Before:
ignoring nonexistent directory "/usr/libdata/gcc41"
ignoring duplicate framework "/System/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:

After:
ignoring nonexistent directory "/usr/libdata/gcc41"
ignoring duplicate directory "/System/Library/Frameworks"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:

This fixes rdar://6566429.

llvm-svn: 64060
2009-02-08 00:55:22 +00:00
Anders Carlsson 7d70fd27a4 More cleanup stack work.
llvm-svn: 64059
2009-02-08 00:50:42 +00:00
Douglas Gregor 9fc4c68380 Add public placement-delete operators. These are automatically used if the allocation throws
llvm-svn: 64056
2009-02-08 00:29:56 +00:00
Anders Carlsson fbfb5e6530 When emitting blocks, keep track of which cleanup scope they have. Minor fixes and cleanup.
llvm-svn: 64053
2009-02-08 00:16:35 +00:00
Anders Carlsson cadb9a6a34 Emit a cleanup block for the cleanup attribute
llvm-svn: 64052
2009-02-07 23:51:38 +00:00
Anders Carlsson be0f76a712 Add support for emitting cleanup blocks. Make EmitCompoundStatement emit cleanup blocks if necessary
llvm-svn: 64051
2009-02-07 23:50:39 +00:00
Anders Carlsson 2cf8c44e43 Add a simple RAII object, to be used for pushing a cleanup entry and make the insertion point be the cleanup block.
llvm-svn: 64048
2009-02-07 23:30:41 +00:00
Anders Carlsson 723f55d697 Improve Sema of the cleanup attribute somewhat.
llvm-svn: 64047
2009-02-07 23:16:50 +00:00
Mike Stump 0509d9635b Ensure we track all the stack depths for all break and continue points
correctly.  This should lay the ground work to throw the big switch
and start code gening break and continue in the presense of vlas.

llvm-svn: 64046
2009-02-07 23:02:10 +00:00
Ted Kremenek 394dfeb37b Update test case.
llvm-svn: 64045
2009-02-07 22:55:48 +00:00
Ted Kremenek eae2a0eb8f Fix null dereference.
llvm-svn: 64044
2009-02-07 22:54:59 +00:00
Anders Carlsson 15cb75a20c Add plumbing for the cleanup stack.
llvm-svn: 64043
2009-02-07 22:53:43 +00:00
Ted Kremenek 0aadcd4179 Commit header.
llvm-svn: 64042
2009-02-07 22:46:46 +00:00
Ted Kremenek 2a4028b728 For retain/release leaks, have the BugReport description indicate the allocation site and initial bindings.
llvm-svn: 64041
2009-02-07 22:38:00 +00:00
Ted Kremenek 79f955bfed Tidy up bug descriptions.
llvm-svn: 64039
2009-02-07 22:37:02 +00:00
Ted Kremenek 252b90ece6 Use BugReport::getDescription() for the compiler warning text.
llvm-svn: 64038
2009-02-07 22:36:41 +00:00
Chris Lattner 4293c8935a C++ really shouldn't check these #defines, thanks to Howard
for pointing this out!

llvm-svn: 64037
2009-02-07 22:21:31 +00:00
Ted Kremenek 008242f6ea Determining the allocation site for a leak when constructing a CFRefLeakReport. This avoids repeated calls to GetAllocationSite when Profiling a CFRefLeakReport object.
llvm-svn: 64036
2009-02-07 22:19:59 +00:00
Ted Kremenek 14036554d2 Split logic for 'getEndPath()' for CFRefReport and CFRefLeakReport.
llvm-svn: 64034
2009-02-07 22:04:05 +00:00
Ted Kremenek da545836f0 Convert a use of 'std::ostringstream' to 'llvm::raw_string_ostream'.
llvm-svn: 64033
2009-02-07 21:59:45 +00:00
Anders Carlsson bf8a1be33c Split the exception object out into its own stack.
llvm-svn: 64032
2009-02-07 21:37:21 +00:00
Anders Carlsson da0e4560a1 Simplify the Objective-C exception handling.
llvm-svn: 64031
2009-02-07 21:26:04 +00:00
Mike Stump 56d2a15829 Format for 80-cols.
llvm-svn: 64030
2009-02-07 20:14:12 +00:00
Sebastian Redl 5822f08cd6 Move CheckPointerToMemberOperands to SemaExprCXX.cpp
llvm-svn: 64029
2009-02-07 20:10:22 +00:00
Mike Stump 6d8a617474 Ensure that we don't miscodegen if vlas creap into the top of the for.
This will allow us to generate break and continue even if vlas are
involved without worry that we'll silently generate bad code.

llvm-svn: 64028
2009-02-07 20:09:00 +00:00
Sebastian Redl 7b7cec6895 Fix pretty-printing of if conditions. Patch by Ben Lickly.
llvm-svn: 64027
2009-02-07 20:05:48 +00:00
Sebastian Redl 2175b6a767 Make one expected-diag directive match exactly one actual diagnostic.
This uncovers some bugs, so several test cases now fail.

llvm-svn: 64025
2009-02-07 19:52:04 +00:00
Mike Stump dc0d6be7b9 Arrange to have the correct StackDepth for while statements.
llvm-svn: 64021
2009-02-07 18:08:12 +00:00
Mike Stump 1f8be1b9ac Fit into 80-col.
llvm-svn: 64020
2009-02-07 17:18:33 +00:00
Douglas Gregor dfa6ee53d7 Add a test case for some Objective-C behavior that will not be supported in Objective-C++
llvm-svn: 64019
2009-02-07 17:16:20 +00:00
Sebastian Redl f3b5e27fee Make const-initialized const integral variables I-C-Es in C++.
llvm-svn: 64015
2009-02-07 13:06:23 +00:00
Mike Stump 1d91dd98ad Fixup goto codegen in and around VLAs.
llvm-svn: 64014
2009-02-07 12:52:26 +00:00
Sebastian Redl 779dd9382d Fill in C++ status table for section 7 (declarations).
llvm-svn: 64013
2009-02-07 12:42:13 +00:00
Chris Lattner 6726d42059 remove two eroneous suffixes, these promote to int. Thanks to Neil
for pointing this out.

llvm-svn: 64011
2009-02-07 08:49:37 +00:00
Chris Lattner 04441a10a5 add note, weirdness.
llvm-svn: 64010
2009-02-07 07:13:51 +00:00
Chris Lattner a7cc1267cf fix some missing parens, thanks for Eli's review!
Obviously I make a miserable header developer :)

llvm-svn: 64009
2009-02-07 06:42:04 +00:00
Chris Lattner 14bc3528f5 fix a typo that Sebastian noticed!
llvm-svn: 64008
2009-02-07 06:38:41 +00:00
Chris Lattner 5455db4273 make sure that UINTMAX_MAX has an unsigned type. This assumes that
uintmax_t is unsigned long long, which is not optimal, but is assumed 
elsewhere already.

llvm-svn: 64007
2009-02-07 06:38:06 +00:00
Chris Lattner 6bda45cec0 make various MAX/MIN constants be preprocessor constants, not C constants.
Thanks to Eli for pointing this out.

llvm-svn: 64006
2009-02-07 06:33:44 +00:00
Mike Stump 1f36fb1de0 Ensure that we assert if given an unhandled value.
llvm-svn: 64004
2009-02-07 03:46:08 +00:00
Daniel Dunbar ee9e4c274b Set load/store alignment when doing ABI coercions.
- Currently, this is producing poor code, but we prefer correctness
   to performance for now. Eventually we should be able to generally
   avoid having to set the alignment when we control the alignment of
   the alloca.

 - This knocks out 33/1000 failures on my single argument ABI tests,
   down to 22/1000 and 18 of these appear to be gcc bugs. Woot.

llvm-svn: 64001
2009-02-07 02:46:03 +00:00
Ted Kremenek 0b41d6c43d Use 'Destroy(Context)' instead of 'Context.Deallocate()' (does recursive freeing of memory).
llvm-svn: 63998
2009-02-07 01:51:40 +00:00
Ted Kremenek 5a201951ca Overhaul of Stmt allocation:
- Made allocation of Stmt objects using vanilla new/delete a *compiler
  error* by making this new/delete "protected" within class Stmt.
- Now the only way to allocate Stmt objects is by using the new
  operator that takes ASTContext& as an argument.  This ensures that
  all Stmt nodes are allocated from the same (pool) allocator.
- Naturally, these two changes required that *all* creation sites for
  AST nodes use new (ASTContext&).  This is a large patch, but the
  majority of the changes are just this mechanical adjustment.
- The above changes also mean that AST nodes can no longer be
  deallocated using 'delete'.  Instead, one most do
  StmtObject->Destroy(ASTContext&) or do
  ASTContextObject.Deallocate(StmtObject) (the latter not running the
  'Destroy' method).

Along the way I also...
- Made CompoundStmt allocate its array of Stmt* using the allocator in
  ASTContext (previously it used std::vector).  There are a whole
  bunch of other Stmt classes that need to be similarly changed to
  ensure that all memory allocated for ASTs comes from the allocator
  in ASTContext.
- Added a new smart pointer ExprOwningPtr to Sema.h.  This replaces
  the uses of llvm::OwningPtr within Sema, as llvm::OwningPtr used
  'delete' to free memory instead of a Stmt's 'Destroy' method.

Big thanks to Doug Gregor for helping with the acrobatics of making
'new/delete' private and the new smart pointer ExprOwningPtr!

llvm-svn: 63997
2009-02-07 01:47:29 +00:00
Ted Kremenek 5d7662cfe0 GRExprEngine: When processing compound assignments, do a switch table lookup to get the non-compound opcode from the compound opcode instead of relying on the order of BinaryOperator::opcode values. This unbreaks the misc-ps.c test.
llvm-svn: 63991
2009-02-07 00:52:24 +00:00
Chris Lattner 19179ad680 start of tgmath, yuck.
llvm-svn: 63990
2009-02-07 00:47:29 +00:00
Sebastian Redl 9c3b4b1bc5 Add negative test cases and fix diagnostics for member pointer dereferencing.
llvm-svn: 63987
2009-02-07 00:41:42 +00:00
Daniel Dunbar d404862cf9 When making dummy file entries, the directory name should also be
non-empty.

llvm-svn: 63986
2009-02-07 00:40:41 +00:00
Sebastian Redl 1d8cb2e0d0 Use our new snazzy stdint.h to make a testcase 64-bit portable.
llvm-svn: 63985
2009-02-07 00:23:52 +00:00
Chris Lattner 01af63beb4 Apparently it is important to define intptr_t and uintptr_t to
long instead of int.  This is because system heaers like to redefine
typedefs and that is an error if they don't exactly match.  Use long
for intptr_t on all systems where long is the right size.

llvm-svn: 63984
2009-02-07 00:23:17 +00:00
Sebastian Redl 112a976616 Implement dereferencing of pointers-to-member.
llvm-svn: 63983
2009-02-07 00:15:38 +00:00
Sebastian Redl ad41b83816 Fix some errors in the new stdint.h.
llvm-svn: 63982
2009-02-06 23:57:52 +00:00
Fariborz Jahanian c76e741622 Fixed an objc2 nonfragile-abi code gen bug.
Now we can say 'hello world' objective-c style
in the nonfragile abi.

llvm-svn: 63981
2009-02-06 23:46:26 +00:00
Chris Lattner 6fbf3a07bc only define MB_LEN_MAX if the system <limits.h> doesn't.
don't typecast CHAR_MIN to char, this makes it not a PP constant
and gives it the wrong unpromoted type.  Thanks to Sebastian for
pointing this out!

llvm-svn: 63980
2009-02-06 23:29:39 +00:00
Chris Lattner 404c2fb9cc add a stdint.h header.
llvm-svn: 63977
2009-02-06 22:59:47 +00:00
Chris Lattner 0763cc6bfd Export __INT8_TYPE__ / __INT16_TYPE__ / __INT32_TYPE__ / __INT64_TYPE__
in a gcc 4.5 compatible way so that stdint.h can follow the compiler's 
notion of types.

llvm-svn: 63976
2009-02-06 22:59:26 +00:00
Douglas Gregor 706a6a9cbf Clean up an already-fixed FIXME
llvm-svn: 63975
2009-02-06 22:58:38 +00:00
Douglas Gregor cd72ba97e7 Semantic checking for class template declarations and
redeclarations. For example, checks that a class template
redeclaration has the same template parameters as previous
declarations.

Detangled class-template checking from ActOnTag, whose logic was
getting rather convoluted because it tried to handle C, C++, and C++
template semantics in one shot.

Made some inroads toward eliminating extraneous "declaration does not
declare anything" errors by adding an "error" type specifier.

llvm-svn: 63973
2009-02-06 22:42:48 +00:00
Ted Kremenek b586c293c8 Update comment.
llvm-svn: 63961
2009-02-06 21:15:34 +00:00
Fariborz Jahanian 6b7cd6e5f4 objc2's nonfragile abi API for messages sent to 'super'.
llvm-svn: 63959
2009-02-06 20:09:23 +00:00
Ted Kremenek 6b7ecf6819 Move StringLiteral to allocate its internal string data using the allocator in
ASTContext. This required changing all clients to pass in the ASTContext& to the
constructor of StringLiteral. I also changed all allocations of StringLiteral to
use new(ASTContext&).

Along the way, I updated a bunch of new()'s in StmtSerialization.cpp to use the
allocator from ASTContext& (not complete).

llvm-svn: 63958
2009-02-06 19:55:15 +00:00
Ted Kremenek 80954b7dc3 Add sub-testcase where we process Cocoa.h using --disable-free (i.e., test the usage of the BumpPtrAllocator in ASTContext).
llvm-svn: 63957
2009-02-06 19:36:35 +00:00
Daniel Dunbar 1a5f04dc66 ccc: Forward -dM to clang.
llvm-svn: 63955
2009-02-06 19:26:48 +00:00
Daniel Dunbar 421d40c22b ccc/Darwin: Add a missing Darwin argument translation, -shared becomes
-dynamiclib. Re-audited translations to make sure I didn't miss
something else.

llvm-svn: 63953
2009-02-06 19:18:58 +00:00
Daniel Dunbar fe2fb0af5a Use 'compile' instead of 'codegen' when reporting error to user.
llvm-svn: 63952
2009-02-06 19:18:03 +00:00
Ted Kremenek fab16c16a7 Added special versions of new[]/delete[] to complement the new/delete which uses ASTContext's allocator. Updated some comments along the way.
llvm-svn: 63949
2009-02-06 19:10:16 +00:00
Chris Lattner 0b0cfbcb62 correct description
llvm-svn: 63947
2009-02-06 18:45:59 +00:00
Chris Lattner 1cee17aa5f first hack at limits.h
llvm-svn: 63945
2009-02-06 18:34:27 +00:00
Chris Lattner a31829b5bc -funsigned-char sets __CHAR_UNSIGNED__
llvm-svn: 63942
2009-02-06 18:20:57 +00:00
Douglas Gregor 8af63e42e3 Diagnose attempts to define a namespace member out-of-line when no
matching member exists. Thanks to Piotr Rak for reporting the problem!

llvm-svn: 63939
2009-02-06 17:46:57 +00:00
Zhongxing Xu 4bdb124036 Put the region store specific test in a separate file.
llvm-svn: 63930
2009-02-06 08:56:58 +00:00
Zhongxing Xu e42755334c SymbolicRegions really have unknown sizes.
llvm-svn: 63929
2009-02-06 08:51:30 +00:00
Zhongxing Xu dec48a50df Create ElementRegion when the base is SymbolicRegion. This is like what we do
for FieldRegion. This enables us to track more values.

Simplify SymbolicRegion::getRValueType(). We assume the symbol always has
pointer type.

llvm-svn: 63928
2009-02-06 08:44:27 +00:00
Chris Lattner 1630c3c4f0 Add an implementation of -dM that follows GCC closely enough to permit
diffing the output of:
  clang -dM -o - -E -x c foo.c | sort

llvm-svn: 63926
2009-02-06 06:45:26 +00:00
Chris Lattner 5c7cd6043e add interface for walking macro table.
llvm-svn: 63925
2009-02-06 06:26:42 +00:00
Chris Lattner f302000e5c add support for -x c++-header, update comment.
llvm-svn: 63924
2009-02-06 06:19:20 +00:00
Chris Lattner fc001b04f8 factor some code out into a helper function.
llvm-svn: 63922
2009-02-06 05:56:11 +00:00
Chris Lattner 4c72665bca file gone.
llvm-svn: 63921
2009-02-06 05:18:06 +00:00
Chris Lattner bba531ce99 get __WCHAR_TYPE__ from the targetinfo hook
llvm-svn: 63920
2009-02-06 05:06:07 +00:00
Chris Lattner a91c30fdb0 simplify and refactor a bunch of type definition code in Preprocessor
predefines buffer initialization.

llvm-svn: 63919
2009-02-06 05:04:11 +00:00
Chris Lattner 61898606dc remove some ad-hocery and use DefineTypeSize for more things.
Now you too can have a 47 bit long long!

llvm-svn: 63918
2009-02-06 04:55:18 +00:00
Chris Lattner a3dc5d8423 refactor some code into a DefineTypeSize function.
llvm-svn: 63917
2009-02-06 04:50:25 +00:00
Chris Lattner fa81669354 default diag::err_pp_file_not_found to mapping to fatal,
implementing PR3492: #include failures should be a fatal error

llvm-svn: 63915
2009-02-06 04:16:41 +00:00
Chris Lattner 9e03119446 don't emit any diagnostics after a fatal one.
llvm-svn: 63914
2009-02-06 04:16:02 +00:00
Chris Lattner b05f49e7fd handle fatal errors, rely on warnings to point out missing cases.
llvm-svn: 63913
2009-02-06 03:57:44 +00:00
Ted Kremenek fe7a9601e9 Use ASTContext's allocator to deallocate Stmt objects instead of using 'delete'. This fixes <rdar://problem/6561143>.
llvm-svn: 63905
2009-02-06 01:42:09 +00:00
Daniel Dunbar ba3325af7b ccc: Give explicit error on @ style argument lists (not yet supported).
llvm-svn: 63903
2009-02-06 01:28:59 +00:00
Daniel Dunbar 724167c280 ccc: Implement special language recognition handling for -.
- <rdar://problem/6551577> [ccc] require -x with -

llvm-svn: 63901
2009-02-05 23:44:44 +00:00
Douglas Gregor eff93e0401 Improve the representation of template type parameters. We now
canonicalize by template parameter depth, index, and name, and the
unnamed version of a template parameter serves as the canonical.

TemplateTypeParmDecl no longer needs to inherit from
TemplateParmPosition, since depth and index information is present
within the type.

llvm-svn: 63899
2009-02-05 23:33:38 +00:00
Ted Kremenek 686a09d7b8 Updated checker build.
llvm-svn: 63897
2009-02-05 23:19:12 +00:00
Chris Lattner 6be3cd1073 allow mapping errors to fatal.
llvm-svn: 63896
2009-02-05 22:56:06 +00:00
Chris Lattner 9d6c4408d1 document fatal
llvm-svn: 63895
2009-02-05 22:49:08 +00:00
Chris Lattner fbe2272fc8 add support to the diagnostics machinery for mapping warnings and
errors to 'fatal' error severity.

llvm-svn: 63894
2009-02-05 22:47:05 +00:00
Ted Kremenek 0ca23d3f73 Add 'AppendValue' to the list of magic CF function names that cause a tracked object to escape. Fixes <rdar://problem/6560661>.
llvm-svn: 63891
2009-02-05 22:34:53 +00:00
Fariborz Jahanian 33f66e640a objc2's nonfragile-abi - API selection for when receiver is a class
llvm-svn: 63881
2009-02-05 20:41:40 +00:00
Anders Carlsson 31f8649f83 Follow Eli's advice and store the VLA size with the native size_t type. Fixes PR3491.
llvm-svn: 63879
2009-02-05 19:43:10 +00:00
Fariborz Jahanian 4f9d349e07 More objc2's API chanes.
llvm-svn: 63878
2009-02-05 19:35:43 +00:00
Douglas Gregor 700792c4e4 Improvements and fixes for name lookup with using directives, from Piotr Rak!
Also, put Objective-C protocols into their own identifier
namespace. Otherwise, we find protocols when we don't want to in C++
(but not in C).

llvm-svn: 63877
2009-02-05 19:25:20 +00:00
Chris Lattner df52dc7a6f I didn't mean to change this.
llvm-svn: 63875
2009-02-05 19:05:56 +00:00
Torok Edwin c6853c1531 Add Debian gcc 4.3 header search directories.
llvm-svn: 63872
2009-02-05 18:12:45 +00:00
Fariborz Jahanian 9065541262 #ifdef'out out objc2 API selection which is not done in gcc (unlike
the documentation to the contrary).

llvm-svn: 63871
2009-02-05 18:00:27 +00:00
Ted Kremenek cc41c07227 Update checker build.
llvm-svn: 63869
2009-02-05 15:48:51 +00:00
Sebastian Redl 0fb63471de Fix the symptom of the regression, by having the CXXConditionDeclExpr not destroy its Decl.
However, the cause still remains: the Decl is linked into the chain of its DeclContext and remains there despite being deleted.

llvm-svn: 63868
2009-02-05 15:12:41 +00:00
Sebastian Redl 726a0d9524 Put the invalid flag of OwningResult into the Action pointer.
This shrinks OwningResult by one pointer. Since it is no longer larger than OwningPtr, merge the two.
This leads to simpler client code and speeds up my benchmark by 2.7%.
For some reason, this exposes a previously hidden bug, causing a regression in SemaCXX/condition.cpp.

llvm-svn: 63867
2009-02-05 15:02:23 +00:00
Sebastian Redl 16d307d8d0 Remove some non-ASCII in comment.
llvm-svn: 63866
2009-02-05 12:33:33 +00:00
Daniel Dunbar 3b2dd4368a Add bare bones test that parameter passing is consistent for
scalar/complex/aggregate cases.
 - Currently disabled for x86_64, triggering a misoptimization
   (PR3489).

llvm-svn: 63864
2009-02-05 11:21:33 +00:00
Daniel Dunbar 5d3dbd64e1 Implement Direct ABIInfo semantics.
- No intended functionality change, this is essentially enabling
   direct passing of complex and aggregate values, which no ABI is
   using.

llvm-svn: 63863
2009-02-05 11:13:54 +00:00
Daniel Dunbar cea3af4e54 Simplify test for whether we need an alloca to hold an indirect return
value.
 - No functionality change.

llvm-svn: 63859
2009-02-05 09:24:53 +00:00
Daniel Dunbar 747865af0c Implement ABI Indirect sematics for arguments.
- No intended functionality change, all current ABI implementations
   were only using indirect for complex/aggregate types, which were
   being passed indirectly with the Direct ABIInfo kind.

llvm-svn: 63858
2009-02-05 09:16:39 +00:00
Daniel Dunbar b8b1c679c4 Merge ABIInfo StructRet/ByVal into Indirect.
- No (intended) functionality change, the semantic changes are to come.

llvm-svn: 63850
2009-02-05 08:00:50 +00:00
Chris Lattner d0a79b2eb8 make clang agree with gcc 4.2's x86-64 predefines and settings.
llvm-svn: 63849
2009-02-05 07:32:46 +00:00
Chris Lattner fafd8d1be9 correct and generalize computation of __INTMAX_MAX__.
llvm-svn: 63848
2009-02-05 07:27:41 +00:00
Chris Lattner 6e5ca6bff9 privatize some stuff.
llvm-svn: 63847
2009-02-05 07:27:29 +00:00
Chris Lattner 8181312251 fix some differences between apple gcc and clang on darwin/x86-32.
llvm-svn: 63846
2009-02-05 07:19:24 +00:00
Daniel Dunbar c79407fc40 Pull CodeGenFunction::GetUndefRValue() out of EmitUnsupportedRValue.
llvm-svn: 63845
2009-02-05 07:09:07 +00:00
Zhongxing Xu 9103df1688 Make SymbolicRegion subclass TypedRegion, for symbols usually have types, so
do the symblic regions associated with them and we need them to be typed.

Current SymbolicRegion::getRValueType() method is very restricting. It may be
modified when we are more clear about what could be the types of symblic
regions.

BasicConstraintManager::Assume() is changed due to that now SymblicRegion is a
subclass of SubRegion.
 

llvm-svn: 63844
2009-02-05 06:57:29 +00:00
Ted Kremenek 400aae7fa4 Remove a bunch of obscene double-buffering of BugReports in the retain/release
checker. This was previously needed because BugReport objects were previously
allocated on the stack and not owned by BugReporter. Now we can just issue them
on the fly. This change was motivated because we were seeing some weird cases
where some really long paths would get issued for bugs (particularly leaks)
because of some double-caching.

llvm-svn: 63840
2009-02-05 06:50:21 +00:00
Daniel Dunbar e7dffe39ff ccc: Translate -O to -O1 for clang, and only pass last -O option.
llvm-svn: 63816
2009-02-05 02:43:38 +00:00
Dale Johannesen 621c3512a3 Reapply Daniel's patch to match up with llvm 63765.
Untested, Daniel or Nate please review.

llvm-svn: 63814
2009-02-05 01:50:47 +00:00
Daniel Dunbar 70245be397 x86-32: Use Ignore to avoid passing empty structs (instead of Expand).
llvm-svn: 63813
2009-02-05 01:50:07 +00:00
Daniel Dunbar 0103574d55 Honor ByVal alignment. Patch by Nate Begeman!
llvm-svn: 63811
2009-02-05 01:31:19 +00:00
Fariborz Jahanian 4e87c834d3 This patch generates messaging code for objc2's non-fragile abi.
llvm-svn: 63810
2009-02-05 01:13:09 +00:00
Daniel Dunbar 8045343ca2 Initialize alignment field for ByVal ABIInfo correctly.
llvm-svn: 63809
2009-02-05 01:01:30 +00:00
Ted Kremenek fb379b2660 Fix regression: Leak (BugType) object should have 'isLeak()' return true.
llvm-svn: 63803
2009-02-05 00:38:00 +00:00
Daniel Dunbar fff09f335d Unbreak CGFunctionInfo::Profile method and reenable caching of ABI
information.

llvm-svn: 63799
2009-02-05 00:00:23 +00:00
Ted Kremenek fc5d067ea0 Overhaul BugReporter interface and implementation. The new interface cleans up
the ownership of BugTypes and BugReports. Now BugReports are owned by BugTypes,
and BugTypes are owned by the BugReporter object.

The major functionality change in this patch is that reports are not immediately
emitted by a call to BugReporter::EmitWarning (now called EmitReport), but
instead of queued up in report "equivalence classes". When
BugReporter::FlushReports() is called, it emits one diagnostic per report
equivalence class. This provides a nice cleanup with the caching of reports as
well as enables the BugReporter engine to select the "best" path for reporting a
path-sensitive bug based on all the locations in the ExplodedGraph that the same
bug could occur.

Along with this patch, Leaks are now coalesced into a common equivalence class
by their allocation site, and the "summary" diagnostic for leaks now reports the
allocation site as the location of the bug (this may later be augmented to also
provide an example location where the leak occurs).

llvm-svn: 63796
2009-02-04 23:49:09 +00:00
Daniel Dunbar 400c040e01 Chase LLVM TOT in circles (i.e., revert r63773 to match revert of
r63765).

llvm-svn: 63795
2009-02-04 23:40:00 +00:00
Daniel Dunbar 56e7552c73 Add ABIArgInfo::dump()
llvm-svn: 63794
2009-02-04 23:24:38 +00:00