Daniel Dunbar
dfcf599dfa
Add option argument to GetAddrOfConstantString to use for name of
...
(first) global holding the string.
- No functionality change.
llvm-svn: 57736
2008-10-17 21:56:50 +00:00
Chris Lattner
f0a5f84c42
fix rdar://6288301: custom warnings don't respect -Werror.
...
llvm-svn: 57731
2008-10-17 21:24:47 +00:00
Ted Kremenek
1416a521b5
Enhance "Assumption" logic in BasicConstraintManager when reasoning about regions and symbolic regions. When assuming whether or not a location is non-null, walk up the region hierarchy until we hit a symbolic region (and test it for null). This may not be the end all solution, as the notion of what a "symbolic region" is really belongs in the specific subclass of StoreManager.
...
llvm-svn: 57730
2008-10-17 21:22:20 +00:00
Ted Kremenek
fe15bedff4
Add pretty-printing support for FieldRegions.
...
llvm-svn: 57724
2008-10-17 21:05:44 +00:00
Daniel Dunbar
1e75408d89
Emit error unsupported when asm string conversion fails instead of
...
assert.
llvm-svn: 57721
2008-10-17 20:58:01 +00:00
Ted Kremenek
a196618ad0
Fixed an elusive caching bug in ExplodedGraph construction when a PostStmtKind was used instead of a PostStoreKind.
...
llvm-svn: 57719
2008-10-17 20:49:23 +00:00
Ted Kremenek
055891cbf3
Test now passes.
...
llvm-svn: 57718
2008-10-17 20:29:05 +00:00
Ted Kremenek
8b103c65c6
- constify some uses of MemRegion* (MemRegion should be immutable).
...
- Added new region "SymbolicRegion", which maps symbol values to the region domain.
- Enhanced BasicStore::getFieldLValue() to return a FieldRegion (using SymbolicRegion)
- Added some utility methods to GRState for fetch svals from the store.
- Fixed regression in CheckNSError (we weren't getting the value bound to the parameter)
llvm-svn: 57717
2008-10-17 20:28:54 +00:00
Daniel Dunbar
fc1066db81
Remove unneeded EncodingRecordTypes argument to getObjCEncodingForType.
...
llvm-svn: 57716
2008-10-17 20:21:44 +00:00
Mon P Wang
fd6735649e
Fixed vec_set_v2di signature
...
llvm-svn: 57696
2008-10-17 17:39:34 +00:00
Ted Kremenek
5870046c43
"Implement" GRExprEngine::VisitLValue for ObjCPropertyRefExpr. This is only a bandid; we need to properly handle properties by using locv/nonloc objects and specially handling property assignments in the transfer function for BinaryOperator.
...
llvm-svn: 57693
2008-10-17 17:24:14 +00:00
Daniel Dunbar
ff3c6747ef
More Obj-C type encoding improvements.
...
- Encode unions and bit-fields correctly.
- Accept option to name record fields (used for NeXT runtime).
llvm-svn: 57685
2008-10-17 16:17:37 +00:00
Daniel Dunbar
b9fd902fdc
Change CGDebugInfo::setLocation to just ignore invalid locations. This
...
simplifies clients.
Also, add assert that RegionStack is empty when the CGDebugInfo is
destroyed.
llvm-svn: 57684
2008-10-17 16:15:48 +00:00
Daniel Dunbar
472175e545
Exercise #pragma pack(pop, <width>) in test case.
...
llvm-svn: 57683
2008-10-17 16:05:47 +00:00
Daniel Dunbar
3cd9a29c64
Fix bug in Obj-C type encoding for structures.
...
- Mechanism for detecting if a structure should be expanded wasn't
reliable. Simplified by just keeping track of what we should be
expanding.
- This fixes a bug in using NSInvocation to invoke a method which
returned a structure, which in used by Key Value Observing, which
in the end, caused a miscompile in poor little Sketch.
llvm-svn: 57675
2008-10-17 07:30:50 +00:00
Daniel Dunbar
40cac777b9
Anonymous structures print as '?=' in Obj-C type encoding.
...
llvm-svn: 57674
2008-10-17 06:22:57 +00:00
Zhongxing Xu
27f174214d
This patch did the following renaming. There should be no functional changes.
...
RVal => SVal
LVal => Loc
NonLVal => NonLoc
lval => loc
nonlval => nonloc
llvm-svn: 57671
2008-10-17 05:57:07 +00:00
Zhongxing Xu
0dd213f8f5
Add test case for array and struct variable lvalue evaluation.
...
llvm-svn: 57670
2008-10-17 05:19:52 +00:00
Daniel Dunbar
3c683f5bf2
NeXT: Use objc_msgSend_fpret for calling functions which return
...
floating point. This is only correct for x86-32 at the moment.
llvm-svn: 57667
2008-10-17 03:24:53 +00:00
Zhongxing Xu
252fe5c9f1
Get array's lvalue through standard interface.
...
llvm-svn: 57666
2008-10-17 02:20:14 +00:00
Zhongxing Xu
9fe408057a
Return the corresponding MemRegionVal for both rvalue and lvalue of array of
...
type T.
llvm-svn: 57665
2008-10-17 02:14:42 +00:00
Zhongxing Xu
4e500455c9
Array and struct variables do have lvalue. For example,
...
struct s {};
void f() {
int a[10];
int (*p)[10];
p = &a;
(*p)[3] =1;
struct s d;
struct s *q;
q = &d;
}
We return the corresponding MemRegionVal for them.
llvm-svn: 57664
2008-10-17 01:51:27 +00:00
Daniel Dunbar
380827cfa1
Quick patch for PR2784, assert genereting debug info for opaque
...
structure.
- I'm not sure yet about the behavior, but this at least prevents the
crash.
Add some asserts on RegionStack usage.
llvm-svn: 57661
2008-10-17 01:07:56 +00:00
Ted Kremenek
357c63ab37
Remove an untrue assertion: lval::FuncVals can be returned in both rvalue and lvalue contexts.
...
llvm-svn: 57659
2008-10-17 00:55:33 +00:00
Ted Kremenek
7ff153c9cb
Mark these tests XFAIL. We need to add back assumption logic when doing array and field accesses.
...
llvm-svn: 57658
2008-10-17 00:51:39 +00:00
Ted Kremenek
3ad391d800
Remove lval::FieldOffset, lval::ArrayOffset. These will be replaced with regions.
...
Remove GRExprEngine::getLVal and RValues::MakeVal.
Enhance StoreManager "GetLValue" methods to dispatch for specific kinds of lvalue queries, as opposed to interogating the expression tree (GRExprEngine already does this).
Added FIXMEs. In particular, we no longer "assume" that a base pointer in a field/array access is null (this logic was removed). Perhaps we should do this when fetching the lvalue for fields and array elements?
llvm-svn: 57657
2008-10-17 00:51:01 +00:00
Ted Kremenek
12dd55b23d
Add transfer function support for ObjCIvarRefExpr.
...
llvm-svn: 57654
2008-10-17 00:03:18 +00:00
Argyrios Kyrtzidis
2c021aa573
In C++, an empty parameter list indicates a function that takes no parameters.
...
llvm-svn: 57646
2008-10-16 17:31:08 +00:00
Chris Lattner
3c3e2cc77f
Add basic FreeBSD target support, patch by Roman Divacky!
...
llvm-svn: 57645
2008-10-16 17:04:31 +00:00
Daniel Dunbar
33d29b3eae
Add --disable-free flag to clang.
...
- Disables the freeing of the ASTContext and the TranslationUnit
after parsing & sema.
- Primarily for timing the impact on -fsyntax-only timings.
llvm-svn: 57643
2008-10-16 16:54:18 +00:00
Argyrios Kyrtzidis
89656d2298
Using dyn_cast_or_null here is redundant, use dyn_cast instead.
...
llvm-svn: 57642
2008-10-16 16:50:47 +00:00
Steve Naroff
9546eee50a
Fix <rdar://problem/6239726> Parser rejects: type of property 'list' does not match type of ivar
...
and
http://llvm.org/bugs/show_bug.cgi?id=2893
llvm-svn: 57640
2008-10-16 14:59:30 +00:00
Daniel Dunbar
be947083d2
Speed up NumericLiteralParser::GetIntegerValue.
...
- Implement fast path when value easily fits in a uint64.
- ~6x faster, translates to 1-2% on Cocoa.h
llvm-svn: 57632
2008-10-16 07:32:01 +00:00
Daniel Dunbar
b1f64426a0
Simplify overflow-on-add check in NumericLiteralParser::GetIntegerValue.
...
llvm-svn: 57629
2008-10-16 06:39:30 +00:00
Zhongxing Xu
232c7929a2
This is the first step to build a better evaluation model for GRExprEngine. A
...
new VisitLValue method is added to replace the old VisitLVal. The semantics
model becomes more explicit to separate rvalue evaluation from lvalue
evaluation.
llvm-svn: 57627
2008-10-16 06:09:51 +00:00
Daniel Dunbar
c3d79cf6b3
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.
llvm-svn: 57624
2008-10-16 03:51:50 +00:00
Daniel Dunbar
4290d46bd4
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.
llvm-svn: 57623
2008-10-16 02:34:03 +00:00
Daniel Dunbar
5f68d4571b
ccc: support -Xlinker
...
llvm-svn: 57613
2008-10-16 00:10:28 +00:00
Argyrios Kyrtzidis
84a4df8c92
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
llvm-svn: 57609
2008-10-15 23:21:32 +00:00
Daniel Dunbar
76eae72a0c
ccc: support -fsyntax-only, add some more darwin options, support
...
logging of actions.
llvm-svn: 57603
2008-10-15 21:52:00 +00:00
Argyrios Kyrtzidis
2e3e756304
Fix this bug:
...
typedef int f();
struct S {
f *x; // incorrectly assuming this is function decl, leading to failed assertions.
};
llvm-svn: 57598
2008-10-15 20:23:22 +00:00
Steve Naroff
dbc44de285
Add TokenRewriter to VC++ project.
...
llvm-svn: 57593
2008-10-15 19:52:33 +00:00
Steve Naroff
6b40b8ab27
Add RewriteTest.cpp to VC++ project.
...
llvm-svn: 57592
2008-10-15 19:49:15 +00:00
Steve Naroff
e17f52fc23
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.
llvm-svn: 57591
2008-10-15 18:38:58 +00:00
Daniel Dunbar
a0dcd78081
Use BatchEmitOwnedPtrs for writing multiple child exprs, per review.
...
Also added serialization support to OverloadExpr.
llvm-svn: 57588
2008-10-15 17:52:29 +00:00
Mon P Wang
d05269d13c
Added pinsrd, pinsrq, and some other vector intrinsics
...
llvm-svn: 57563
2008-10-15 06:18:34 +00:00
Ted Kremenek
bb7818b666
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.
...
llvm-svn: 57554
2008-10-15 05:23:41 +00:00
Argyrios Kyrtzidis
88e1b97f16
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.
llvm-svn: 57541
2008-10-15 00:42:39 +00:00
Daniel Dunbar
267c4fe1b5
Test commit.
...
llvm-svn: 57540
2008-10-15 00:26:06 +00:00
Steve Naroff
8afa98916a
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.
llvm-svn: 57529
2008-10-14 22:18:38 +00:00
Daniel Dunbar
c064d4edc4
Fix const qualifiers on ProtocolQualifierListTy.
...
llvm-svn: 57520
2008-10-14 20:22:44 +00:00
Argyrios Kyrtzidis
ab3633b626
Revert my previous change, got stupidly confused with my local changes.
...
llvm-svn: 57514
2008-10-14 18:28:48 +00:00
Argyrios Kyrtzidis
23d5426c67
Fix a call to Sema::LookupDecl that had incorrect parameters.
...
llvm-svn: 57511
2008-10-14 17:28:09 +00:00
Daniel Dunbar
cbdf409c2c
Add serialization support in several missing places.
...
llvm-svn: 57502
2008-10-14 16:57:09 +00:00
Daniel Dunbar
d5420e3bef
Move Type::EmitImpl into header, add FIXME to make abstract.
...
llvm-svn: 57501
2008-10-14 16:55:17 +00:00
Daniel Dunbar
eee51d125f
Fix typo in testcase.
...
llvm-svn: 57499
2008-10-14 16:46:03 +00:00
Chris Lattner
3211159cab
add a testcase.
...
llvm-svn: 57479
2008-10-14 06:32:07 +00:00
Daniel Dunbar
1be9f88a2f
Fix test suite regression, getFloatTypeSemantics shouldn't be called
...
on non-float types.
llvm-svn: 57477
2008-10-14 05:41:12 +00:00
Daniel Dunbar
5460374cd9
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.
llvm-svn: 57476
2008-10-14 05:35:18 +00:00
Ted Kremenek
d323ccd29c
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.
llvm-svn: 57467
2008-10-13 21:46:42 +00:00
Daniel Dunbar
d9eff3d4e4
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.
llvm-svn: 57445
2008-10-13 17:02:26 +00:00
Argyrios Kyrtzidis
9103317346
More const-ness goodness.
...
llvm-svn: 57420
2008-10-12 18:45:56 +00:00
Argyrios Kyrtzidis
01622642d3
Improve the const-ness of a few methods.
...
No functionality change.
llvm-svn: 57417
2008-10-12 18:40:01 +00:00
Argyrios Kyrtzidis
3768ad6d58
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.
llvm-svn: 57415
2008-10-12 16:14:48 +00:00
Chris Lattner
f6a3bda65e
make the -rewrite-test a bit more interesting: it now
...
wraps comments in <i> tags. Extend rewrite tokens to support
this minimal functionality.
llvm-svn: 57409
2008-10-12 06:09:52 +00:00
Chris Lattner
b6aa53b7de
start implementing a token rewriter. At this point, it just reads in a file
...
and lets a client iterate over it.
llvm-svn: 57407
2008-10-12 05:44:03 +00:00
Chris Lattner
1782da2f84
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.
llvm-svn: 57406
2008-10-12 05:29:20 +00:00
Chris Lattner
fc7d4a3bd2
Add a new -dump-raw-tokens option, which allows us to see raw tokens.
...
Rename -dumptokens to -dump-tokens.
llvm-svn: 57405
2008-10-12 05:03:36 +00:00
Chris Lattner
b11c3233d8
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.
llvm-svn: 57404
2008-10-12 04:51:35 +00:00
Chris Lattner
99e7d23455
When in keep whitespace mode, make sure to return block comments that are
...
unterminated.
llvm-svn: 57403
2008-10-12 04:19:49 +00:00
Chris Lattner
e01e758e11
Change SkipBlockComment and SkipBCPLComment to return true when in
...
keep comment mode, instead of returning false. This matches SkipWhitespace.
llvm-svn: 57402
2008-10-12 04:15:42 +00:00
Chris Lattner
4d96344c19
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 :)
llvm-svn: 57401
2008-10-12 04:05:48 +00:00
Chris Lattner
924efdf623
Stop the preprocessor from poking the lexer's private parts.
...
llvm-svn: 57399
2008-10-12 03:31:33 +00:00
Chris Lattner
097a8b8777
Fix a couple more places that poke KeepCommentMode unnecesarily.
...
llvm-svn: 57398
2008-10-12 03:27:19 +00:00
Chris Lattner
8637abd333
add a new inKeepCommentMode() accessor to abstract the KeepCommentMode
...
ivar.
llvm-svn: 57397
2008-10-12 03:22:02 +00:00
Chris Lattner
e3f863a388
fix misleading comment.
...
llvm-svn: 57396
2008-10-12 01:34:51 +00:00
Chris Lattner
7c2e9809b1
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).
llvm-svn: 57395
2008-10-12 01:31:51 +00:00
Chris Lattner
6b0c5ad096
add a comment.
...
llvm-svn: 57394
2008-10-12 01:23:27 +00:00
Chris Lattner
50c9050037
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.
llvm-svn: 57393
2008-10-12 01:15:46 +00:00
Chris Lattner
5d3e26a4f6
silence release-assert warnings.
...
llvm-svn: 57392
2008-10-12 00:31:50 +00:00
Chris Lattner
79ef843533
silence some release-assert warnings.
...
llvm-svn: 57391
2008-10-12 00:28:42 +00:00
Chris Lattner
e05f534628
silence a bunch of warnings in a release-assert build.
...
llvm-svn: 57390
2008-10-12 00:26:57 +00:00
Chris Lattner
87e97ea7b8
improve a comment.
...
llvm-svn: 57389
2008-10-12 00:23:07 +00:00
Steve Naroff
b2b5540c40
Add DeclGroup.cpp.
...
llvm-svn: 57354
2008-10-10 16:41:38 +00:00
Steve Naroff
8022c30aaa
Fix/simplify RewriteBlocks::RewriteBlockPointerFunctionArgs().
...
This completes the fix for <rdar://problem/6272905> clang block rewriter: parameter to function not imported into block?.
llvm-svn: 57350
2008-10-10 15:33:34 +00:00
Seo Sanghyeon
c9e7c272da
Tests for return statement checks
...
llvm-svn: 57341
2008-10-10 07:20:06 +00:00
Steve Naroff
1d95e5a531
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.
...
llvm-svn: 57337
2008-10-10 01:28:17 +00:00
Daniel Dunbar
eca513d945
Lift EmitTargetBuiltinExpr out of EmitBuiltinExpr.
...
llvm-svn: 57335
2008-10-10 00:24:54 +00:00
Daniel Dunbar
faa4f50b71
Disable blocks support in C++ mode.
...
llvm-svn: 57334
2008-10-10 00:20:52 +00:00
Ted Kremenek
63cfae34fd
Add missing newline.
...
llvm-svn: 57333
2008-10-10 00:17:08 +00:00
Dale Johannesen
c48814bc98
Adjust calls to APFloat conversion for new interface.
...
llvm-svn: 57332
2008-10-09 23:02:32 +00:00
Zhongxing Xu
cc06b463f5
Check some cases for previous patch. Make the code more robust.
...
llvm-svn: 57317
2008-10-09 03:19:06 +00:00
Argyrios Kyrtzidis
1207d31952
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.
llvm-svn: 57313
2008-10-08 22:20:31 +00:00
Steve Naroff
44078b95ee
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).
llvm-svn: 57304
2008-10-08 18:44:00 +00:00
Ted Kremenek
944375abae
Update checker build.
...
llvm-svn: 57303
2008-10-08 18:32:06 +00:00
Steve Naroff
35530480c2
Touchup the rewriter to handle the new BlockExpr->BlockDecl dance.
...
llvm-svn: 57299
2008-10-08 17:31:13 +00:00
Steve Naroff
415d3d570a
- 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).
llvm-svn: 57298
2008-10-08 17:01:13 +00:00
Zhongxing Xu
d9959aee34
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.
...
llvm-svn: 57285
2008-10-08 02:50:44 +00:00
Ted Kremenek
587a44fe3d
A little more tweaking with StmtIterator and SizeOfAlignofExpr. A recent commit actually introduced a regression, not fixed a bug.
...
llvm-svn: 57282
2008-10-07 23:35:42 +00:00
Ted Kremenek
9bb286ff43
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*.
llvm-svn: 57275
2008-10-07 23:09:49 +00:00
Ted Kremenek
5ee6292e32
Add #include (introduced by dependence on DeclGroup)
...
llvm-svn: 57274
2008-10-07 23:08:39 +00:00
Ted Kremenek
4faf673d7f
Fixed a masked bug when iterating over the child expressions of SizeOfAlignOfTypeExpr. This bug was unmasked by recent changes to StmtIterator.
...
llvm-svn: 57273
2008-10-07 23:07:10 +00:00
Ted Kremenek
12183e25aa
Add const_iterator to DeclGroup.
...
Serialization for OwningDeclGroupRefs now works.
llvm-svn: 57272
2008-10-07 23:06:01 +00:00
Ted Kremenek
f9638bac59
Add StmtIterator support for DeclGroups.
...
llvm-svn: 57271
2008-10-07 23:04:14 +00:00
Argyrios Kyrtzidis
8ae3684aa9
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
llvm-svn: 57241
2008-10-07 10:21:57 +00:00
Zhongxing Xu
de7509f01a
Added a function call case that generates sink nodes.
...
llvm-svn: 57240
2008-10-07 10:06:03 +00:00
Zhongxing Xu
f5e7c90c46
Migrate MemRegionManager from StateManager to StoreManager.
...
llvm-svn: 57225
2008-10-07 01:31:04 +00:00
Ted Kremenek
6553748599
Added prototype serialization code for DeclGroup.
...
llvm-svn: 57222
2008-10-06 23:49:24 +00:00
Argyrios Kyrtzidis
7b41f721b4
Use getCustomDiagID() instead of specifying the diagnostic in the 'DiagnosticKinds.def' file.
...
llvm-svn: 57220
2008-10-06 23:16:35 +00:00
Argyrios Kyrtzidis
997d00dd13
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 ;".
llvm-svn: 57219
2008-10-06 23:08:37 +00:00
Ted Kremenek
21cc560188
Remove DeclStmt::getDecl(). Now clients of DeclStmt must explicitly reason about a DeclStmt referring to a collection of Decls.
...
llvm-svn: 57217
2008-10-06 22:51:42 +00:00
Ted Kremenek
db7f2a74db
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.
...
llvm-svn: 57216
2008-10-06 22:45:07 +00:00
Ted Kremenek
5b6f8ee7b9
Use "DeclStmt::getSolitaryDecl()" when accessing the DeclStmt of an @catch .
...
llvm-svn: 57215
2008-10-06 22:39:38 +00:00
Ted Kremenek
6d60a4ec19
Modified DeclGroupRef to always load/store the internal pointer value as Decl*. This hopefully will obviate any concerns with violating strict type-aliasing issues.
...
llvm-svn: 57213
2008-10-06 22:17:16 +00:00
Ted Kremenek
292b3842a0
Use DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when rewriting Objective-c foreach statements.
...
llvm-svn: 57212
2008-10-06 22:16:13 +00:00
Ted Kremenek
3fef35736e
Use DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when processing the Decl of an Objective-C foreach statement.
...
llvm-svn: 57209
2008-10-06 20:59:48 +00:00
Ted Kremenek
a7297be859
Use DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when processing the Decl of a @catch statement.
...
llvm-svn: 57208
2008-10-06 20:58:56 +00:00
Ted Kremenek
11b004216c
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().
...
llvm-svn: 57207
2008-10-06 20:58:11 +00:00
Ted Kremenek
ef52c641e7
Use DeclStmt::decl_iterator to walk a group of Decl*'s instead of using the ScopedDecl chain.
...
llvm-svn: 57206
2008-10-06 20:56:19 +00:00
Ted Kremenek
a86db10563
Don't use DeclStmt::getDecl() to serialize out DeclStmt; use TheDecl directly.
...
This patch precedes removing getDecl() DeclStmt::entirely.
llvm-svn: 57205
2008-10-06 20:55:44 +00:00
Ted Kremenek
acf920dd39
Add DeclStmt::hasSolitaryDecl() and DeclStmt::getSolitaryDecl()
...
llvm-svn: 57204
2008-10-06 20:54:44 +00:00
Ted Kremenek
7c2d69f007
Use "unsigned" instead of "int" for i to remove a "comparison between unsigned and signed" warning (potential integer overflow).
...
llvm-svn: 57201
2008-10-06 20:35:04 +00:00
Anders Carlsson
5f7ee680f8
Add 'x' constraint character.
...
llvm-svn: 57198
2008-10-06 19:17:39 +00:00
Ted Kremenek
dcd6632463
Use the DeclStmt::decl_iterator to get the first decl in a DeclStmt instead of using DeclStmt::getDecl().
...
llvm-svn: 57196
2008-10-06 18:48:35 +00:00
Ted Kremenek
53532c1fda
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.
llvm-svn: 57195
2008-10-06 18:47:09 +00:00
Ted Kremenek
4db44b62ad
Don't use DeclStmt::getDecl(); this will eventually disappear. Just fetch the first decl using the DeclStmt::decl_iterator.
...
llvm-svn: 57194
2008-10-06 18:43:53 +00:00
Ted Kremenek
704a2505db
In EmitDeclStmt: use DeclStmt::const_decl_iterator instead of walking the scoped decl chain.
...
llvm-svn: 57192
2008-10-06 18:42:27 +00:00
Ted Kremenek
15e6b40832
Added PrintRawDeclStmt; use this method to print out DeclStmt instead of using PrintRawDecl (which falsely assumes DeclStmts have only one Decl).
...
llvm-svn: 57191
2008-10-06 18:39:36 +00:00
Ted Kremenek
62408480d9
Use Decl::decl_iterator instead of walking the ScopedDecl chain (which will soon be removed).
...
llvm-svn: 57190
2008-10-06 18:38:35 +00:00
Ted Kremenek
fae8cb0736
Use DeclStmt::decl_iterator instead of using Decl::getDecl(). Soon DeclStmts will wrap group of Decls.
...
Added FIXME.
llvm-svn: 57189
2008-10-06 18:37:46 +00:00
Argyrios Kyrtzidis
153d967d14
The current semantic process for direct initializers won't work properly for class types.
...
Add a FIXME until class constructors are supported.
llvm-svn: 57188
2008-10-06 18:37:09 +00:00
Ted Kremenek
f8a2765fb7
Use DeclStmt::decl_iterator instead of walking the ScopedDecl chain (which will soon be removed).
...
llvm-svn: 57187
2008-10-06 18:36:52 +00:00
Ted Kremenek
151534a197
Add const_decl_iterator to DecStmt.
...
llvm-svn: 57186
2008-10-06 18:35:55 +00:00
Ted Kremenek
c7d5d976bf
Update Xcode project.
...
llvm-svn: 57180
2008-10-06 17:42:44 +00:00
Argyrios Kyrtzidis
9a1191c047
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.
llvm-svn: 57178
2008-10-06 17:10:33 +00:00
Ted Kremenek
3b670d1a0c
Updated checker build.
...
llvm-svn: 57176
2008-10-06 15:46:11 +00:00
Chris Lattner
25728d931a
fix incorrect rdar number.
...
llvm-svn: 57165
2008-10-06 07:43:28 +00:00
Chris Lattner
1b0a00a4c9
__CONSTANT_CFSTRINGS__ should be defined even in C mode, otherwise the CFSTR
...
won't expand to the builtin. This fixes rdar://6248329
llvm-svn: 57164
2008-10-06 07:43:09 +00:00
Chris Lattner
a97132a9c4
Make sema and codegen allow __builtin___CFStringMakeConstantString as a valid
...
constant lvalue. Implement this in codegen by moving the code out of CGBuiltin
into EmitConstantExpr.
llvm-svn: 57163
2008-10-06 07:26:43 +00:00
Chris Lattner
2c091b1ead
ExprConstant should not abort when it sees a pointer constant that isn't.
...
llvm-svn: 57162
2008-10-06 07:20:11 +00:00
Chris Lattner
24355b5240
always try to fold a builtin before emitting it. In the future
...
it is possible that a builtin could sometimes be folded (e.g. __builtin_clz)
if it's operand is a constant.
llvm-svn: 57161
2008-10-06 06:56:41 +00:00
Chris Lattner
b7c86a211c
Remove the 'C' / isConstantExpr flag on builtins. Code should never
...
depend on the value of this flag, it should depend on whether
tryEvaluate is able to *actually* fold a builtin.
llvm-svn: 57160
2008-10-06 06:51:12 +00:00
Chris Lattner
cb13691a62
Add a Expr::isEvaluatable method, eliminate isBuiltinConstantExpr
...
which is checking for something that can be inconsistent with
what we can constant fold.
llvm-svn: 57159
2008-10-06 06:49:02 +00:00
Chris Lattner
86ee286b09
Move folding of __builtin_classify_type out of the CallExpr
...
interface into the constant folding interface.
llvm-svn: 57158
2008-10-06 06:40:35 +00:00
Chris Lattner
0b7282eafc
Move handling of __builtin_nan("") out of CGBuiltin.cpp into ExprConstant.cpp
...
llvm-svn: 57157
2008-10-06 06:31:58 +00:00
Chris Lattner
a1518b1dfe
remove some code where CGBuiltin folds constants, and use tryEvaluate to
...
do it instead. We should still handle __builtin_nan etc, but don't yet.
This fixes incorrect evaluation of __builtin_constant_p, a FIXME.
llvm-svn: 57156
2008-10-06 06:09:18 +00:00
Chris Lattner
e50e90142e
instead of making codegen try to know about all of the builtins to generate
...
constants for them, just use the constant evaluator to do the job. This
also fixes crashes on 'unknown constant builtins'.
llvm-svn: 57155
2008-10-06 05:59:01 +00:00
Chris Lattner
37346e081c
Teach FloatExprEvaluator to evaluate __builtin_huge_val and inf.
...
llvm-svn: 57154
2008-10-06 05:53:16 +00:00
Chris Lattner
c43467526d
"Enhance" CheckArithmeticConstantExpression to accept ?: with a constant
...
condition as a constant even if the unevaluated side is a not a constant.
We don't do this when extensions are off, and we emit a warning when this
happens:
t.c:22:11: warning: expression is not a constant, but is accepted as one by GNU extensions
short t = __builtin_constant_p(5353) ? 42 : somefunc();
^ ~~~~~~~~~~
suggestions for improvement are welcome. This is obviously horrible, but
is required for real-world code.
llvm-svn: 57153
2008-10-06 05:42:39 +00:00
Chris Lattner
4deaa4ea24
Add a comment that describes tryEvaluate. Make tryEvaluate fold
...
__builtin_constant_p properly, and add some scaffolding for
FloatExprEvaluator to eventually handle huge_val and inf.
llvm-svn: 57152
2008-10-06 05:28:25 +00:00
Chris Lattner
01ff98a48a
add a new CallExpr::isBuiltinCall() method, and use it to simplify some existing
...
code.
llvm-svn: 57151
2008-10-06 05:00:53 +00:00
Anders Carlsson
1e18220dc4
Actually use the mmintrin.h header, it's good enough now.
...
llvm-svn: 57150
2008-10-06 04:49:00 +00:00
Chris Lattner
d1d152a613
a more efficient test for __builtin_classify_type
...
llvm-svn: 57149
2008-10-06 04:48:17 +00:00
Zhongxing Xu
a4bbcd302e
Fix typos.
...
llvm-svn: 57146
2008-10-06 03:03:33 +00:00
Anders Carlsson
f407150c06
Apparently gcc uses pi64 for the shift intrinsics.
...
llvm-svn: 57145
2008-10-06 02:07:50 +00:00
Anders Carlsson
83661acf30
Add the 'y' assembler constraint.
...
llvm-svn: 57144
2008-10-06 00:41:45 +00:00
Argyrios Kyrtzidis
e8addf5e04
Allow variadic arguments without named ones for C++, e.g. "void(...);"
...
llvm-svn: 57143
2008-10-06 00:07:55 +00:00
Anders Carlsson
b83162840f
Implement support for the const and pure attributes.
...
llvm-svn: 57142
2008-10-05 23:32:53 +00:00
Argyrios Kyrtzidis
4217c7ec81
A tiny optimization; use isCXXFunctionDeclarator only when it's appropriate.
...
llvm-svn: 57141
2008-10-05 23:15:41 +00:00
Chris Lattner
09d98f5d8a
miscellaneous cleanups
...
llvm-svn: 57140
2008-10-05 21:50:58 +00:00
Chris Lattner
ac7ed9a71a
move __FLT_EVAL_METHOD__, __FLT_RADIX__, and __DECIMAL_DIG__ into
...
target indep code.
llvm-svn: 57139
2008-10-05 21:49:27 +00:00
Chris Lattner
c34a35d56f
it helps when I save the file before testing and committing.
...
llvm-svn: 57138
2008-10-05 21:42:17 +00:00
Chris Lattner
6da2f0dd2e
suck the rest of the FP macros out of the targets into the PP
...
llvm-svn: 57137
2008-10-05 21:40:58 +00:00
Argyrios Kyrtzidis
279d9814e5
Add some text from the C++ standard and additional ambiguity resolution tests.
...
No funcitonality change.
llvm-svn: 57136
2008-10-05 21:10:08 +00:00
Chris Lattner
5cd8351808
start moving fp macros over
...
llvm-svn: 57134
2008-10-05 20:40:30 +00:00
Daniel Dunbar
6ba6cc42d4
Add script for checking builtin macros verse another compiler ($CC or
...
gcc).
llvm-svn: 57133
2008-10-05 20:39:30 +00:00
Chris Lattner
6512a88984
move a bunch more integer sizing out of target-specific code into
...
target indep code.
Note that this changes functionality on PIC16: it defines __INT_MAX__
correctly for it, and it changes sizeof(long) to 16-bits (to match
the size of pointer).
llvm-svn: 57132
2008-10-05 20:06:37 +00:00
Argyrios Kyrtzidis
2b1ef227f5
Handle ambiguities between expressions and type-ids that occur inside parentheses, e.g.:
...
sizeof(int()) -> "int()" is type-id
sizeof(int()+1) -> "int()+1" is expression.
llvm-svn: 57131
2008-10-05 19:56:22 +00:00
Chris Lattner
4ecd753486
eliminate __USER_LABEL_PREFIX__ from the Targets.cpp file, start moving
...
integer size #defines over to the Preprocessor.
llvm-svn: 57130
2008-10-05 19:44:25 +00:00
Chris Lattner
248d3c4192
gcc no longer defines __block to nothing when blocks aren't enabled.
...
llvm-svn: 57129
2008-10-05 19:32:52 +00:00
Chris Lattner
1f7e2d5430
rearrange preprocessor macro definitions into language-specific
...
then target specific.
llvm-svn: 57128
2008-10-05 19:32:22 +00:00
Chris Lattner
f37bafc5ca
Implement PR2773, support for __USER_LABEL_PREFIX__
...
llvm-svn: 57127
2008-10-05 19:22:37 +00:00
Chris Lattner
9daca0e561
Fix a problem reported in PR2766 that makes clang reject old versions
...
of GCC's headers. This impacts people that run clang in Tiger systems.
llvm-svn: 57126
2008-10-05 19:05:44 +00:00
Argyrios Kyrtzidis
df788f4eea
Found a subtle bug caused by an implicit enum-to-bool conversion (of the TentativeParsingResult enum).
...
This was the motivation of the following changes:
-'TentativeParsingResult' enum is replaced by a 'TPResult' class that basically encapsulates the enum.
-TPR_true, TPR_false, TPR_ambiguous, and TPR_error enum constants are replaced by TPResult::True(), TPResult::False(), etc. calls that return a TPResult object.
-Also fixed the subtle bug in Parser::isCXXFunctionDeclarator (caught by the above changes as a compilation error).
llvm-svn: 57125
2008-10-05 18:52:21 +00:00
Anders Carlsson
c181b01681
Add parsing of the sentinel attribute. Still need to create the attribute.
...
llvm-svn: 57121
2008-10-05 18:05:59 +00:00
Anders Carlsson
d27a0c2395
Change indentation for a couple of files in the Xcode project.
...
llvm-svn: 57120
2008-10-05 18:04:30 +00:00
Chris Lattner
465fa32cd5
Wrap long lines and other minor cleanups, no functionality change.
...
llvm-svn: 57119
2008-10-05 17:34:18 +00:00
Anders Carlsson
c442c92b6f
Remove copyright notice, we decided not to have them.
...
llvm-svn: 57118
2008-10-05 17:21:08 +00:00
Argyrios Kyrtzidis
5af11b2462
Move the TentativeParsingResult enum closer to where it gets used.
...
No functionality change.
llvm-svn: 57115
2008-10-05 17:02:44 +00:00
Argyrios Kyrtzidis
bc28fefcde
Disambiguate between a declaration or an expression, in the 'for-init-statement' part of a 'for' statement.
...
llvm-svn: 57112
2008-10-05 15:50:46 +00:00
Argyrios Kyrtzidis
2534620b4e
Fix Parser::isCXXConditionDeclaration to properly resolve declarations.
...
llvm-svn: 57111
2008-10-05 15:19:49 +00:00
Argyrios Kyrtzidis
71f3e19df0
Disambiguate between a declaration or expression for the 'condition' part of a if/switch/while/for statement.
...
llvm-svn: 57109
2008-10-05 15:03:47 +00:00
Argyrios Kyrtzidis
7b87f27438
Consider GNU attributes when doing ambiguity resolution.
...
llvm-svn: 57108
2008-10-05 14:27:18 +00:00
Zhongxing Xu
8c9771bdf0
Remove redundant parameter and rename StMgr to StateMgr.
...
llvm-svn: 57107
2008-10-05 12:12:48 +00:00
Daniel Dunbar
93bc49d882
Add X86 builtin code generation test case.
...
llvm-svn: 57104
2008-10-05 06:38:36 +00:00
Daniel Dunbar
363a5c0a1b
Improve C language testing coverage.
...
llvm-svn: 57103
2008-10-05 06:36:33 +00:00
Daniel Dunbar
35bd17f1a5
Fix X86 palignr[128] builtins to match LLVM.
...
llvm-svn: 57102
2008-10-05 06:35:41 +00:00
Daniel Dunbar
b11d5d65e8
Add some builtins to codegen test case.
...
llvm-svn: 57101
2008-10-05 06:34:45 +00:00
Daniel Dunbar
b8ed192605
Make VectorType printing less broken.
...
- Print size as number of elements times "sizeof(elt type)", not
perfect but better than just printing the completely wrong type.
llvm-svn: 57100
2008-10-05 05:43:11 +00:00
Daniel Dunbar
e47e96a4a5
Fix another X86 builtin definitions.
...
- vec_set_v4hi had "v4s" in place of "V4s"
llvm-svn: 57099
2008-10-05 05:21:00 +00:00
Daniel Dunbar
91d8be141b
Fix some X86 builtin definitions.
...
- cmp instructions return int
- storedqu had bad const qualifier
- pmuldq128 used invalid type code
llvm-svn: 57098
2008-10-05 05:14:37 +00:00
Daniel Dunbar
0af89ff0fb
Add -rewrite-macros test case.
...
llvm-svn: 57094
2008-10-05 01:39:04 +00:00
Daniel Dunbar
374b8b4269
Allow -verify to be used with -rewrite-macros.
...
llvm-svn: 57093
2008-10-05 01:38:39 +00:00
Daniel Dunbar
91d085e368
Coverage test for targets.
...
- This pushes us over 80% coverage of executable LOC.
llvm-svn: 57092
2008-10-05 01:04:25 +00:00
Steve Naroff
47ddedab08
Update VC++ project file
...
llvm-svn: 57090
2008-10-05 00:52:59 +00:00
Daniel Dunbar
05d93dd73d
Improve codegen coverage tests.
...
- Hit debug info generation.
- Hit both ObjC runtimes.
llvm-svn: 57088
2008-10-05 00:31:54 +00:00
Daniel Dunbar
6b57b45b4d
Add dummy -ast-dump support for ObjC category implementations.
...
llvm-svn: 57087
2008-10-05 00:31:15 +00:00
Steve Naroff
8f9be42072
Remove old diag that alerted the user to a limitation we no longer have:-)
...
llvm-svn: 57086
2008-10-05 00:12:46 +00:00
Argyrios Kyrtzidis
72d8149a1e
Append the test runs with '&&'.
...
llvm-svn: 57085
2008-10-05 00:08:56 +00:00
Argyrios Kyrtzidis
2c7137d8d1
Resolve ambiguous C++ statements (C++ 6.8p1).
...
'ParseTentative.cpp' implements the functionality needed to resolve ambiguous C++ statements, to either a declaration or an expression, by "tentatively parsing" them.
llvm-svn: 57084
2008-10-05 00:06:24 +00:00