Commit Graph

5846 Commits

Author SHA1 Message Date
Ted Kremenek 8d78a09a56 Reorder serialization methods.
When serializing DeclStmt, encode a bit indicating whether or not the DeclStmt owns the Decl.  This is an interim solution.

llvm-svn: 54410
2008-08-06 15:50:59 +00:00
Daniel Dunbar e8bdce441b Fix EmitNullInitializationToLValue for bitfield lvalues.
- PR2643

llvm-svn: 54397
2008-08-06 05:32:55 +00:00
Daniel Dunbar ead7c91240 Fix bitfield accesses which straddle the boundary of the underlying
type.

 - This generates somewhat less optimal code than before but this is
   not hard to rectify once stable (at the cost of slightly more
   complex code).

 - This currently always uses little-endian ordering of the bitfield. 

 - This breaks the CodeGen/bitfield.c test because it was grepping for
   hard-coded assembly instructions. Will fix once a better test case
   is constructed (hard to do without execution).

 - This fixes SingleSource/UnitTests/2006-01-23-InitializedBitField.c
   and Regression/C/PR1386.c from the test suite.

 - <rdar://problem/6085090>, <rdar://problem/6094169>

llvm-svn: 54395
2008-08-06 05:08:45 +00:00
Ted Kremenek be160966cd Update xcode project to new libDriver layout.
llvm-svn: 54393
2008-08-06 02:55:08 +00:00
Daniel Dunbar bfb1cd7454 Fix CodeGen of pointer arithmetic in compound assignment statements.
- Changed EmitSub to work on all cases (arithmetic, ptr - int, ptr -
   ptr) so that implementation matches that of other operators.

 - Modify EmitCompoundAssign to compute and perform the appropriate
   casts of left, right, and result types for the assorted pointer
   arithmetic cases.

 - Fix EmitSub (ptr - int) case to negate the rhs *after*
   extension. This is critical when the rhs is unsigned (and needs
   extension).

 - This fixes cfrac.

 - <rdr://6115726>

llvm-svn: 54392
2008-08-06 02:00:38 +00:00
Daniel Dunbar ffc29be83f Implement GNU asm-label extension support in CodeGen. This fixes
scimark2 on Darwin.

 - Added Sema support for asm-label on variables, which I forgot before.

 - Update CodeGen to use GlobalDeclMap to determine if static Decls
   require emission (instead of LLVM module name lookup). Important
   since the Decl name and the LLVM module name can differ.

 - <rdar://problem/6116729>

llvm-svn: 54388
2008-08-06 00:03:29 +00:00
Nico Weber b5fc3c300a add a libDriver, for now only move the text diangostics stuff from Driver to there
llvm-svn: 54383
2008-08-05 23:33:20 +00:00
Daniel Dunbar 829e988899 Change CodeGen of global decls to key off of the name (instead of
having multiple bindings from all the possible decls which
  conceptually map to the same global).

 - This eliminates CodeGen depending on the LLVM module for name
   lookup.

 - This also eliminates the need for ReplaceMapValuesWith (hurrah).

 - This handles lookups for FunctionDecls correctly in the presence of
   aliases, this was previously broken.

 - WIP: Can still clean up & unify variable and function emission.

llvm-svn: 54382
2008-08-05 23:31:02 +00:00
Nico Weber de565e3bc9 remove spaces at eol to test commit access
llvm-svn: 54381
2008-08-05 23:15:29 +00:00
Ted Kremenek 182ab758a3 Add missing "classof" methods to NonNullAttr, fixing a heisencrash.
llvm-svn: 54373
2008-08-05 21:29:52 +00:00
Ted Kremenek 4f8792b616 Added decl_iterator to DeclStmt to provide an abstract interface to iterate over the ScopedDecls of a DeclStmt.
Updated a few clients of DeclStmt::getNextDeclarator() to use decl_iterator instead.  Will update other clients after additional testing.

llvm-svn: 54368
2008-08-05 20:46:55 +00:00
Steve Naroff dd514e01f2 Finish fixing <rdar://problem/5929344> clang ObjC rewriter: "extern int __CFConstantStringClassReference[];" should be extern "C"
llvm-svn: 54367
2008-08-05 20:04:48 +00:00
Ted Kremenek 9f6112c4e6 Remove excess #include.
llvm-svn: 54366
2008-08-05 19:56:24 +00:00
Nuno Lopes d86aa9340d fix crash when printing diagnostics with tokens that span through more than one line
llvm-svn: 54365
2008-08-05 19:40:20 +00:00
Ted Kremenek 2c674f6dbb Refactored driver logic for CodeGen into LLVMCodeGenWriter. This ASTConsumer layers on top of LLVMCodeGen (another existing ASTConsumer) to emit bitcode files to disk. This layering takes this logic out of clang.cpp and puts it directly into the ASTConsumer interface. The benefit is that now --emit-llvm works with both serialized ASTs and regular source files.
llvm-svn: 54364
2008-08-05 18:50:11 +00:00
Steve Naroff 568bbf73b2 Fix <rdar://problem/6108119> clang ObjC rewriter: if no newline at end of input file, rewriter inserts #define on same line as closing brace
llvm-svn: 54363
2008-08-05 18:47:23 +00:00
Daniel Dunbar 1ff1d1fd51 Move AsmLabel into Declarator instead of just a parameter to
ActOnDeclarator.

llvm-svn: 54353
2008-08-05 16:28:08 +00:00
Daniel Dunbar eca183bad2 Add test case for PR2001.
llvm-svn: 54352
2008-08-05 16:15:29 +00:00
Daniel Dunbar d548c79eaf Fix const-init test case
- Use -verify and added expected warnings for EXTWARN change.

llvm-svn: 54342
2008-08-05 06:30:41 +00:00
Chris Lattner 197a301669 Fix rdar://6124613 a crash on invalid code.
llvm-svn: 54340
2008-08-05 06:19:09 +00:00
Daniel Dunbar 4983df37a7 Add more Parser/Sema support for GCC asm-label extension.
- ActOnDeclarator now takes an additional parameter which is the
   AsmLabel if used. Its unfortunate that this bubbles up this high,
   but we cannot just lump it in as an attribute without mistakenly
   *accepting* it as an attribute.
 - The actual asm-label itself is, however, encoded as an AsmLabelAttr
   on the FunctionDecl.
 - Slightly improved parser error recovery on malformed asm-labels.
 - CodeGen support still missing...

llvm-svn: 54339
2008-08-05 01:35:17 +00:00
Daniel Dunbar 5aa55d51ca Bug fix, CodeGen of (void*) - (void*) was broken.
- <rdar://problem/6122967>

llvm-svn: 54338
2008-08-05 00:47:03 +00:00
Daniel Dunbar 81f7f2904c Add EXTWARN Diagnostic class.
- Like EXTENSION but always generates a warning (even without
   -pedantic).
 - Updated ptr -> int, int -> ptr, and incompatible cast warnings to
   be EXTWARN.
 - Other EXTENSION level diagnostics should be audited for upgrade.
 - Updated several test cases to fix code which produced unanticipated
   warnings.

llvm-svn: 54335
2008-08-05 00:07:51 +00:00
Ted Kremenek be9b33bf0f Nico Weber:
"the attached patch fixes some typos, 80 cols violations, etc. in comments."

llvm-svn: 54328
2008-08-04 22:51:42 +00:00
Daniel Dunbar b692ef405b Fix several issues in checking of address-of expressions.
- clang was erroneously accepting address-of applied to lvalue
   expressions involving pointer arithmetic.
 - clang was erroneously rejecting address-of applied to deref
   expressions of pointer-typed variables.
 - Improved existing test case.
 - Fixes: <rdar://problem/6113867>, <rdar://problem/6080158>

llvm-svn: 54326
2008-08-04 20:02:37 +00:00
Ted Kremenek 7ae17ce6b4 Misc cleanups.
When results go to a auto-generated dir in /tmp, don't use randomized file names.  Just output /tmp/scan-build-DATE-counter, where counter is an auto-incremented counter for runs produced that day.

llvm-svn: 54325
2008-08-04 18:15:26 +00:00
Ted Kremenek 11911c2940 Updated latest checker build.
llvm-svn: 54324
2008-08-04 17:36:34 +00:00
Ted Kremenek 5a3803c076 Convert remaining "open" calls to use three-argument form (thanks to Sam Bishop for the tip!).
Recognize 'ccc-analyzer' as a build command some users may use.  Treat it just like calling gcc.

llvm-svn: 54323
2008-08-04 17:34:06 +00:00
Daniel Dunbar d27262f369 Avoid creating dummy block when no indirect gotos are present.
llvm-svn: 54322
2008-08-04 17:24:44 +00:00
Ted Kremenek 9898028742 Fix regression when invoking the MissingDealloc analysis: disable this check when in -fobjc-gc-only mode.
llvm-svn: 54319
2008-08-04 17:14:10 +00:00
Daniel Dunbar 88402ce8d0 Add CodeGen support for indirect goto.
- Follows emission scheme used by llvm-gcc, i.e. invent an id for
   each label whose address is taken and replace each indirect goto by
   a switch to each possible target.
 - Currently we emit a switch for each indirect goto instead of
   merging them as llvm-gcc does.

llvm-svn: 54318
2008-08-04 16:51:22 +00:00
Chris Lattner 7adf076088 Finally fix PR2189. This makes a fairly invasive but important change to
move getAsArrayType into ASTContext instead of being a method on type.
This is required because getAsArrayType(const AT), where AT is a typedef
for "int[10]" needs to return ArrayType(const int, 10).

Fixing this greatly simplifies getArrayDecayedType, which is a good sign.

llvm-svn: 54317
2008-08-04 07:31:14 +00:00
Ted Kremenek dea68f4cbe Updated latest checker build.
llvm-svn: 54276
2008-08-03 03:14:03 +00:00
Ted Kremenek 9512c122fa Change 'dead store (++/--)' to 'dead increment'
llvm-svn: 54268
2008-08-02 18:19:48 +00:00
Argyrios Kyrtzidis 25d05e88a5 Wherever a type is used/returned from the Action module, use TypeTy instead of DeclTy or void.
No functionality change.

llvm-svn: 54265
2008-08-01 10:35:27 +00:00
Argyrios Kyrtzidis 85324837ce Make the default constructor of IdentifierResolver::iterator public.
llvm-svn: 54264
2008-08-01 10:20:48 +00:00
Daniel Dunbar f4693e289a Add more output to clang -parse-print-callbacks
- Just added prints for all the action functions. Ideally this would
   be extended to print all the information for the actions.

llvm-svn: 54259
2008-08-01 00:41:12 +00:00
Daniel Dunbar 74aa7e1eae Support constructor and destructor attributes in CodeGen
- There is an miscompilation issue remaining due to a poor
   interaction between the delayed emission of static functions and
   the emission of constructors, but that already existed prior to
   this change.

llvm-svn: 54258
2008-08-01 00:01:51 +00:00
Daniel Dunbar 032db47f0f Support __attribute__(({con,de}structor)) in Parse & Sema
- Including possible priority argument
 - In other news, the attribute parsing code really needs a cleanup

llvm-svn: 54257
2008-07-31 22:40:48 +00:00
Ted Kremenek a7045d663d Enhanced path-sensitive return-of-stack-address check to print out the name of the variable whose address was returned.
llvm-svn: 54253
2008-07-31 20:31:27 +00:00
Ted Kremenek e5b40a9112 Remove getCodeBody() from Decl, and hoist getBody() into Decl as a virtual function.
llvm-svn: 54247
2008-07-31 17:32:12 +00:00
Chris Lattner b4ec8de163 improve order
llvm-svn: 54244
2008-07-31 06:48:13 +00:00
Chris Lattner 330f0f2567 Fix a regression I introduced in r54107:
http://llvm.org/viewvc/llvm-project?view=rev&revision=54107

llvm-svn: 54242
2008-07-31 04:58:58 +00:00
Mon P Wang b160a0d78d Updated to match new atomic names (to enable overloading for pointers to
different address spaces) for llvm r54195.

llvm-svn: 54241
2008-07-31 03:28:23 +00:00
Daniel Dunbar b39b1cd7c3 Fix implicit initialization of structures.
<rdar://problem/6113085>

llvm-svn: 54237
2008-07-30 21:00:24 +00:00
Ted Kremenek 6a77d42a4d Use stable sort.
llvm-svn: 54222
2008-07-30 18:03:31 +00:00
Ted Kremenek e8fce56cd1 "Escape" bug names with quotes for selecting/deselecting from the bug table.
llvm-svn: 54220
2008-07-30 17:58:08 +00:00
Ted Kremenek a8b8ce499a Add range highlighting for path-sensitive return-of-stack-address check.
llvm-svn: 54219
2008-07-30 17:49:12 +00:00
Daniel Dunbar e49df9b58f Change CodeGenModule GlobalDeclMap to directly reference globals
instead of mapping the decl to a bitcast of the global to the correct
type.
 
 - GetAddrOf{Function,GlobalVar} introduce the bitcast on every use now.

 - This solves a problem where a dangling pointer could be introduced
   by the RAUW done when replacing a forward or tentative
   definition. See testcase for more details.

 - Fixes <rdar://problem/6108358>

llvm-svn: 54211
2008-07-30 16:32:24 +00:00
Ted Kremenek 8cf5045012 Fix regression in range highlighting in HTML output.
llvm-svn: 54181
2008-07-29 23:35:38 +00:00
Daniel Dunbar 9c426524f8 Rework codegen emission of globals
- No (intended) functionality change.

 - Primary purpose is to clearly separate (lazy) construction of
   globals that are a forward declaration or tentative definition from
   those that are the final definition.

 - Lazy construction is now encapsulated in
   GetAddrOf{Function,GlobalVar} while final definitions are
   constructed in EmitGlobal{Function,Var}Definition.
 
 - External interface for dealing with globals is now limited to
   EmitGlobal and GetAddrOf{Function,GlobalVar}.

 - Also updated helper functions dealing with statics, annotations,
   and ctors to be private.

llvm-svn: 54179
2008-07-29 23:18:29 +00:00
Steve Naroff 873bd8497a Fix incomplete implementation for rewriting protocol refs.
<rdar://problem/6108127> clang ObjC rewriter: no translation of id <proto>

llvm-svn: 54163
2008-07-29 18:15:38 +00:00
Daniel Dunbar 837fd272f8 Fix codegen of chained declarations
- Killed useless CodeGenModule::EmitGlobalVarDeclarator, instead just
   recurse on any ScopedDecl.
 - Fix for <rdar://problem/6093838>

llvm-svn: 54162
2008-07-29 17:47:36 +00:00
Chris Lattner 373351725f add a crazy idea
llvm-svn: 54151
2008-07-29 03:46:33 +00:00
Chris Lattner 03bc8c0ab8 fix tag
llvm-svn: 54121
2008-07-27 06:13:09 +00:00
Chris Lattner e8c687f05a list delta and distcc.
llvm-svn: 54120
2008-07-27 06:10:19 +00:00
Eli Friedman bd84059cdb Minor tweak plus a couple of FIXMEs.
llvm-svn: 54119
2008-07-27 05:46:18 +00:00
Eli Friedman d7a9a46cb5 Remove bashism; sh != bash on Ubuntu.
llvm-svn: 54118
2008-07-27 05:05:07 +00:00
Ted Kremenek 192510920e Fix serialization for TypedefType by allowing TypedefType to access the internal CanonicalType stored in Type.
The test case Serialization/stmt_exprs.c now passes.

llvm-svn: 54117
2008-07-27 03:47:53 +00:00
Chris Lattner 872eb55f5e make "call foo.dump()" and "call foo->dump()" work in GDB,
with QualTypes and Types.

llvm-svn: 54116
2008-07-27 00:48:22 +00:00
Chris Lattner e80159da05 remove QualType::getCanonicalType. Also make
QualType::ReadBackpatch public so that FieldDecl doesn't need
to be a friend of QualType.

llvm-svn: 54115
2008-07-27 00:06:09 +00:00
Chris Lattner 35ffe331b9 remove two uses of getCanonicalType I missed.
llvm-svn: 54114
2008-07-27 00:05:05 +00:00
Chris Lattner 613fdff902 clean up the footer a bit more.
llvm-svn: 54113
2008-07-26 23:54:49 +00:00
Chris Lattner e3bbfffa5b remove SSIs.
llvm-svn: 54112
2008-07-26 23:52:26 +00:00
Chris Lattner 9213f5d947 Add the right path to the lines image.
llvm-svn: 54111
2008-07-26 23:51:08 +00:00
Chris Lattner 7cb2da9d0b link to doxygen dox
llvm-svn: 54110
2008-07-26 23:45:57 +00:00
Chris Lattner 401cc23c4d Comment out the last call to QualType::getCanonicalType. This *breaks*
Serialization/stmt_exprs.c, but I don't know the right solution.  Will fix
when I get a chance to talk to Ted about it.

llvm-svn: 54109
2008-07-26 22:40:28 +00:00
Chris Lattner d9fa5d6a23 Fix a bug in my previous patch, CGF is not valid for constants outside a function
llvm-svn: 54108
2008-07-26 22:39:33 +00:00
Chris Lattner 0f398c4472 remove uses of QualType::getCanonicalType() from codegen for PR2189
llvm-svn: 54107
2008-07-26 22:37:01 +00:00
Chris Lattner 3f6cd0bc76 remove some unneeded calls to getCanonicalType
llvm-svn: 54106
2008-07-26 22:36:27 +00:00
Chris Lattner 574dee6cac change more instances of QualType::getCanonicalType to call
ASTContext::getCanonicalType instead (PR2189)

llvm-svn: 54105
2008-07-26 22:17:49 +00:00
Chris Lattner 6fc6614c0d alphabeticalize a bit better.
llvm-svn: 54104
2008-07-26 22:09:09 +00:00
Daniel Dunbar 086fe1ac79 Add doxygen support
- Stolen from LLVM with minor modifications

llvm-svn: 54103
2008-07-26 21:32:24 +00:00
Chris Lattner 6731544be7 convert more code to use ASTContext to get canonical types instead
of doing it directly.  This is required for PR2189.

llvm-svn: 54102
2008-07-26 21:30:36 +00:00
Chris Lattner ac87ef5dcc remove a helper method.
llvm-svn: 54101
2008-07-26 20:50:02 +00:00
Chris Lattner 7e80097f6e implement codegen support for labels at the end of stmtexprs.
llvm-svn: 54100
2008-07-26 20:23:23 +00:00
Chris Lattner 6284378fcd minor tidying, no functionality change.
llvm-svn: 54099
2008-07-26 20:15:14 +00:00
Chris Lattner 944d306371 fix some problems handling stmtexprs with labels (PR2374), and
improve 'expression unused' diagnostics for stmtexprs.

llvm-svn: 54098
2008-07-26 19:51:01 +00:00
Chris Lattner 06afbebbdd fix an extraneous blank line in -ast-dump output.
llvm-svn: 54097
2008-07-26 19:24:43 +00:00
Chris Lattner bcf2e66b3c testcase for PR2416, which we already handle correctly.
llvm-svn: 54096
2008-07-26 19:15:11 +00:00
Ted Kremenek ef6378cda7 Remove some old text.
llvm-svn: 54095
2008-07-26 05:21:44 +00:00
Chris Lattner df59f5aa3c Pull protocol resolution of out ActOnStartClassInterface, this is also the
last client of the old ParseObjCProtocolReferences, so it also removes it.

llvm-svn: 54094
2008-07-26 04:13:19 +00:00
Chris Lattner b1f3c948ee refactor protocol resolution out of ActOnStartCategoryInterface
llvm-svn: 54093
2008-07-26 04:07:02 +00:00
Chris Lattner 3bbae00f50 pull protocol resolution out into ActOnStartProtocolInterface.
This temporarily duplicates ParseObjCProtocolReferences, but it
will be removed in the future.

llvm-svn: 54092
2008-07-26 04:03:38 +00:00
Chris Lattner 9c1842b612 simplify some code.
llvm-svn: 54091
2008-07-26 03:47:43 +00:00
Chris Lattner 908d39e45e remove duplicate error message.
llvm-svn: 54090
2008-07-26 03:40:25 +00:00
Chris Lattner 8b2ec166b8 < only starts a declspec in objc mode.
llvm-svn: 54089
2008-07-26 03:38:44 +00:00
Chris Lattner 12fd035d6f remove fixed fixme
llvm-svn: 54088
2008-07-26 01:56:46 +00:00
Chris Lattner bc76297674 make DeclSpec manage its own protocol qualifier list memory instead of having
clients allocate the memory and it delete it.

llvm-svn: 54087
2008-07-26 01:53:50 +00:00
Chris Lattner 16fac4f2ad Fix hte next wave of problems with protocol qualified ID:
1) reject stuff like "id<foo> short" and "<foo> short".  2) set
the declspec range correctly 3) only parse protocol qualifiers
when in objc mode.

llvm-svn: 54086
2008-07-26 01:18:38 +00:00
Chris Lattner 31236f8744 remove objc prefixes from these tests.
llvm-svn: 54085
2008-07-26 01:04:40 +00:00
Chris Lattner 89026888ef move all objc sema tests into a new SemaObjC directory. Next step is to
remove the objc- prefix from the tests that use it.

llvm-svn: 54084
2008-07-26 00:57:24 +00:00
Chris Lattner a075e63bbc fix several problems with the protocol qualified id handling where id was implicit.
First, fix canonical type handling of these, since protocol qualified id's are always
canonical.  Next, enhance SemaType to actually make these when used (instead of int)
allowing them to actually be used when appropriate.  Finally remove a bunch of logic
relating to the mishandling of canonical types with protocol-qual id's.  This fixes
rdar://5986251

llvm-svn: 54083
2008-07-26 00:46:50 +00:00
Chris Lattner 0974b2380f improve handling of the horrible GCC objc extension that treats "<foo>"
like "id<foo>".  This 1) fixes an infinite loop in the parser on things
like "short<foo>" 2) emits a warning about this bogus construct and 3)
changes the testcase to be substantially reduced.

llvm-svn: 54082
2008-07-26 00:20:22 +00:00
Chris Lattner 9acd2f1cd2 add a new diag helper that takes a range.
llvm-svn: 54081
2008-07-26 00:16:04 +00:00
Chris Lattner 0d70761cad GCC supports the complex conjugate operator (an extension) on complex int
as well as complex float. rdar://6097730

llvm-svn: 54080
2008-07-25 23:52:49 +00:00
Chris Lattner 8c217a81ac fix diagnostics.
llvm-svn: 54079
2008-07-25 23:41:08 +00:00
Chris Lattner 4591fd0aac Fix rdar://6103124, the only dummy blocks are ones without names. Named blocks
are important part of control flow structures.

llvm-svn: 54078
2008-07-25 23:40:10 +00:00
Ted Kremenek 0478105f7c Added project idea for a doxygen-like tool built using clang
llvm-svn: 54076
2008-07-25 23:34:29 +00:00
Chris Lattner 2841fc0e7b fix 80 col violation.
llvm-svn: 54075
2008-07-25 23:30:42 +00:00