John McCall
bb0260139a
Switch the __cxa_free_exception cleanup to be lazy.
...
llvm-svn: 108276
2010-07-13 21:17:51 +00:00
Fariborz Jahanian
714447b2ed
Set DeclContext of ParamVarDecl only. No need
...
to set that of VarDecl for block variables
(they are already set). Per Doug's comment.
llvm-svn: 108273
2010-07-13 21:05:02 +00:00
John McCall
2b7fc3828e
Teach IR generation how to lazily emit cleanups. This has a lot of advantages,
...
mostly in avoiding unnecessary work at compile time but also in producing more
sensible block orderings.
Move the destructor cleanups for local variables over to use lazy cleanups.
Eventually all cleanups will do this; for now we have some awkward code
duplication.
Tell IR generation just to never produce landing pads in -fno-exceptions.
This is a much more comprehensive solution to a problem which previously was
half-solved by checks in most cleanup-generation spots.
llvm-svn: 108270
2010-07-13 20:32:21 +00:00
Fariborz Jahanian
a6c7efec2b
More block instantiation stuff. Set variable/param DeclContext
...
to block context when first instantiating them.
llvm-svn: 108266
2010-07-13 20:05:58 +00:00
Chris Lattner
8406c5197b
Add a warning to catch a bug recently caught by code review, like this:
...
t2.c:2:12: warning: use of logical && with constant operand; switch to bitwise &
or remove constant [-Wlogical-bitwise-confusion]
return x && 4;
^ ~
wording improvement suggestions are welcome.
llvm-svn: 108260
2010-07-13 19:41:32 +00:00
Chris Lattner
ca9f2a025c
80 column issues.
...
llvm-svn: 108257
2010-07-13 19:22:31 +00:00
Douglas Gregor
a8a089bfd5
Whenever we're creating an expression that is typically an rvalue
...
(e.g., a call, cast, etc.), immediately adjust the expression's type
to strip cv-qualifiers off of all non-class types (in C++) or all
types (in C). This effectively extends my previous fix for PR7463,
which was restricted to calls, to other kinds of expressions within
similar characteristics. I've audited every use of
getNonReferenceType() in the code base, switching to the newly-renamed
getNonLValueExprType() where necessary.
Big thanks to Eli for pointing out just how incomplete my original fix
for PR7463 actually was. We've been handling cv-qualifiers on rvalues
wrong for a very, very long time. Fixes PR7463.
llvm-svn: 108253
2010-07-13 18:40:04 +00:00
Chandler Carruth
46e8978c69
Silence Doug's favorite GCC warning.
...
llvm-svn: 108247
2010-07-13 17:07:17 +00:00
Devang Patel
01c8c100c2
Add volatile qualifiers for "this".
...
llvm-svn: 108245
2010-07-13 16:23:13 +00:00
Douglas Gregor
f2753b3b4e
Downgrade the "when type is in parentheses, array cannot have dynamic
...
size" error for code like
new (int [size])
to a warning, add a Fix-It to remove the parentheses, and make this
diagnostic work properly when it occurs in a template
instantiation. <rdar://problem/8018245>.
llvm-svn: 108242
2010-07-13 15:54:32 +00:00
Argyrios Kyrtzidis
36745fda34
Modify the pragma handlers to accept and use StringRefs instead of IdentifierInfos.
...
When loading the PCH, IdentifierInfos that are associated with pragmas cause declarations that use these identifiers to be deserialized (e.g. the "clang" pragma causes the "clang" namespace to be loaded).
We can avoid this if we just use StringRefs for the pragmas.
As a bonus, since we don't have to create and pass IdentifierInfos, the pragma interfaces get a bit more simplified.
llvm-svn: 108237
2010-07-13 09:07:17 +00:00
Douglas Gregor
e82f087378
Improve diagnostics for the "type qualifier on return type has no
...
effect warning" by printing the qualifiers we saw and correctly
pluralizing the message, e.g.,
test/SemaCXX/conditional-expr.cpp:295:3: warning: 'const volatile' type
qualifiers on return type have no effect
const volatile Enum g2() {
^~~~~ ~~~~~~~~
llvm-svn: 108236
2010-07-13 08:50:30 +00:00
Douglas Gregor
f5b160f89c
When computing the canonical profile of a DeclRefExpr or MemberExpr,
...
don't include the nested-name-specifier or template arguments: they
were only relevant when resolving the declaration. Fixes PR7460.
llvm-svn: 108235
2010-07-13 08:37:11 +00:00
Douglas Gregor
603d81bf8d
When forming a function call or message send expression, be sure to
...
strip cv-qualifiers from the expression's type when the language calls
for it: in C, that's all the time, while C++ only does it for
non-class types.
Centralized the computation of the call expression type in
QualType::getCallResultType() and some helper functions in other nodes
(FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant
callers of getResultType() to getCallResultType().
Fixes PR7598 and PR7463, along with a bunch of getResultType() call
sites that weren't stripping references off the result type (nothing
stripped cv-qualifiers properly before this change).
llvm-svn: 108234
2010-07-13 08:18:22 +00:00
Douglas Gregor
d8f446f1b2
Diagnose typedef of an operator name. Fixes PR7462
...
llvm-svn: 108233
2010-07-13 06:37:01 +00:00
Douglas Gregor
aa8c97262a
Complain when an unnamed enumeration has no enumerations (in
...
C++). Fixes PR7466.
llvm-svn: 108231
2010-07-13 06:24:26 +00:00
Douglas Gregor
a700f68828
Reinstate the optimization suppressing available_externally functions
...
at -O0. The only change from the previous patch is that we don't try
to generate virtual method thunks for an available_externally
function.
llvm-svn: 108230
2010-07-13 06:02:28 +00:00
Devang Patel
0a34e31d81
const qualify debug info for "this" for const methods.
...
llvm-svn: 108220
2010-07-13 00:24:30 +00:00
Fariborz Jahanian
f8681a2a3f
Instantiate attributes when first building an instantiated
...
VarDecl.
llvm-svn: 108218
2010-07-13 00:16:40 +00:00
Douglas Gregor
6cc1df5d3d
Provide a special diagnostic for attempts to explicitly specialize
...
class templates within class scope (which is ill-formed), and recover
by dropping the explicit specialization entirely. Fixes the infinite
loop in PR7622.
llvm-svn: 108217
2010-07-13 00:10:04 +00:00
Douglas Gregor
11cfd9441d
Fix a documentation paste-o and eliminate a useless function parameter, both found by Sebastian
...
llvm-svn: 108214
2010-07-12 23:48:14 +00:00
Sebastian Redl
5467c9fac5
Produce an error on encountering a pointer or reference to a qualified function type. Fixes PR7470.
...
llvm-svn: 108209
2010-07-12 23:11:43 +00:00
Devang Patel
0aabb1200f
While collecting members for a class, always create delcaration entry for methods. Debug info for method definition will be generated while generating code for method body.
...
Tested by classes.exp in gdb testsuite.
llvm-svn: 108205
2010-07-12 22:54:41 +00:00
Sebastian Redl
143413f8fb
Split the normal and chained PCH writing paths and add a tiny bit of implementation to the latter. WIP.
...
llvm-svn: 108200
2010-07-12 22:02:52 +00:00
Argyrios Kyrtzidis
d1d239f35c
Remove the check for repeated tok::eofs, we are not supposed to go past eof so this code is
...
totally unnecessary.
llvm-svn: 108199
2010-07-12 21:41:41 +00:00
Argyrios Kyrtzidis
f4cc7dcf9b
Simplify code using the new FoldingSetImpl::InsertNode() overload.
...
llvm-svn: 108198
2010-07-12 21:41:31 +00:00
Fariborz Jahanian
8308585a1e
Copy over attributes to instantiated variable.
...
llvm-svn: 108195
2010-07-12 21:12:19 +00:00
Douglas Gregor
553f3a9b30
Speculatively revert r108156; it appears to be breaking self-host.
...
llvm-svn: 108194
2010-07-12 21:08:32 +00:00
Argyrios Kyrtzidis
c2924de667
If we are past tok::eof and in caching lex mode, avoid caching repeated tok::eofs.
...
llvm-svn: 108175
2010-07-12 18:49:30 +00:00
Fariborz Jahanian
c289bce1f5
Compute Type dependent-ness of BlockDeclRefExpr
...
on the fly when constructing it.
llvm-svn: 108166
2010-07-12 18:12:03 +00:00
Fariborz Jahanian
70c0b08022
Move setting of Dependent Type to BlockDeclRefExpr's
...
constructor.
llvm-svn: 108157
2010-07-12 17:26:57 +00:00
Douglas Gregor
dbb2806a7b
Do not generate LLVM IR for available_externally function bodies at
...
-O0, since we won't be using the definitions for anything anyway. For
lib/System/Path.o when built in Debug+Asserts mode, this leads to a 4%
improvement in compile time (and suppresses 440 function bodies).
<rdar://problem/7987644>
llvm-svn: 108156
2010-07-12 17:24:55 +00:00
Chandler Carruth
65a38183f0
Fix another aspect of PR7047, macro expansions. Previously, this was hacked
...
around by exempting enums from the check, but this doesn't handle a lot of
cases. A better approach is to directly check if the operator comes from
a macro expansion.
I've removed a reference to the rdar that originally led to the enum
suppression when removing it's overly contrived test case. Let me know if that
number or a more reasilistic test case involving enums is still needed.
llvm-svn: 108128
2010-07-12 06:23:38 +00:00
Chris Lattner
5a503e9f70
we do in fact have to cache the EOF token returned by the preprocessor.
...
In the case of backtracking, the cached token lexer will be the only
lexer on the stack, without this the token stack will be empty and EOF
won't be returned.
This fixes PR7072.
llvm-svn: 108124
2010-07-12 04:25:32 +00:00
Chris Lattner
0931644922
revert a hunk of code that Argiris added in r106213, which is the
...
root cause of PR7481 and probably more, and has no apparent
testcases. I don't understand the logic here so I can't repair it.
llvm-svn: 108119
2010-07-12 01:48:28 +00:00
Chris Lattner
1390134c18
Fix PR7617 by not entering ParseFunctionDefinition when
...
a function prototype is followed by a declarator if we
aren't parsing a K&R style identifier list.
Also, avoid skipping randomly after a declaration if a
semicolon is missing. Before we'd get:
t.c:3:1: error: expected function body after function declarator
void bar();
^
Now we get:
t.c:1:11: error: invalid token after top level declarator
void foo()
^
;
llvm-svn: 108105
2010-07-11 22:42:07 +00:00
Chris Lattner
dbb1e93a9f
add a const qualifier, refactor some code.
...
llvm-svn: 108104
2010-07-11 22:24:20 +00:00
Chandler Carruth
62e5e56dad
Switch to void-cast for this. Chris prefers that over the attribute, I'll
...
probably try and switch more of these if I can.
llvm-svn: 108085
2010-07-11 07:42:13 +00:00
Chandler Carruth
32652f3400
Mark assert-only variables as unused.
...
llvm-svn: 108068
2010-07-11 03:24:05 +00:00
Dale Johannesen
bde8ee26d0
Fix compile error. Per Fariborz.
...
llvm-svn: 108051
2010-07-10 19:53:56 +00:00
Chandler Carruth
17773fcd83
Lay the ground work for resoving PR7047. This doesn't actually fix it because
...
default arguments to template parameters don't have a DeclContext when
instantiated, and so we can't detect that we're in an instantiation context as
opposed to the definition context. However, it fixes the more commonly-occuring
cases in TMP code that use devolve to this type of tautology after
substitution.
llvm-svn: 108044
2010-07-10 12:30:03 +00:00
Argyrios Kyrtzidis
b8d77eb300
Add PCH support for the remaining C++ exprs.
...
llvm-svn: 108042
2010-07-10 11:46:15 +00:00
John Thompson
c438947242
Hack for dealing with commas until we support multiple alternative constraints, per pr7338.
...
llvm-svn: 108028
2010-07-09 22:49:34 +00:00
Fariborz Jahanian
4239aa104b
BlockDeclRefExpr of a dependent type must
...
be a dependent expression when its is built.
llvm-svn: 108026
2010-07-09 22:21:32 +00:00
Fariborz Jahanian
2f8bd36bcf
Instantiation of byref variable in
...
block literal expression.
llvm-svn: 108019
2010-07-09 21:27:28 +00:00
Sebastian Redl
3e39272fed
Slightly improve the diagnostic when using a qualified function typedef to declare nonmember or static member functions.
...
llvm-svn: 108018
2010-07-09 21:26:08 +00:00
Argyrios Kyrtzidis
8704057ce9
Reorganize how ClassTemplate[Partial]SpecializationDecls are read/written to avoid the
...
possibility of adding an unitialized one into the folding set.
llvm-svn: 108016
2010-07-09 21:11:43 +00:00
Argyrios Kyrtzidis
dd2061b2cd
isMemberSpecialization -> setMemberSpecialization.
...
llvm-svn: 108015
2010-07-09 21:11:35 +00:00
Sebastian Redl
4d3af3e192
When given the -chained-pch option and a previous PCH file, have the PCHWriter emit a CHAINED_METADATA record instead of METADATA, and write a link to the previous file there.
...
llvm-svn: 108014
2010-07-09 21:00:24 +00:00
Craig Silverstein
4a5d086b50
Fix a crashing but trying to print a TemplateTemplateParmDecl
...
for code like this:
template<template<typename T> class U> class V {};
The problem is that the DeclPrinter assumed all TemplateDecls
have a getTemplatedClass(), but template template params don't
(so we got a NULL dereference). The solution is to detect if
we're a template template param, and construct the template
class name ('class U') specially in this case.
OKed by dgregor and chandlerc
llvm-svn: 108007
2010-07-09 20:25:10 +00:00
Chandler Carruth
0b73ccfe20
Rip out the floating point return type handling from the atomic builtin. It's
...
wrong, and we don't handle floating point value type arguments yet anyways.
Will add correct logic for both when I finish the patch.
llvm-svn: 108004
2010-07-09 19:19:40 +00:00
Chandler Carruth
741e5cea77
Fix PR7600, and correctly convert the result of an atomic builtin to the
...
expected value type. This is necessary as the builtin is internally represented
as only operating on integral types.
Also, add a FIXME to add support for floating point value types.
llvm-svn: 108002
2010-07-09 18:59:35 +00:00
Fariborz Jahanian
1babe7778d
Instantiation of block literal expressions. wip.
...
llvm-svn: 108000
2010-07-09 18:44:02 +00:00
Sebastian Redl
60876431b1
Correctly initialize Reader to null.
...
llvm-svn: 107994
2010-07-09 17:53:32 +00:00
Sebastian Redl
f525a30d19
Really respect -chained-pch.
...
llvm-svn: 107993
2010-07-09 17:40:12 +00:00
Douglas Gregor
8ed0c0b99d
Introduce -f{no-}spell-checking options to enable/disable
...
spell-checking. By default, spell-checking is enabled for Clang
(obviously) but disabled in CIndex for performance reasons.
llvm-svn: 107992
2010-07-09 17:35:33 +00:00
John Thompson
ab71ead011
Revert 107953, remove comma ignoring from PPC constraints.
...
llvm-svn: 107956
2010-07-09 04:53:08 +00:00
John Thompson
7099f0c0d5
Updating PPC target to ignore commas in asm contrains, as apparently that is what gcc does.
...
llvm-svn: 107953
2010-07-09 02:01:40 +00:00
Sebastian Redl
f4b0c4b946
Add a frontend option -chained-pch and don't pass an active PCH reader to the PCH writer if it is not set, preventing creation of chained PCH files. Since the reader is so far unused, effectively no functionality change.
...
llvm-svn: 107936
2010-07-09 00:00:58 +00:00
Jordy Rose
d5d2e50f3e
Cleanup in CStringChecker. Now properly bifurcates the state for zero/nonzero sizes.
...
llvm-svn: 107935
2010-07-08 23:57:29 +00:00
Douglas Gregor
4587969555
Support code completion for parameter names in Objective-C method
...
declarations.
llvm-svn: 107933
2010-07-08 23:37:41 +00:00
Douglas Gregor
95887f9c5b
Introduce a new code-completion point prior to an identifier in the
...
selector of an Objective-C method declaration, e.g., given
- (int)first:(int)x second:(int)y;
this code completion point triggers at the location of "second". It
will provide completions that fill out the method declaration for any
known method, anywhere in the translation unit.
llvm-svn: 107929
2010-07-08 23:20:03 +00:00
Sebastian Redl
caef9ab03c
When looking for an entity's Scope, don't consider scopes that can't contain declarations. Fixes PR7594.
...
llvm-svn: 107927
2010-07-08 23:07:34 +00:00
Sebastian Redl
595c51342c
Some preparatory work for chained PCH. No functionality change.
...
llvm-svn: 107915
2010-07-08 22:01:51 +00:00
Douglas Gregor
55b037b9f3
During code completion, give the "nil" and "NULL" macros the same
...
priority as other constants. And, if we're in a place where we prefer
a pointer type, consider "nil" and "NULL" to be close matches.
llvm-svn: 107910
2010-07-08 20:55:51 +00:00
Douglas Gregor
eaff2cbbab
Allow C-style casts and reinterpret_casts between block pointers and
...
either integer values or other pointers. Fixes <rdar://problem/8134521>.
llvm-svn: 107905
2010-07-08 20:27:32 +00:00
Eli Friedman
07c89c6b3e
PR7588: Fix the _mm_shufflehi_epi16 macro. (The issue was an oversight
...
involving operator precedence.)
llvm-svn: 107902
2010-07-08 20:09:45 +00:00
Devang Patel
8f3f76f991
Handle forward declarations properly in debug info.
...
Patch by Alexander Kabaev.
PR 7595.
llvm-svn: 107900
2010-07-08 19:56:29 +00:00
Douglas Gregor
9961ce9428
When performing substitution of template arguments within the body of
...
a template, be sure to include the template arguments from the
injected-class-name. Fixes PR7587.
llvm-svn: 107895
2010-07-08 18:37:38 +00:00
Argyrios Kyrtzidis
7e8996c7e6
Introduce PCHReader::GetTranslationUnitDecl() and use it instead of ReadDeclRecord when initializing.
...
ReadDeclRecord would hit assertion if the translation unit declaration was already loaded during
IdentifierInfo initialization.
llvm-svn: 107885
2010-07-08 17:13:02 +00:00
Argyrios Kyrtzidis
9f2d24a808
Support TemplateTemplateParmDecl for PCH.
...
llvm-svn: 107884
2010-07-08 17:12:57 +00:00
Argyrios Kyrtzidis
a4ed18191c
For TagType and TemplateSpecializationType, isDependent calculation may be invalid because some decls that the
...
calculation is using may still be initializing.
Thus, store the isDependent flag to PCH and restore directly to Type.
llvm-svn: 107873
2010-07-08 13:09:53 +00:00
Argyrios Kyrtzidis
1985bb3b10
Read/write the C++ parts of DeclRefExpr and MemberExpr for PCH.
...
llvm-svn: 107872
2010-07-08 13:09:47 +00:00
Argyrios Kyrtzidis
00dda6accc
Fix reading of UsingDecl from PCH.
...
llvm-svn: 107871
2010-07-08 13:09:41 +00:00
Chandler Carruth
dd1bc0f1b5
Add support for differentiating between attributes ignored when handled and
...
unknown attributes that we discard. Add a diagnostic group for unknown
attribute warnings to allow turning these off when we don't care. Also
consolidates the tests for this case.
llvm-svn: 107864
2010-07-08 09:42:26 +00:00
John McCall
be349def4b
Mark calls to 'throw()' functions as nounwind, and mark the functions nounwind
...
as well.
llvm-svn: 107858
2010-07-08 06:48:12 +00:00
Douglas Gregor
747eb7840a
Reinstate the fix for PR7556. A silly use of isTrivial() was
...
suppressing copies of objects with trivial copy constructors.
llvm-svn: 107857
2010-07-08 06:14:04 +00:00
Chris Lattner
cb7696cf35
fix the clang side of PR7437: EmitAggregateCopy
...
was not producing a memcpy with the right address
spaces because of two places in it doing casts of
the arguments to i8, one of which that didn't
preserve the address space.
There is also an optimizer bug here.
llvm-svn: 107842
2010-07-08 00:07:45 +00:00
Douglas Gregor
e182370eda
Revert r107828 and r107827, the fix for PR7556, which seems to be
...
breaking bootstrap on Linux.
llvm-svn: 107837
2010-07-07 23:37:33 +00:00
Chris Lattner
86851b8a7a
fix PR4499, patch by Kyle Dean!
...
llvm-svn: 107836
2010-07-07 23:24:27 +00:00
Sebastian Redl
a771d2239d
Rip out the C++0x-specific handling of destructor names. The specification is still in flux and unclear, and our interim workaround was broken. Fixes PR7467.
...
llvm-svn: 107835
2010-07-07 23:17:38 +00:00
Douglas Gregor
1d9ef840fa
A using declaration can redeclare a typedef to the same type. These
...
typedefs won't have the same canonical declaration (since they are
distinct), so we need to check for this case specifically. Fixes
<rdar://problem/8018262>.
llvm-svn: 107833
2010-07-07 23:08:52 +00:00
Douglas Gregor
6df2b8c3ac
Rename CXXZeroInitValueExpr to CXXScalarValueInitExpr, to reflect its
...
newly-narrowed scope. No functionality change.
llvm-svn: 107828
2010-07-07 22:43:56 +00:00
Douglas Gregor
442612c285
Do not use CXXZeroValueInitExpr for class types. Instead, use
...
CXXConstructExpr/CXXTemporaryObjectExpr/CXXNewExpr as
appropriate. Fixes PR7556, and provides a slide codegen improvement
when copy-initializing a POD class type from a value-initialized
temporary. Previously, we weren't eliding the copy.
llvm-svn: 107827
2010-07-07 22:35:13 +00:00
Nate Begeman
5da51d38d7
Fix an issue with opencl init list checking.
...
llvm-svn: 107824
2010-07-07 22:26:56 +00:00
Douglas Gregor
2530efd3cf
When printing statistics for the ASTContext, also print them for its BumpPtrAllocator
...
llvm-svn: 107790
2010-07-07 16:40:34 +00:00
Chris Lattner
3e2ee147d0
add driver support for minix, patch by Kees van Reeuwijk
...
from PR7583
llvm-svn: 107788
2010-07-07 16:01:42 +00:00
Argyrios Kyrtzidis
ad65c6926b
Fix broken reading of NestedNameSpecifiers from PCH.
...
llvm-svn: 107784
2010-07-07 15:46:30 +00:00
Argyrios Kyrtzidis
903ccd6121
Delay passing InterestingDecls to the Consumer until when we know we are not in recursive loading and the
...
declarations are fully initialized.
llvm-svn: 107783
2010-07-07 15:46:26 +00:00
Argyrios Kyrtzidis
54fcbc7345
getBody() -> hasBody()
...
llvm-svn: 107773
2010-07-07 12:24:18 +00:00
Argyrios Kyrtzidis
0b6a06a335
Simplify code and remove comment that is no longer relevant.
...
llvm-svn: 107772
2010-07-07 12:24:14 +00:00
Argyrios Kyrtzidis
568bc84562
Remove Decl::getCompoundBody().
...
This has 2 (slight) advantages:
-Make explicit at getBody()'s callsite that we expect/handle only CompoundStmt and not CXXTryStmt.
-Better tracking of Decl::getBody()'s callsites.
llvm-svn: 107771
2010-07-07 11:31:34 +00:00
Argyrios Kyrtzidis
6fbc8fa53e
Simplify code. CompoundStmt's RBraceLoc can be found using its SourceRange too.
...
llvm-svn: 107770
2010-07-07 11:31:27 +00:00
Argyrios Kyrtzidis
46f556d4e5
Simplify code. FunctionDecl and ObjCMethodDecl have some common interfaces.
...
llvm-svn: 107769
2010-07-07 11:31:23 +00:00
Argyrios Kyrtzidis
36ea322579
Introduce Decl::hasBody() and FunctionDecl::hasBody() and use them instead of getBody() when we are just checking the existence of a body, to avoid de-serialization of the body from PCH.
...
Makes de-serialization of the function body even more "lazier".
llvm-svn: 107768
2010-07-07 11:31:19 +00:00
Jordy Rose
65136fb669
Add memcmp() and bcmp() to CStringChecker. These check for valid access to the buffer arguments and have a special-case for when the buffer arguments are known to be the same address, or when the size is zero.
...
llvm-svn: 107761
2010-07-07 08:15:01 +00:00
Jordy Rose
33c829a6fd
Cleanup on CStringChecker and its associated tests. Also check for null arguments...which are allowed if the access length is 0!
...
llvm-svn: 107759
2010-07-07 07:48:06 +00:00
John McCall
b609d3f5f9
Teach function-try-blocks on constructors and destructors to implicitly
...
rethrow. Fixes rdar://problem/7696603
llvm-svn: 107757
2010-07-07 06:56:46 +00:00
Chris Lattner
3956106543
implement PR7569, warning about assignment to null, which
...
people seem to write when they want a deterministic trap.
Suggest instead that they use a volatile pointer or
__builtin_trap.
llvm-svn: 107756
2010-07-07 06:14:23 +00:00
John McCall
11086fcb65
Don't consider casted non-global pointers to be evaluatable.
...
Fixes rdar://problem/8154689
llvm-svn: 107755
2010-07-07 05:08:32 +00:00
Tom Care
ca1f871ff8
Change explicit handling of impossible condition to call llvm_unreachable in IdempotentOperationChecker::PreVisitBinaryOperator.
...
llvm-svn: 107748
2010-07-07 01:27:17 +00:00
Chandler Carruth
509a9ce9da
Silence an annoying GCC warning about use of an uninitialized variable. Even
...
making the other switch case unreachable, or sinking the 'continue' into it
doesn't silence this.
llvm-svn: 107745
2010-07-07 00:36:56 +00:00
Chandler Carruth
dce439d11d
Use 'llvm_unreachable' to mark impossible code paths so that GCC doesn't
...
consider them for warnings.
llvm-svn: 107741
2010-07-07 00:07:37 +00:00
John McCall
09ae03299a
Provide a hook for the benefit of clients using clang IR gen as a subroutine:
...
emit metadata associating allocas and global values with a Decl*. This feature
is controlled by an option that (intentionally) cannot be enabled on the command
line.
To use this feature, simply set
CodeGenOptions.EmitDeclMetadata = true;
and then interpret the completely underspecified metadata. :)
llvm-svn: 107739
2010-07-06 23:57:41 +00:00
Ted Kremenek
da534381f8
Fix casts in RegionStore to not always assume that bindings are only to SubRegions. Fixes assertion failure
...
reported in PR 7572.
llvm-svn: 107738
2010-07-06 23:53:29 +00:00
Ted Kremenek
0fc6354f2f
Implement dumpToStream() for NonStaticGlobalSpaceRegion and StaticGlobalSpaceRegion.
...
llvm-svn: 107731
2010-07-06 23:37:21 +00:00
Jordy Rose
cf781e5430
Add comment noting VLASizeChecker's duty in defining a VLA's extent.
...
llvm-svn: 107728
2010-07-06 23:33:54 +00:00
Jordy Rose
134a236a14
Add a new path-sensitive checker for functions in <string.h>, for both null-terminated strings and memory blocks. Currently only checks memcpy(), memmove(), and bcopy(), but this is intended to be expanded soon.
...
llvm-svn: 107722
2010-07-06 23:11:01 +00:00
Ted Kremenek
128bfb7643
Sort CMake file.
...
llvm-svn: 107709
2010-07-06 22:03:19 +00:00
Tom Care
3ff08a8e76
Added a path-sensitive idempotent operation checker (-analyzer-idempotent-operation). Finds idempotent and/or tautological operations in a path sensitive context, flagging operations that have no effect or a predictable effect.
...
Example:
{
int a = 1;
int b = 5;
int c = b / a; // a is 1 on all paths
}
- New IdempotentOperationChecker class
- Moved recursive Stmt functions in r107675 to IdempotentOperationChecker
- Minor refactoring of SVal to allow checking for any integer
- Added command line option for check
- Added basic test cases
llvm-svn: 107706
2010-07-06 21:43:29 +00:00
Nick Lewycky
c96c37f6fd
Fix multiple emission of the this-> fixit for each instantiation by fixing the
...
AST during the instantiation. Fixes PR7417!
llvm-svn: 107690
2010-07-06 19:51:49 +00:00
John McCall
189223e222
Make CGBuilderTy a typedef again; its functionality has been rolled back
...
into IRBuilder.
llvm-svn: 107687
2010-07-06 18:43:48 +00:00
Douglas Gregor
ec9c6ae1cb
Improve the accuracy of getSourceRange() for DeclaratorDecl and
...
TagDecl subclasses when out-of-line template declaration information
is available, from Peter Collingbourne!
llvm-svn: 107686
2010-07-06 18:42:40 +00:00
Douglas Gregor
d890b734f8
Correctly set the location of the "template" keyword for a class
...
template specialization, from Peter Collingbourne.
llvm-svn: 107682
2010-07-06 18:33:12 +00:00
Douglas Gregor
6191f6c607
Remove my egregious hack that forced deserialization of visible
...
declarations when implicitly declaring the default constructor, copy
constructor, destructor, and copy-assignment operators of a
class. Argiris fixed the underlying problem in r107596.
llvm-svn: 107681
2010-07-06 18:29:01 +00:00
Duncan Sands
1614396b15
Pacify versions of gcc that think these variables may be used
...
uninitialized (which doesn't seem to be the case), by giving
them arbitrary initial values.
llvm-svn: 107679
2010-07-06 18:19:40 +00:00
John McCall
2d605ac1f5
When destroying a cleanup, kill any references to instructions in the entry
...
block before deleting it. Fixes PR7575.
This really just a short-term fix before implementing lazy cleanups.
llvm-svn: 107676
2010-07-06 17:35:03 +00:00
Tom Care
4626285dba
Added several helper functions to Stmt to recursively check for different elements (macros, enum constants, etc).
...
llvm-svn: 107675
2010-07-06 17:28:49 +00:00
Argyrios Kyrtzidis
39fdf81b43
Read/write function template specializations for PCH, properly this time.
...
llvm-svn: 107665
2010-07-06 15:37:09 +00:00
Argyrios Kyrtzidis
af2eac2869
Add to PCH missing Sema information about VTable uses and dynamic classes.
...
llvm-svn: 107664
2010-07-06 15:37:04 +00:00
Argyrios Kyrtzidis
181431cd91
Allow a CXXRecordDecl to get a DefinitionData pointer even when its owner is still initializing.
...
llvm-svn: 107663
2010-07-06 15:36:58 +00:00
Argyrios Kyrtzidis
282b36b7f6
Read/write instantiated-from-member of EnumDecl for PCH.
...
llvm-svn: 107662
2010-07-06 15:36:48 +00:00
Zhongxing Xu
5b488b1e6c
Add an assertion.
...
llvm-svn: 107645
2010-07-06 07:08:47 +00:00
Zhongxing Xu
b525bce698
Collect function definitions in the Indexer when indexing through the ASTs.
...
Add an API to get an Entity associated with a name in the global namespace.
llvm-svn: 107642
2010-07-06 05:55:13 +00:00
John McCall
466e221037
When creating functions to run global initializers and destructors, mark them
...
as nounwind in -fno-exceptions. Fixes rdar://problem/8090834.
llvm-svn: 107639
2010-07-06 04:38:10 +00:00
Jordy Rose
c7c8c3d66b
Remove the now-unused GRState::isEqual method. Instead of asking if an expression equals a certain value, use SValuator::EvalEQ and GRState::Assume to see if it can, must, or must not equal that value.
...
llvm-svn: 107638
2010-07-06 04:12:24 +00:00
Jordy Rose
40c5c24c06
Improve NULL-checking for CFRetain/CFRelease. We now remember that the argument was non-NULL, and we report where the null assumption came from (like AttrNonNullChecker already did).
...
llvm-svn: 107633
2010-07-06 02:34:42 +00:00
John McCall
bd30929e4d
Validated by nightly-test runs on x86 and x86-64 darwin, including after
...
self-host. Hopefully these results hold up on different platforms.
I tried to keep the GNU ObjC runtime happy, but it's hard for me to test.
Reimplement how clang generates IR for exceptions. Instead of creating new
invoke destinations which sequentially chain to the previous destination,
push a more semantic representation of *why* we need the cleanup/catch/filter
behavior, then collect that information into a single landing pad upon request.
Also reorganizes how normal cleanups (i.e. cleanups triggered by non-exceptional
control flow) are generated, since it's actually fairly closely tied in with
the former. Remove the need to track which cleanup scope a block is associated
with.
Document a lot of previously poorly-understood (by me, at least) behavior.
The new framework implements the Horrible Hack (tm), which requires every
landing pad to have a catch-all so that inlining will work. Clang no longer
requires the Horrible Hack just to make exceptions flow correctly within
a function, however. The HH is an unfortunate requirement of LLVM's EH IR.
llvm-svn: 107631
2010-07-06 01:34:17 +00:00
Zhongxing Xu
f894cfb44f
Local variables have no linkage, make invalid Entities.
...
llvm-svn: 107630
2010-07-06 01:20:49 +00:00
Chris Lattner
ceddafb846
Generate fewer first class aggregate values for other
...
coerce cases (e.g. {double,int}) which avoids fastisel
bailing out at -O0.
llvm-svn: 107628
2010-07-05 20:41:41 +00:00
Chris Lattner
c401de9998
in the "coerce" case, the ABI handling code ends up making the
...
alloca for an argument. Make sure the argument gets the proper
decl alignment, which may be different than the type alignment.
This fixes PR7567
llvm-svn: 107627
2010-07-05 20:21:00 +00:00
Chris Lattner
93b2836267
fix a bug I introduced in r107624
...
llvm-svn: 107626
2010-07-05 19:36:34 +00:00
Chris Lattner
9156f1bdd3
rearrange some logic, no functionality change.
...
llvm-svn: 107624
2010-07-05 19:17:26 +00:00
Chris Lattner
53b479ff6a
fix PR7564 a cast where the bitfield struct init code
...
wasn't handling array padding elements right.
llvm-svn: 107621
2010-07-05 18:03:30 +00:00
Chris Lattner
9a3459f1a6
AppendBitField really can never fail, so return its return value.
...
Everyone knows that no bugs are ever possible with bitfields.
llvm-svn: 107620
2010-07-05 17:04:23 +00:00
Argyrios Kyrtzidis
a95d019150
Read/write the identifier namespace in PCH for decls that may modify it.
...
We can now use a PCH'ed <map>.
llvm-svn: 107617
2010-07-05 10:38:01 +00:00
Argyrios Kyrtzidis
927d8e06c1
Read/write some source location for PCH.
...
llvm-svn: 107616
2010-07-05 10:37:55 +00:00
Jordy Rose
0704a7fe43
Support sizeof for VLA expressions (sizeof(someVLA)). sizeof(int[n]) still unimplemented. A VLA region's sizeof value matches its extent.
...
llvm-svn: 107611
2010-07-05 04:42:43 +00:00
Zhongxing Xu
1bbbc2e509
Refrase comments.
...
llvm-svn: 107607
2010-07-05 02:36:16 +00:00
Zhongxing Xu
74458782cc
Although in C++ class name has external linkage, usually the definition of the
...
class is available in the same translation unit when it's needed. So we make
all of them invalid Entity.
llvm-svn: 107606
2010-07-05 02:35:40 +00:00
Zhongxing Xu
57012ee70d
Make FieldDecl an invalid Entity since it has no linkage.
...
llvm-svn: 107605
2010-07-05 02:31:16 +00:00
Zhongxing Xu
5776d439ca
Indexer: make FieldDecl an internal Entity.
...
llvm-svn: 107604
2010-07-05 01:44:14 +00:00
Jordy Rose
e6b999bf9a
Track extents for VLAs.
...
llvm-svn: 107603
2010-07-05 00:50:15 +00:00
Argyrios Kyrtzidis
b5fcdc21c2
Fix a regression of a previous commit of mine (rdar://8158953).
...
Some of the invariant checks for creating Record/Enum types don't hold true during PCH reading.
Introduce more suitable ASTContext::getRecordType() and getEnumType().
llvm-svn: 107598
2010-07-04 21:44:47 +00:00
Argyrios Kyrtzidis
6685e8a747
Read/write more information of ASTContext for PCH. Overriden methods and instantiated-from information.
...
llvm-svn: 107597
2010-07-04 21:44:35 +00:00
Argyrios Kyrtzidis
e51e554a82
When adding a visible decl, deserialize the visible decls and add it.
...
Before this commit, visible decls added before deserialization were ignored.
This was not an issue since name lookup (that usually comes before the addition) forces deserialization
but it is an issue for lazily declared class implicit members.
We can use a PCH'ed <string> now.
llvm-svn: 107596
2010-07-04 21:44:25 +00:00
Argyrios Kyrtzidis
e862cbc5f6
Don't try to install the __[u]int128_t identifier if it is already installed by PCHReader.
...
Currently, adding it to visible decls of a PCH'ed translation unit has no effect because
adding visible decls before deserialization has no effect (the decls won't be visible).
This will be fixed in a future commit; then it will force deserialization of visible decls, so avoid pointlessly installing it.
llvm-svn: 107595
2010-07-04 21:44:19 +00:00
Argyrios Kyrtzidis
ccde6a02c8
Write/read ParmVarDecl's UninstantiatedDefaultArg for PCH.
...
llvm-svn: 107594
2010-07-04 21:44:07 +00:00
Argyrios Kyrtzidis
cdb8b3f7ec
Read/write specialization info of static data members for PCH.
...
llvm-svn: 107593
2010-07-04 21:44:00 +00:00
Jordy Rose
674bd55f02
Add a new symbol type, SymbolExtent, to represent the extents of memory regions that may not be known at compile-time (such as those created by malloc). This replaces the old setExtent/getExtent API on Store, which used the GRState's GDM to store SVals.
...
Also adds a getKnownValue() method to SValuator, which gets the integer value of an SVal if it is known to only have one possible value. There are more places in the code that could be using this, but in general we want to be dealing entirely in SVals, so its usefulness is limited.
The only visible functionality change is that extents are now honored for any DeclRegion, such as fields and Objective-C ivars, rather than just variables. This shows up in bounds-checking and cast-size-checking.
llvm-svn: 107577
2010-07-04 00:00:41 +00:00
John McCall
1e5d75d73f
Mark the operator delete associated with a virtual destructor as referenced.
...
llvm-svn: 107573
2010-07-03 18:33:00 +00:00
Charles Davis
3babfba597
Mangle Objective-C pointers and block pointers in the Microsoft C++ Mangler.
...
ObjC pointers were easy enough (as far as the ABI is concerned, they're
just pointers to structs), but I had to invent a new mangling for block
pointers. This is particularly worrying with the Microsoft ABI, because
it is a vendor-specific ABI; extending it could come back to bite us
later when MS extends it on their own (and you know they will).
llvm-svn: 107572
2010-07-03 16:56:59 +00:00
John McCall
1180f8e90f
Provide convenience routines to save and restore the current insertion
...
point.
llvm-svn: 107570
2010-07-03 09:25:20 +00:00
Charles Davis
3b10dd1bec
Fix mangling of array dimensions in the Microsoft C++ Mangler.
...
llvm-svn: 107568
2010-07-03 08:15:16 +00:00
Charles Davis
d49950a317
Mangle member pointer types in the Microsoft C++ Mangler.
...
llvm-svn: 107567
2010-07-03 08:01:32 +00:00
Argyrios Kyrtzidis
dae2a1607e
When setting the anonymous namespace at PCH reading, it may still be initializing so avoid
...
the invariant checks at NamespaceDecl::setAnonymousNamespace().
llvm-svn: 107566
2010-07-03 07:57:53 +00:00
Charles Davis
0029a2a957
Fix mangling of function pointers in the Microsoft C++ Mangler.
...
llvm-svn: 107564
2010-07-03 05:53:41 +00:00
Charles Davis
77552766d9
Fix mangling of array parameters for functions in the Microsoft C++ Mangler.
...
Only actual functions get mangled correctly; I don't know how to fix it for
function pointers yet. Thanks to John McCall for the hint.
Also, mangle anonymous tag types. I don't have a suitable testcase yet; I have
a feeling that that's going to need support for static locals, and I haven't
figured out exactly how MSVC's scheme for mangling those works.
llvm-svn: 107561
2010-07-03 02:41:45 +00:00
Douglas Gregor
9672f92f7f
Lazily declare default constructors. We now delay the construction of
...
declarations for implicit default constructors, copy constructors,
copy assignment operators, and destructors. On a "simple" translation
unit that includes a bunch of C++ standard library headers, we
generate relatively few of these implicit declarations now:
4/159 implicit default constructors created
18/236 implicit copy constructors created
70/241 implicit copy assignment operators created
0/173 implicit destructors created
And, on this translation unit, this optimization doesn't really
provide any benefit. I'll do some more performance measurements soon,
but this completes the implementation work for <rdar://problem/8151045>.
llvm-svn: 107551
2010-07-03 00:47:00 +00:00
Douglas Gregor
a6d695057c
Lazily declare implicit copy constructors.
...
llvm-svn: 107543
2010-07-02 23:41:54 +00:00
Argyrios Kyrtzidis
3701fcd759
Read/write CastExpr's CXXBaseSpecifierArray for PCH.
...
llvm-svn: 107542
2010-07-02 23:30:27 +00:00
Argyrios Kyrtzidis
4259ebcdac
Fix broken PCH support for CXXDefaultArgExpr.
...
llvm-svn: 107541
2010-07-02 23:30:15 +00:00
Douglas Gregor
52b7282081
Introduce a new routine, LookupConstructors(), and use it for all
...
constructor-name lookup.
llvm-svn: 107536
2010-07-02 23:12:18 +00:00
Douglas Gregor
330b9cff74
Lazily declare copy-assignment operators.
...
llvm-svn: 107521
2010-07-02 21:50:04 +00:00
Douglas Gregor
7454c563f1
Lazily declare the implicitly-declared destructor in a C++ class.
...
llvm-svn: 107510
2010-07-02 20:37:36 +00:00
Douglas Gregor
0be31a2eb7
Move the "current scope" state from the Parser into Action. This
...
allows Sema some limited access to the current scope, which we only
use in one way: when Sema is performing some kind of declaration that
is not directly driven by the parser (e.g., due to template
instantiatio or lazy declaration of a member), we can find the Scope
associated with a DeclContext, if that DeclContext is still in the
process of being parsed.
Use this to make the implicit declaration of special member functions
in a C++ class more "scope-less", rather than using the NULL Scope hack.
llvm-svn: 107491
2010-07-02 17:43:08 +00:00
Argyrios Kyrtzidis
335751610e
Handle CXXConstructorDecl, CXXDestructorDecl, and CXXConversionDecl for PCH.
...
<vector> header can be used correctly through PCH now.
llvm-svn: 107483
2010-07-02 15:58:43 +00:00
Argyrios Kyrtzidis
a45855fc2a
Disable Decl::CheckAccessDeclContext() temporarily.
...
llvm-svn: 107478
2010-07-02 11:55:44 +00:00
Argyrios Kyrtzidis
373a83abdc
Fix reading FunctionDecls from PCH.
...
llvm-svn: 107477
2010-07-02 11:55:40 +00:00
Argyrios Kyrtzidis
e23371e71d
Fix reading ClassTemplateDecl's ClassTemplateSpecializationDecls and ClassTemplatePartialSpecializationDecls.
...
Store/read also their template arguments because they may be initializing and not be able to provide them.
llvm-svn: 107476
2010-07-02 11:55:37 +00:00
Argyrios Kyrtzidis
2c2167ac3d
Fully read/write CXXRecordDecl for PCH.
...
llvm-svn: 107475
2010-07-02 11:55:32 +00:00
Argyrios Kyrtzidis
e929095f4a
Fix reading of DependentNameType.
...
llvm-svn: 107474
2010-07-02 11:55:24 +00:00
Argyrios Kyrtzidis
dab33c5d33
Allow reading of InjectedClassNameType from PCH even when its decl is currently initializing.
...
llvm-svn: 107473
2010-07-02 11:55:20 +00:00
Argyrios Kyrtzidis
ee776bcb7a
Fix broken reading of member pointer from PCH.
...
llvm-svn: 107472
2010-07-02 11:55:15 +00:00
Argyrios Kyrtzidis
45a83f9acc
- Allow a typedef type to be read from PCH even if its decl is currently initializing.
...
- Fix creation of TemplateSpecializationType.
llvm-svn: 107471
2010-07-02 11:55:11 +00:00
Argyrios Kyrtzidis
e3029a7e7b
Fix broken reading of "#lines" from PCH.
...
llvm-svn: 107470
2010-07-02 11:55:05 +00:00
Argyrios Kyrtzidis
318b0e78c6
Generally types expect an initialized TypeDecl; its safer and less complicated to delay PCH reading the type of a TypeDecl.
...
llvm-svn: 107469
2010-07-02 11:55:01 +00:00
Argyrios Kyrtzidis
39f0e308c4
Add some side-effect free Create methods for TypeDecl subclasses and use them for PCH reading.
...
llvm-svn: 107468
2010-07-02 11:54:55 +00:00
Zhongxing Xu
a74c22daec
Change CallGraph::Prog to be a reference. idx::Program means to be a global object to the Index library.
...
llvm-svn: 107461
2010-07-02 06:39:46 +00:00
Douglas Gregor
e71eddac59
Add a new routine Sema::LookupDestructor and make all destructor-lookup calls use that routine
...
llvm-svn: 107444
2010-07-01 22:47:18 +00:00
Douglas Gregor
6d880b1a83
Provide exception specifications for implicitly-declared default constructors.
...
llvm-svn: 107437
2010-07-01 22:31:05 +00:00
Douglas Gregor
4e8b5fb1eb
Move the implicit declaration of a default constructor into a separate
...
routine; no functionality change.
llvm-svn: 107434
2010-07-01 22:02:46 +00:00
Douglas Gregor
8453ddb5fe
Provide exception specifications for implicitly-declared copy constructors.
...
llvm-svn: 107429
2010-07-01 20:59:04 +00:00
Ted Kremenek
bd862711fd
Fix PR 7475 by enhancing the static analyzer to also invalidate bindings for non-static global variables
...
when calling a function/method whose impact on global variables we cannot accurately estimate.
This change introduces two new MemSpaceRegions that divide up the memory space of globals, and causes
RegionStore and BasicStore to consult a binding to the NonStaticGlobalsMemSpaceRegion when lazily
determining the value of a global.
llvm-svn: 107423
2010-07-01 20:16:50 +00:00
Jordy Rose
f7488ec6dc
Add an ivar to SymbolReaper for the current statement, and then stop passing the current statement around everywhere. Preparation for symbolic extents.
...
llvm-svn: 107422
2010-07-01 20:09:55 +00:00
Douglas Gregor
f120304cc4
Move the implicit declaration of a constructor out to a separate
...
method. No functionality change.
llvm-svn: 107415
2010-07-01 19:09:28 +00:00
Douglas Gregor
cfe682274c
Teach DeclareImplicitCopyConstructor how to cope with virtual bases
...
and multi-dimensional array fields. Fixes several bugs found by
inspection.
llvm-svn: 107411
2010-07-01 18:27:03 +00:00
Douglas Gregor
54be33925a
Move declaration of a class's implicit copy constructor into a
...
separate function. Aside from making the loops infinitely faster, no
functionality change.
llvm-svn: 107407
2010-07-01 17:57:27 +00:00
Douglas Gregor
68e1136585
Provide an exception-specification for an implicitly-declared
...
copy-assignment operator.
llvm-svn: 107406
2010-07-01 17:48:08 +00:00
Douglas Gregor
f56ab7b6be
Move the implicit declaration of a class's copy-assignment operator
...
into a separate routine. No functionality change.
llvm-svn: 107402
2010-07-01 16:36:15 +00:00
Douglas Gregor
3311ed4f0e
Make loops infinitely faster. No functionality change.
...
llvm-svn: 107398
2010-07-01 15:29:53 +00:00
Douglas Gregor
bac7490ffc
Remove unnecessary ASTContext parameter from
...
CXXRecordDecl::getDestructor(); no functionality change.
llvm-svn: 107394
2010-07-01 14:13:13 +00:00
Zhongxing Xu
bf81ed1fcf
ExplodedGraph never uses ASTContext, remove it.
...
llvm-svn: 107388
2010-07-01 07:10:59 +00:00
Chris Lattner
0e7929f30c
fix rdar://8147692 - yet another crash due to my abi work.
...
llvm-svn: 107387
2010-07-01 06:20:47 +00:00
Douglas Gregor
957551609c
Reinstate fix for PR7526, which was failing because, now that we
...
aren't dropping all exception specifications on destructors, the
exception specifications on implicitly-declared destructors were
detected as being wrong (which they were).
Introduce logic to provide a proper exception-specification for
implicitly-declared destructors. This also fixes PR6972.
Note that the other implicitly-declared special member functions also
need to get exception-specifications. I'll deal with that in a
subsequent commit.
llvm-svn: 107385
2010-07-01 05:10:53 +00:00
Douglas Gregor
7c42659cee
When performing copy initialization via user-defined conversions,
...
don't allow two user-defined conversions. Fixes PR6595 (again).
llvm-svn: 107379
2010-07-01 03:43:00 +00:00
Douglas Gregor
3671ad4571
Revert r107374, which broke bootstrap.
...
llvm-svn: 107378
2010-07-01 03:28:42 +00:00
Douglas Gregor
c6e4c68371
When building the type of a destructor, make sure to keep the
...
exception specification. Fixes PR7526.
llvm-svn: 107374
2010-07-01 02:33:15 +00:00
Douglas Gregor
fb0c0d37b7
Extend the "cannot convert from base class pointer to derived class
...
pointer" diagnostic to handle references, too.
llvm-svn: 107372
2010-07-01 02:14:45 +00:00
Daniel Dunbar
bb7ac52e02
Driver/IRgen: Add support for -momit-leaf-frame-pointer.
...
llvm-svn: 107367
2010-07-01 01:31:45 +00:00
Douglas Gregor
5a5fcd83c5
Be a bit more careful with undefined CXXRecordDecls. Fixes
...
rdar://problem/8124080 and PR7118.
llvm-svn: 107358
2010-07-01 00:21:21 +00:00
Daniel Dunbar
3de064dfdf
Revert "IRgen: Make sure any prolog instructions get debug info.", the lexical
...
scope hasn't been set up yet so this isn't valid. It was just a cleanup to the
IR, so I'm going to ignore it for now.
llvm-svn: 107356
2010-07-01 00:16:31 +00:00
Douglas Gregor
dc13ded606
Implement C++ DR481, which clarifies that the scope of template
...
parameters starts at the end of the template-parameter rather than at
the point where the template parameter name is encounted. For example,
given:
typedef unsigned char T;
template<typename T = T> struct X0 { };
The "T" in the default argument refers to the typedef of "unsigned
char", rather than referring to the newly-introduced template type
parameter 'T'.
Addresses <rdar://problem/8122812>.
llvm-svn: 107354
2010-07-01 00:00:45 +00:00
Daniel Dunbar
9dcde4bdec
Driver/Darwin: Add one -L for the DarwinClang toolchain to point into the gcc
...
library directory, as we still rely on a few libraries that are hiding there (in
particular libstdc++.dylib).
llvm-svn: 107353
2010-06-30 23:56:13 +00:00
Douglas Gregor
56f2e34a6a
Improve diagnostic when we fail to pick an overload because it would
...
require a base-to-derived pointer conversion.
llvm-svn: 107349
2010-06-30 23:01:39 +00:00
John Thompson
781ad17ba9
Fix vector literal/cast confusion - bug 6895.
...
llvm-svn: 107347
2010-06-30 22:55:51 +00:00
Daniel Dunbar
8d65fc86c4
Move lib/Runtime to runtime/, and build after everything else.
...
llvm-svn: 107327
2010-06-30 22:10:38 +00:00
Daniel Dunbar
6696e22cc9
IRgen: Fix debug info regression in r106970; when we eliminate the return value
...
store make sure to move the debug metadata from the store (which is actual
'return' statement location) to the return instruction (which otherwise would
have the function end location as its debug info).
- Tested by gdb test suite.
llvm-svn: 107322
2010-06-30 21:27:58 +00:00
Daniel Dunbar
d7ac9a375a
IRgen: Make sure any prolog instructions get debug info.
...
llvm-svn: 107320
2010-06-30 21:27:56 +00:00
Daniel Dunbar
8ab6c54ce2
Rewriter: Use the appropriate printing context instead of the default
...
constructed one -- this is necessary to ensure types get printed correctly.
llvm-svn: 107312
2010-06-30 19:16:53 +00:00
Daniel Dunbar
219fa69f91
AST: Propogate printing policy to types in a bunch more places.
...
llvm-svn: 107311
2010-06-30 19:16:48 +00:00
Chris Lattner
5c740f1523
Reapply:
...
r107173, "fix PR7519: after thrashing around and remembering how all this stuff"
r107216, "fix PR7523, which was caused by the ABI code calling ConvertType instead"
This includes a fix to make ConvertTypeForMem handle the "recursive" case, and call
it as such when lowering function types which have an indirect result.
llvm-svn: 107310
2010-06-30 19:14:05 +00:00
Fariborz Jahanian
02995320e9
Use isFunctionOrMethod for vars declared locallly
...
in method/blocks to decide not to mangle them.
llvm-svn: 107309
2010-06-30 18:57:21 +00:00
Eric Christopher
aba9fb217e
Add a return to silence a warning. Alternately a default: return false
...
would work.
Sebastian: figure out which one you want :)
llvm-svn: 107305
2010-06-30 18:36:32 +00:00
Fariborz Jahanian
0f19afb9d4
extern variable declared locally to objective-c++ method
...
should not be mangled either. Fixes radar 8016412.
llvm-svn: 107303
2010-06-30 18:27:47 +00:00
Sebastian Redl
d92badfd9c
Make both old and new versions of reference binding use the new classification functions, and updated them for N3092.
...
llvm-svn: 107301
2010-06-30 18:13:39 +00:00
Douglas Gregor
2187266120
Complain about the application of a transparent_union attribute to a
...
union whose first field has integral vector type. Also, clean up this
diagnostic a bit. Thanks to Eli for spotting this change in semantics
last week.
llvm-svn: 107296
2010-06-30 17:24:13 +00:00
Chris Lattner
749b8ed5af
reduce nesting.
...
llvm-svn: 107292
2010-06-30 16:58:07 +00:00
Sebastian Redl
d559a545d4
Fix a comment typo.
...
llvm-svn: 107290
2010-06-30 16:41:54 +00:00
Fariborz Jahanian
e33c116bdf
Nasty rewriter bug which turns out to have an easy fix in
...
rewriting a c-style cast expression in statement printer.
Fixes radar 8143056.
llvm-svn: 107289
2010-06-30 16:31:08 +00:00
Argyrios Kyrtzidis
639ffb0c07
Fix rdar://8139785 "implement warning on dead expression in comma operator"
...
As a bonus, fix the warning for || and && operators; it was emitted even if one of the operands had side effects, e.g:
x || test_logical_foo1();
emitted a bogus "expression result unused" for 'x'.
llvm-svn: 107274
2010-06-30 10:53:14 +00:00
Argyrios Kyrtzidis
bd8ac8cf07
Fix PCH support for UnresolvedUsingTypenameDecl and UnresolvedUsingValueDecl.
...
llvm-svn: 107268
2010-06-30 08:49:30 +00:00
Argyrios Kyrtzidis
4a57bd0d62
Support DependentSizedArrayType for PCH.
...
llvm-svn: 107267
2010-06-30 08:49:25 +00:00
Argyrios Kyrtzidis
f9f47c8e54
Support ParenListExpr for PCH.
...
llvm-svn: 107266
2010-06-30 08:49:18 +00:00
Charles Davis
2a47730767
Mangle arrays in the Microsoft C++ Mangler. It's not quite finished (it
...
doesn't mangle array parameters right), but I think that should be fixed
in Sema (Doug, John, what do you think?).
Also, stub out the remaining mangleType() routines.
llvm-svn: 107264
2010-06-30 08:09:57 +00:00
Ted Kremenek
169e43c4cf
Correctly implement the CheckerVisit optimization introduced in r106884, but this time actually used the cached checker list when calling back to Checker visit methods. This reduces the analysis time for sqlite3.c by 8%.
...
llvm-svn: 107259
2010-06-30 07:28:52 +00:00
Daniel Dunbar
120a1e9d0f
Headers: Define __INT64_TYPE__ in terms of getInt64Type(), which isn't always
...
'long'. The practical upshot is so that the uint64_t we define in our stdint.h
ends up being compatible with that defined by gcc (at least on Darwin), which
otherwise could lead to type incompatibilities with other system headers.
llvm-svn: 107255
2010-06-30 06:30:56 +00:00
Daniel Dunbar
540e8b1dcd
Headers: Change [u]intmax_t to be defined in terms of __[U]INTMAX_TYPE__, instead of intN_t.
...
llvm-svn: 107254
2010-06-30 06:30:50 +00:00
Chandler Carruth
139e96216a
Reapply r107235, this time with both my typo fixed, and a logical bug fixed.
...
Previously we relied on the presence of a member which needs no initialization
to prevent us from creating an additional initialization of the outer anonymous
union field. We have already correctly marked that field as initialized by the
member of the union (repeatedly due to the original bug this patch fixes) so we
simply need to bail out.
llvm-svn: 107242
2010-06-30 02:59:29 +00:00
Chandler Carruth
0e783c2e86
Revert r107235, it had a silly typo in it, and fixing the typo breaks something
...
else. Get the build bots happy while I debug. Very sorry for the delay fixing
this...
llvm-svn: 107239
2010-06-30 02:06:16 +00:00
Jordy Rose
dc48471861
Pointers casted as integers still count as locations to SimpleSValuator, so don't crash if we do a funny thing like ((int)ptr)&1. Fixes PR7527.
...
llvm-svn: 107236
2010-06-30 01:35:20 +00:00
Chandler Carruth
abb04f730e
Fix PR7402: We were creating implicit member initializers for every field in an
...
anonymous union under the presumption that they didn't do anything. While this
is true, our checks for redundant initialization of an anonymous union still
fire when these overlap with explicit user initialization. A cleaner approach
is to avoid initializing multiple members of a union altogether, but this still
is in a rather fuzzy are especially when C++0x allows non-POD types into
unions.
llvm-svn: 107235
2010-06-30 00:54:29 +00:00
Daniel Dunbar
e422266926
Revert r107173, "fix PR7519: after thrashing around and remembering how all this stuff", it broke bootstrap.
...
llvm-svn: 107232
2010-06-30 00:22:35 +00:00
Daniel Dunbar
8386469d7d
Revert r107216, "fix PR7523, which was caused by the ABI code calling ConvertType instead", it is part of a boostrap breaking sequence.
...
llvm-svn: 107231
2010-06-30 00:22:30 +00:00
Douglas Gregor
4799d03ce8
Implement C++ DR299, which allows an implicit conversion from a class
...
type to an integral or enumeration type in the size of an array new
expression, e.g.,
new int[ConvertibleToInt(10)];
This is a GNU and C++0x extension.
llvm-svn: 107229
2010-06-30 00:20:43 +00:00
Chandler Carruth
9c9286b531
Retain the source location of the constructor when building an implicit member
...
initialization. I tried several ideas but couldn't come up with a test case for
this that didn't rely on a Clang bug to report a diagnostic after template
instantiation of the constructor due to the implicit initializers. Suggestions
welcome. This fixes the source location aspect of PR7402.
llvm-svn: 107226
2010-06-29 23:50:44 +00:00
Douglas Gregor
5823da3ab0
Re-improve recovery when the condition of a switch statement does not
...
have integral or enumeration type, so that we still check the contents
of the switch body. My previous patch made this worse; now we're back
to where we were previously.
llvm-svn: 107223
2010-06-29 23:25:20 +00:00
Douglas Gregor
f4ea725d38
Factor the conversion from a switch condition to an integral or
...
enumeration type out into a separate, reusable routine. The only
functionality change here is that we recover a little more
aggressively from ill-formed switch conditions.
llvm-svn: 107222
2010-06-29 23:17:37 +00:00
Argyrios Kyrtzidis
74d28bd084
Support C++ friend declarations for PCH.
...
This commit 'introduces' a slightly different way to restore the state of the AST object.
It makes PCHDeclReader/PCHDeclWriter friends and gives them access to the private members of the object.
The rationale is to avoid using/modifying the AST interfaces for PCH read/write so that to:
-Avoid complications with objects that have side-effects during creation or when using some setters.
-Not 'pollute' the AST interface with methods only used by the PCH reader/writer
-Allow AST objects to be read-only.
llvm-svn: 107219
2010-06-29 22:47:00 +00:00
Argyrios Kyrtzidis
26d7201d5d
When we know that we are at sub-statement reading (which is all of PCHStmtReader) use the "faster" ReadSubStmt. No functionality change.
...
llvm-svn: 107218
2010-06-29 22:46:25 +00:00
Daniel Dunbar
8c94ffe776
IRgen: Assignment to Objective-C properties shouldn't reload the value, for
...
complex values either. Previously we did this properly for regular assignment,
but not for compound assignment.
- Also, tidy up assignment code a bit to look more like the scalar path.
llvm-svn: 107217
2010-06-29 22:44:21 +00:00
Chris Lattner
466b1419c6
fix PR7523, which was caused by the ABI code calling ConvertType instead
...
of ConvertTypeRecursive when it needed to in a few cases, causing pointer
types to get resolved at the wrong time.
llvm-svn: 107216
2010-06-29 22:39:04 +00:00
Daniel Dunbar
c85ea8e175
IRgen: Assignment to Objective-C properties shouldn't reload the value (which
...
would trigger an extra method call).
- While in the area, I also changed Clang to not emit an unnecessary load from
'x' in cases like 'y = (x = 1)'.
llvm-svn: 107210
2010-06-29 22:00:45 +00:00
Ted Kremenek
090d62e7cc
Tweaker Checker::VisitEndAnalysis to have 'hasWorkRemaining' also
...
be true if some paths were aborted because they exceeded
the maximum loop unrolling count.
llvm-svn: 107209
2010-06-29 21:58:54 +00:00
Douglas Gregor
c048c52734
When typo correction produces a result that is not of the kind we're
...
looking for, reset the name within the LookupResult structure in
addition to clearing out the results. Fixes PR7508.
llvm-svn: 107197
2010-06-29 19:27:42 +00:00
Chris Lattner
cccaad9584
change ABIArgInfo to hold its llvm type with PATypeHolder so that
...
it doesn't dangle as types get refined. This fixes Shootout-C++/lists1
and probably also PR7522.
llvm-svn: 107196
2010-06-29 19:21:36 +00:00
Douglas Gregor
9629e9ac3e
Typo correction for namespace alias definitions
...
llvm-svn: 107191
2010-06-29 18:55:19 +00:00
Daniel Dunbar
f35e76552f
Sema: Fix a subtle i64 -> i32 truncation which broke layout of large structures
...
with bit-fields.
llvm-svn: 107185
2010-06-29 18:34:35 +00:00
Chris Lattner
34d6281ae5
relax the CGFunctionInfo::CGFunctionInfo ctor to allow any sequence
...
of CanQualTypes to be passed in.
llvm-svn: 107176
2010-06-29 18:13:52 +00:00
Fariborz Jahanian
66f9a6560e
This patch fixes a bug whereby, clang skipped
...
unimplemented property warning for properties
coming from class's conformin protocol. It also
simplifies the algorithm in the process.
Fixes radar 8035776.
llvm-svn: 107174
2010-06-29 18:12:32 +00:00
Chris Lattner
ab1e65e2ea
fix PR7519: after thrashing around and remembering how all this stuff
...
works, the fix is quite simple: just make sure to call ConvertTypeRecursive
when the function type being lowered is in the midst of ConvertType.
llvm-svn: 107173
2010-06-29 17:56:33 +00:00
Douglas Gregor
cdf87024ed
Allow a using directive to refer to the implicitly-defined namespace
...
"std", with a warning, to improve GCC compatibility. Fixes PR7517.
As a drive-by, add typo correction for using directives.
llvm-svn: 107172
2010-06-29 17:53:46 +00:00
Douglas Gregor
56980d688b
With packed enums, an enumerator's value may be stored in more bits
...
than the enumeration type itself takes. Fixes PR7477.
llvm-svn: 107163
2010-06-29 17:12:35 +00:00
Chris Lattner
e70a007b36
minor cleanups.
...
llvm-svn: 107150
2010-06-29 16:40:28 +00:00
Daniel Dunbar
00d3d8e902
Driver/Darwin: Only run dsymutil when we are also compiling/assembling as part
...
of the compilation.
- <rdar://problem/8141387> clang is always invoking dsymutil
llvm-svn: 107149
2010-06-29 16:38:33 +00:00
Jeffrey Yasskin
bb219e01a6
Delete assert in ComputeKeyFunction. The function runs fine without it, since
...
there's an explicit guard on isPolymorphic, and virtual bases don't affect the
key function calculation. This allows people to call
ASTContext::getKeyFunction on arbitrary classes.
llvm-svn: 107143
2010-06-29 15:27:35 +00:00
Chris Lattner
22a931e3bb
Change X86_64ABIInfo to have ASTContext and TargetData ivars to
...
avoid passing ASTContext down through all the methods it has.
When classifying an argument, or argument piece, as INTEGER, check
to see if we have a pointer at exactly the same offset in the
preferred type. If so, use that pointer type instead of i64. This
allows us to compile A function taking a stringref into something
like this:
define i8* @foo(i64 %D.coerce0, i8* %D.coerce1) nounwind ssp {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=4]
%0 = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
store i64 %D.coerce0, i64* %0
%1 = getelementptr %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
store i8* %D.coerce1, i8** %1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
%tmp3 = load i8** %tmp2 ; <i8*> [#uses=1]
%add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
ret i8* %add.ptr
}
instead of this:
define i8* @foo(i64 %D.coerce0, i64 %D.coerce1) nounwind ssp {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
%0 = insertvalue %0 undef, i64 %D.coerce0, 0 ; <%0> [#uses=1]
%1 = insertvalue %0 %0, i64 %D.coerce1, 1 ; <%0> [#uses=1]
%2 = bitcast %struct.DeclGroup* %D to %0* ; <%0*> [#uses=1]
store %0 %1, %0* %2, align 1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
%tmp3 = load i8** %tmp2 ; <i8*> [#uses=1]
%add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
ret i8* %add.ptr
}
This implements rdar://7375902 - [codegen quality] clang x86-64 ABI lowering code punishing StringRef
llvm-svn: 107123
2010-06-29 06:01:59 +00:00
Chris Lattner
399d22ac1b
plumb preferred types down into X86_64ABIInfo::classifyArgumentType,
...
no functionality change.
llvm-svn: 107115
2010-06-29 01:14:09 +00:00
Chris Lattner
1d7c9f7f4b
Pass the LLVM IR version of argument types down into computeInfo.
...
This is somewhat annoying to do this at this level, but it avoids
having ABIInfo know depend on CodeGenTypes for a hint.
Nothing is using this yet, so no functionality change.
llvm-svn: 107111
2010-06-29 01:08:48 +00:00
Chandler Carruth
8337ba6303
Prefer llvm_unreachable(...) to assert(false && ...). This is important as
...
without it we might exit a non-void function without returning.
llvm-svn: 107106
2010-06-29 00:23:11 +00:00
Chris Lattner
9e748e9d6e
add IR names to coerced arguments.
...
llvm-svn: 107105
2010-06-29 00:14:52 +00:00
Chris Lattner
15ec361bd6
make the argument passing stuff in the FCA case smarter still, by
...
avoiding making the FCA at all when the types exactly line up. For
example, before we made:
%struct.DeclGroup = type { i64, i64 }
define i64 @_Z3foo9DeclGroup(i64, i64) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
%2 = insertvalue %struct.DeclGroup undef, i64 %0, 0 ; <%struct.DeclGroup> [#uses=1]
%3 = insertvalue %struct.DeclGroup %2, i64 %1, 1 ; <%struct.DeclGroup> [#uses=1]
store %struct.DeclGroup %3, %struct.DeclGroup* %D
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
%tmp3 = load i64* %tmp2 ; <i64> [#uses=1]
%add = add nsw i64 %tmp1, %tmp3 ; <i64> [#uses=1]
ret i64 %add
}
... which has the pointless insertvalue, which fastisel hates, now we
make:
%struct.DeclGroup = type { i64, i64 }
define i64 @_Z3foo9DeclGroup(i64, i64) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=4]
%2 = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
store i64 %0, i64* %2
%3 = getelementptr %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
store i64 %1, i64* %3
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
%tmp3 = load i64* %tmp2 ; <i64> [#uses=1]
%add = add nsw i64 %tmp1, %tmp3 ; <i64> [#uses=1]
ret i64 %add
}
This only kicks in when x86-64 abi lowering decides it likes us.
llvm-svn: 107104
2010-06-29 00:06:42 +00:00
Chris Lattner
3dd716c3c3
Change CGCall to handle the "coerce" case where the coerce-to type
...
is a FCA to pass each of the elements as individual scalars. This
produces code fast isel is less likely to reject and is easier on
the optimizers.
For example, before we would compile:
struct DeclGroup { long NumDecls; char * Y; };
char * foo(DeclGroup D) {
return D.NumDecls+D.Y;
}
to:
%struct.DeclGroup = type { i64, i64 }
define i64 @_Z3foo9DeclGroup(%struct.DeclGroup) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
store %struct.DeclGroup %0, %struct.DeclGroup* %D, align 1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
%tmp3 = load i64* %tmp2 ; <i64> [#uses=1]
%add = add nsw i64 %tmp1, %tmp3 ; <i64> [#uses=1]
ret i64 %add
}
Now we get:
%0 = type { i64, i64 }
%struct.DeclGroup = type { i64, i8* }
define i8* @_Z3foo9DeclGroup(i64, i64) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
%2 = insertvalue %0 undef, i64 %0, 0 ; <%0> [#uses=1]
%3 = insertvalue %0 %2, i64 %1, 1 ; <%0> [#uses=1]
%4 = bitcast %struct.DeclGroup* %D to %0* ; <%0*> [#uses=1]
store %0 %3, %0* %4, align 1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
%tmp3 = load i8** %tmp2 ; <i8*> [#uses=1]
%add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
ret i8* %add.ptr
}
Elimination of the FCA inside the function is still-to-come.
llvm-svn: 107099
2010-06-28 23:44:11 +00:00
Chris Lattner
d200eda487
make the trivial forms of CreateCoerced{Load|Store} trivial.
...
llvm-svn: 107091
2010-06-28 22:51:39 +00:00
Argyrios Kyrtzidis
d0795b2d78
Modify the way sub-statements are stored and retrieved from PCH.
...
Before this commit, sub-stmts were stored as encountered and when they were placed in the Stmts stack we had to know what index
each stmt operand has. This complicated supporting variable sub-stmts and sub-stmts that were contained in TypeSourceInfos, e.g.
x = sizeof(int[1]);
would crash PCH.
Now, sub-stmts are stored in reverse order, from last to first, so that when reading them, in order to get the next sub-stmt we just
need to pop the last stmt from the stack. This greatly simplified the way stmts are written and read (just use PCHWriter::AddStmt and
PCHReader::ReadStmt accordingly) and allowed variable stmt operands and TypeSourceInfo exprs.
llvm-svn: 107087
2010-06-28 22:28:35 +00:00
Chris Lattner
93af332819
pass/return structs of char and short as i8/i16 to avoid
...
aweful through-memory coersion, just like we do for i32 now.
llvm-svn: 107078
2010-06-28 21:59:07 +00:00
Chris Lattner
d776fb150e
more tidying up.
...
llvm-svn: 107076
2010-06-28 21:43:59 +00:00
Ted Kremenek
e60d304d13
Remove state assertion.
...
llvm-svn: 107064
2010-06-28 20:44:49 +00:00
Ted Kremenek
ea78375ed4
Don't crash in InitializePreprocessor() when there is no valid PTHManager. Fixes <rdar://problem/8098441>.
...
llvm-svn: 107061
2010-06-28 20:32:40 +00:00
Chris Lattner
0cf2419cd7
random acts of tidying.
...
llvm-svn: 107050
2010-06-28 20:05:43 +00:00
Chris Lattner
a7d81ab7f3
X86-64:
...
pass/return structs of float/int as float/i32 instead of double/i64
to make the code generated for ABI cleaner. Passing in the low part
of a double is the same as passing in a float.
For example, we now compile:
struct DeclGroup { float NumDecls; };
float foo(DeclGroup D);
void bar(DeclGroup *D) {
foo(*D);
}
into:
%struct.DeclGroup = type { float }
define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) nounwind {
entry:
%D.addr = alloca %struct.DeclGroup*, align 8 ; <%struct.DeclGroup**> [#uses=2]
%agg.tmp = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
%tmp = load %struct.DeclGroup** %D.addr ; <%struct.DeclGroup*> [#uses=1]
%tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
%tmp2 = bitcast %struct.DeclGroup* %tmp to i8* ; <i8*> [#uses=1]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
%coerce.dive = getelementptr %struct.DeclGroup* %agg.tmp, i32 0, i32 0 ; <float*> [#uses=1]
%0 = load float* %coerce.dive, align 1 ; <float> [#uses=1]
%call = call float @_Z3foo9DeclGroup(float %0) ; <float> [#uses=0]
ret void
}
instead of:
%struct.DeclGroup = type { float }
define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) nounwind {
entry:
%D.addr = alloca %struct.DeclGroup*, align 8 ; <%struct.DeclGroup**> [#uses=2]
%agg.tmp = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp3 = alloca double ; <double*> [#uses=2]
store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
%tmp = load %struct.DeclGroup** %D.addr ; <%struct.DeclGroup*> [#uses=1]
%tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
%tmp2 = bitcast %struct.DeclGroup* %tmp to i8* ; <i8*> [#uses=1]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
%coerce.dive = getelementptr %struct.DeclGroup* %agg.tmp, i32 0, i32 0 ; <float*> [#uses=1]
%0 = bitcast double* %tmp3 to float* ; <float*> [#uses=1]
%1 = load float* %coerce.dive ; <float> [#uses=1]
store float %1, float* %0, align 1
%2 = load double* %tmp3 ; <double> [#uses=1]
%call = call float @_Z3foo9DeclGroup(double %2) ; <float> [#uses=0]
ret void
}
which is this machine code (at -O0):
__Z3barP9DeclGroup:
subq $24, %rsp
movq %rdi, 16(%rsp)
movq 16(%rsp), %rdi
leaq 8(%rsp), %rax
movl (%rdi), %ecx
movl %ecx, (%rax)
movss 8(%rsp), %xmm0
callq __Z3foo9DeclGroup
addq $24, %rsp
ret
vs this:
__Z3barP9DeclGroup:
subq $24, %rsp
movq %rdi, 16(%rsp)
movq 16(%rsp), %rdi
leaq 8(%rsp), %rax
movl (%rdi), %ecx
movl %ecx, (%rax)
movss 8(%rsp), %xmm0
movss %xmm0, (%rsp)
movsd (%rsp), %xmm0
callq __Z3foo9DeclGroup
addq $24, %rsp
ret
At -O3, it is the difference between this now:
__Z3barP9DeclGroup:
movss (%rdi), %xmm0
jmp __Z3foo9DeclGroup # TAILCALL
vs this before:
__Z3barP9DeclGroup:
movl (%rdi), %eax
movd %rax, %xmm0
jmp __Z3foo9DeclGroup # TAILCALL
llvm-svn: 107048
2010-06-28 19:56:59 +00:00
Fariborz Jahanian
c42461e145
Minor refactorin of my last patch (radar 7860965 related).
...
llvm-svn: 107047
2010-06-28 19:42:10 +00:00
Fariborz Jahanian
36ad0e99d5
Have __func__ and siblings point to block's implementation function
...
name. Fixes radar 7860965.
llvm-svn: 107044
2010-06-28 18:58:34 +00:00
Rafael Espindola
0e1fb4f341
Set the default arch based on the triple.
...
llvm-svn: 107021
2010-06-28 17:18:09 +00:00
Chris Lattner
c1028f689e
Fix UnitTests/2004-02-02-NegativeZero.c, which regressed when
...
I broke negate of FP values.
llvm-svn: 107019
2010-06-28 17:12:37 +00:00
Dan Gohman
3bc1b0c882
llvm::errs() is non-buffered, so it doesn't need to be flushed.
...
llvm-svn: 107012
2010-06-28 15:56:07 +00:00
Sebastian Redl
f9463106b3
Introduce Expr::Classify and Expr::ClassifyModifiable, which determine the classification of an expression under the C++0x taxology (value category). Reimplement isLvalue and isModifiableLvalue using these functions. No regressions in the test suite from this, and my rough performance check doesn't show any regressions either.
...
llvm-svn: 107007
2010-06-28 15:09:07 +00:00
Argyrios Kyrtzidis
99a226dde4
Support CXXPseudoDestructorExpr for PCH.
...
llvm-svn: 106999
2010-06-28 09:32:03 +00:00
Argyrios Kyrtzidis
cd444d1af7
Support DependentScopeDeclRefExpr for PCH.
...
llvm-svn: 106998
2010-06-28 09:31:56 +00:00
Argyrios Kyrtzidis
b5288de67c
Refactor PCH reading/writing of template arguments passed to expressions.
...
llvm-svn: 106997
2010-06-28 09:31:48 +00:00
Argyrios Kyrtzidis
ddf5f211d0
Fix PCH emitting/reading for template arguments that contain expressions.
...
llvm-svn: 106996
2010-06-28 09:31:42 +00:00
Argyrios Kyrtzidis
0b0369a6b3
Fix various bugs in recent commits for C++ PCH.
...
llvm-svn: 106995
2010-06-28 09:31:34 +00:00
Chandler Carruth
2d69ec7a72
Partial fix for PR7267 based on comments by John McCall on an earlier patch.
...
This is more targeted, as it simply provides toggle actions for the parser to
turn access checking on and off. We then use these to suppress access checking
only while we parse the template-id (included scope specifier) of an explicit
instantiation and explicit specialization of a class template. The
specialization behavior is an extension, as it seems likely a defect that the
standard did not exempt them as it does explicit instantiations.
This allows the very common practice of specializing trait classes to work for
private, internal types. This doesn't address instantiating or specializing
function templates, although those apparently already partially work.
The naming and style for the Action layer isn't my favorite, comments and
suggestions would be appreciated there.
llvm-svn: 106993
2010-06-28 08:39:25 +00:00
Jordy Rose
61176897ba
Pointer comparisons (and pointer-pointer subtraction). Basically filling in SimpleSValuator::EvalBinOpLL().
...
llvm-svn: 106992
2010-06-28 08:26:15 +00:00
Chandler Carruth
b6f991787b
Suppress diagnosing access violations while looking up deallocation functions
...
much as we already do for allocation function lookup. Explicitly check access
for the function we actually select in one case that was previously missing,
but being caught behind the blanket diagnostics for all overload candidates.
This fixs PR7436.
llvm-svn: 106986
2010-06-28 00:30:51 +00:00
Rafael Espindola
b1ef8ffb15
Use softfp for linux gnueabi, keep the warning for everything else.
...
llvm-svn: 106984
2010-06-27 18:29:21 +00:00
Anders Carlsson
3f48c603fb
Correctly destroy reference temporaries with global storage. Remove ErrorUnsupported call when binding a global reference to a non-lvalue. Fixes PR7326.
...
llvm-svn: 106983
2010-06-27 17:52:15 +00:00
Anders Carlsson
18c205ecdf
Add a CreateReferenceTemporary that will do the right thing for variables with global storage.
...
llvm-svn: 106982
2010-06-27 17:23:46 +00:00
Anders Carlsson
2969c8c69d
Simplify CodeGenFunction::EmitReferenceBindingToExpr as a first step towards fixing PR7326.
...
llvm-svn: 106981
2010-06-27 16:56:04 +00:00
Anders Carlsson
ca68d357d4
Reduce indentation.
...
llvm-svn: 106980
2010-06-27 15:24:55 +00:00
Chris Lattner
818efb64a3
misc tidying
...
llvm-svn: 106978
2010-06-27 07:40:06 +00:00
Chris Lattner
5e016ae983
finally get around to doing a significant cleanup to irgen:
...
have CGF create and make accessible standard int32,int64 and
intptr types. This fixes a ton of 80 column violations
introduced by LLVMContextification and cleans up stuff a lot.
llvm-svn: 106977
2010-06-27 07:15:29 +00:00
Chris Lattner
e000907e13
tidy up OrderGlobalInits
...
llvm-svn: 106976
2010-06-27 06:32:58 +00:00
Chris Lattner
055097f024
If coercing something from int or pointer type to int or pointer type
...
(potentially after unwrapping it from a struct) do it without going through
memory. We now compile:
struct DeclGroup {
unsigned NumDecls;
};
int foo(DeclGroup D) {
return D.NumDecls;
}
into:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
%D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%coerce.val.ii = trunc i64 %0 to i32 ; <i32> [#uses=1]
store i32 %coerce.val.ii, i32* %coerce.dive
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp1 = load i32* %tmp ; <i32> [#uses=1]
ret i32 %tmp1
}
instead of:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
%D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp = alloca i64 ; <i64*> [#uses=2]
%coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
store i64 %0, i64* %tmp
%1 = bitcast i64* %tmp to i32* ; <i32*> [#uses=1]
%2 = load i32* %1, align 1 ; <i32> [#uses=1]
store i32 %2, i32* %coerce.dive
%tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp2 = load i32* %tmp1 ; <i32> [#uses=1]
ret i32 %tmp2
}
... which is quite a bit less terrifying.
llvm-svn: 106975
2010-06-27 06:26:04 +00:00
Chris Lattner
895c52ba8b
Same patch as the previous on the store side. Before we compiled this:
...
struct DeclGroup {
unsigned NumDecls;
};
int foo(DeclGroup D) {
return D.NumDecls;
}
to:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
%D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp = alloca i64 ; <i64*> [#uses=2]
store i64 %0, i64* %tmp
%1 = bitcast i64* %tmp to %struct.DeclGroup* ; <%struct.DeclGroup*> [#uses=1]
%2 = load %struct.DeclGroup* %1, align 1 ; <%struct.DeclGroup> [#uses=1]
store %struct.DeclGroup %2, %struct.DeclGroup* %D
%tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp2 = load i32* %tmp1 ; <i32> [#uses=1]
ret i32 %tmp2
}
which caused fast isel bailouts due to the FCA load/store of %2. Now
we generate this just blissful code:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
%D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp = alloca i64 ; <i64*> [#uses=2]
%coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
store i64 %0, i64* %tmp
%1 = bitcast i64* %tmp to i32* ; <i32*> [#uses=1]
%2 = load i32* %1, align 1 ; <i32> [#uses=1]
store i32 %2, i32* %coerce.dive
%tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp2 = load i32* %tmp1 ; <i32> [#uses=1]
ret i32 %tmp2
}
This avoids fastisel bailing out and is groundwork for future patch.
This reduces bailouts on CGStmt.ll to 911 from 935.
llvm-svn: 106974
2010-06-27 06:04:18 +00:00
Chris Lattner
1cd6698a7c
improve CreateCoercedLoad a bit to generate slightly less awful
...
IR when handling X86-64 by-value struct stuff. For example, we
use to compile this:
struct DeclGroup {
unsigned NumDecls;
};
int foo(DeclGroup D);
void bar(DeclGroup *D) {
foo(*D);
}
into:
define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) ssp nounwind {
entry:
%D.addr = alloca %struct.DeclGroup*, align 8 ; <%struct.DeclGroup**> [#uses=2]
%agg.tmp = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp3 = alloca i64 ; <i64*> [#uses=2]
store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
%tmp = load %struct.DeclGroup** %D.addr ; <%struct.DeclGroup*> [#uses=1]
%tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
%tmp2 = bitcast %struct.DeclGroup* %tmp to i8* ; <i8*> [#uses=1]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
%0 = bitcast i64* %tmp3 to %struct.DeclGroup* ; <%struct.DeclGroup*> [#uses=1]
%1 = load %struct.DeclGroup* %agg.tmp ; <%struct.DeclGroup> [#uses=1]
store %struct.DeclGroup %1, %struct.DeclGroup* %0, align 1
%2 = load i64* %tmp3 ; <i64> [#uses=1]
call void @_Z3foo9DeclGroup(i64 %2)
ret void
}
which would cause fastisel to bail out due to the first class aggregate load %1. With
this patch we now compile it into the (still awful):
define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) nounwind ssp noredzone {
entry:
%D.addr = alloca %struct.DeclGroup*, align 8 ; <%struct.DeclGroup**> [#uses=2]
%agg.tmp = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp3 = alloca i64 ; <i64*> [#uses=2]
store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
%tmp = load %struct.DeclGroup** %D.addr ; <%struct.DeclGroup*> [#uses=1]
%tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
%tmp2 = bitcast %struct.DeclGroup* %tmp to i8* ; <i8*> [#uses=1]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
%coerce.dive = getelementptr %struct.DeclGroup* %agg.tmp, i32 0, i32 0 ; <i32*> [#uses=1]
%0 = bitcast i64* %tmp3 to i32* ; <i32*> [#uses=1]
%1 = load i32* %coerce.dive ; <i32> [#uses=1]
store i32 %1, i32* %0, align 1
%2 = load i64* %tmp3 ; <i64> [#uses=1]
%call = call i32 @_Z3foo9DeclGroup(i64 %2) noredzone ; <i32> [#uses=0]
ret void
}
which doesn't bail out. On CGStmt.ll, this reduces fastisel bail outs from 958 to 935,
and is the precursor of better things to come.
llvm-svn: 106973
2010-06-27 05:56:15 +00:00
Jordy Rose
7f8ea4d677
Implicitly compare symbolic expressions to zero when they're being used as constraints. Part of PR7491.
...
llvm-svn: 106972
2010-06-27 01:20:56 +00:00
Chris Lattner
3fcc790cd8
Change IR generation for return (in the simple case) to avoid doing silly
...
load/store nonsense in the epilog. For example, for:
int foo(int X) {
int A[100];
return A[X];
}
we used to generate:
%arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i64 %idxprom ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]
store i32 %tmp1, i32* %retval
%0 = load i32* %retval ; <i32> [#uses=1]
ret i32 %0
}
which codegen'd to this code:
_foo: ## @foo
## BB#0: ## %entry
subq $408, %rsp ## imm = 0x198
movl %edi, 400(%rsp)
movl 400(%rsp), %edi
movslq %edi, %rax
movl (%rsp,%rax,4), %edi
movl %edi, 404(%rsp)
movl 404(%rsp), %eax
addq $408, %rsp ## imm = 0x198
ret
Now we generate:
%arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i64 %idxprom ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]
ret i32 %tmp1
}
and:
_foo: ## @foo
## BB#0: ## %entry
subq $408, %rsp ## imm = 0x198
movl %edi, 404(%rsp)
movl 404(%rsp), %edi
movslq %edi, %rax
movl (%rsp,%rax,4), %eax
addq $408, %rsp ## imm = 0x198
ret
This actually does matter, cutting out 2000 lines of IR from CGStmt.ll
for example.
Another interesting effect is that altivec.h functions which are dead
now get dce'd by the inliner. Hence all the changes to
builtins-ppc-altivec.c to ensure the calls aren't dead.
llvm-svn: 106970
2010-06-27 01:06:27 +00:00
Chris Lattner
726b3d09cd
reduce indentation
...
llvm-svn: 106967
2010-06-26 23:13:19 +00:00
Chris Lattner
6c5abe88bf
Implement rdar://7530813 - collapse multiple GEP instructions in IRgen
...
This avoids generating two gep's for common array operations. Before
we would generate something like:
%tmp = load i32* %X.addr ; <i32> [#uses=1]
%arraydecay = getelementptr inbounds [100 x i32]* %A, i32 0, i32 0 ; <i32*> [#uses=1]
%arrayidx = getelementptr inbounds i32* %arraydecay, i32 %tmp ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]
Now we generate:
%tmp = load i32* %X.addr ; <i32> [#uses=1]
%arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i32 %tmp ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]
Less IR is better at -O0.
llvm-svn: 106966
2010-06-26 23:03:20 +00:00
Ted Kremenek
f00eac5cff
Allow '__extension__' to be analyzed in a lvalue context.
...
llvm-svn: 106964
2010-06-26 22:40:52 +00:00
Chris Lattner
57ce97151f
minor cleanup: don't emit the base of an array subscript until after
...
we're done diddling around with the index stuff. Use a cheaper type
comparison.
llvm-svn: 106963
2010-06-26 22:40:46 +00:00
Chris Lattner
431bef4409
fix inc/dec to honor -fwrapv and -ftrapv, implementing PR7426.
...
llvm-svn: 106962
2010-06-26 22:18:28 +00:00
Chris Lattner
05dc78c096
move scalar inc/dec codegen into ScalarExprEmitter instead
...
of being in CGF. No functionality change.
llvm-svn: 106961
2010-06-26 22:09:34 +00:00
Chris Lattner
fa20e95043
use more efficient type comparison predicates.
...
llvm-svn: 106958
2010-06-26 21:52:32 +00:00
Chris Lattner
0bf27620f0
Fix unary minus to trap on overflow with -ftrapv, refactoring binop
...
code so we can use it from VisitUnaryMinus.
llvm-svn: 106957
2010-06-26 21:48:21 +00:00
Chris Lattner
51924e517b
Implement support for -fwrapv, rdar://7221421
...
As part of this, pull together trapv handling into the same enum.
This also add support for NSW multiplies.
This also makes PCH disagreement on overflow behavior silent, since it
really doesn't matter except for warnings and codegen (no macros get
defined etc).
llvm-svn: 106956
2010-06-26 21:25:03 +00:00
Chris Lattner
217e056e40
implement rdar://7432000 - signed negate should codegen as NSW.
...
While I'm in there, adjust pointer to member adjustments as well.
llvm-svn: 106955
2010-06-26 20:27:24 +00:00
Chris Lattner
30c924b3e8
Implement support for #pragma message, patch by Michael Spencer!
...
llvm-svn: 106950
2010-06-26 17:11:39 +00:00
Anders Carlsson
04775f8413
Change EmitReferenceBindingToExpr to take a decl instead of a boolean.
...
llvm-svn: 106949
2010-06-26 16:35:32 +00:00
Anders Carlsson
709ef8e46c
Add function for mangling reference temporaries.
...
llvm-svn: 106948
2010-06-26 16:09:40 +00:00
Charles Davis
f4db33cbdf
Mangle pointer and (lvalue) reference types in the Microsoft C++ Mangler.
...
Also, fix mangling of throw specs. Turns out MSVC totally ignores throw
specs when mangling names.
llvm-svn: 106937
2010-06-26 03:50:05 +00:00
Bob Wilson
f11a38dcce
Add a missing dependency to try to fix a buildbot failure.
...
It complained with:
llvm[5]: Building Clang arm_neon.h.inc with tblgen
cp: cannot create regular file `/build/buildbot-llvm/clang-x86_64-linux-selfhost-rel/llvm.obj.2/Release/lib/clang/2.0/include/arm_neon.h': No such file or directory
llvm-svn: 106922
2010-06-26 00:03:23 +00:00
Ted Kremenek
58f61ec1de
Relax assertion since non-pod C++ classes are not aggregates, but still can appear in this context.
...
llvm-svn: 106919
2010-06-25 23:51:38 +00:00
Jordy Rose
c3bcc36a0b
When a constant size array is casted to another type, its length should be scaled as well.
...
llvm-svn: 106911
2010-06-25 23:23:04 +00:00
Ted Kremenek
abb1f91325
Use TypeSourceInfo to help determine the SourceRange of a CXXNewExpr. This fixes several
...
cases where we generated an invalid SourceRange for this expression. Thanks to John McCall
for helping me figure this out.
llvm-svn: 106903
2010-06-25 22:48:49 +00:00
Ted Kremenek
fe97a1ac65
Add "checker caching" to GRExprEngine::CheckerVisit to progressively build
...
a winowed list of checkers that actually do something for a given StmtClass.
As the number of checkers grows, this may potentially significantly reduce
the number of checkers called at any one time. My own measurements show that
for the ~20 registered Checker objects, only ~5 of them respond at any one time
to a give statement. While this isn't a net performance win right now (there
is a minor slowdown on sqlite.3) this improvement does greatly improve debugging
when stepping through the checkers used to evaluate a given statement.
llvm-svn: 106884
2010-06-25 20:59:31 +00:00
Ted Kremenek
76abf19ea6
Fix -analyze-display-progress (once again), this time with an additional regression test.
...
llvm-svn: 106883
2010-06-25 20:59:24 +00:00
Fariborz Jahanian
b66b08ef01
Minor change to my last patch to fix PR7490.
...
llvm-svn: 106875
2010-06-25 20:01:13 +00:00
Eric Christopher
17c7b89054
Translate numbers properly.
...
llvm-svn: 106873
2010-06-25 19:04:52 +00:00
Fariborz Jahanian
d5202e0926
IRGen for trivial initialization of dynamiccaly allocated
...
array of other done c++ objects. Fixes PR7490.
llvm-svn: 106869
2010-06-25 18:26:07 +00:00
Tom Care
375387d1f8
Change RegionStoreManager::Retrieve to infer the type of a symbolic region from the context when it is not already available.
...
llvm-svn: 106868
2010-06-25 18:22:31 +00:00
Daniel Dunbar
283fe3d07a
build: Get CLANG_VERSION from Version.inc instead of depending on VER file directly.
...
llvm-svn: 106864
2010-06-25 17:33:49 +00:00
Argyrios Kyrtzidis
b1d38e3f4a
Support NonTypeTemplateParmDecl for PCH.
...
llvm-svn: 106860
2010-06-25 16:25:09 +00:00
Argyrios Kyrtzidis
03e5e0467c
Make PCHWriter::FlushStmts() robust. If we added null Stmts, reading them back got messed up.
...
llvm-svn: 106859
2010-06-25 16:25:02 +00:00
Argyrios Kyrtzidis
f0f7a792d7
Support DependentTemplateSpecializationType and ElaboratedType for PCH.
...
llvm-svn: 106858
2010-06-25 16:24:58 +00:00
Argyrios Kyrtzidis
dc9ca0afa8
Add forgotten breaks in case statements.
...
llvm-svn: 106857
2010-06-25 16:24:51 +00:00
Argyrios Kyrtzidis
58e01ad26f
Support UnresolvedLookupExpr for PCH.
...
llvm-svn: 106832
2010-06-25 09:03:34 +00:00
Argyrios Kyrtzidis
b8d3c63820
Support UnresolvedMemberExpr for PCH.
...
llvm-svn: 106831
2010-06-25 09:03:26 +00:00
Argyrios Kyrtzidis
6ba1bb5dec
Print source location when we encounter unhandled statement during PCH writing.
...
llvm-svn: 106830
2010-06-25 09:03:12 +00:00
Chandler Carruth
f40c42f2cd
Implement dependent alignment attribute support. This is a bit gross given the
...
current attribute system, but it is enough to handle class templates which
specify parts of their alignment in terms of their template parameters.
This also replaces the attributes test in SemaTemplate with one that actually
tests working attributes instead of broken ones. I plan to add more tests here
for non-dependent attributes in a subsequent patch.
Thanks to John for walking me through some of this. =D
llvm-svn: 106818
2010-06-25 03:22:07 +00:00
Fariborz Jahanian
ad356a14f9
Add comment for my last patch.
...
llvm-svn: 106813
2010-06-25 00:05:45 +00:00
John Thompson
ceebdf1fc6
Fixed another double-char in PPC-specific asm constraints.
...
llvm-svn: 106812
2010-06-25 00:02:05 +00:00
John Thompson
07a61a41c8
Added PPC-specific asm constraints, PS3 configuration changes.
...
llvm-svn: 106806
2010-06-24 22:44:13 +00:00
Eric Christopher
ca10da8839
Remove HAS_TLS define.
...
llvm-svn: 106786
2010-06-24 20:41:41 +00:00
Fariborz Jahanian
4f9c9d6591
Fixes a regression when redeclaration of a global satic
...
is an extern local to a function. Radar 8125274.
llvm-svn: 106773
2010-06-24 18:50:41 +00:00
Ted Kremenek
87f475a329
Return null pointer instead of 'false' (fixes clang warning).
...
llvm-svn: 106755
2010-06-24 16:26:12 +00:00
Zhongxing Xu
facf8a8e74
Add check for illegal whence argument of fseek.
...
llvm-svn: 106742
2010-06-24 13:36:41 +00:00
Zhongxing Xu
a7e5dd6c3a
Should return stateNotNull.
...
llvm-svn: 106741
2010-06-24 13:09:02 +00:00
Zhongxing Xu
ae45144d81
Let StreamChecker::CheckNullStream() return a GRState after successful check.
...
llvm-svn: 106738
2010-06-24 12:52:28 +00:00
Argyrios Kyrtzidis
bfcacee9b3
Support a couple more C++ Exprs for PCH.
...
llvm-svn: 106727
2010-06-24 08:57:31 +00:00
Argyrios Kyrtzidis
30d98f3d9e
Fix broken de/serialization for a couple of C++ Exprs.
...
llvm-svn: 106726
2010-06-24 08:57:09 +00:00
Eric Christopher
03256c32ff
More clang support for darwin tls. Add a __has_feature macro and
...
target specific preprocessor define as well.
llvm-svn: 106715
2010-06-24 02:02:00 +00:00
Fariborz Jahanian
9b5528d278
Patch to correctly mangle block helper functions
...
when block literal is declared inside a ctor/dtor.
Fixes radr 8096995.
llvm-svn: 106700
2010-06-24 00:08:06 +00:00
Ted Kremenek
574f304631
Add 'VisitEndAnalysis' callback to Checker class. This callback is called by GRExprEngine
...
when the worklist algorithm has terminated. This allows some checkers to do a post-analysis
phase after all paths have been analyzed.
llvm-svn: 106689
2010-06-23 22:08:00 +00:00
Duncan Sands
d3e231eb3c
Add parentheses suggested by gcc.
...
llvm-svn: 106668
2010-06-23 19:34:52 +00:00
Daniel Dunbar
a99a3c108f
Driver: Add make variable to allow disabling default integrated assembler, till
...
all the kinks are worked out.
llvm-svn: 106641
2010-06-23 18:15:13 +00:00
Argyrios Kyrtzidis
818c5db054
Support C++ class template specializations and partial specializations for PCH.
...
llvm-svn: 106625
2010-06-23 13:48:30 +00:00
Argyrios Kyrtzidis
fe6ba881b6
Modify ClassTemplateSpecializationDecl and ClassTemplatePartialSpecializationDecl to allow PCH read/write.
...
llvm-svn: 106624
2010-06-23 13:48:23 +00:00
Chris Lattner
37141f4fb4
improve altivec vector bool/pixel support, patch by Anton Yartsev
...
with several tweaks by me.
llvm-svn: 106619
2010-06-23 06:00:24 +00:00