platform/upstream/llvm.git
12 years agochecking test case for r164811. was an omission to not check this in. this was alrea...
Reed Kotler [Mon, 1 Oct 2012 21:35:06 +0000 (21:35 +0000)]
checking test case for  r164811. was an omission to not check this in. this was already approved

llvm-svn: 164972

12 years agoRename a test I just added.
Fariborz Jahanian [Mon, 1 Oct 2012 21:21:50 +0000 (21:21 +0000)]
Rename a test I just added.

llvm-svn: 164971

12 years agoobjective-C modern translator. Test for producing both
Fariborz Jahanian [Mon, 1 Oct 2012 20:55:56 +0000 (20:55 +0000)]
objective-C modern translator. Test for producing both
32bit and 64bit version of modern translator.
// rdar://12189793

llvm-svn: 164970

12 years ago[ms-inline asm] Expose the getReg() function in the base class.
Chad Rosier [Mon, 1 Oct 2012 20:53:03 +0000 (20:53 +0000)]
[ms-inline asm] Expose the getReg() function in the base class.

llvm-svn: 164969

12 years agoFix treatment of case which came up on std-proposals@: 'void' is permitted in core...
Richard Smith [Mon, 1 Oct 2012 20:36:17 +0000 (20:36 +0000)]
Fix treatment of case which came up on std-proposals@: 'void' is permitted in core constant expressions, despite not being a literal type.

llvm-svn: 164968

12 years agoPR13978: A 'decltype' DeclSpec has an expression representation, not a type
Richard Smith [Mon, 1 Oct 2012 20:35:07 +0000 (20:35 +0000)]
PR13978: A 'decltype' DeclSpec has an expression representation, not a type
representation. Fix crash if it appears in the return type of a member function
definition.

llvm-svn: 164967

12 years agoMove isObjCSelf into Expr.
Anna Zaks [Mon, 1 Oct 2012 20:34:04 +0000 (20:34 +0000)]
Move isObjCSelf into Expr.

llvm-svn: 164966

12 years ago[analyzer] Address Jordan's review for r164868.
Anna Zaks [Mon, 1 Oct 2012 20:33:58 +0000 (20:33 +0000)]
[analyzer] Address Jordan's review for r164868.

llvm-svn: 164965

12 years ago[Docs] Update File Headers section to cover doxygen style file level docs.
Michael J. Spencer [Mon, 1 Oct 2012 19:59:21 +0000 (19:59 +0000)]
[Docs] Update File Headers section to cover doxygen style file level docs.

llvm-svn: 164964

12 years agoAdd xml test for availability to comment-xml-schema.c
Fariborz Jahanian [Mon, 1 Oct 2012 19:10:40 +0000 (19:10 +0000)]
Add xml test for availability to comment-xml-schema.c

llvm-svn: 164961

12 years ago[analyzer] Allow ObjC ivar lvalues where the base is nil.
Jordan Rose [Mon, 1 Oct 2012 19:07:22 +0000 (19:07 +0000)]
[analyzer] Allow ObjC ivar lvalues where the base is nil.

By analogy with C structs, this seems to be legal, if probably discouraged.
It's only if the ivar is read from or written to that there's a problem.
Running a program that gets the "address" of an instance variable does in
fact return the offset when the base "object" is nil.

This isn't a full revert because r164442 includes some diagnostic tweaks
as well; those have been kept.

This partially reverts r164442 / 08965091770c9b276c238bac2f716eaa4da2dca4.

llvm-svn: 164960

12 years ago[analyzer] Add a test for PR13927 "offsetof replacement flagged as null deref"
Jordan Rose [Mon, 1 Oct 2012 19:07:19 +0000 (19:07 +0000)]
[analyzer] Add a test for PR13927 "offsetof replacement flagged as null deref"

This seems to be legal according to C11 6.5.3.2.

No functionality change.

llvm-svn: 164959

12 years agoRevert "[analyzer] Check that a member expr is valid even when the result is an lvalue."
Jordan Rose [Mon, 1 Oct 2012 19:07:15 +0000 (19:07 +0000)]
Revert "[analyzer] Check that a member expr is valid even when the result is an lvalue."

The original intent of this commit was to catch potential null dereferences
early, but it breaks the common "home-grown offsetof" idiom (PR13927):

 (((struct Foo *)0)->member - ((struct foo *)0))

As it turns out, this appears to be legal in C, per a footnote in
C11 6.5.3.2: "Thus, &*E is equivalent to E (even if E is a null pointer)".
In C++ this issue is still open:
  http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#232

We'll just have to make sure we have good path notes in the future.

This reverts r164441 / 9be016dcd1ca3986873a7b66bd4bc027309ceb59.

llvm-svn: 164958

12 years agoavailability in structured documents. Takes
Fariborz Jahanian [Mon, 1 Oct 2012 18:42:25 +0000 (18:42 +0000)]
availability in structured documents. Takes
care of comments by Dimitri and Doug.

llvm-svn: 164957

12 years agoRe-enable support for --program-prefix.
Jordan Rose [Mon, 1 Oct 2012 18:40:32 +0000 (18:40 +0000)]
Re-enable support for --program-prefix.

The Apple buildbots have been modified not to pass --target,
so they shouldn't choke on a default program prefix anymore.

Patch by Rick Foos!

llvm-svn: 164956

12 years agoHave AnalyzerOptions::getBooleanOption() stick the matching config
Ted Kremenek [Mon, 1 Oct 2012 18:28:19 +0000 (18:28 +0000)]
Have AnalyzerOptions::getBooleanOption() stick the matching config
string in the config table so that it can be dumped as part of the
config dumper.  Add a test to show that these options are sticking
and can be cross-checked using FileCheck.

llvm-svn: 164954

12 years agoAdd checker debug.ConfigDumper to dump the contents of the configuration table.
Ted Kremenek [Mon, 1 Oct 2012 18:28:14 +0000 (18:28 +0000)]
Add checker debug.ConfigDumper to dump the contents of the configuration table.
The format of this output is a WIP; largely I'm bringing it up now
for regression testing.  We can evolve the output format over time.

llvm-svn: 164953

12 years agoReapply "[analyzer] Handle inlined constructors for rvalue temporaries correctly."
Jordan Rose [Mon, 1 Oct 2012 17:51:35 +0000 (17:51 +0000)]
Reapply "[analyzer] Handle inlined constructors for rvalue temporaries correctly."

This is related to but not blocked by <rdar://problem/12137950>
("Return-by-value structs do not have associated regions")

This reverts r164875 / 3278d41e17749dbedb204a81ef373499f10251d7.

llvm-svn: 164952

12 years agoCleaning up the self initialization checker.
Richard Trieu [Mon, 1 Oct 2012 17:39:51 +0000 (17:39 +0000)]
Cleaning up the self initialization checker.
-Allow Sema to do more processing on the initial Expr before checking it.
-Remove the special conditions in HandleExpr()
-Move the code so that only one call site is needed.
-Removed the function from Sema and only call it locally.
-Warn on potentially evaluated reference variables, not just casts to r-values.
-Update tests.

llvm-svn: 164951

12 years ago<rdar://problem/12406088> Fixing a crasher with adding a regex command, due to access...
Enrico Granata [Mon, 1 Oct 2012 17:19:37 +0000 (17:19 +0000)]
<rdar://problem/12406088> Fixing a crasher with adding a regex command, due to accessing a shared pointer without first checking for NULL

llvm-svn: 164950

12 years agoForgot the SPIR test case.
Micah Villmow [Mon, 1 Oct 2012 17:07:51 +0000 (17:07 +0000)]
Forgot the SPIR test case.

llvm-svn: 164949

12 years agoAdd in support for SPIR to LLVM core. This adds a new target and two new calling...
Micah Villmow [Mon, 1 Oct 2012 17:01:31 +0000 (17:01 +0000)]
Add in support for SPIR to LLVM core. This adds a new target and two new calling conventions.

llvm-svn: 164948

12 years ago[analyzer] Make ProgramStateManager's SubEngine parameter optional.
Jordan Rose [Mon, 1 Oct 2012 16:53:40 +0000 (16:53 +0000)]
[analyzer] Make ProgramStateManager's SubEngine parameter optional.

It is possible and valid to have a state manager and associated objects
without having a SubEngine or checkers.

Patch by Olaf Krzikalla!

llvm-svn: 164947

12 years agoFix PR13899
Michael Liao [Mon, 1 Oct 2012 16:44:04 +0000 (16:44 +0000)]
Fix PR13899

- Update maximal stack alignment when stack arguments are prepared before a
  call.
- Test cases are enhanced to show it's not a Win32 specific issue but a generic
  one.

llvm-svn: 164946

12 years agoProvide a shortcut for MCObjectStreamer when emitting fills.
Benjamin Kramer [Mon, 1 Oct 2012 15:14:14 +0000 (15:14 +0000)]
Provide a shortcut for MCObjectStreamer when emitting fills.

Reduces runtime of i386-large-relocations.s by 10x in Release builds, even more
in Debug+Asserts builds.

llvm-svn: 164945

12 years agoFix ASTMatchersTests in configurations where
Daniel Jasper [Mon, 1 Oct 2012 15:05:34 +0000 (15:05 +0000)]
Fix ASTMatchersTests in configurations where
"#include <initializer_list>" is unavailable for whatever reason.

llvm-svn: 164944

12 years agoAdd matchers for selected C++11 features.
Daniel Jasper [Mon, 1 Oct 2012 13:40:41 +0000 (13:40 +0000)]
Add matchers for selected C++11 features.

Patch by Gábor Horváth.
Review: http://llvm-reviews.chandlerc.com/D46

llvm-svn: 164943

12 years agoFix more misspellings found by Duncan during review.
Chandler Carruth [Mon, 1 Oct 2012 12:30:45 +0000 (12:30 +0000)]
Fix more misspellings found by Duncan during review.

llvm-svn: 164940

12 years agoMake this plural. Spotted by Duncan in review (and a very old typo, this
Chandler Carruth [Mon, 1 Oct 2012 12:24:42 +0000 (12:24 +0000)]
Make this plural. Spotted by Duncan in review (and a very old typo, this
is the second time I've moved this comment around...)

llvm-svn: 164939

12 years agoPrune some unnecessary includes.
Chandler Carruth [Mon, 1 Oct 2012 12:21:54 +0000 (12:21 +0000)]
Prune some unnecessary includes.

llvm-svn: 164938

12 years agoFix several issues with alignment. We weren't always accounting for type
Chandler Carruth [Mon, 1 Oct 2012 12:16:54 +0000 (12:16 +0000)]
Fix several issues with alignment. We weren't always accounting for type
alignment requirements of the new alloca. As one consequence which was
reported as a bug by Duncan, we overaligned memcpy calls to ranges of
allocas after they were rewritten to types with lower alignment
requirements. Other consquences are possible, but I don't have any test
cases for them.

llvm-svn: 164937

12 years agoTargetData: s/uint32_t/unsigned/ per Kuba's request.
Benjamin Kramer [Mon, 1 Oct 2012 11:56:16 +0000 (11:56 +0000)]
TargetData: s/uint32_t/unsigned/ per Kuba's request.

llvm-svn: 164935

12 years agoSimplifyCFG: Don't crash when forming a switch bitmap with an undef default value.
Benjamin Kramer [Mon, 1 Oct 2012 11:31:48 +0000 (11:31 +0000)]
SimplifyCFG: Don't crash when forming a switch bitmap with an undef default value.

Fixes PR13985.

llvm-svn: 164934

12 years agoFactor the PHI and select speculation into a separate rewriter. This
Chandler Carruth [Mon, 1 Oct 2012 10:54:05 +0000 (10:54 +0000)]
Factor the PHI and select speculation into a separate rewriter. This
could probably be factored still further to hoist this logic into
a generic helper, but currently I don't have particularly clean ideas
about how to handle that.

This at least allows us to drop custom load rewriting from the
speculation logic, which in turn allows the existing load rewriting
logic to fire. In theory, this could enable vector promotion or other
tricks after speculation occurs, but I've not dug into such issues. This
is primarily just cleaning up the factoring of the code and the
resulting logic.

llvm-svn: 164933

12 years agoThe Redeclarable part of named decls is read before their name.
Axel Naumann [Mon, 1 Oct 2012 09:51:27 +0000 (09:51 +0000)]
The Redeclarable part of named decls is read before their name.
Lookup can nevertheless find them due to the serialized lookup table.
For instance when reading a template decl's templatedDecl, it will search for existing decls that it could be a redeclaration of, and find the half-read template decl.
Thus there is no point in asserting the names of decls.

llvm-svn: 164932

12 years agoAlso merge template redeclarations.
Axel Naumann [Mon, 1 Oct 2012 09:18:00 +0000 (09:18 +0000)]
Also merge template redeclarations.
Don't require specializations (of existing and read template) to be unique.

llvm-svn: 164931

12 years agoMark two Clang tests as passing on ARM
Nico Weber [Mon, 1 Oct 2012 08:44:54 +0000 (08:44 +0000)]
Mark two Clang tests as passing on ARM

Also move one of them from grep to FileCheck.
Patch from Joey Gouly <joey.gouly@arm.com>!

llvm-svn: 164929

12 years agofix test/CodeGen/tbaa-for-vptr.cpp: don't hardcode the index of metadata
Kostya Serebryany [Mon, 1 Oct 2012 08:39:00 +0000 (08:39 +0000)]
fix test/CodeGen/tbaa-for-vptr.cpp: don't hardcode the index of metadata

llvm-svn: 164928

12 years agoBring ASTReader and Writer into sync for the case where a canonical template speciali...
Axel Naumann [Mon, 1 Oct 2012 07:34:47 +0000 (07:34 +0000)]
Bring ASTReader and Writer into sync for the case where a canonical template specialization was written, which is non-canonical at the time of reading: force the reading of the ClassTemplateDecl if it was written.
The easiest way out is to store whether the decl was canonical at the time of writing.
Add test.

llvm-svn: 164927

12 years agoUse constants for all return values in switch. Allows clang to optimize it into a...
Craig Topper [Mon, 1 Oct 2012 07:33:27 +0000 (07:33 +0000)]
Use constants for all return values in switch. Allows clang to optimize it into a lookup table.

llvm-svn: 164926

12 years agoRefactor the PartitionUse structure to actually use the Use* instead of
Chandler Carruth [Mon, 1 Oct 2012 01:49:22 +0000 (01:49 +0000)]
Refactor the PartitionUse structure to actually use the Use* instead of
a pair of instructions, one for the used pointer and the second for the
user. This simplifies the representation and also makes it more dense.

This was noticed because of the miscompile in PR13926. In that case, we
were running up against a fundamental "bad idea" in the speculation of
PHI and select instructions: the speculation and rewriting are
interleaved, which requires phi speculation to also perform load
rewriting! This is bad, and causes us to miss opportunities to do (for
example) vector rewriting only exposed after PHI speculation, etc etc.
It also, in the old system, required us to insert *new* load uses into
the current partition's use list, which would then be ignored during
rewriting because we had already extracted an end iterator for the use
list. The appending behavior (and much of the other oddities) stem from
the strange de-duplication strategy in the PartitionUse builder.
Amusingly, all this went without notice for so long because it could
only be triggered by having *different* GEPs into the same partition of
the same alloca, where both different GEPs were operands of a single
PHI, and where the GEP which was not encountered first also had multiple
uses within that same PHI node... Hence the insane steps required to
reproduce.

So, step one in fixing this fundamental bad idea is to make the
PartitionUse actually contain a Use*, and to make the builder do proper
deduplication instead of funky de-duplication. This is enough to remove
the appending behavior, and fix the miscompile in PR13926, but there is
more work to be done here. Subsequent commits will lift the speculation
into its own visitor. It'll be a useful step toward potentially
extracting all of the speculation logic into a generic utility
transform.

The existing PHI test case for repeated operands has been made more
extreme to catch even these issues. This test case, run through the old
pass, will exactly reproduce the miscompile from PR13926. ;] We were so
close here!

llvm-svn: 164925

12 years agoUse dyn_cast instead of isa and cast.
Jakub Staszak [Sun, 30 Sep 2012 21:24:57 +0000 (21:24 +0000)]
Use dyn_cast instead of isa and cast.

No functionality change.

llvm-svn: 164924

12 years agoSimplifyCFG: Enumerating all predecessors of a BB can be expensive (switches), avoid...
Benjamin Kramer [Sun, 30 Sep 2012 21:03:56 +0000 (21:03 +0000)]
SimplifyCFG: Enumerating all predecessors of a BB can be expensive (switches), avoid it if possible.

No functionality change.

llvm-svn: 164923

12 years agoRST docs: convert HTML escapes to plain text in code examples.
Dmitri Gribenko [Sun, 30 Sep 2012 20:51:02 +0000 (20:51 +0000)]
RST docs: convert HTML escapes to plain text in code examples.

llvm-svn: 164922

12 years agoSphinx CSS: remove negative letter-spacing, it makes some fonts look really
Dmitri Gribenko [Sun, 30 Sep 2012 20:43:24 +0000 (20:43 +0000)]
Sphinx CSS: remove negative letter-spacing, it makes some fonts look really
bad.  Fonts already have appropriate tracking built-in.

llvm-svn: 164921

12 years agoFix &amp;&amp; to && in Coding Standards.
Jakub Staszak [Sun, 30 Sep 2012 20:42:13 +0000 (20:42 +0000)]
Fix &amp;&amp; to && in Coding Standards.

llvm-svn: 164920

12 years agoChange getX86SubSuperRegister to take an MVT::SimpleValueType rather than an EVT...
Craig Topper [Sun, 30 Sep 2012 19:49:56 +0000 (19:49 +0000)]
Change getX86SubSuperRegister to take an MVT::SimpleValueType rather than an EVT and add llvm_unreachable to the switches. Helps it compile to dramatically better code.

llvm-svn: 164919

12 years agoArgumentPromotion: Remove ancient workaround for a bug in the C backend.
Benjamin Kramer [Sun, 30 Sep 2012 17:31:56 +0000 (17:31 +0000)]
ArgumentPromotion: Remove ancient workaround for a bug in the C backend.

Fun fact: The CBE learned how to deal with this situation before it was removed.

llvm-svn: 164918

12 years agoCodeGen: Copy tail padding when we're not dealing with a trivial copy assign or move...
Benjamin Kramer [Sun, 30 Sep 2012 12:43:37 +0000 (12:43 +0000)]
CodeGen: Copy tail padding when we're not dealing with a trivial copy assign or move assign operator.

This fixes a regression from r162254, the optimizer has problems reasoning
about the smaller memcpy as it's often not safe to widen a store but making it
smaller is.

llvm-svn: 164917

12 years agoFilter out tools and unittests which we don't want to build when we're building clang...
Bill Wendling [Sun, 30 Sep 2012 11:23:30 +0000 (11:23 +0000)]
Filter out tools and unittests which we don't want to build when we're building clang only.

llvm-svn: 164916

12 years agoRemove this hack in favor of another, better way of performing the same thing.
Bill Wendling [Sun, 30 Sep 2012 11:22:45 +0000 (11:22 +0000)]
Remove this hack in favor of another, better way of performing the same thing.

llvm-svn: 164915

12 years agoIgnore apparent buffer overruns on external or weak globals. This is a major
Duncan Sands [Sun, 30 Sep 2012 07:30:10 +0000 (07:30 +0000)]
Ignore apparent buffer overruns on external or weak globals.  This is a major
source of false positives due to globals being declared in a header with some
kind of incomplete (small) type, but the actual definition being bigger.

llvm-svn: 164912

12 years agoRevert r164910 because it causes failures to several phase2 builds.
Nadav Rotem [Sun, 30 Sep 2012 07:17:56 +0000 (07:17 +0000)]
Revert r164910 because it causes failures to several phase2 builds.

llvm-svn: 164911

12 years agoA DAGCombine optimization for merging consecutive stores. This optimization is not...
Nadav Rotem [Sun, 30 Sep 2012 06:24:14 +0000 (06:24 +0000)]
A DAGCombine optimization for merging consecutive stores. This optimization is not profitable in many cases
because moden processos can store multiple values in parallel, and preparing the consecutive store requires
some work.  We only handle these cases:

1. Consecutive stores where the values and consecutive loads. For example:
 int a = p->a;
 int b = p->b;
 q->a = a;
 q->b = b;

2. Consecutive stores where the values are constants. Foe example:
 q->a = 4;
 q->b = 5;

llvm-svn: 164910

12 years agoTemporarily comment out some new arm variants to try to fix buildbots.
Bob Wilson [Sun, 30 Sep 2012 05:34:28 +0000 (05:34 +0000)]
Temporarily comment out some new arm variants to try to fix buildbots.

llvm-svn: 164909

12 years agoSpecify a full target in an attempt to appease buildbots.
Bob Wilson [Sun, 30 Sep 2012 00:58:28 +0000 (00:58 +0000)]
Specify a full target in an attempt to appease buildbots.

llvm-svn: 164908

12 years agoAdd Clang support for iOS6.
Bob Wilson [Sat, 29 Sep 2012 23:52:58 +0000 (23:52 +0000)]
Add Clang support for iOS6.

llvm-svn: 164907

12 years agoAdd ARM VFPv4 feature and enable it by default for Swift.
Bob Wilson [Sat, 29 Sep 2012 23:52:52 +0000 (23:52 +0000)]
Add ARM VFPv4 feature and enable it by default for Swift.

llvm-svn: 164906

12 years agoAdd armv7s and some other arm variants supported by Mach-O files.
Bob Wilson [Sat, 29 Sep 2012 23:52:50 +0000 (23:52 +0000)]
Add armv7s and some other arm variants supported by Mach-O files.

llvm-svn: 164905

12 years agoAdd an FMA intrinsic for ARM Neon.
Bob Wilson [Sat, 29 Sep 2012 23:52:48 +0000 (23:52 +0000)]
Add an FMA intrinsic for ARM Neon.

llvm-svn: 164904

12 years agoAdd compiler-rt support for Swift.
Bob Wilson [Sat, 29 Sep 2012 23:37:01 +0000 (23:37 +0000)]
Add compiler-rt support for Swift.

llvm-svn: 164903

12 years agoAdd support for iOS6.
Bob Wilson [Sat, 29 Sep 2012 23:25:48 +0000 (23:25 +0000)]
Add support for iOS6.

llvm-svn: 164902

12 years agoWhitespace.
Bob Wilson [Sat, 29 Sep 2012 22:08:54 +0000 (22:08 +0000)]
Whitespace.

llvm-svn: 164900

12 years agoAdd LLVM support for Swift.
Bob Wilson [Sat, 29 Sep 2012 21:43:49 +0000 (21:43 +0000)]
Add LLVM support for Swift.

llvm-svn: 164899

12 years agoWhitespace.
Bob Wilson [Sat, 29 Sep 2012 21:27:31 +0000 (21:27 +0000)]
Whitespace.

llvm-svn: 164898

12 years agoShrink TargetAlignElem a bit, we do a lot of searches on them.
Benjamin Kramer [Sat, 29 Sep 2012 19:57:14 +0000 (19:57 +0000)]
Shrink TargetAlignElem a bit, we do a lot of searches on them.

llvm-svn: 164897

12 years agoFix refersToDeclaration()-matcher and add missing test case. This was
Daniel Jasper [Sat, 29 Sep 2012 15:55:18 +0000 (15:55 +0000)]
Fix refersToDeclaration()-matcher and add missing test case. This was
broken as of r164656 as TemplateArgument::getAsDecl() now asserts
instead of returning NULL for other template arugment kinds.

llvm-svn: 164896

12 years agoMove the 'find macro by spelling' infrastructure to the Preprocessor class and
Dmitri Gribenko [Sat, 29 Sep 2012 11:40:46 +0000 (11:40 +0000)]
Move the 'find macro by spelling' infrastructure to the Preprocessor class and
use it to suggest appropriate macro for __attribute__((deprecated)) in
-Wdocumentation-deprecated-sync.

llvm-svn: 164892

12 years agoFix a somewhat surprising miscompile where code relying on an ABI
Chandler Carruth [Sat, 29 Sep 2012 10:41:21 +0000 (10:41 +0000)]
Fix a somewhat surprising miscompile where code relying on an ABI
alignment could lose it due to the alloca type moving down to a much
smaller alignment guarantee.

Now SROA will actively compute a proper alignment, factoring the target
data, any explicit alignment, and the offset within the struct. This
will in some cases lower the alignment requirements, but when we lower
them below those of the type, we drop the alignment entirely to give
freedom to the code generator to align it however is convenient.

Thanks to Duncan for the lovely test case that pinned this down. =]

llvm-svn: 164891

12 years agoSpeculatively revert commit 164885 (nadav) in the hope of ressurecting a pile of
Duncan Sands [Sat, 29 Sep 2012 10:25:35 +0000 (10:25 +0000)]
Speculatively revert commit 164885 (nadav) in the hope of ressurecting a pile of
buildbots.  Original commit message:

A DAGCombine optimization for merging consecutive stores. This optimization is not profitable in many cases
because moden processos can store multiple values in parallel, and preparing the consecutive store requires
some work.  We only handle these cases:

1. Consecutive stores where the values and consecutive loads. For example:
  int a = p->a;
  int b = p->b;
  q->a = a;
  q->b = b;

2. Consecutive stores where the values are constants. Foe example:
  q->a = 4;
  q->b = 5;

llvm-svn: 164890

12 years agoComment XML schema: correct indentation.
Dmitri Gribenko [Sat, 29 Sep 2012 08:27:37 +0000 (08:27 +0000)]
Comment XML schema: correct indentation.

llvm-svn: 164889

12 years agoAdd the RelocateOrLoadKernel and LoadKernel methods to ProcessGDBRemote::DoRemoteConn...
Jason Molenda [Sat, 29 Sep 2012 08:03:33 +0000 (08:03 +0000)]
Add the RelocateOrLoadKernel and LoadKernel methods to ProcessGDBRemote::DoRemoteConnect().
When attaching to a remote system that does not look like a typical vendor system, and no
executable binary was specified to lldb, check a couple of fixed locations where kernels
running in ASLR mode (slid in memory to a random address) store their load addr when booted
in debug mode, and relocate the symbols or load the kernel wholesale from the host computer
if we can find it.

<rdar://problem/7714201>

llvm-svn: 164888

12 years agoTidy up to match coding standards. Remove 'else' after 'return' and moving operators...
Craig Topper [Sat, 29 Sep 2012 07:18:53 +0000 (07:18 +0000)]
Tidy up to match coding standards. Remove 'else' after 'return' and moving operators to end of preceding line. No functional change intended.

llvm-svn: 164887

12 years agoReplace a couple if/elses around similar calls with conditional operators on the...
Craig Topper [Sat, 29 Sep 2012 06:54:22 +0000 (06:54 +0000)]
Replace a couple if/elses around similar calls with conditional operators on the varying arguments. No functional change.

llvm-svn: 164886

12 years agoA DAGCombine optimization for merging consecutive stores. This optimization is not...
Nadav Rotem [Sat, 29 Sep 2012 06:33:25 +0000 (06:33 +0000)]
A DAGCombine optimization for merging consecutive stores. This optimization is not profitable in many cases
because moden processos can store multiple values in parallel, and preparing the consecutive store requires
some work.  We only handle these cases:

1. Consecutive stores where the values and consecutive loads. For example:
  int a = p->a;
  int b = p->b;
  q->a = a;
  q->b = b;

2. Consecutive stores where the values are constants. Foe example:
  q->a = 4;
  q->b = 5;

llvm-svn: 164885

12 years agoAdd support for debugging KASLR kernels via kdp (the kernel being
Jason Molenda [Sat, 29 Sep 2012 04:02:01 +0000 (04:02 +0000)]
Add support for debugging KASLR kernels via kdp (the kernel being
loaded at a random offset).

To get the kernel's UUID and load address I need to send a kdp
packet so I had to implement the kernel relocation (and attempt to
find the kernel if none was provided to lldb already) in ProcessKDP
-- but this code really properly belongs in DynamicLoaderDarwinKernel.

I also had to add an optional Stream to ConnectRemote so
ProcessKDP::DoConnectRemote can print feedback about the remote kernel's
UUID, load address, and notify the user if we auto-loaded the kernel via
the UUID.

<rdar://problem/7714201>

llvm-svn: 164881

12 years agoRemove more LLVM_DELETED_FUNCTIONs from destructors to fix -std=c++11 build on gcc...
Craig Topper [Sat, 29 Sep 2012 02:25:34 +0000 (02:25 +0000)]
Remove more LLVM_DELETED_FUNCTIONs from destructors to fix -std=c++11 build on gcc 4.7.

llvm-svn: 164880

12 years agoclang/test/CodeGen/tbaa-struct.cpp: Fix. Be aware of 32 bit pointer.
NAKAMURA Takumi [Sat, 29 Sep 2012 02:00:04 +0000 (02:00 +0000)]
clang/test/CodeGen/tbaa-struct.cpp: Fix. Be aware of 32 bit pointer.

llvm-svn: 164879

12 years agoNow in the presence of an Objective-C version 2
Sean Callanan [Sat, 29 Sep 2012 01:53:36 +0000 (01:53 +0000)]
Now in the presence of an Objective-C version 2
runtime, we read method signatures for both class
and instance methods out of the runtime data.

(lldb) fr var str
(NSString *) str = 0x0000000105000180 @"Hello from '/Volumes/Data/projects/lldb/test/lang/objc/foundation/a.out'"
(lldb) expr str.length
(unsigned long long) $0 = 72
(lldb) expr [NSString stringWithCString:"Hello world!" encoding:1]
(id) $1 = 0x0000000105100050
(lldb) po $1
$1 = 0x0000000105100050 Hello world!

(lldb) fr var array1
(NSArray *) array1 = 0x000000010010a6e0 @"3 objects"
(lldb) expr array1.count
(unsigned long long) $0 = 3
(lldb) expr [array1 objectAtIndex:2]
(id) $1 = 0x00000001000025d0
(lldb) po $1
$1 = 0x00000001000025d0 array1 object3

Notice that both regular and property-style notation
work.  I still need to add explicit support for
properties with non-default setters/getters.

This information is only queried if an Objective-C
object does not have debug information for a complete
type available.  Otherwise we query debug information
as usual.

llvm-svn: 164878

12 years agoRevert "[analyzer] Create a temporary region for rvalue structs when accessing fields"
Jordan Rose [Sat, 29 Sep 2012 01:36:51 +0000 (01:36 +0000)]
Revert "[analyzer] Create a temporary region for rvalue structs when accessing fields"

This reverts commit 6f61df3e7256413dcb99afb9673f4206e3c4992c.

llvm-svn: 164877

12 years agoRevert "[analyzer] Create a temp region when a method is called on a struct rvalue."
Jordan Rose [Sat, 29 Sep 2012 01:36:47 +0000 (01:36 +0000)]
Revert "[analyzer] Create a temp region when a method is called on a struct rvalue."

This reverts commit 0006ba445962621ed82ec84400a6b978205a3fbc.

llvm-svn: 164876

12 years agoRevert "[analyzer] Handle inlined constructors for rvalue temporaries correctly."
Jordan Rose [Sat, 29 Sep 2012 01:36:42 +0000 (01:36 +0000)]
Revert "[analyzer] Handle inlined constructors for rvalue temporaries correctly."

This reverts commit 580cd17f256259f39a382e967173f34d68e73859.

llvm-svn: 164875

12 years agoFor PPCallbacks::InclusionDirective() add a parameter for the module, whenever
Argyrios Kyrtzidis [Sat, 29 Sep 2012 01:06:10 +0000 (01:06 +0000)]
For PPCallbacks::InclusionDirective() add a parameter for the module, whenever
an inclusion directive was automatically turned into a module import, and
PPCallbacks::moduleImport() for an explicit module import.

llvm-svn: 164874

12 years agoIn the Module class, add a reference to the corresponding AST file.
Argyrios Kyrtzidis [Sat, 29 Sep 2012 01:06:04 +0000 (01:06 +0000)]
In the Module class, add a reference to the corresponding AST file.

llvm-svn: 164873

12 years agoAdd an assertion to make sure the implicitly imported module
Argyrios Kyrtzidis [Sat, 29 Sep 2012 01:06:01 +0000 (01:06 +0000)]
Add an assertion to make sure the implicitly imported module
is the same as the suggested one when looking up the include filename.

llvm-svn: 164872

12 years ago<rdar://problem/12378910> Fix a bunch of other places where similar problems could...
Enrico Granata [Sat, 29 Sep 2012 00:47:43 +0000 (00:47 +0000)]
<rdar://problem/12378910> Fix a bunch of other places where similar problems could happen

llvm-svn: 164871

12 years ago<rdar://problem/12378910> Fixing a potential crasher in the data formatters where...
Enrico Granata [Sat, 29 Sep 2012 00:45:53 +0000 (00:45 +0000)]
<rdar://problem/12378910> Fixing a potential crasher in the data formatters where we fail to check for NULL or empty class name

llvm-svn: 164870

12 years ago[analyzer] Do not visit ObjCMethodDecl twice in the AST checkers.
Anna Zaks [Sat, 29 Sep 2012 00:20:40 +0000 (00:20 +0000)]
[analyzer] Do not visit ObjCMethodDecl twice in the AST checkers.

llvm-svn: 164869

12 years ago[analyzer] Re-implement IvarInvalidationChecker so that it verifies that
Anna Zaks [Sat, 29 Sep 2012 00:20:38 +0000 (00:20 +0000)]
[analyzer] Re-implement IvarInvalidationChecker so that it verifies that
the validation occurred.

The original implementation was pessimistic - we assumed that ivars
which escape are invalidated. This version is optimistic, it assumes
that the ivars will always be explicitly invalidated: either set to nil
or sent an invalidation message.

llvm-svn: 164868

12 years agoAdd test case for r164850.
Evan Cheng [Sat, 29 Sep 2012 00:12:08 +0000 (00:12 +0000)]
Add test case for r164850.

llvm-svn: 164867

12 years agoDo not delete BBs if their addresses are taken. rdar://12396696
Evan Cheng [Fri, 28 Sep 2012 23:58:57 +0000 (23:58 +0000)]
Do not delete BBs if their addresses are taken. rdar://12396696

llvm-svn: 164866

12 years agoImplementing plugins that provide commands.
Enrico Granata [Fri, 28 Sep 2012 23:57:51 +0000 (23:57 +0000)]
Implementing plugins that provide commands.
This checkin adds the capability for LLDB to load plugins from external dylibs that can provide new commands
It exports an SBCommand class from the public API layer, and a new SBCommandPluginInterface

There is a minimal load-only plugin manager built into the debugger, which can be accessed via Debugger::LoadPlugin.

Plugins are loaded from two locations at debugger startup (LLDB.framework/Resources/PlugIns and ~/Library/Application Support/LLDB/PlugIns) and more can be (re)loaded via the "plugin load" command

For an example of how to make a plugin, refer to the fooplugin.cpp file in examples/plugins/commands

Caveats:
Currently, the new API objects and features are not exposed via Python.
The new commands can only be "parsed" (i.e. not raw) and get their command line via a char** parameter (we do not expose our internal Args object)
There is no unloading feature, which can potentially lead to leaks if you overwrite the commands by reloading the same or different plugins
There is no API exposed for option parsing, which means you may need to use getopt or roll-your-own

llvm-svn: 164865

12 years agoPR13941: Mark all virtual functions as unnamed_addr. It's not possible to
Richard Smith [Fri, 28 Sep 2012 22:46:07 +0000 (22:46 +0000)]
PR13941: Mark all virtual functions as unnamed_addr. It's not possible to
observe their addresses (taking their address gives the vtable slot) so we are
free to merge their definitions.

llvm-svn: 164864

12 years agoSet up code under _LIBCXX_DYNAMIC_FALLBACK which is off by default. For a full descr...
Howard Hinnant [Fri, 28 Sep 2012 22:43:50 +0000 (22:43 +0000)]
Set up code under _LIBCXX_DYNAMIC_FALLBACK which is off by default.  For a full description of _LIBCXX_DYNAMIC_FALLBACK, see src/private_typeinfo.cpp.

llvm-svn: 164863

12 years agoUse a custom DenseMapInfo for WeakObjectProfileTy.
Jordan Rose [Fri, 28 Sep 2012 22:42:04 +0000 (22:42 +0000)]
Use a custom DenseMapInfo for WeakObjectProfileTy.

We can't specialize the usual llvm::DenseMapInfo at the end of the file
because by that point the DenseMap in FunctionScopeInfo has already been
instantiated.

No functionality change.

llvm-svn: 164862

12 years ago[Doc parsing] Add availability information to generated Comment XML.
Fariborz Jahanian [Fri, 28 Sep 2012 22:35:49 +0000 (22:35 +0000)]
[Doc parsing] Add availability information to generated Comment XML.
(I still need to add a test once I figure it out).
Reviewed off-line by Doug. // rdar://12378879

llvm-svn: 164861

12 years agoDon't use bit-wise operations to query for inclusion/exclusion of attributes.
Bill Wendling [Fri, 28 Sep 2012 22:30:18 +0000 (22:30 +0000)]
Don't use bit-wise operations to query for inclusion/exclusion of attributes.

llvm-svn: 164860

12 years agoFix buildbots by not using a template from another namespace.
Jordan Rose [Fri, 28 Sep 2012 22:29:02 +0000 (22:29 +0000)]
Fix buildbots by not using a template from another namespace.

No need to specialize BeforeThanCompare for a comparator that's only
going to be used once.

llvm-svn: 164859

12 years agoCompatibility macro detection for the -Wimplicit-fallthrough diagnostic.
Alexander Kornienko [Fri, 28 Sep 2012 22:24:03 +0000 (22:24 +0000)]
Compatibility macro detection for the -Wimplicit-fallthrough diagnostic.

Summary:
When issuing a diagnostic message for the -Wimplicit-fallthrough diagnostics, always try to find the latest macro, defined at the point of fallthrough, which is immediately expanded to "[[clang::fallthrough]]", and use it's name instead of the actual sequence.

Known issues:
  * uses PP.getSpelling() to compare macro definition with a string (anyone can suggest a convenient way to fill a token array, or maybe lex it in runtime?);
  * this can be generalized and used in other similar cases, any ideas where it should reside then?

Reviewers: doug.gregor, rsmith

Reviewed By: rsmith

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D50

llvm-svn: 164858

12 years ago-Wreceiver-is-weak: rephrase warning text and add a suggestion Note.
Jordan Rose [Fri, 28 Sep 2012 22:21:42 +0000 (22:21 +0000)]
-Wreceiver-is-weak: rephrase warning text and add a suggestion Note.

New output:
  warning: weak property may be unpredictably set to nil
  note: property declared here
  note: assign the value to a strong variable to keep the object alive
        during use

<rdar://problem/12277204>

llvm-svn: 164857