]> granicus.if.org Git - clang/log
clang
16 years agoTeach tryEvaluate that fabs, copysign, and unary +/- are constants for
Daniel Dunbar [Thu, 16 Oct 2008 03:51:50 +0000 (03:51 +0000)]
Teach tryEvaluate that fabs, copysign, and unary +/- are constants for
floats.
 - With testcase, which also has some other things GCC folds but we
   don't commented out in it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57624 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImplement #pragma pack use in structure packing. The general approach
Daniel Dunbar [Thu, 16 Oct 2008 02:34:03 +0000 (02:34 +0000)]
Implement #pragma pack use in structure packing. The general approach
is to encode the state of the #pragma pack stack as an attribute when
the structure is declared.

 - Extend PackedAttr to take an alignment (in bits), and reuse for
   both __attribute__((packed)) (which takes no argument, instead
   packing tightly (to "minimize the memory required") and for #pragma
   pack (which allows specification of the maximum alignment in
   bytes). __attribute__((packed)) is just encoded as Alignment=1.

   This conflates two related but different mechanisms, but it didn't
   seem worth another attribute.

 - I have attempted to follow the MSVC semantics as opposed to the gcc
   ones, since if I understand correctly #pragma pack originated with
   MSVC. The semantics are generally equivalent except when the stack
   is altered during the definition of a structure; its not clear if
   anyone does this in practice. See testcase if curious.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57623 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoccc: support -Xlinker
Daniel Dunbar [Thu, 16 Oct 2008 00:10:28 +0000 (00:10 +0000)]
ccc: support -Xlinker

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57613 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoIssue a warning when there's an ambiguous function declarator (that could be a direct...
Argyrios Kyrtzidis [Wed, 15 Oct 2008 23:21:32 +0000 (23:21 +0000)]
Issue a warning when there's an ambiguous function declarator (that could be a direct initializer for a variable defition).
Idea originated from here: http://thread.gmane.org/gmane.comp.gcc.devel/101524

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57609 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoccc: support -fsyntax-only, add some more darwin options, support
Daniel Dunbar [Wed, 15 Oct 2008 21:52:00 +0000 (21:52 +0000)]
ccc: support -fsyntax-only, add some more darwin options, support
logging of actions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57603 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix this bug:
Argyrios Kyrtzidis [Wed, 15 Oct 2008 20:23:22 +0000 (20:23 +0000)]
Fix this bug:

typedef int f();
struct S {
   f *x; // incorrectly assuming this is function decl, leading to failed assertions.
};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57598 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd TokenRewriter to VC++ project.
Steve Naroff [Wed, 15 Oct 2008 19:52:33 +0000 (19:52 +0000)]
Add TokenRewriter to VC++ project.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57593 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd RewriteTest.cpp to VC++ project.
Steve Naroff [Wed, 15 Oct 2008 19:49:15 +0000 (19:49 +0000)]
Add RewriteTest.cpp to VC++ project.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57592 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTighten up blocks rewriter to handle casts and some other interesting cases.
Steve Naroff [Wed, 15 Oct 2008 18:38:58 +0000 (18:38 +0000)]
Tighten up blocks rewriter to handle casts and some other interesting cases.

This fixes <rdar://problem/6289007> clang block rewriter: ^ in cast is not rewritten.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57591 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse BatchEmitOwnedPtrs for writing multiple child exprs, per review.
Daniel Dunbar [Wed, 15 Oct 2008 17:52:29 +0000 (17:52 +0000)]
Use BatchEmitOwnedPtrs for writing multiple child exprs, per review.

Also added serialization support to OverloadExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57588 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded pinsrd, pinsrq, and some other vector intrinsics
Mon P Wang [Wed, 15 Oct 2008 06:18:34 +0000 (06:18 +0000)]
Added pinsrd, pinsrq, and some other vector intrinsics

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57563 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoEnhance dead store checker to not flag preincrements to dead variables where the...
Ted Kremenek [Wed, 15 Oct 2008 05:23:41 +0000 (05:23 +0000)]
Enhance dead store checker to not flag preincrements to dead variables where the preincrement is a subexpression, e.g. foo(++x);  This can cause false negatives, but will remove a whole class of false positives.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57554 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSimplify handling of struct/union/class tags.
Argyrios Kyrtzidis [Wed, 15 Oct 2008 00:42:39 +0000 (00:42 +0000)]
Simplify handling of struct/union/class tags.
Instead of using two sets of Decl kinds (Struct/Union/Class and CXXStruct/CXXUnion/CXXClass), use one 'Record' and one 'CXXRecord' Decl kind and make tag kind a property of TagDecl.
Cleans up the code a bit and better reflects that Decl class structure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57541 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTest commit.
Daniel Dunbar [Wed, 15 Oct 2008 00:26:06 +0000 (00:26 +0000)]
Test commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57540 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDowngrade incompatibilities with objc qualified types (e.g. id <P>) to warnings.
Steve Naroff [Tue, 14 Oct 2008 22:18:38 +0000 (22:18 +0000)]
Downgrade incompatibilities with objc qualified types (e.g. id <P>) to warnings.
Note: One day, we should consider moving the actual diags to ObjCQualifiedIdTypesAreCompatible(), since it has more information on the actual problem. GCC currently emits slightly more instructive errors for some cases involving protocols. I added a FIXME to the code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57529 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix const qualifiers on ProtocolQualifierListTy.
Daniel Dunbar [Tue, 14 Oct 2008 20:22:44 +0000 (20:22 +0000)]
Fix const qualifiers on ProtocolQualifierListTy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57520 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRevert my previous change, got stupidly confused with my local changes.
Argyrios Kyrtzidis [Tue, 14 Oct 2008 18:28:48 +0000 (18:28 +0000)]
Revert my previous change, got stupidly confused with my local changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57514 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix a call to Sema::LookupDecl that had incorrect parameters.
Argyrios Kyrtzidis [Tue, 14 Oct 2008 17:28:09 +0000 (17:28 +0000)]
Fix a call to Sema::LookupDecl that had incorrect parameters.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57511 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd serialization support in several missing places.
Daniel Dunbar [Tue, 14 Oct 2008 16:57:09 +0000 (16:57 +0000)]
Add serialization support in several missing places.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57502 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMove Type::EmitImpl into header, add FIXME to make abstract.
Daniel Dunbar [Tue, 14 Oct 2008 16:55:17 +0000 (16:55 +0000)]
Move Type::EmitImpl into header, add FIXME to make abstract.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57501 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix typo in testcase.
Daniel Dunbar [Tue, 14 Oct 2008 16:46:03 +0000 (16:46 +0000)]
Fix typo in testcase.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57499 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoadd a testcase.
Chris Lattner [Tue, 14 Oct 2008 06:32:07 +0000 (06:32 +0000)]
add a testcase.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57479 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix test suite regression, getFloatTypeSemantics shouldn't be called
Daniel Dunbar [Tue, 14 Oct 2008 05:41:12 +0000 (05:41 +0000)]
Fix test suite regression, getFloatTypeSemantics shouldn't be called
on non-float types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57477 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd Sema implementation of #pragma pack stack.
Daniel Dunbar [Tue, 14 Oct 2008 05:35:18 +0000 (05:35 +0000)]
Add Sema implementation of #pragma pack stack.
 - Follows the MSVC (original) implementation, including support of
   pack(show) (useful for testing).
 - Implements support for named pack records which gcc seems to
   ignore (or implements incorrectly).
 - Not currently wired to anything, only functionality change is the
   type checking of the pragma.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57476 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse 'realpath' to resolve the absolute path to clang and ccc-analyzer.
Ted Kremenek [Mon, 13 Oct 2008 21:46:42 +0000 (21:46 +0000)]
Use 'realpath' to resolve the absolute path to clang and ccc-analyzer.
Add "-analyze-headers" option to scan-build that passes the option -analyzer-opt-analyze-headers to clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57467 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoLift out ABIInfo abstract base class.
Daniel Dunbar [Mon, 13 Oct 2008 17:02:26 +0000 (17:02 +0000)]
Lift out ABIInfo abstract base class.
 - Currently still lives in CGCall.cpp but is intended to be the
   target specific place for hooking ABI information.
 - Select ABIInfo to use based on Target's prefix and pointer width.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57445 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMore const-ness goodness.
Argyrios Kyrtzidis [Sun, 12 Oct 2008 18:45:56 +0000 (18:45 +0000)]
More const-ness goodness.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57420 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImprove the const-ness of a few methods.
Argyrios Kyrtzidis [Sun, 12 Oct 2008 18:40:01 +0000 (18:40 +0000)]
Improve the const-ness of a few methods.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57417 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImplement more efficient Decl <-> DeclContext conversions.
Argyrios Kyrtzidis [Sun, 12 Oct 2008 16:14:48 +0000 (16:14 +0000)]
Implement more efficient Decl <-> DeclContext conversions.
When the static type on the Decl side is a subclass of DeclContext the compiler will use a "inlinable" static_cast, instead of always using an out-of-line function call.

Note, though, that the isa<> check still uses an out-of-line function call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57415 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agomake the -rewrite-test a bit more interesting: it now
Chris Lattner [Sun, 12 Oct 2008 06:09:52 +0000 (06:09 +0000)]
make the -rewrite-test a bit more interesting: it now
wraps comments in <i> tags.  Extend rewrite tokens to support
this minimal functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57409 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agostart implementing a token rewriter. At this point, it just reads in a file
Chris Lattner [Sun, 12 Oct 2008 05:44:03 +0000 (05:44 +0000)]
start implementing a token rewriter.  At this point, it just reads in a file
and lets a client iterate over it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57407 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd a new -rewrite-test option, which is basically a
Chris Lattner [Sun, 12 Oct 2008 05:29:20 +0000 (05:29 +0000)]
Add a new -rewrite-test option, which is basically a
playground to experiment with some new rewriter approaches. For now
it is probably the most complex version of 'cat' ever invented.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57406 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd a new -dump-raw-tokens option, which allows us to see raw tokens.
Chris Lattner [Sun, 12 Oct 2008 05:03:36 +0000 (05:03 +0000)]
Add a new -dump-raw-tokens option, which allows us to see raw tokens.
Rename -dumptokens to -dump-tokens.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57405 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoChange FormTokenWithChars to take the token kind to form, since all clients
Chris Lattner [Sun, 12 Oct 2008 04:51:35 +0000 (04:51 +0000)]
Change FormTokenWithChars to take the token kind to form, since all clients
were setting a kind and then forming it.  This is just a minor API cleanup,
no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57404 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoWhen in keep whitespace mode, make sure to return block comments that are
Chris Lattner [Sun, 12 Oct 2008 04:19:49 +0000 (04:19 +0000)]
When in keep whitespace mode, make sure to return block comments that are
unterminated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57403 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoChange SkipBlockComment and SkipBCPLComment to return true when in
Chris Lattner [Sun, 12 Oct 2008 04:15:42 +0000 (04:15 +0000)]
Change SkipBlockComment and SkipBCPLComment to return true when in
keep comment mode, instead of returning false.  This matches SkipWhitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57402 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd a new mode to the lexer which enables it to return all characters,
Chris Lattner [Sun, 12 Oct 2008 04:05:48 +0000 (04:05 +0000)]
Add a new mode to the lexer which enables it to return all characters,
even whitespace, as tokens from the file.  This is enabled with
L->SetKeepWhitespaceMode(true) on a raw lexer.  In this mode, you too
can use clang as a really complex version of 'cat' with code like this:

  Lexer RawLex(SourceLocation::getFileLoc(SM.getMainFileID(), 0),
               PP.getLangOptions(), File.first, File.second);

  RawLex.SetKeepWhitespaceMode(true);

  Token RawTok;
  RawLex.LexFromRawLexer(RawTok);
  while (RawTok.isNot(tok::eof)) {
    std::cout << PP.getSpelling(RawTok);
    RawLex.LexFromRawLexer(RawTok);
  }

This will emit exactly the input file, with no canonicalization or other
translation.  Realistic clients actually do something with the tokens of
course :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57401 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoStop the preprocessor from poking the lexer's private parts.
Chris Lattner [Sun, 12 Oct 2008 03:31:33 +0000 (03:31 +0000)]
Stop the preprocessor from poking the lexer's private parts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57399 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix a couple more places that poke KeepCommentMode unnecesarily.
Chris Lattner [Sun, 12 Oct 2008 03:27:19 +0000 (03:27 +0000)]
Fix a couple more places that poke KeepCommentMode unnecesarily.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57398 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoadd a new inKeepCommentMode() accessor to abstract the KeepCommentMode
Chris Lattner [Sun, 12 Oct 2008 03:22:02 +0000 (03:22 +0000)]
add a new inKeepCommentMode() accessor to abstract the KeepCommentMode
ivar.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57397 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agofix misleading comment.
Chris Lattner [Sun, 12 Oct 2008 01:34:51 +0000 (01:34 +0000)]
fix misleading comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57396 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSimplify raw mode lexing by treating an unterminate /**/ comment the
Chris Lattner [Sun, 12 Oct 2008 01:31:51 +0000 (01:31 +0000)]
Simplify raw mode lexing by treating an unterminate /**/ comment the
same we we do an unterminated string or character literal.  This makes
it so we can guarantee that the lexer never calls into the
preprocessor (which would be suicide for a raw lexer).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57395 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoadd a comment.
Chris Lattner [Sun, 12 Oct 2008 01:23:27 +0000 (01:23 +0000)]
add a comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57394 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoChange how raw lexers are handled: instead of creating them and then
Chris Lattner [Sun, 12 Oct 2008 01:15:46 +0000 (01:15 +0000)]
Change how raw lexers are handled: instead of creating them and then
using LexRawToken, create one and use LexFromRawLexer.  This avoids
twiddling the RawLexer flag around and simplifies some code (even
speeding raw lexing up a tiny bit).

This change also improves the token paster to use a Lexer on the stack
instead of new/deleting it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57393 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agosilence release-assert warnings.
Chris Lattner [Sun, 12 Oct 2008 00:31:50 +0000 (00:31 +0000)]
silence release-assert warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57392 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agosilence some release-assert warnings.
Chris Lattner [Sun, 12 Oct 2008 00:28:42 +0000 (00:28 +0000)]
silence some release-assert warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57391 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agosilence a bunch of warnings in a release-assert build.
Chris Lattner [Sun, 12 Oct 2008 00:26:57 +0000 (00:26 +0000)]
silence a bunch of warnings in a release-assert build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57390 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoimprove a comment.
Chris Lattner [Sun, 12 Oct 2008 00:23:07 +0000 (00:23 +0000)]
improve a comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57389 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd DeclGroup.cpp.
Steve Naroff [Fri, 10 Oct 2008 16:41:38 +0000 (16:41 +0000)]
Add DeclGroup.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57354 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix/simplify RewriteBlocks::RewriteBlockPointerFunctionArgs().
Steve Naroff [Fri, 10 Oct 2008 15:33:34 +0000 (15:33 +0000)]
Fix/simplify RewriteBlocks::RewriteBlockPointerFunctionArgs().

This completes the fix for <rdar://problem/6272905> clang block rewriter: parameter to function not imported into block?.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57350 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTests for return statement checks
Seo Sanghyeon [Fri, 10 Oct 2008 07:20:06 +0000 (07:20 +0000)]
Tests for return statement checks

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57341 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFinal phase of converting BlockDecls over to DeclContext. This is unfortunately a...
Steve Naroff [Fri, 10 Oct 2008 01:28:17 +0000 (01:28 +0000)]
Final phase of converting BlockDecls over to DeclContext. This is unfortunately a largish/complex diff, however it was necessry to pass all the current block tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57337 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoLift EmitTargetBuiltinExpr out of EmitBuiltinExpr.
Daniel Dunbar [Fri, 10 Oct 2008 00:24:54 +0000 (00:24 +0000)]
Lift EmitTargetBuiltinExpr out of EmitBuiltinExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57335 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDisable blocks support in C++ mode.
Daniel Dunbar [Fri, 10 Oct 2008 00:20:52 +0000 (00:20 +0000)]
Disable blocks support in C++ mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57334 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd missing newline.
Ted Kremenek [Fri, 10 Oct 2008 00:17:08 +0000 (00:17 +0000)]
Add missing newline.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57333 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdjust calls to APFloat conversion for new interface.
Dale Johannesen [Thu, 9 Oct 2008 23:02:32 +0000 (23:02 +0000)]
Adjust calls to APFloat conversion for new interface.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57332 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoCheck some cases for previous patch. Make the code more robust.
Zhongxing Xu [Thu, 9 Oct 2008 03:19:06 +0000 (03:19 +0000)]
Check some cases for previous patch. Make the code more robust.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57317 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix a bug that crashed clang when parsing this:
Argyrios Kyrtzidis [Wed, 8 Oct 2008 22:20:31 +0000 (22:20 +0000)]
Fix a bug that crashed clang when parsing this:

class C {
  static const int number = 50;
  static int arr[number];
};

Here's how it worked:
-GetTypeForDeclarator was called from both Sema::ActOnCXXMemberDeclarator and Sema::ActOnDeclarator.
-VariableArrayTypes are not uniqued so two VariableArrayTypes were created with the same DeclRefExpr.
-On exit they both tried to destroy that one DeclRefExpr.

The fix is not to use GetTypeForDeclarator from the Sema::ActOnCXXMemberDeclarator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57313 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoInstantiate the BlockDecl in ActOnBlockStart() so we can use it as a DeclContext.
Steve Naroff [Wed, 8 Oct 2008 18:44:00 +0000 (18:44 +0000)]
Instantiate the BlockDecl in ActOnBlockStart() so we can use it as a DeclContext.
This required changes to attach the compound statement later on (like we do for functions).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57304 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdate checker build.
Ted Kremenek [Wed, 8 Oct 2008 18:32:06 +0000 (18:32 +0000)]
Update checker build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57303 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTouchup the rewriter to handle the new BlockExpr->BlockDecl dance.
Steve Naroff [Wed, 8 Oct 2008 17:31:13 +0000 (17:31 +0000)]
Touchup the rewriter to handle the new BlockExpr->BlockDecl dance.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57299 91177308-0d34-0410-b5e6-96231b3b80d8

16 years ago- Add BlockDecl AST node.
Steve Naroff [Wed, 8 Oct 2008 17:01:13 +0000 (17:01 +0000)]
- Add BlockDecl AST node.
- Modify BlockExpr to reference the BlockDecl.

This is "cleanup" necessary to improve our lookup semantics for blocks (to fix <rdar://problem/6272905> clang block rewriter: parameter to function not imported into block?).

Still some follow-up work to finish this (forthcoming).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57298 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoThis is the first step to implement a field-sensitive store model. Other things are...
Zhongxing Xu [Wed, 8 Oct 2008 02:50:44 +0000 (02:50 +0000)]
This is the first step to implement a field-sensitive store model. Other things are simplified: no heap shape assumption, no parameter alias assumption, etc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57285 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoA little more tweaking with StmtIterator and SizeOfAlignofExpr. A recent commit...
Ted Kremenek [Tue, 7 Oct 2008 23:35:42 +0000 (23:35 +0000)]
A little more tweaking with StmtIterator and SizeOfAlignofExpr.  A recent commit actually introduced a regression, not fixed a bug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57282 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMigrate DeclStmt over to using a DeclGroup instead of a pointer to a ScopedDecl*.
Ted Kremenek [Tue, 7 Oct 2008 23:09:49 +0000 (23:09 +0000)]
Migrate DeclStmt over to using a DeclGroup instead of a pointer to a ScopedDecl*.
This also removes the ugly hack needed in CFG.cpp for subclassing DeclStmt to create a DeclStmt with one Decl*.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57275 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd #include (introduced by dependence on DeclGroup)
Ted Kremenek [Tue, 7 Oct 2008 23:08:39 +0000 (23:08 +0000)]
Add #include (introduced by dependence on DeclGroup)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57274 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed a masked bug when iterating over the child expressions of SizeOfAlignOfTypeExpr...
Ted Kremenek [Tue, 7 Oct 2008 23:07:10 +0000 (23:07 +0000)]
Fixed a masked bug when iterating over the child expressions of SizeOfAlignOfTypeExpr.  This bug was unmasked by recent changes to StmtIterator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57273 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd const_iterator to DeclGroup.
Ted Kremenek [Tue, 7 Oct 2008 23:06:01 +0000 (23:06 +0000)]
Add const_iterator to DeclGroup.
Serialization for OwningDeclGroupRefs now works.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57272 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd StmtIterator support for DeclGroups.
Ted Kremenek [Tue, 7 Oct 2008 23:04:14 +0000 (23:04 +0000)]
Add StmtIterator support for DeclGroups.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57271 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoIn ParseParenDeclarator match "D.setGroupingParens(true);" with another setGroupingPa...
Argyrios Kyrtzidis [Tue, 7 Oct 2008 10:21:57 +0000 (10:21 +0000)]
In ParseParenDeclarator match "D.setGroupingParens(true);" with another setGroupingParens call after the ')' is parsed.
Fixes this bug:
  int (x)(0); // error, expected function declarator where the '(0)' initializer is

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57241 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded a function call case that generates sink nodes.
Zhongxing Xu [Tue, 7 Oct 2008 10:06:03 +0000 (10:06 +0000)]
Added a function call case that generates sink nodes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57240 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMigrate MemRegionManager from StateManager to StoreManager.
Zhongxing Xu [Tue, 7 Oct 2008 01:31:04 +0000 (01:31 +0000)]
Migrate MemRegionManager from StateManager to StoreManager.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57225 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded prototype serialization code for DeclGroup.
Ted Kremenek [Mon, 6 Oct 2008 23:49:24 +0000 (23:49 +0000)]
Added prototype serialization code for DeclGroup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57222 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse getCustomDiagID() instead of specifying the diagnostic in the 'DiagnosticKinds...
Argyrios Kyrtzidis [Mon, 6 Oct 2008 23:16:35 +0000 (23:16 +0000)]
Use getCustomDiagID() instead of specifying the diagnostic in the 'DiagnosticKinds.def' file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57220 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSimplify handling of direct initializers by letting Sema::AddInitializerToDecl handle...
Argyrios Kyrtzidis [Mon, 6 Oct 2008 23:08:37 +0000 (23:08 +0000)]
Simplify handling of direct initializers by letting Sema::AddInitializerToDecl handle conversions, instead of using Sema::ActOnCXXTypeConstructExpr.
Additional benefit is that diagnostics are the same for both direct-initialization and copy-initialization.

In the case of "int x( expression );":
-The Init expression of VarDecl 'x' will be the expression inside the parentheses.
-VarDecl::hasCXXDirectInitializer for VarDecl 'x' will return true to let clients distinguish from "int x = expression ;".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57219 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove DeclStmt::getDecl(). Now clients of DeclStmt must explicitly reason about...
Ted Kremenek [Mon, 6 Oct 2008 22:51:42 +0000 (22:51 +0000)]
Remove DeclStmt::getDecl().  Now clients of DeclStmt must explicitly reason about a DeclStmt referring to a collection of Decls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57217 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoExplicitly access the first Decl* referenced by a DeclStmt instead of using "getDecl...
Ted Kremenek [Mon, 6 Oct 2008 22:45:07 +0000 (22:45 +0000)]
Explicitly access the first Decl* referenced by a DeclStmt instead of using "getDecl()."  Added a FIXME indicating that the call to RewriteObjCQualifiedInterfaceTypes() is meant to modifying the type-specifier; hopefully this will be a little more clean once DeclGroups contain type specifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57216 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse "DeclStmt::getSolitaryDecl()" when accessing the DeclStmt of an @catch.
Ted Kremenek [Mon, 6 Oct 2008 22:39:38 +0000 (22:39 +0000)]
Use "DeclStmt::getSolitaryDecl()" when accessing the DeclStmt of an @catch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57215 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoModified DeclGroupRef to always load/store the internal pointer value as Decl*. ...
Ted Kremenek [Mon, 6 Oct 2008 22:17:16 +0000 (22:17 +0000)]
Modified DeclGroupRef to always load/store the internal pointer value as Decl*.  This hopefully will obviate any concerns with violating strict type-aliasing issues.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57213 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when rewriting Objecti...
Ted Kremenek [Mon, 6 Oct 2008 22:16:13 +0000 (22:16 +0000)]
Use DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when rewriting Objective-c foreach statements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57212 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when processing the...
Ted Kremenek [Mon, 6 Oct 2008 20:59:48 +0000 (20:59 +0000)]
Use DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when processing the Decl of an Objective-C foreach statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57209 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when processing the...
Ted Kremenek [Mon, 6 Oct 2008 20:58:56 +0000 (20:58 +0000)]
Use DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when processing the Decl of a @catch statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57208 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoWhen processing Objective-C foreach statements, first check to see if the statement...
Ted Kremenek [Mon, 6 Oct 2008 20:58:11 +0000 (20:58 +0000)]
When processing Objective-C foreach statements, first check to see if the statement has a DeclStmt with a single Decl.  Afterwards, use DeclStmt::getSolitaryDecl() to access that Decl (thus avoiding an assertion being triggered).  These changes remove an unneeded use of ScopedDecl::getNextDeclarator() and DeclStmt::getDecl().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57207 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse DeclStmt::decl_iterator to walk a group of Decl*'s instead of using the ScopedDec...
Ted Kremenek [Mon, 6 Oct 2008 20:56:19 +0000 (20:56 +0000)]
Use DeclStmt::decl_iterator to walk a group of Decl*'s instead of using the ScopedDecl chain.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57206 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDon't use DeclStmt::getDecl() to serialize out DeclStmt; use TheDecl directly.
Ted Kremenek [Mon, 6 Oct 2008 20:55:44 +0000 (20:55 +0000)]
Don't use DeclStmt::getDecl() to serialize out DeclStmt; use TheDecl directly.
This patch precedes removing getDecl() DeclStmt::entirely.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57205 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd DeclStmt::hasSolitaryDecl() and DeclStmt::getSolitaryDecl()
Ted Kremenek [Mon, 6 Oct 2008 20:54:44 +0000 (20:54 +0000)]
Add DeclStmt::hasSolitaryDecl() and DeclStmt::getSolitaryDecl()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57204 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse "unsigned" instead of "int" for i to remove a "comparison between unsigned and...
Ted Kremenek [Mon, 6 Oct 2008 20:35:04 +0000 (20:35 +0000)]
Use "unsigned" instead of "int" for i to remove a "comparison between unsigned and signed" warning (potential integer overflow).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57201 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd 'x' constraint character.
Anders Carlsson [Mon, 6 Oct 2008 19:17:39 +0000 (19:17 +0000)]
Add 'x' constraint character.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57198 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse the DeclStmt::decl_iterator to get the first decl in a DeclStmt instead of using...
Ted Kremenek [Mon, 6 Oct 2008 18:48:35 +0000 (18:48 +0000)]
Use the DeclStmt::decl_iterator to get the first decl in a DeclStmt instead of using DeclStmt::getDecl().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57196 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoIn RewriteFunctionBody, using DeclStmt::decl_iterator to rewrite the Decls in a DeclS...
Ted Kremenek [Mon, 6 Oct 2008 18:47:09 +0000 (18:47 +0000)]
In RewriteFunctionBody, using DeclStmt::decl_iterator to rewrite the Decls in a DeclStmt instead of  using getDecl() to fetch the first Decl.

Steve: Please review this patch.  'make test' passes, and my cursory scan of the rewriter leads me to believe this doesn't break anything, but I'm not sure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57195 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDon't use DeclStmt::getDecl(); this will eventually disappear. Just fetch the first...
Ted Kremenek [Mon, 6 Oct 2008 18:43:53 +0000 (18:43 +0000)]
Don't use DeclStmt::getDecl(); this will eventually disappear.  Just fetch the first decl using the DeclStmt::decl_iterator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57194 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoIn EmitDeclStmt: use DeclStmt::const_decl_iterator instead of walking the scoped...
Ted Kremenek [Mon, 6 Oct 2008 18:42:27 +0000 (18:42 +0000)]
In EmitDeclStmt: use DeclStmt::const_decl_iterator instead of walking the scoped decl chain.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57192 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded PrintRawDeclStmt; use this method to print out DeclStmt instead of using PrintR...
Ted Kremenek [Mon, 6 Oct 2008 18:39:36 +0000 (18:39 +0000)]
Added PrintRawDeclStmt; use this method to print out DeclStmt instead of using PrintRawDecl (which falsely assumes DeclStmts have only one Decl).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57191 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse Decl::decl_iterator instead of walking the ScopedDecl chain (which will soon...
Ted Kremenek [Mon, 6 Oct 2008 18:38:35 +0000 (18:38 +0000)]
Use Decl::decl_iterator instead of walking the ScopedDecl chain (which will soon be removed).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57190 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse DeclStmt::decl_iterator instead of using Decl::getDecl(). Soon DeclStmts will...
Ted Kremenek [Mon, 6 Oct 2008 18:37:46 +0000 (18:37 +0000)]
Use DeclStmt::decl_iterator instead of using Decl::getDecl().  Soon DeclStmts will wrap group of Decls.
Added FIXME.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57189 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoThe current semantic process for direct initializers won't work properly for class...
Argyrios Kyrtzidis [Mon, 6 Oct 2008 18:37:09 +0000 (18:37 +0000)]
The current semantic process for direct initializers won't work properly for class types.
Add a FIXME until class constructors are supported.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57188 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse DeclStmt::decl_iterator instead of walking the ScopedDecl chain (which will soon...
Ted Kremenek [Mon, 6 Oct 2008 18:36:52 +0000 (18:36 +0000)]
Use DeclStmt::decl_iterator instead of walking the ScopedDecl chain (which will soon be removed).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57187 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd const_decl_iterator to DecStmt.
Ted Kremenek [Mon, 6 Oct 2008 18:35:55 +0000 (18:35 +0000)]
Add const_decl_iterator to DecStmt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57186 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdate Xcode project.
Ted Kremenek [Mon, 6 Oct 2008 17:42:44 +0000 (17:42 +0000)]
Update Xcode project.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57180 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImplement support for C++ direct initializers in declarations, e.g. "int x(1);".
Argyrios Kyrtzidis [Mon, 6 Oct 2008 17:10:33 +0000 (17:10 +0000)]
Implement support for C++ direct initializers in declarations, e.g. "int x(1);".

This is how this kind of initializers appear in the AST:
-The Init expression of the VarDecl is a functional type construction (of the VarDecl's type).
-The new VarDecl::hasCXXDirectInitializer() returns true.

e.g, for "int x(1);":
-VarDecl 'x' has Init with expression "int(1)" (CXXFunctionalCastExpr).
-hasCXXDirectInitializer() of VarDecl 'x' returns true.

A major benefit is that clients that don't particularly care about which exactly form was the initializer can handle both cases without special case code.
Note that codegening works now for "int x(1);" without any changes to CodeGen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57178 91177308-0d34-0410-b5e6-96231b3b80d8