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
Chris Lattner
b48a2d5d2f
polish the -finstrument-functions implementation, patch by Nelson Elhage!
...
llvm-svn: 106618
2010-06-23 05:21:28 +00:00
Zhongxing Xu
2213aa360a
add comments.
...
llvm-svn: 106617
2010-06-23 02:12:00 +00:00
Zhongxing Xu
93cef8665c
add comments.
...
llvm-svn: 106616
2010-06-23 02:06:56 +00:00
Ted Kremenek
2a33a0deef
Correctly construct an ElementRegion for alloca() + pointer arithmetic. Fixes analyzer
...
crash reported in PR 7450.
llvm-svn: 106609
2010-06-22 23:58:31 +00:00
Douglas Gregor
689999da1f
String literals enclosed in parentheses are still string
...
literals. Fixes PR7488.
llvm-svn: 106607
2010-06-22 23:47:37 +00:00
Douglas Gregor
769ba3e50c
Make c++ and C++ valid extensions for C++ source files, from Seth Cantrell!
...
llvm-svn: 106602
2010-06-22 23:43:22 +00:00
Douglas Gregor
a3208f9e7c
Vector types are not arithmetic types, either. Note that we now ban
...
__real myvec and __imag myvec, since they aren't all that useful (it's
just an identity function) but we might want to use them in more
restricted cases in the future (e.g., "__real mycomplexvec" could
extract the real parts of a vector of complex numbers).
llvm-svn: 106601
2010-06-22 23:41:02 +00:00
Fariborz Jahanian
3bf0ded346
Patch to provide separate ASTs for multiple ObjC class extension
...
declarations (implements radar 7928731).
llvm-svn: 106597
2010-06-22 23:20:40 +00:00
Douglas Gregor
c646d13054
Teach Type::isRealType() that vector types are never real types. All
...
of the callers of isRealType() already assumed this, and one of them
(increment/decrement) mistakenly permitted increments of vector types
because of it.
llvm-svn: 106596
2010-06-22 23:13:52 +00:00
Douglas Gregor
49b4d73451
Type Type::isRealFloatingType() that vectors are not floating-point
...
types, updating callers of both isFloatingType() and
isRealFloatingType() accordingly. Caught at least one issue where we
allowed one to declare a vector of vectors (!), along with cleaning up
the standard-conversion logic for C++.
llvm-svn: 106595
2010-06-22 23:07:26 +00:00
Douglas Gregor
4ffbad1904
Change Type::isFloatingType() to reflect the actual definition of a
...
"floating type" in C, which does not include vector types. Introduce
Type::hasFloatingRepresentation() for the places where we want to know
whether the underlying representation is one or more floating-point
values. Remove some hacks we had where the former behavior of
Type::isFloatingType() was at odds with the language definition of the
term.
llvm-svn: 106584
2010-06-22 22:12:46 +00:00
Daniel Dunbar
a91c0ba88a
Driver: Remove some dead code left around after a refactoring. Found by the
...
Clang static analyzer!
llvm-svn: 106568
2010-06-22 20:18:18 +00:00
Ted Kremenek
55081f9317
Don't assert on C++ casts that are currently not handled by the static analyzer.
...
Instead, halt the analysis of the current path, which is what we do in GRExprEngine::ProcessStmt
for all other C++ constructs not currently handled by the analyzer.
llvm-svn: 106561
2010-06-22 19:05:10 +00:00
Argyrios Kyrtzidis
6e57c35513
Read/write CXXDeleteExpr from/to PCH.
...
llvm-svn: 106552
2010-06-22 17:07:59 +00:00
Douglas Gregor
db48cf3c31
Don't allow vector conversions to sneak in under the guise of
...
floating-point conversions or floating-integral conversions. We
really, really, really need to make isFloatingType() and friends not
apply to vector types.
llvm-svn: 106551
2010-06-22 16:52:27 +00:00
Fariborz Jahanian
7966aff294
Fixes a problem in generation of meta-data for
...
category implementation whereby property list was missing.
NeXt ObjC runtime (radar 8093297).
llvm-svn: 106550
2010-06-22 16:33:55 +00:00
Anders Carlsson
ea836bc41c
Switch over to the new caching version of getMangledName.
...
llvm-svn: 106549
2010-06-22 16:16:50 +00:00
Anders Carlsson
2e2f4d2e6d
Add a new variant of getMangledName that caches the mangling for decls.
...
llvm-svn: 106547
2010-06-22 16:05:32 +00:00
Anders Carlsson
16d9f1788e
Add GlobalDecl::getCanonicalDecl.
...
llvm-svn: 106546
2010-06-22 16:00:14 +00:00
Douglas Gregor
c9ea2d5a67
In C++, allow a declaration of an enum to follow a definition of that
...
enum as a GNU extension.
llvm-svn: 106540
2010-06-22 14:26:35 +00:00
Argyrios Kyrtzidis
75000b6814
Fix PR7180.
...
For
void f( a:🅱️ :c );
we would cache the tokens "a:🅱️ :" but then we would try to annotate them using the range "a::".
Before annotating them with the (invalid) C++ scope spec, set it to the range of "a:🅱️ :".
llvm-svn: 106536
2010-06-22 11:30:04 +00:00
Argyrios Kyrtzidis
69da4a8f07
Support emitting/reading function templates to/from PCH.
...
llvm-svn: 106534
2010-06-22 09:55:07 +00:00
Argyrios Kyrtzidis
ae85e2414c
-Introduce PCHReader::ReadTemplateArgumentLoc()
...
-Introduce PCHWriter::AddTemplateArgumentLocInfo()
-Modify PCHWriter::AddTemplateArgumentLoc() to also write TemplateArgumentLoc's TemplateArgument
and move the existing calls of AddTemplateArgumentLoc() to AddTemplateArgumentLocInfo().
llvm-svn: 106533
2010-06-22 09:54:59 +00:00
Argyrios Kyrtzidis
cb6f346873
Make it easier to read/write the template part of FunctionDecl.
...
Introduce:
-FunctionDecl::getTemplatedKind() which returns an enum signifying what kind of templated
FunctionDecl it is.
-An overload of FunctionDecl::setFunctionTemplateSpecialization() which accepts arrays of
TemplateArguments and TemplateArgumentLocs
-A constructor to TemplateArgumentList which accepts an array of TemplateArguments.
llvm-svn: 106532
2010-06-22 09:54:51 +00:00
Zhongxing Xu
4505747979
Add a bunch of stream APIs to SteamChecker.
...
llvm-svn: 106530
2010-06-22 07:50:21 +00:00
Douglas Gregor
ef4a2a2b54
Apply array-to-pointer decay when instantiating a MemberExpr. Fixes
...
PR7405, patch by Kyle Lippincott!
llvm-svn: 106523
2010-06-22 02:41:05 +00:00
Fariborz Jahanian
469b200321
Per Chris's comment, remove another static (this one
...
is a static comparator operator).
llvm-svn: 106511
2010-06-22 00:23:08 +00:00
Chris Lattner
3c77a355e0
implement support for -finstrument-functions, patch by Nelson
...
Elhage!
llvm-svn: 106507
2010-06-22 00:03:40 +00:00
Douglas Gregor
27b98eae80
Alter the internal representation of the condition variable in
...
if/while/switch/for statements to ensure that walking the children of
these statements actually works. Previously, we stored the condition
variable as a VarDecl. However, StmtIterator isn't able to walk from a
VarDecl to a set of statements, and would (in some circumstances) walk
beyond the end of the list of statements, cause Bad Behavior.
In this change, we've gone back to representing the condition
variables as DeclStmts. While not as memory-efficient as VarDecls, it
greatly simplifies iteration over the children.
Fixes the remainder of <rdar://problem/8104754>.
llvm-svn: 106504
2010-06-21 23:44:13 +00:00
Fariborz Jahanian
c9fec975e6
Avoid using a local static for providing lexical
...
order of priorotized global object initializations.
llvm-svn: 106503
2010-06-21 23:31:29 +00:00
Douglas Gregor
143d367ecf
Zero out a stale pointer
...
llvm-svn: 106497
2010-06-21 22:46:46 +00:00
Douglas Gregor
9377c8230b
When semantic analysis fail to introduce a class or class template,
...
just skip over the body of the class or class template: it's a
semantic disaster that's likely to cause invariants to break. Fixes
part of <rdar://problem/8104754>.
llvm-svn: 106496
2010-06-21 22:31:09 +00:00
Fariborz Jahanian
9adb2e646c
In fragile-abi (32bit mode abi) generate global symbol
...
objc_category_name_xxx for each category implementation.
(fixes PR7431) patch by Nico Weber.
llvm-svn: 106492
2010-06-21 22:05:18 +00:00
Fariborz Jahanian
89bdd14f2f
In supporting init-priority, globals with the same init_priority must be
...
emitted in the order in which they are seen (still radar 8076356).
llvm-svn: 106485
2010-06-21 21:27:42 +00:00
Tom Care
3f272b853f
Bug 7377: printf checking fails to flag some undefined behavior
...
http://llvm.org/bugs/show_bug.cgi?id=7377
Updated format string highlighting and fixits to take advantage of the new CharSourceRange class.
- Change HighlightRange to allow highlighting whitespace only in a CharSourceRange (for warnings about the ' ' (space) flag)
- Change format specifier range helper function to allow for half-open ranges (+1 to end)
- Enabled previously failing tests (FIXMEs/XFAILs removed)
- Small fixes and additions to format string test cases
M test/Sema/format-strings.c
M test/Sema/format-strings-fixit.c
M lib/Frontend/TextDiagnosticPrinter.cpp
M lib/Sema/SemaChecking.cpp
llvm-svn: 106480
2010-06-21 21:21:01 +00:00
Anders Carlsson
280e61f148
Fix an Obj-C++ miscompile when calling an Obj-C method that returns a C++ reference.
...
llvm-svn: 106477
2010-06-21 20:59:55 +00:00
Jordy Rose
79404afc1c
When folding additive operations, convert the values to the same type. When assuming relationships, convert the integers to the same type as the symbol, at least for now.
...
llvm-svn: 106458
2010-06-21 20:15:15 +00:00
Jordy Rose
3d85888d4e
If a nonnull argument evaluates to UnknownVal, don't warn (and don't crash).
...
llvm-svn: 106456
2010-06-21 20:08:28 +00:00
Fariborz Jahanian
090e4e5773
Use more efficient API of SmallVector/array_pod_sort
...
for sorting (radar 8076356).
llvm-svn: 106453
2010-06-21 19:49:38 +00:00
Fariborz Jahanian
9f2a4eed0d
IRGen for implementation of init-priority attribute.
...
Test case will be checked in llvm test suite.
(finishes off radar 8076356).
llvm-svn: 106441
2010-06-21 18:45:05 +00:00
Douglas Gregor
5dd34744c5
Instantiations subject to an explicit template instantiation
...
declaration have default visibility even under
-fvisibility=hidden. Fixes <rdar://problem/8109763>.
llvm-svn: 106440
2010-06-21 18:41:26 +00:00
Fariborz Jahanian
cc99b3ca9e
Fixes a corner case bug whereby declaring and defining an extern variable in a
...
particular sequence causes its definition to not be generated in the object file.
(fixes radar 8071804).
llvm-svn: 106424
2010-06-21 16:08:37 +00:00
Argyrios Kyrtzidis
a35c8e4092
Combine ClassTemplateDecl's PreviousDeclaration with CommonPtr, as in FunctionTemplateDecl.
...
llvm-svn: 106412
2010-06-21 10:57:41 +00:00
Nate Begeman
ed48c857dc
Implement remaining codegen for NEON, all operations should now work.
...
llvm-svn: 106407
2010-06-20 23:05:28 +00:00
Argyrios Kyrtzidis
41d4562da2
Support PCH emitting/reading of using declarations.
...
llvm-svn: 106404
2010-06-20 14:40:59 +00:00
Benjamin Kramer
22a544bc82
Add braces to avoid an ambiguous else, fixing a GCC warning.
...
llvm-svn: 106403
2010-06-20 10:20:36 +00:00
Jordy Rose
895c899142
Adds analyzer support for idempotent and tautological binary operations such as "a*0" and "a+0". This is not very powerful, but does make the analyzer look a little smarter than it actually is.
...
llvm-svn: 106402
2010-06-20 04:56:29 +00:00
Jordy Rose
2dd9b02cc8
Casting to void* or any other pointer-to-sizeless type (e.g. function pointers) causes a divide-by-zero error. Simple fix: check if the pointee type size is 0 and bail out early if it is.
...
llvm-svn: 106401
2010-06-20 04:30:57 +00:00
Argyrios Kyrtzidis
e1224c8aba
Cure for Doug's insomnia.
...
llvm-svn: 106394
2010-06-19 19:58:34 +00:00
Argyrios Kyrtzidis
26b72453f7
Include a hack to allow loading of templated CXXRecordDecls and test template reading from PCH.
...
llvm-svn: 106393
2010-06-19 19:29:21 +00:00
Argyrios Kyrtzidis
95c04caf92
Initial support for reading templates from PCH.
...
llvm-svn: 106392
2010-06-19 19:29:09 +00:00
Argyrios Kyrtzidis
106caf92cd
Initial support for writing templates to PCH.
...
llvm-svn: 106391
2010-06-19 19:28:53 +00:00
Anton Korobeynikov
cc50b7d7d5
More AltiVec support.
...
Patch by Anton Yartsev!
llvm-svn: 106387
2010-06-19 09:47:18 +00:00
Eli Friedman
c96b2496fc
Fix for PR7415: refactor CodeGenModule::MayDeferGeneration and make it less
...
conservative for static variables in templated classes.
llvm-svn: 106385
2010-06-19 06:24:06 +00:00
Chris Lattner
87233f785b
Fix PR7097, a bad interaction between -fno-use-cxa-atexit and
...
-mconstructor-aliases by using a WeakVH instead of a raw pointer.
llvm-svn: 106384
2010-06-19 05:52:45 +00:00
Fariborz Jahanian
0bf5ee74c4
More Sema Check and a test case for init_priority attr.
...
(radar 8076356).
llvm-svn: 106350
2010-06-18 23:14:53 +00:00
Jordy Rose
c0fe8429f2
Fold additive constants, and support comparsions of the form $sym+const1 <> const2
...
llvm-svn: 106339
2010-06-18 22:49:11 +00:00
Chris Lattner
ed8b6b799d
introduce a new CharSourceRange class, and enhance the diagnostics routines
...
to use them instead of SourceRange. CharSourceRange is just a SourceRange
plus a bool that indicates whether the range has the end character resolved
or whether the end location is the start of the end token. While most of
the compiler wants to think of ranges that have ends that are the start of
the end token, the printf diagnostic stuff wants to highlight ranges within
tokens.
This is transparent to the diagnostic stuff. To start taking advantage of
the new capabilities, you can do something like this:
Diag(..) << CharSourceRange::getCharRange(Begin,End)
llvm-svn: 106338
2010-06-18 22:45:06 +00:00
Douglas Gregor
7ba0c3fd55
A trivial fix for a test case that's too horrible to commit. Fixes
...
<rdar://problem/8108088>.
llvm-svn: 106328
2010-06-18 22:12:56 +00:00
Fariborz Jahanian
ef5f621215
Implements Sema part of init_priority(priority) attribute
...
(radar 8076356) - wip.
llvm-svn: 106322
2010-06-18 21:44:06 +00:00
Douglas Gregor
8fba4f22ce
Don't complain about missing field initializers when the initializer
...
list is completely empty, from Lasse Kärkkäinen! Fixes PR7413.
llvm-svn: 106320
2010-06-18 21:43:10 +00:00
Douglas Gregor
77e274fbc6
Merge the "regparm" attribute from a previous declaration of a
...
function to redeclarations of that function. Fixes PR7025.
llvm-svn: 106317
2010-06-18 21:30:25 +00:00
Charles Davis
108f5a2748
Mangle tag types (unions, structs, classes, enums) in the Microsoft C++ Mangler.
...
Also, test that static members with default visibility in a struct have the
right mangling.
llvm-svn: 106276
2010-06-18 07:51:00 +00:00
Tom Care
6e4ea2db7f
Printf format strings: Added some more tests and fixed some minor bugs.
...
- Precision toStrings shouldn't print a dot when they have no value.
- Length of char length modifier is now returned correctly.
- Added several fixit tests.
Note: fixit tests are currently broken due to a bug in HighlightRange. Marking as XFAIL for now.
M test/Sema/format-strings-fixit.c
M include/clang/Analysis/Analyses/PrintfFormatString.h
M lib/Analysis/PrintfFormatString.cpp
llvm-svn: 106275
2010-06-18 03:02:16 +00:00
Zhongxing Xu
e96a9132b8
Add null stream check for more APIs.
...
llvm-svn: 106274
2010-06-18 02:47:46 +00:00
Ted Kremenek
520f47b66f
Change two static variables into instance variables of ASTContext. This allows us to have multiple copies
...
of ASTContext at the same time.
llvm-svn: 106258
2010-06-18 00:31:04 +00:00
Douglas Gregor
ebada077d9
Given Decl::isUsed() a flag indicating when to consider the "used"
...
attribute as part of the calculation. Sema::MarkDeclReferenced(), and
a few other places, want only to consider the "used" bit to determine,
e.g, whether to perform template instantiation. Fixes a linkage issue
with Boost.Serialization.
llvm-svn: 106252
2010-06-17 23:14:26 +00:00
Fariborz Jahanian
64cda8b5f3
objective-C++ IRGen: property reference as an
...
lvalue when performing a derived-to-base conversion.
Fixes radar 7501812. Added an executable test to
llvm-test suite.
llvm-svn: 106247
2010-06-17 23:00:29 +00:00
Tom Care
9eee328dac
Bug 7394 - Fixed toString representation of Precisions in format strings.
...
M include/clang/Analysis/Analyses/PrintfFormatString.h
M lib/Analysis/PrintfFormatString.cpp
llvm-svn: 106245
2010-06-17 22:55:40 +00:00
Fariborz Jahanian
6fdb139cdd
Do not treat @selector as lvalue (unlike g++).
...
Patch by Nico Weber (pr7390).
llvm-svn: 106242
2010-06-17 21:45:48 +00:00
Fariborz Jahanian
9240f3dac7
Objective-c++ IRGen. Support for @selector expression as
...
an lvalue. Fixes PR7390.
llvm-svn: 106235
2010-06-17 19:56:20 +00:00
Tom Care
b49ec6907b
Bug 7377: Fixed several bad printf format string bugs.
...
- Added warning for undefined behavior when using field specifier
- Added warning for undefined behavior when using length modifier
- Fixed warnings for invalid flags
- Added warning for ignored flags
- Added fixits for the above warnings
- Fixed accuracy of detecting several undefined behavior conditions
- Receive normal warnings in addition to security warnings when using %n
- Fix bug where '+' flag would remain on unsigned conversion suggestions
Summary of changes:
- Added expanded tests
- Added/expanded warnings
- Added position info to OptionalAmounts for fixits
- Extracted optional flags to a wrapper class with position info for fixits
- Added several methods to validate a FormatSpecifier by component, each checking for undefined behavior
- Fixed conversion specifier checking to conform to C99 standard
- Added hooks to detect the invalid states in CheckPrintfHandler::HandleFormatSpecifier
Note: warnings involving the ' ' (space) flag are temporarily disabled until whitespace highlighting no longer triggers assertions. I will make a post about this on cfe-dev shortly.
M test/Sema/format-strings.c
M include/clang/Basic/DiagnosticSemaKinds.td
M include/clang/Analysis/Analyses/PrintfFormatString.h
M lib/Analysis/PrintfFormatString.cpp
M lib/Sema/SemaChecking.cpp
llvm-svn: 106233
2010-06-17 19:00:27 +00:00
Douglas Gregor
ffa20398a6
When pushing a copy of the TypeLoc information for a dependent
...
template specialization type, copy the location information but use
the new type. Fixes PR7385.
llvm-svn: 106224
2010-06-17 16:03:49 +00:00
Douglas Gregor
630dec57a2
Use UnaryOperator as the representation of dependent expressions when
...
no overloaded operators were found in scope, mirroring what we already
do for BinaryOperator.
llvm-svn: 106222
2010-06-17 15:46:20 +00:00
Douglas Gregor
0552291859
Update CMake build system for ARM NEON generation.
...
llvm-svn: 106220
2010-06-17 15:17:41 +00:00
Gabor Greif
2cd6c7bd70
fix some more gcc3.4 constness warnings
...
llvm-svn: 106216
2010-06-17 11:29:31 +00:00
Argyrios Kyrtzidis
e9b76afe4f
Make sure the caching mechanism in Parser::ParseLexedMethodDefs is robust against the parser reading too few tokens.
...
llvm-svn: 106214
2010-06-17 10:52:22 +00:00
Argyrios Kyrtzidis
355094ef06
Make sure parens/braces/brackets are correctly balanced.
...
In a line like:
(;
the semicolon leaves Parser:ParenCount unbalanced (it's 1 even though we stopped looking for a right paren).
This may affect later parsing and result in bad recovery for parsing errors.
llvm-svn: 106213
2010-06-17 10:52:18 +00:00
Argyrios Kyrtzidis
fa533e7652
Don't ast-print the builtin __[u]int128_t.
...
llvm-svn: 106212
2010-06-17 10:52:11 +00:00
Charles Davis
8c02c13e19
Mangle operator names in the Microsoft C++ Mangler.
...
llvm-svn: 106211
2010-06-17 06:47:31 +00:00
Ted Kremenek
5df037e808
Tweak stack address checker to report multiple cases where globals may reference stack memory.
...
Also refactor the diagnostics so that we print out the kind of stack memory returned.
llvm-svn: 106210
2010-06-17 04:21:37 +00:00
Nate Begeman
35f4c1c6b1
Generate arm_neon.inc in include/clang/Basic, which provides:
...
1. builtins definitions for BuiltinsARM.def
2. intrinsic validation code for SemaChecking
Unsure as to whether this is the best way to handle the make dependencies or not.
llvm-svn: 106208
2010-06-17 04:17:01 +00:00
Nate Begeman
dbafec1f3e
Remove last of the bool shifts for MS VC++, patch by dimitry andric
...
llvm-svn: 106206
2010-06-17 02:26:59 +00:00
Ted Kremenek
24c8e4f245
Per conversation with Doug, remove two assertions in ParseLexedMethodDefs() that
...
didn't indicate violated invariants but that we weren't recovering well.
llvm-svn: 106195
2010-06-17 00:59:17 +00:00
Alexis Hunt
c675ec09f0
Update CMake build for new attribute changes.
...
llvm-svn: 106188
2010-06-17 00:37:02 +00:00
Ted Kremenek
17504bea33
Rework StackAddrLeakChecker to find stores of stack memory addresses to global variables
...
by inspecting the Store bindings instead of iterating over all the global variables
in a translation unit. By looking at the store directly, we avoid cases where we cannot
directly load from the global variable, such as an array (which can result in an assertion failure)
and it also catches cases where we store stack addresses to non-scalar globals.
Also, but not iterating over all the globals in the translation unit, we maintain cache
locality, and the complexity of the checker becomes restricted to the complexity of the
analyzed function, and doesn't scale with the size of the translation unit.
This fixes PR 7383.
llvm-svn: 106184
2010-06-17 00:24:44 +00:00
Ted Kremenek
648ef7a2d7
Implement RegionStoreManager::iterBindings(). This implementation only returns the base region in
...
the binding key instead of the region + offset. It isn't clear if this is the best semantics, but most
clients will likely only care about simple bindings, or bindings to a particular variable. We can
refine later if necessary.
llvm-svn: 106183
2010-06-17 00:24:42 +00:00
Ted Kremenek
70c090822d
Correctly return early from BasicStoreManager::iterBindings() when the BindingsHandler returns false.
...
llvm-svn: 106182
2010-06-17 00:24:37 +00:00
Douglas Gregor
428119e39a
When parsing cached C++ method declarations/definitions, save the
...
"previous token" location at the end of the class definition. This
eliminates a badly-placed error + Fix-It when the ';' following a
class definition is missing. Fixes <rdar://problem/8066414>.
llvm-svn: 106175
2010-06-16 23:45:56 +00:00
Alexis Hunt
344393e9cf
Implement first TD-based usage of attributes.
...
Currently, there are two effective changes:
- Attr::Kind has been changed to attr::Kind, in a separate namespace
rather than the Attr class. This is because the enumerator needs to
be visible to parse.
- The class definitions for the C++0x attributes other than aligned are
generated by TableGen.
The specific classes generated by TableGen are controlled by an array in
TableGen (see the accompanying commit to the LLVM repository). I will be
expanding the amount of code generated as I develop the new attributes system
while initially keeping it confined to these attributes.
llvm-svn: 106172
2010-06-16 23:43:53 +00:00
Douglas Gregor
13d0568ecc
Make the "extra ';' inside a struct or union" diagnostic more
...
precise. Fixes PR7336.
llvm-svn: 106170
2010-06-16 23:08:59 +00:00
Douglas Gregor
bb1196534c
When we see a 'template' disambiguator that marks the next identifier
...
(or operator-function-id) as a template, but the context is actually
non-dependent or the current instantiation, allow us to use knowledge
of what kind of template it is, e.g., type template vs. function
template, for further syntactic disambiguation. This allows us to
parse properly in the presence of stray "template" keywords, which is
necessary in C++0x and it's good recovery in C++98/03.
llvm-svn: 106167
2010-06-16 23:00:59 +00:00
Douglas Gregor
f7d7771812
Fix the recently-added warning about 'typename' and 'template'
...
disambiguation keywords outside of templates in C++98/03. Previously,
the warning would fire when the associated nested-name-specifier was
not dependent, but that was a misreading of the C++98/03 standard:
now, we complain only when we're outside of any template.
llvm-svn: 106161
2010-06-16 22:31:08 +00:00
Ted Kremenek
64c235e4c6
Extend format string type-checking to include '%p'. Fixes remaining cases PR 4468.
...
llvm-svn: 106151
2010-06-16 21:23:04 +00:00
Douglas Gregor
7dbfb46163
Canonicalize template template parameters when canonicalizing a
...
template name that refers to such a parameter. It's amazing that this
problem didn't surface earlier. Fixes PR7387.
llvm-svn: 106147
2010-06-16 21:09:37 +00:00
Fariborz Jahanian
18e0275033
C return types must be complete as well.
...
Moved check before we build the ObjCMessageExpr node.
(PR7386 related).
llvm-svn: 106139
2010-06-16 19:56:08 +00:00
Rafael Espindola
23a8a06554
Change the test for which ABI/CC to use on ARM to be base on the environment
...
(the last argument of the triple).
llvm-svn: 106131
2010-06-16 19:01:17 +00:00
Fariborz Jahanian
1d44608cc1
Make sure result type of objc++ message expression is
...
complete before attempting to bind it to a temporary.
Fixes PR7386.
llvm-svn: 106130
2010-06-16 18:56:04 +00:00
Daniel Dunbar
7c995e8fac
Frontend: Allow passing -cc1 level arguments to plugins. Patch by Troy Straszheim!
...
llvm-svn: 106113
2010-06-16 16:59:23 +00:00
Douglas Gregor
94584683fa
Don't poke at an undefined class type of a field. Fixes PR7355.
...
llvm-svn: 106111
2010-06-16 16:54:04 +00:00
Douglas Gregor
010815a20b
Downgrade the error when using a typedef in the nested-name-specifier
...
of an explicit instantiation to an ExtWarn, since nobody else seems to
diagnose this problem.
llvm-svn: 106109
2010-06-16 16:26:47 +00:00
Douglas Gregor
f56055aee3
Add Cygwin C++ header search path.
...
llvm-svn: 106108
2010-06-16 16:24:51 +00:00
Fariborz Jahanian
4a30307840
Fixed conflict between objc_memmove_collectable builtin
...
decl. and one ddefined in darwin header file.
llvm-svn: 106107
2010-06-16 16:22:04 +00:00
Rafael Espindola
a92c442437
Don't set the calling convention for ARM if it is already the default.
...
llvm-svn: 106106
2010-06-16 16:13:39 +00:00
Douglas Gregor
1c69bf00ae
If a non-dependent base class initializer fails to match any direct or
...
virtual base class, but the class still has dependent base classes,
then don't diagnose the failed match as an error: the right base class
might magically appear. Fixes PR7259.
llvm-svn: 106103
2010-06-16 16:03:14 +00:00
Douglas Gregor
9938e3b11b
Add some missing parentheses, from Anton Yartsev
...
llvm-svn: 106101
2010-06-16 15:28:57 +00:00
Douglas Gregor
2ebcae1931
Revert r106099; it broke self-host.
...
llvm-svn: 106100
2010-06-16 15:23:05 +00:00
Abramo Bagnara
bec18dbb88
Added TemplateTypeParmType::getDecl().
...
llvm-svn: 106099
2010-06-16 14:59:30 +00:00
John McCall
38e5f433b2
Fix the build. Using declarations should not be considering when looking
...
for overridden virtual methods.
llvm-svn: 106096
2010-06-16 09:33:39 +00:00
John McCall
e9cccd86da
Fix a point of semantics with using declaration hiding: method templates
...
introduced by using decls are hidden even if their template parameter lists
or return types differ from the "overriding" declaration.
Propagate using shadow declarations around more effectively when looking up
template-ids. Reperform lookup for template-ids in member expressions so that
access control is properly set up.
Fix some number of latent bugs involving template-ids with totally invalid
base types. You can only actually get these with a scope specifier, since
otherwise the template-id won't parse as a template-id.
Fixes PR7384.
llvm-svn: 106093
2010-06-16 08:42:20 +00:00
Zhongxing Xu
abd60dd1fc
We return Loc where we know.
...
llvm-svn: 106087
2010-06-16 06:16:46 +00:00
Zhongxing Xu
7880db8a89
Typo.
...
llvm-svn: 106086
2010-06-16 05:58:35 +00:00
Zhongxing Xu
b4126ee133
Although arguments can not be undefined when we get here, they can still be
...
unknown.
llvm-svn: 106085
2010-06-16 05:56:39 +00:00
Zhongxing Xu
9fe7e9129b
Cast earlier. We know we can get a DefinedSVal.
...
llvm-svn: 106084
2010-06-16 05:52:03 +00:00
Zhongxing Xu
8225bda0d5
Register CallAndMessageChecker before AttrNonNullChecker. Then we can assume
...
arguments are not undefined.
llvm-svn: 106083
2010-06-16 05:45:09 +00:00
Zhongxing Xu
0fa7cddbab
Add StreamChecker. This checker models and checks stream manipulation functions.
...
This is the start.
llvm-svn: 106082
2010-06-16 05:38:05 +00:00
Charles Davis
89338af1ff
Start mangling function types in the Microsoft C++ Mangler.
...
llvm-svn: 106081
2010-06-16 05:33:16 +00:00
Douglas Gregor
6972a62c8f
Give Type::isIntegralType() an ASTContext parameter, so that it
...
provides C "integer type" semantics in C and C++ "integral type"
semantics in C++.
Note that I still need to update isIntegerType (and possibly other
predicates) using the same approach I've taken for
isIntegralType(). The two should have the same meaning, but currently
don't (!).
llvm-svn: 106074
2010-06-16 00:35:25 +00:00
Douglas Gregor
b90df60b3b
Introduce Type::isIntegralOrEnumerationType(), to cover those places
...
in C++ that involve both integral and enumeration types. Convert all
of the callers to Type::isIntegralType() that are meant to work with
both integral and enumeration types over to
Type::isIntegralOrEnumerationType(), to prepare to eliminate
enumeration types as integral types.
llvm-svn: 106071
2010-06-16 00:17:44 +00:00
Fariborz Jahanian
00bdca561a
Workaround a possible VS C++ bug.
...
llvm-svn: 106070
2010-06-16 00:16:38 +00:00
Chandler Carruth
8509824cdb
Move CodeGenOptions.h *back* into Frontend. This should have been done when the
...
dependency edge was reversed such that CodeGen depends on Frontend.
llvm-svn: 106065
2010-06-15 23:19:56 +00:00
Fariborz Jahanian
021510e96f
Patch adds support for copying of those
...
objective-c++ class objects which have GC'able objc object
pointers and need to use ObjC's objc_memmove_collectable
API (radar 8070772).
llvm-svn: 106061
2010-06-15 22:44:06 +00:00
Douglas Gregor
f267edd8ac
Update equality and relationship comparisons of pointers to reflect
...
C++ semantics, eliminating an extension diagnostic that doesn't match
C++ semantics (ordered comparison with NULL) and tightening some
extwarns to errors in C++ to match GCC and maintain conformance in
SFINAE contexts. Fixes <rdar://problem/7941392>.
llvm-svn: 106050
2010-06-15 21:38:40 +00:00
Chris Lattner
bba37f4dea
fix the various buildbot failures by ensuring that tokens are really completely initialized.
...
llvm-svn: 106043
2010-06-15 21:06:38 +00:00
Douglas Gregor
c4827d31aa
Remove a completely useless and utterly incorrect assertion.
...
llvm-svn: 106040
2010-06-15 20:38:36 +00:00
Daniel Dunbar
3648ba756f
Driver: Support -Wp,-MMD,FOO, which I found an instance of. :(
...
llvm-svn: 106039
2010-06-15 20:30:18 +00:00
Douglas Gregor
9858ed5b69
Teach code completion not to ignore data members when performing code
...
completion for expressions.
llvm-svn: 106037
2010-06-15 20:26:51 +00:00
Chris Lattner
4e18a2bc97
fix an uninitialized variable, patch by Michael Spencer!
...
llvm-svn: 106025
2010-06-15 18:55:23 +00:00
Chris Lattner
c548be9ab3
Remove a dead argument to ProcessUCNEscape.
...
Fix string concatenation to treat escapes in concatenated strings that
are wide because of other string chunks to process the escapes as wide
themselves. Before we would warn about and miscompile the attached testcase.
This fixes rdar://8040728 - miscompile + warning: hex escape sequence out of range
llvm-svn: 106012
2010-06-15 18:06:43 +00:00
Chris Lattner
a8687ae490
tidy up
...
llvm-svn: 106011
2010-06-15 18:05:34 +00:00
Daniel Dunbar
c1b1729b66
Break Frontend's dependency on Rewrite, Checker and CodeGen in shared library configuration
...
Currently, all AST consumers are located in the Frontend library,
meaning that in a shared library configuration, Frontend has a
dependency on Rewrite, Checker and CodeGen. This is suboptimal for
clients which only wish to make use of the frontend. CodeGen in
particular introduces a large number of unwanted dependencies.
This patch breaks the dependency by moving all AST consumers with
dependencies on Rewrite, Checker and/or CodeGen to their respective
libraries. The patch therefore introduces dependencies in the other
direction (i.e. from Rewrite, Checker and CodeGen to Frontend).
After applying this patch, Clang builds correctly using CMake and
shared libraries ("cmake -DBUILD_SHARED_LIBS=ON").
N.B. This patch includes file renames which are indicated in the
patch body.
Changes in this revision of the patch:
- Fixed some copy-paste mistakes in the header files
- Modified certain aspects of the coding to comply with the LLVM
Coding Standards
llvm-svn: 106010
2010-06-15 17:48:49 +00:00
Douglas Gregor
20527e2c83
Allocate template parameter lists for out-of-line definitions via the
...
ASTContext rather than via the normal heap.
llvm-svn: 106008
2010-06-15 17:44:38 +00:00
Douglas Gregor
0832963acd
Implement -fvisibility-inlines-hidden. <rdar://problem/7819834>
...
llvm-svn: 106003
2010-06-15 17:05:35 +00:00
Daniel Dunbar
e9c5e2cc71
Driver/FreeBSD: Add libexec to program search paths, to workaround some build
...
problem; patch by Ed Schouten.
llvm-svn: 105996
2010-06-15 15:03:31 +00:00
Nick Lewycky
a2fb98bfda
When analyzing for member self-assignment, don't attempt to dereference null
...
Stmt* such as those which occur in ?: . Fixes PR7378.
Also, generally whip the code into shape fixing several coding style violations.
llvm-svn: 105992
2010-06-15 07:32:55 +00:00
Alexis Hunt
0684e33ba5
MinGW requires that wint_t be defined in stddef.h. In order to accomodate, we
...
won't define it unless specifically requested via the use of __need_wint_t.
llvm-svn: 105985
2010-06-15 02:36:48 +00:00
Ted Kremenek
4c721bf892
Change AnalysisConsumer to analyze functions created by instantiantiating a macro. Fixes PR 7361.
...
llvm-svn: 105984
2010-06-15 00:55:40 +00:00
Chris Lattner
c7ed7ea390
fix the inline asm diagnostics to emit the error on the primary
...
source code location instead of on the note. Previously we generated:
<inline asm>:1:2: error: unrecognized instruction
barf
^
t.c:4:8: note: generated from here
asm ("barf");
^
Now we generate:
t.c:4:8: error: unrecognized instruction
asm ("barf");
^
<inline asm>:1:2: note: instantated into assembly here
barf
^
llvm-svn: 105978
2010-06-15 00:03:12 +00:00
Douglas Gregor
4f6e8deec4
Make sure to set the visible on a vtable; VTTs and typeinfo already
...
handle visibility properly. Fixes <rdar://problem/8091955>.
llvm-svn: 105977
2010-06-14 23:41:45 +00:00
Douglas Gregor
1726d1517e
Add name mangling for address spaces. We use the vendor-extension
...
mangling for types, where the <source-name> is ASxxx (xxx is the
address-space number).
llvm-svn: 105975
2010-06-14 23:15:08 +00:00
Douglas Gregor
c9d2682df3
Warn when a 'typename' or a 'template' keyword refers to a
...
non-dependent type or template name, respectively, in C++98/03. Fixes
PR7111 and <rdar://problem/8002682>.
llvm-svn: 105968
2010-06-14 22:07:54 +00:00
Daniel Dunbar
5a9d1835be
Driver: Fix PR4062 by dissecting one particular -Wp, form.
...
llvm-svn: 105966
2010-06-14 21:37:09 +00:00
Daniel Dunbar
fb3d747fc6
Driver: Dissect -Wl, and -Xlinker arguments to remove --no-demangle, which was a
...
collect2 option that is passed by some projects (notably WebKit).
llvm-svn: 105964
2010-06-14 21:23:12 +00:00
Daniel Dunbar
3f1a1ffd95
Driver: Eliminate uses of Arg::getIndex.
...
Also, fix a memory leak.
llvm-svn: 105963
2010-06-14 21:23:08 +00:00
Daniel Dunbar
5714fc5e8b
Driver: Fix refacto in DerivedArgList::MakeSeparateArg.
...
llvm-svn: 105958
2010-06-14 20:20:44 +00:00
Daniel Dunbar
2d6e9ee033
Driver: Add DerivedArgList::AddFOOArg helper functions, and switch to using them.
...
llvm-svn: 105957
2010-06-14 20:20:41 +00:00
Chris Lattner
48eb14dd79
Fix:
...
Decl.cpp:716:28: warning: initialization of pointer of type 'clang::VarDecl *' from literal 'false' [-Wbool-conversions]
VarDecl *LastTentative = false;
^
RewriteRope.cpp:535:12: warning: initialization of pointer of type '<anonymous>::RopePieceBTreeNode *' from literal 'false'
[-Wbool-conversions]
return false;
^
llvm-svn: 105946
2010-06-14 18:31:46 +00:00
Benjamin Kramer
7039fcbc5d
An implementation of __builtin__fpclassify the way Chris Lattner described by Jörg Blank.
...
llvm-svn: 105936
2010-06-14 10:30:41 +00:00
Charles Davis
2d7b10cc97
Microsoft C++ Mangler:
...
- Mangle qualifiers.
- Start mangling variables' types into the name. A variable declared with a
builtin type should now mangle properly.
llvm-svn: 105931
2010-06-14 05:29:01 +00:00
Nate Begeman
91e1feab7a
Add some missing shifts
...
Fix multiplies by scalar
Add SemaChecking code for all immediates
Add SemaChecking-gen support to arm_neon.td
llvm-svn: 105930
2010-06-14 05:21:25 +00:00
Anders Carlsson
cc59cc5d80
Do the same short-circuit optimization when laying out bases.
...
llvm-svn: 105920
2010-06-13 18:00:18 +00:00
Anders Carlsson
ae111dc821
Implement part of the EmptySubobjectMap optimization described in PR6998. We still need to do this for bases.
...
llvm-svn: 105919
2010-06-13 17:49:16 +00:00
John McCall
30576cdce3
TemplateSpecializationType's isCurrentInstantiation bit can be derived
...
from its canonical type.
llvm-svn: 105912
2010-06-13 09:25:03 +00:00
Chris Lattner
f3d3b36870
Allow an asm label specifier on C++ methods, like GCC does.
...
Patch by David Majnemer!
llvm-svn: 105909
2010-06-13 05:34:18 +00:00
Nate Begeman
d773fe67dd
Most of NEON sema checking & fix to polynomial type detection
...
llvm-svn: 105908
2010-06-13 04:47:52 +00:00
Chris Lattner
bc6bcabc61
fix PR7360: -P mode turns off line markers, but not blank space.
...
Apparently some programs which abuse the preprocessor depend
on this.
llvm-svn: 105889
2010-06-12 16:20:56 +00:00
Abramo Bagnara
da41d0cf5b
Added template parameters info for out-of-line definitions of class template methods.
...
llvm-svn: 105882
2010-06-12 08:15:14 +00:00
Charles Davis
7dacc95299
Microsoft C++ Mangler:
...
- Don't mangle static variables at global scope.
- Add support for mangling builtin types. This will be used later.
llvm-svn: 105881
2010-06-12 08:11:16 +00:00
Abramo Bagnara
8075c85230
Don't omit class explicit instantiation from AST.
...
llvm-svn: 105880
2010-06-12 07:44:57 +00:00
Nate Begeman
c6ac0ce89f
Shifts complete. Only vld & sema checking of constants remain.
...
llvm-svn: 105879
2010-06-12 06:06:07 +00:00
Nate Begeman
dd715805ab
vbsl, vrev* is implemented via arm_neon.h
...
llvm-svn: 105875
2010-06-12 03:11:41 +00:00
John McCall
45d30c3e36
When deciding whether an expression has the boolean nature, don't look through
...
explicit casts. Fixes PR7359.
llvm-svn: 105871
2010-06-12 01:56:02 +00:00
Argyrios Kyrtzidis
9116717189
Fix PCH issue. Attributes of a declaration were truncated to just one when the decl was read from a PCH file.
...
llvm-svn: 105852
2010-06-11 23:09:25 +00:00
Nate Begeman
8ed060b95a
Most of remaining builtins, 2 generics, vld, and rounding shfits remain.
...
llvm-svn: 105848
2010-06-11 22:57:12 +00:00
Daniel Dunbar
af8decbde0
Driver: Switch Compilation to return the translated arguments by default.
...
llvm-svn: 105844
2010-06-11 22:43:38 +00:00
Daniel Dunbar
775d406043
Driver: Add an explicit argument translation phase to the driver itself. We are going to need this to handle things like -Xassembler, -Xpreprocessor, and -Xlinker which we might have to introspect.
...
llvm-svn: 105842
2010-06-11 22:00:26 +00:00
Daniel Dunbar
5c5d30b03a
Driver: Get rid of the proxy support in DerivedArgList.
...
llvm-svn: 105841
2010-06-11 22:00:22 +00:00
Daniel Dunbar
18974bdc68
Fix a couple comments.
...
llvm-svn: 105840
2010-06-11 22:00:19 +00:00
Daniel Dunbar
7c9e4306af
Driver: Change OptTable::ParseArg to take any ArgList.
...
llvm-svn: 105839
2010-06-11 22:00:17 +00:00
Daniel Dunbar
a442fd5da6
Driver: Fix arg_iterator typing to reflect that it is really an iterator over Arg*s.
...
llvm-svn: 105838
2010-06-11 22:00:13 +00:00
Daniel Dunbar
d839e77b12
Preprocessor: Ignore unknown pragmas in -E -dM and -Eonly modes.
...
llvm-svn: 105830
2010-06-11 20:10:12 +00:00
John McCall
875679eea0
Fix the constant evaluator for AltiVec-style vector literals so that the
...
vector is filled with the given constant; we were just initializing the
first element.
llvm-svn: 105824
2010-06-11 17:54:15 +00:00
John McCall
b86a6b830e
Allow pseudo-destructors to be called on qualified pointers. Patch by
...
Troy Straszheim!
llvm-svn: 105823
2010-06-11 17:36:40 +00:00
John McCall
773cc98c3a
Don't store ASTContext references in the TST nodes just to support profiling.
...
llvm-svn: 105820
2010-06-11 11:07:21 +00:00
John McCall
dad856dba3
Provide an Objective C mangling for wchar_t. Patch by Nico Weber!
...
llvm-svn: 105818
2010-06-11 10:11:05 +00:00
John McCall
6d1116ac49
Conversions from Objective C object pointers to bool are "pointer conversions
...
to bool" in the sense of C++ [over.ics.rank]p4 bullet 1. I have decreed it.
llvm-svn: 105817
2010-06-11 10:04:22 +00:00
Jeffrey Yasskin
5d474d0a96
Fix the 64-bit build. operator<<(DiagnosticBuilder, long) doesn't exist, so
...
ptrdiff_t (long on 64-bit, apparently) is ambiguous between the int and
unsigned int overloads.
llvm-svn: 105816
2010-06-11 06:58:43 +00:00
Jeffrey Yasskin
2b99c6fc4f
Add an option -fshow-overloads=best|all to limit the number of overload
...
candidates printed. We default to 'all'. At the moment, 'best' prints only
the first 4 overloads, but we'll improve that over time.
llvm-svn: 105815
2010-06-11 05:57:47 +00:00
Charles Davis
b6a5a0d9e1
When mangling for the Microsoft C++ ABI, mangle variables in the global
...
namespace, too.
llvm-svn: 105809
2010-06-11 04:25:47 +00:00
Tom Care
00554634db
Small fixes regarding printf fix suggestions.
...
- Added some handling of flags that become invalid when changing the conversion specifier.
- Changed fixit behavior to remove unnecessary length modifiers.
- Separated some tests out and added some comments.
modified:
lib/Analysis/PrintfFormatString.cpp
test/Sema/format-strings-fixit.c
llvm-svn: 105807
2010-06-11 04:22:02 +00:00
Charles Davis
9af2d4a614
Start implementing the Microsoft-style name mangler. Mangle simple names
...
(but not their types; that's later).
NOTE: Right now, variables in the global namespace don't get mangled, even
though they're supposed to be. This is because the default mangler
implements the shouldMangleDeclName() method that tells clang not to mangle
them. This will be fixed in a later patch.
llvm-svn: 105805
2010-06-11 03:07:32 +00:00
Charles Davis
95a546ee4d
Add an option to specify the target C++ ABI to the frontend. Use it to
...
select either the default Itanium ABI or the new, experimental Microsoft ABI.
llvm-svn: 105804
2010-06-11 01:06:47 +00:00
John McCall
c392f37ae8
Split DependentNameType into two types. DependentNameType represents the
...
case of an elaborated-type-specifier like 'typename A<T>::foo', and
DependentTemplateSpecializationType represents the case of an
elaborated-type-specifier like 'typename A<T>::template B<T>'. The TypeLoc
representation of a DependentTST conveniently exactly matches that of an
ElaboratedType wrapping a TST.
Kill off the explicit rebuild methods for RebuildInCurrentInstantiation;
the standard implementations work fine because the nested name specifier
is computable in the newly-entered context.
llvm-svn: 105801
2010-06-11 00:33:02 +00:00
Nate Begeman
e0935ffa50
Multiplies, some shifts, set_lane
...
llvm-svn: 105793
2010-06-10 18:11:55 +00:00
Chandler Carruth
c65667c8ba
Another chunk of the new RecursiveASTVisitor implementation: switch the return
...
value semantics such that we recurse while the visitors return true, and halt
as soon as one returns false. Patch by csilvers.
llvm-svn: 105787
2010-06-10 10:31:57 +00:00
Rafael Espindola
ad8fed53ff
Create a LinuxTargetInfo on ARM. This make clang correctly expand
...
__USER_LABEL_PREFIX__.
llvm-svn: 105771
2010-06-10 00:46:51 +00:00
Nate Begeman
4a04b467d9
support _lane ops, and multiplies by scalar.
...
llvm-svn: 105770
2010-06-10 00:17:56 +00:00
Charles Davis
74ce85980b
Add a stub Microsoft Visual C++ ABI class (with stub mangler).
...
llvm-svn: 105767
2010-06-09 23:25:41 +00:00
Daniel Dunbar
bfe71f2416
Driver: Change Option parsing to always create arguments referring to unaliased
...
options.
- This matches the intent of the .td files, and will simplify alias handling.
- PR7321.
llvm-svn: 105763
2010-06-09 22:44:34 +00:00
Daniel Dunbar
35cbfeba8f
Driver: Eliminate Arg subclasses, which are now unnecessary.
...
llvm-svn: 105762
2010-06-09 22:31:08 +00:00
Daniel Dunbar
8b77f73314
Driver: Keep the rendering style in the option, instead of as part of the Arg.
...
llvm-svn: 105761
2010-06-09 22:31:04 +00:00
Daniel Dunbar
8f1ebabaf7
Driver: Change Arg to just hold the values directly, instead of implicitly
...
deriving them from the Arg type.
llvm-svn: 105760
2010-06-09 22:31:00 +00:00
Daniel Dunbar
0bcb62dc30
Frontend: Fix crashes on error paths.
...
llvm-svn: 105759
2010-06-09 22:30:54 +00:00
Sebastian Redl
c3eba8f547
Commit my WIP on constexpr support. This commit: an XFAILed test and treating constexpr as a top-level const.
...
llvm-svn: 105752
2010-06-09 21:19:43 +00:00
Sebastian Redl
243d9057d0
Fix two typos in comments.
...
llvm-svn: 105751
2010-06-09 21:17:41 +00:00
Daniel Dunbar
c656d3e111
Revert "Driver: Change Option parsing to always create arguments referring to
...
unaliased", this isn't quite right yet.
llvm-svn: 105747
2010-06-09 19:27:07 +00:00
Daniel Dunbar
aea0620b89
Driver: Change Option parsing to always create arguments referring to unaliased
...
options.
- This matches the intent of the .td files, and will simplify alias handling.
- PR7321.
llvm-svn: 105744
2010-06-09 19:19:01 +00:00
Daniel Dunbar
26a95c6717
Driver: Add an explicit offset to JoinedArg and JoinedAndSeparateArg, so that
...
they can be independent of the exact option that created them.
llvm-svn: 105739
2010-06-09 18:49:38 +00:00
Daniel Dunbar
d96e279f02
Driver: Change Arg::render methods to use option name instead of string where
...
possible.
llvm-svn: 105738
2010-06-09 18:49:31 +00:00
Nate Begeman
d90aa43bdf
Implement codegen for hadd, hsub, max, min, mlal, movl, movn, padal, mov_n
...
Make note about how to handle the dozen or so multiply by scalar ops.
llvm-svn: 105734
2010-06-09 18:04:15 +00:00
Abramo Bagnara
656e300f03
Added inherited info to template and non-type arguments of templates.
...
llvm-svn: 105716
2010-06-09 09:26:05 +00:00
Chandler Carruth
af80f66997
Major redesign of the RecursiveASTVisitor. This implements the majority of the
...
new design discussed on cfe-dev, with further steps in that direction to come.
It is already much more complete than the previous visitor.
Patch by Zhanyong and Craig with 80 column wraps and one missing declaration
added by me.
llvm-svn: 105709
2010-06-09 08:17:30 +00:00
Chandler Carruth
b52b9100bf
Remove an entry for a now deleted file. Fixes the neglected CMake build. ;]
...
llvm-svn: 105708
2010-06-09 08:12:12 +00:00
John McCall
a5dd326ca5
Correctly handle > 257 substitutions in a single mangling, and don't introduce
...
a spurious substitution for an unscoped dependent template-id after introducing
a substitution for the scoped template-id.
llvm-svn: 105699
2010-06-09 07:26:17 +00:00
Zhongxing Xu
1225aacacf
Merge StackAddrLeakChecker and ReturnStackAddressChecker.
...
llvm-svn: 105687
2010-06-09 06:08:24 +00:00
Zhongxing Xu
4200be5e76
Directly compare the StackFrameContext. This greatly simplifies logic and
...
improves generality. Thanks Ted.
llvm-svn: 105686
2010-06-09 05:50:38 +00:00
Nate Begeman
4307a25545
More accurate BuiltinsARM.def
...
vget_lane support
llvm-svn: 105684
2010-06-09 05:30:26 +00:00
Douglas Gregor
b4e3533ce1
Fix a typo that breaks the GCC build. Turns out that Clang isn't
...
diagnosing this code as an error when it should, so I've filed
http://llvm.org/bugs/show_bug.cgi?id=7325 .
llvm-svn: 105683
2010-06-09 05:25:34 +00:00
Tom Care
b704270779
Added FixIt support to printf format string checking.
...
- Refactored LengthModifier to be a class.
- Added toString methods in all member classes of FormatSpecifier.
- FixIt suggestions keep user specified flags unless incorrect.
Limitations:
- The suggestions are not conversion specifier sensitive. For example, if we have a 'pad with zeroes' flag, and the correction is a string conversion specifier, we do not remove the flag. Clang will warn us on the next compilation.
A test/Sema/format-strings-fixit.c
M include/clang/Analysis/Analyses/PrintfFormatString.h
M lib/Analysis/PrintfFormatString.cpp
M lib/Sema/SemaChecking.cpp
llvm-svn: 105680
2010-06-09 04:11:11 +00:00
Douglas Gregor
1fc3d66da4
Tweak our handling of the notion of a standard conversion sequence
...
being a subsequence of another standard conversion sequence. Instead
of requiring exact type equality for the second conversion step,
require type *similarity*, which is type equality with cv-qualifiers
removed at all levels. This appears to match the behavior of EDG and
VC++ (albeit not GCC), and feels more intuitive. Big thanks to John
for the line of reasoning that supports this change: since
cv-qualifiers are orthogonal to the second conversion step, we should
ignore them in the type comparison.
llvm-svn: 105678
2010-06-09 03:53:18 +00:00
Rafael Espindola
6bb986d530
Simplify the code a bit and avoid a gcc waring about uninitialized variables.
...
llvm-svn: 105676
2010-06-09 03:48:40 +00:00
Anders Carlsson
635186a8c4
Get rid of getMangledCXXCtorName and getMangledCXXDtorName.
...
llvm-svn: 105673
2010-06-09 02:36:32 +00:00
Anders Carlsson
09b5fe68ab
More mangling cleanup.
...
llvm-svn: 105672
2010-06-09 02:30:12 +00:00
Anders Carlsson
d4ce4e4bc0
Get rid of an unnecessary getMangledName overload.
...
llvm-svn: 105671
2010-06-09 02:20:01 +00:00
Rafael Espindola
9cdbd9dc08
Fix a gcc warning.
...
llvm-svn: 105670
2010-06-09 02:17:08 +00:00
Nate Begeman
5548309fa7
Implement transpose/zip/unzip & table lookup.
...
Test out some basic constant-checking.
llvm-svn: 105667
2010-06-09 01:10:23 +00:00
Ted Kremenek
076baeb03e
Fix memory leak in ASTContext where ASTRecordLayout objects involving C++ structures wouldn't have
...
their associated memory destroyed when using a BumpPtrAllocator. These objects internally use
a DenseMap.
llvm-svn: 105659
2010-06-08 23:00:58 +00:00
Ted Kremenek
dea66e3e4c
Fix memory leak in Preprocessor where MacroInfo objects in the MICache wouldn't have their
...
associated SmallVectors get deallocated.
llvm-svn: 105658
2010-06-08 23:00:53 +00:00
Jordy Rose
954238366b
Code cleanup: remove explicit flush() in favor of using the ostream's str()
...
llvm-svn: 105657
2010-06-08 22:59:01 +00:00
Anders Carlsson
851318a93a
On Darwin, initialization and destruction functions should go into the __StaticInit section.
...
llvm-svn: 105650
2010-06-08 22:47:50 +00:00
Anders Carlsson
b2839e4aa1
Add a global CreateGlobalInitOrDestructFunction and use it for creating global init or destruction functions.
...
llvm-svn: 105649
2010-06-08 22:40:05 +00:00
Anders Carlsson
9eb101c5d3
Rename __tcf_ to __cxx_global_array_dtor. Remove the UniqueAggreDestructorCount from CodeGenFunction and let LLVM handle uniquing the internal functions instead.
...
llvm-svn: 105648
2010-06-08 22:30:17 +00:00
Anders Carlsson
282bc10eaa
Move GenerateCXXAggrDestructorHelper to CGDeclCXX.cpp where it belongs.
...
llvm-svn: 105647
2010-06-08 22:17:27 +00:00
Anders Carlsson
165ec0a04f
Simplify GenerateCXXAggrDestructorHelper.
...
llvm-svn: 105646
2010-06-08 22:14:59 +00:00
Douglas Gregor
6f2e095f06
When referring to a tag that was previously declared only as a friend,
...
build a new declaration for that tag type that will be visible for
future lookups of that tag.
llvm-svn: 105643
2010-06-08 21:27:36 +00:00
Douglas Gregor
ce21919bd6
A built-in overload candidate is consider a non-template function when
...
determining whether one overload candidate is better than
another. Fixes PR7319.
llvm-svn: 105642
2010-06-08 21:03:17 +00:00
Fariborz Jahanian
3b83618054
Block Code Gen. API. Call destructor on descriptior
...
entry previously constructed via copy constructor.
llvm-svn: 105641
2010-06-08 20:57:22 +00:00
Daniel Dunbar
5d02e0bd8a
Simplify libIndex Makefile, which doesn't need to worry about altivec support.
...
llvm-svn: 105639
2010-06-08 20:57:18 +00:00
Daniel Dunbar
ee6b692551
Makefiles: Set Clang CPP compiler flags in a single location, instead of scattered throughout the project Makefiles.
...
llvm-svn: 105638
2010-06-08 20:44:43 +00:00
Daniel Dunbar
e6c1daa8fd
Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.
...
- This eliminates most dependencies on how Clang is installed relative to LLVM.
llvm-svn: 105637
2010-06-08 20:34:18 +00:00
Douglas Gregor
ec170db73d
Warn about comparisons between arrays and improve self-comparison
...
warnings, from Troy Straszheim! Fixes PR6163.
llvm-svn: 105631
2010-06-08 19:50:34 +00:00
Anders Carlsson
446872069f
Correctly handle fields with virtual bases containing empty subobjects.
...
llvm-svn: 105628
2010-06-08 19:09:24 +00:00
Fariborz Jahanian
8e73928f52
Fixes a typo which prevented proper code gen. for
...
copy-in of c++ class objects into blocks.
llvm-svn: 105622
2010-06-08 17:52:11 +00:00
Douglas Gregor
4038cf4b57
Implement a warning when converting the literal 'false' to a
...
pointer. Original patch by Troy D. Straszheim; fixes PR7283.
llvm-svn: 105621
2010-06-08 17:35:15 +00:00