platform/upstream/llvm.git
11 years agoRemove unused name of variable to quiet a warning. Also canonicalize a
Nick Lewycky [Mon, 24 Sep 2012 23:47:23 +0000 (23:47 +0000)]
Remove unused name of variable to quiet a warning. Also canonicalize a
declaration to use the same form as in the rest of the file. No functionality
change.

llvm-svn: 164576

11 years agoApply the emulated nullptr_t with constexpr. This is an unusual configuration that...
Howard Hinnant [Mon, 24 Sep 2012 23:36:40 +0000 (23:36 +0000)]
Apply the emulated nullptr_t with constexpr.  This is an unusual configuration that would take advantage of this.  But it has popped up in the wild and does no harm to support it.

llvm-svn: 164575

11 years agoMaking sure we do not try to compare a NULL string - which would cause us to crash
Enrico Granata [Mon, 24 Sep 2012 23:30:10 +0000 (23:30 +0000)]
Making sure we do not try to compare a NULL string - which would cause us to crash

llvm-svn: 164574

11 years agoAdded a new Xcode build configuration, DebugClang,
Sean Callanan [Mon, 24 Sep 2012 23:21:18 +0000 (23:21 +0000)]
Added a new Xcode build configuration, DebugClang,
which builds a Debug+Asserts build of Clang and
links LLDB against it.  The Debug configuration
builds Clang with Release+Asserts, for faster
linking and smaller memory footprint when debugging
the build LLDB.

llvm-svn: 164573

11 years agoRemoved some debugging cruft.
Sean Callanan [Mon, 24 Sep 2012 23:11:56 +0000 (23:11 +0000)]
Removed some debugging cruft.

llvm-svn: 164572

11 years agoMark jump tables in code sections with DataRegion directives.
Jim Grosbach [Mon, 24 Sep 2012 23:06:27 +0000 (23:06 +0000)]
Mark jump tables in code sections with DataRegion directives.

Even out-of-line jump tables can be in the code section, so mark them
as data-regions for those targets which support the directives.

rdar://12362871&12362974

llvm-svn: 164571

11 years agoTypo.
Chad Rosier [Mon, 24 Sep 2012 23:04:25 +0000 (23:04 +0000)]
Typo.

llvm-svn: 164570

11 years agoHandle C++ functional casts in a similar way to C-style casts in
Eli Friedman [Mon, 24 Sep 2012 23:02:26 +0000 (23:02 +0000)]
Handle C++ functional casts in a similar way to C-style casts in
unused expression warnings.  <rdar://problem/12359208>.

llvm-svn: 164569

11 years agoUpdate for r164567.
Chad Rosier [Mon, 24 Sep 2012 22:58:50 +0000 (22:58 +0000)]
Update for r164567.

llvm-svn: 164568

11 years agoRather then have a wrapper function, have tblgen instantiate the implementation.
Chad Rosier [Mon, 24 Sep 2012 22:57:55 +0000 (22:57 +0000)]
Rather then have a wrapper function, have tblgen instantiate the implementation.
Also remove an unused argument.

llvm-svn: 164567

11 years agoobjective-C: use 'instance variables' as plural when referring
Fariborz Jahanian [Mon, 24 Sep 2012 22:51:51 +0000 (22:51 +0000)]
objective-C: use 'instance variables' as plural when referring
to the feature.

llvm-svn: 164566

11 years agoClear UNIVERSAL_SDK_PATH setting when building host tools. <rdar://12360497>
Bob Wilson [Mon, 24 Sep 2012 22:51:19 +0000 (22:51 +0000)]
Clear UNIVERSAL_SDK_PATH setting when building host tools.  <rdar://12360497>

I also moved the SDKROOT setting into the make flags, since clearing it from
the environment isn't good enough to override a setting on the make command
line.  That hasn't been a problem but it could be, and it's good to be
consistent with the way UNIVERSAL_SDK_PATH is handled.

llvm-svn: 164565

11 years agoFix string comparisons in ABIMacOSX_i386::RegisterIsCalleeSaved so
Jason Molenda [Mon, 24 Sep 2012 22:51:04 +0000 (22:51 +0000)]
Fix string comparisons in ABIMacOSX_i386::RegisterIsCalleeSaved so
that volatile registers are correctly reported for this ABI.
We were incorrectly passing up volatile registers from callee
frames.

llvm-svn: 164564

11 years agoBrought LLDB top-of-tree into sync with LLVM/Clang
Sean Callanan [Mon, 24 Sep 2012 22:25:51 +0000 (22:25 +0000)]
Brought LLDB top-of-tree into sync with LLVM/Clang
top-of-tree.  Removed all local patches and llvm.zip.

The intent is that fron now on top-of-tree will
always build against LLVM/Clang top-of-tree, and
that problems building will be resolved as they
occur.  Stable release branches of LLDB can be
constructed as needed and linked to specific release
branches of LLVM/Clang.

llvm-svn: 164563

11 years agoTeach DSE that strcpy, strncpy, strcat and strncat are all stores which may be
Nick Lewycky [Mon, 24 Sep 2012 22:09:10 +0000 (22:09 +0000)]
Teach DSE that strcpy, strncpy, strcat and strncat are all stores which may be
dead.

llvm-svn: 164561

11 years agoMove all the calls to AA.getTargetLibraryInfo() to using a TLI member variable.
Nick Lewycky [Mon, 24 Sep 2012 22:07:09 +0000 (22:07 +0000)]
Move all the calls to AA.getTargetLibraryInfo() to using a TLI member variable.
No functionality change.

llvm-svn: 164560

11 years agoobjective-C: remove use of 'ivar' in favor of
Fariborz Jahanian [Mon, 24 Sep 2012 22:00:36 +0000 (22:00 +0000)]
objective-C: remove use of 'ivar' in favor of
'instance variable' in text of all diagnostics
for objective-C: // rdar://12352442

llvm-svn: 164559

11 years agoMade TestHiddenIvars an expected failure with
Sean Callanan [Mon, 24 Sep 2012 21:34:40 +0000 (21:34 +0000)]
Made TestHiddenIvars an expected failure with
"frame variable".  "expr" finds hidden ivars
correctly.

llvm-svn: 164558

11 years agoAdd clarifying comment.
Ted Kremenek [Mon, 24 Sep 2012 21:17:14 +0000 (21:17 +0000)]
Add clarifying comment.

llvm-svn: 164557

11 years agoMore tests for r164545 (change extension warning about 'long long').
Dmitri Gribenko [Mon, 24 Sep 2012 21:09:05 +0000 (21:09 +0000)]
More tests for r164545 (change extension warning about 'long long').

llvm-svn: 164556

11 years agoStringRef'ize Preprocessor::CreateString().
Dmitri Gribenko [Mon, 24 Sep 2012 21:07:17 +0000 (21:07 +0000)]
StringRef'ize Preprocessor::CreateString().

llvm-svn: 164555

11 years agoReplace raw call to snprintf() by llvm streams.
Dmitri Gribenko [Mon, 24 Sep 2012 20:56:28 +0000 (20:56 +0000)]
Replace raw call to snprintf() by llvm streams.

llvm-svn: 164554

11 years agoSpecify MachinePointerInfo as refering to the argument value and offset of the
Roman Divacky [Mon, 24 Sep 2012 20:47:19 +0000 (20:47 +0000)]
Specify MachinePointerInfo as refering to the argument value and offset of the
store when handling byval arguments. Thus preventing reordering of the store
with load with post-RA scheduler.

llvm-svn: 164553

11 years agoReplace an assertion with an error for empty __asm statements.
Bob Wilson [Mon, 24 Sep 2012 19:57:59 +0000 (19:57 +0000)]
Replace an assertion with an error for empty __asm statements.

llvm-svn: 164551

11 years agoFix a comment typo and clean up formatting.
Bob Wilson [Mon, 24 Sep 2012 19:57:55 +0000 (19:57 +0000)]
Fix a comment typo and clean up formatting.

llvm-svn: 164550

11 years agoMake sure that we don't end up making an #undef'd macro visible after
Douglas Gregor [Mon, 24 Sep 2012 19:56:18 +0000 (19:56 +0000)]
Make sure that we don't end up making an #undef'd macro visible after
the fact. Test cases will come when we're actually (de-)serializing
macro history.

llvm-svn: 164549

11 years agoRather then have a wrapper function, have tblgen instantiate the implementation.
Chad Rosier [Mon, 24 Sep 2012 19:32:29 +0000 (19:32 +0000)]
Rather then have a wrapper function, have tblgen instantiate the implementation.

llvm-svn: 164548

11 years ago[libclang] Bring CXCursor_AsmStmt back as an alias for CXCursor_GCCAsmStmt.
Argyrios Kyrtzidis [Mon, 24 Sep 2012 19:27:20 +0000 (19:27 +0000)]
[libclang] Bring CXCursor_AsmStmt back as an alias for CXCursor_GCCAsmStmt.

This was renamed in r162632 which was badness because the C API needs to be stable.
rdar://12360096

llvm-svn: 164547

11 years agoInclude 'long long' extension warning in the LongLong group so that it can be
Dmitri Gribenko [Mon, 24 Sep 2012 19:05:10 +0000 (19:05 +0000)]
Include 'long long' extension warning in the LongLong group so that it can be
silenced by -Wno-long-long.  Thanks Richard Smith for the fix idea!

llvm-svn: 164546

11 years agoChange the wording of the extension warning from
Dmitri Gribenko [Mon, 24 Sep 2012 18:19:21 +0000 (18:19 +0000)]
Change the wording of the extension warning from
> 'long long' is an extension when C99 mode is not enabled
to
> 'long long' is a C++11 extension
while compiling in C++98 mode.

llvm-svn: 164545

11 years agoRemove a couple of debugging printf's from the testsuite.
Jim Ingham [Mon, 24 Sep 2012 18:11:54 +0000 (18:11 +0000)]
Remove a couple of debugging printf's from the testsuite.

llvm-svn: 164544

11 years ago[analyzer] Really turn on dynamic-bifurcation on by default.
Anna Zaks [Mon, 24 Sep 2012 17:43:47 +0000 (17:43 +0000)]
[analyzer] Really turn on dynamic-bifurcation on by default.

Thanks to Byoungyoung for realizing taht we are not passing the default
option correctly.

llvm-svn: 164543

11 years ago[analyzer] Remove unused.
Anna Zaks [Mon, 24 Sep 2012 17:43:44 +0000 (17:43 +0000)]
[analyzer] Remove unused.

llvm-svn: 164542

11 years ago[analyzer]Prevent infinite recursion(assume->checker:evalAssume->assume)
Anna Zaks [Mon, 24 Sep 2012 17:43:41 +0000 (17:43 +0000)]
[analyzer]Prevent infinite recursion(assume->checker:evalAssume->assume)

(Unfortunately, I do not have a good reduced test case for this.)

llvm-svn: 164541

11 years agoAdd missing : in CHECK line.
Richard Osborne [Mon, 24 Sep 2012 17:22:43 +0000 (17:22 +0000)]
Add missing : in CHECK line.

llvm-svn: 164540

11 years agoAdd missing check for presence of target data.
Richard Osborne [Mon, 24 Sep 2012 17:10:03 +0000 (17:10 +0000)]
Add missing check for presence of target data.

This avoids a crash in visitAllocaInst when target data isn't available.

llvm-svn: 164539

11 years agoUpdating email address
Marshall Clow [Mon, 24 Sep 2012 14:27:24 +0000 (14:27 +0000)]
Updating email address

llvm-svn: 164490

11 years agoUpdating email address
Marshall Clow [Mon, 24 Sep 2012 14:27:10 +0000 (14:27 +0000)]
Updating email address

llvm-svn: 164489

11 years ago[TSan] one more attempt to fix sleep_sync test: call sleep in the spawned thread...
Alexey Samsonov [Mon, 24 Sep 2012 13:35:46 +0000 (13:35 +0000)]
[TSan] one more attempt to fix sleep_sync test: call sleep in the spawned thread so that sleep-synchronization will be detected even if child thread is started late.

llvm-svn: 164488

11 years ago[TSan] Provide replacements for operators new/delete instead of declaring extern...
Alexey Samsonov [Mon, 24 Sep 2012 13:19:47 +0000 (13:19 +0000)]
[TSan] Provide replacements for operators new/delete instead of declaring extern C functions with weirdly mangled names (same strategy is used in ASan).

llvm-svn: 164487

11 years ago[ASan] Apply some ASan-relevant pieces of patch by Ruben Van Boxem. In the same time...
Alexey Samsonov [Mon, 24 Sep 2012 11:43:40 +0000 (11:43 +0000)]
[ASan] Apply some ASan-relevant pieces of patch by Ruben Van Boxem. In the same time, remove ASan from CMake build on Windows after conversation with Timur. We don't want to support building ASan on Windows until it is in a working state.

llvm-svn: 164486

11 years agoUse an explicit target to test that source fortification is off when building for...
Alexander Potapenko [Mon, 24 Sep 2012 10:25:24 +0000 (10:25 +0000)]
Use an explicit target to test that source fortification is off when building for Darwin with -faddress-sanitizer.

llvm-svn: 164485

11 years agoSmall cleanup of literal semantic analysis: hiding 'char *' pointers behind
Dmitri Gribenko [Mon, 24 Sep 2012 09:53:54 +0000 (09:53 +0000)]
Small cleanup of literal semantic analysis: hiding 'char *' pointers behind
StringRef makes code cleaner.  Also, make the temporary buffer smaller:
512 characters is unreasonably large for integer literals.

llvm-svn: 164484

11 years ago[TSan] increase sleep time in test to ensure correct event ordering
Alexey Samsonov [Mon, 24 Sep 2012 08:57:41 +0000 (08:57 +0000)]
[TSan] increase sleep time in test to ensure correct event ordering

llvm-svn: 164483

11 years agoUpdate the Clang tests which run with a full optimization pipeline for
Chandler Carruth [Mon, 24 Sep 2012 01:10:25 +0000 (01:10 +0000)]
Update the Clang tests which run with a full optimization pipeline for
the new SROA pass. This is a benign change: the order of PHI nodes
changed.

llvm-svn: 164481

11 years agoEnable the new SROA pass by default.
Chandler Carruth [Mon, 24 Sep 2012 01:10:25 +0000 (01:10 +0000)]
Enable the new SROA pass by default.

Queue the fallout. ;]

llvm-svn: 164480

11 years agoAddress one of the original FIXMEs for the new SROA pass by implementing
Chandler Carruth [Mon, 24 Sep 2012 00:34:20 +0000 (00:34 +0000)]
Address one of the original FIXMEs for the new SROA pass by implementing
integer promotion analogous to vector promotion. When there is an
integer alloca being accessed both as its integer type and as a narrower
integer type, promote the narrower access to "insert" and "extract" the
smaller integer from the larger one, and make the integer alloca
a candidate for promotion.

In the new formulation, we don't care about target legal integer or use
thresholds to control things. Instead, we only perform this promotion to
an integer type which the frontend has already emitted a load or store
for. This bounds the scope and prevents optimization passes from
coalescing larger and larger entities into a single integer.

llvm-svn: 164479

11 years agounittests/AST/StmtPrinterTest.cpp: Suppress a LP64-assumed test, "0x100000000i128...
NAKAMURA Takumi [Mon, 24 Sep 2012 00:34:18 +0000 (00:34 +0000)]
unittests/AST/StmtPrinterTest.cpp: Suppress a LP64-assumed test, "0x100000000i128 => 4294967296L", for now.

LONG_MAX is 2147483647L on common 32 bit and LLP64 (Windows x64).

llvm-svn: 164478

11 years agoAs a followup for r164303, add some tests for printing literals that test
Dmitri Gribenko [Sun, 23 Sep 2012 20:29:07 +0000 (20:29 +0000)]
As a followup for r164303, add some tests for printing literals that test
printing directly rather than through a complicated machinery of ObjC rewriter.

llvm-svn: 164477

11 years agoEmit dtors into proper section while compiling in vcpp-compatible mode.
Anton Korobeynikov [Sun, 23 Sep 2012 15:53:47 +0000 (15:53 +0000)]
Emit dtors into proper section while compiling in vcpp-compatible mode.
Patch by Kai!

llvm-svn: 164476

11 years agoSwitch to a signed representation for the dynamic offsets while walking
Chandler Carruth [Sun, 23 Sep 2012 11:43:14 +0000 (11:43 +0000)]
Switch to a signed representation for the dynamic offsets while walking
across the uses of the alloca. It's entirely possible for negative
numbers to come up here, and in some rare cases simply doing the 2's
complement arithmetic isn't the correct decision. Notably, we can't zext
the index of the GEP. The definition of GEP is that these offsets are
sign extended or truncated to the size of the pointer, and then wrapping
2's complement arithmetic used.

This patch fixes an issue that comes up with *no* input from the
buildbots or bootstrap afaict. The only place where it manifested,
disturbingly, is Clang's own regression test suite. A reduced and
targeted collection of tests are added to cope with this. Note that I've
tried to pin down the potential cases of overflow, but may have missed
some cases. I've tried to add a few cases to test this, but its hard
because LLVM has quite limited support for >64bit constructs.

llvm-svn: 164475

11 years agoDon't do actual work inside an assert statement. Fixes PR11760!
Nick Lewycky [Sun, 23 Sep 2012 03:58:21 +0000 (03:58 +0000)]
Don't do actual work inside an assert statement. Fixes PR11760!

llvm-svn: 164474

11 years agoImplement ToolChain::IsUnwindTablesDefault to reduce code duplication a bit.
Rafael Espindola [Sun, 23 Sep 2012 03:05:41 +0000 (03:05 +0000)]
Implement ToolChain::IsUnwindTablesDefault to reduce code duplication a bit.

llvm-svn: 164473

11 years agoRevise test to avoid using of 'grep'
Michael Liao [Sun, 23 Sep 2012 02:41:47 +0000 (02:41 +0000)]
Revise test to avoid using of 'grep'

llvm-svn: 164472

11 years agoAdd LLVM_OVERRIDE to methods that override their base classes.
Craig Topper [Sun, 23 Sep 2012 02:12:10 +0000 (02:12 +0000)]
Add LLVM_OVERRIDE to methods that override their base classes.

llvm-svn: 164471

11 years agoOn Hexagon getArchName() never returns x86_64, simplify the function.
Rafael Espindola [Sat, 22 Sep 2012 22:58:57 +0000 (22:58 +0000)]
On Hexagon getArchName() never returns x86_64, simplify the function.

llvm-svn: 164470

11 years agoUse pipes.
Rafael Espindola [Sat, 22 Sep 2012 22:51:00 +0000 (22:51 +0000)]
Use pipes.

llvm-svn: 164469

11 years agoUse FileCheck.
Rafael Espindola [Sat, 22 Sep 2012 22:30:04 +0000 (22:30 +0000)]
Use FileCheck.

llvm-svn: 164468

11 years agoComment sema: warn when comment has \deprecated but declaration does not have a
Dmitri Gribenko [Sat, 22 Sep 2012 21:47:50 +0000 (21:47 +0000)]
Comment sema: warn when comment has \deprecated but declaration does not have a
deprecation attribute ('deprecated', 'availability' or 'unavailable').

This warning is under a separate flag, -Wdocumentation-deprecated-sync, so it
can be turned off easily while leaving other -Wdocumentation warnings on.

llvm-svn: 164467

11 years agoRemove superfluous \namespace command.
Dmitri Gribenko [Sat, 22 Sep 2012 21:44:37 +0000 (21:44 +0000)]
Remove superfluous \namespace command.

llvm-svn: 164466

11 years agoEnhance test case of atomic16 to verify inst encoding fixed in r164453.
Michael Liao [Sat, 22 Sep 2012 21:07:59 +0000 (21:07 +0000)]
Enhance test case of atomic16 to verify inst encoding fixed in r164453.

llvm-svn: 164465

11 years agoFix cindex.py compatibility with older libclang.so
Dmitri Gribenko [Sat, 22 Sep 2012 17:52:29 +0000 (17:52 +0000)]
Fix cindex.py compatibility with older libclang.so

The issue is that we were calling clang_getCompletionBriefComment
unconditionally.  New we check if this function is available before calling it.

llvm-svn: 164464

11 years agoUse FileCheck.
Rafael Espindola [Sat, 22 Sep 2012 15:26:38 +0000 (15:26 +0000)]
Use FileCheck.

llvm-svn: 164462

11 years agoFix pr13749. There is still a lot of code using getArchName that should be
Rafael Espindola [Sat, 22 Sep 2012 15:04:11 +0000 (15:04 +0000)]
Fix pr13749. There is still a lot of code using getArchName that should be
using getArch, but I will try to fix them one at time to add tests.

llvm-svn: 164460

11 years agoARMInstPrinter.cpp: Fix a warning in -Asserts. [-Wunused-variable]
NAKAMURA Takumi [Sat, 22 Sep 2012 13:12:28 +0000 (13:12 +0000)]
ARMInstPrinter.cpp: Fix a warning in -Asserts. [-Wunused-variable]

llvm-svn: 164459

11 years agoWhitespace.
NAKAMURA Takumi [Sat, 22 Sep 2012 13:12:22 +0000 (13:12 +0000)]
Whitespace.

llvm-svn: 164458

11 years agoFix edge cases of ARM shift operands in arith instructions.
Tim Northover [Sat, 22 Sep 2012 11:18:19 +0000 (11:18 +0000)]
Fix edge cases of ARM shift operands in arith instructions.

As before with load instructions, oddities like "asr #32", "rrx" could
be printed incorrectly.

Patch by Chris Lidbury.

llvm-svn: 164456

11 years agoFix the handling of edge cases in ARM shifted operands.
Tim Northover [Sat, 22 Sep 2012 11:18:12 +0000 (11:18 +0000)]
Fix the handling of edge cases in ARM shifted operands.

This patch fixes load/store instructions to handle less common cases
like "asr #32", "rrx" properly throughout the MC layer.

Patch by Chris Lidbury.

llvm-svn: 164455

11 years agoAvoid multiple atomic builtin declaration.
Abramo Bagnara [Sat, 22 Sep 2012 09:05:22 +0000 (09:05 +0000)]
Avoid multiple atomic builtin declaration.

llvm-svn: 164454

11 years agoFix 16-bit atomic inst encoding and keep pseudo-inst starting with '#'
Michael Liao [Sat, 22 Sep 2012 05:41:15 +0000 (05:41 +0000)]
Fix 16-bit atomic inst encoding and keep pseudo-inst starting with '#'

llvm-svn: 164453

11 years agoFix typo in r164357
Michael Liao [Sat, 22 Sep 2012 03:39:42 +0000 (03:39 +0000)]
Fix typo in r164357

llvm-svn: 164452

11 years agoMachine Model (-schedmodel only). Added SchedAliases.
Andrew Trick [Sat, 22 Sep 2012 02:24:21 +0000 (02:24 +0000)]
Machine Model (-schedmodel only). Added SchedAliases.

Allow subtargets to tie SchedReadWrite types to processor specific
sequences or variants.

llvm-svn: 164451

11 years agoWhen importing a FunctionProtoType::ExtProtoInfo, its ExceptionSpecDecl can point...
Argyrios Kyrtzidis [Sat, 22 Sep 2012 01:58:06 +0000 (01:58 +0000)]
When importing a FunctionProtoType::ExtProtoInfo, its ExceptionSpecDecl can point to the
FunctionDecl that we are importing the FunctionProtoType for, in which case we'll have
infinite recursion when importing.

Initially create a FunctionProtoType with null ExceptionSpecDecl/ExceptionSpecTemplate and
update the type in ASTNodeImporter::VisitFunctionDecl after the FunctionDecl has been created.

llvm-svn: 164450

11 years ago[analyzer] Suppress bugs whose paths go through the return of a null pointer.
Jordan Rose [Sat, 22 Sep 2012 01:25:06 +0000 (01:25 +0000)]
[analyzer] Suppress bugs whose paths go through the return of a null pointer.

This is a heuristic intended to greatly reduce the number of false
positives resulting from inlining, particularly inlining of generic,
defensive C++ methods that live in header files. The suppression is
triggered in the cases where we ask to track where a null pointer came
from, and it turns out that the source of the null pointer was an inlined
function call.

This change brings the number of bug reports in LLVM from ~1500 down to
around ~300, a much more manageable number. Yes, some true positives may
be hidden as well, but from what I looked at the vast majority of silenced
reports are false positives, and many of the true issues found by the
analyzer are still reported.

I'm hoping to improve this heuristic further by adding some exceptions
next week (cases in which a bug should still be reported).

llvm-svn: 164449

11 years ago[analyzer] Track a null value back through FindLastStoreBRVisitor.
Jordan Rose [Sat, 22 Sep 2012 01:25:00 +0000 (01:25 +0000)]
[analyzer] Track a null value back through FindLastStoreBRVisitor.

Also, tidy up the other tracking visitors so that they mark the right
things as interesting and don't do extra work.

llvm-svn: 164448

11 years ago[analyzer] Always allow BugReporterVisitors to see the bug path.
Jordan Rose [Sat, 22 Sep 2012 01:24:56 +0000 (01:24 +0000)]
[analyzer] Always allow BugReporterVisitors to see the bug path.

Before, PathDiagnosticConsumers that did not support actual path output
would (sensibly) cause the generation of the full path to be skipped.
However, BugReporterVisitors may want to see the path in order to mark a
BugReport as invalid.

Now, even for a path generation scheme of 'None' we will still create a
trimmed graph and walk backwards through the bug path, doing no work other
than passing the nodes to the BugReporterVisitors. This isn't cheap, but
it's necessary to properly do suppression when the first path consumer does
not support path notes.

In the future, we should try only generating the path and visitor-provided
path notes once, or at least only creating the trimmed graph once.

llvm-svn: 164447

11 years ago[analyzer] Allow a BugReport to be marked "invalid" during path generation.
Jordan Rose [Sat, 22 Sep 2012 01:24:53 +0000 (01:24 +0000)]
[analyzer] Allow a BugReport to be marked "invalid" during path generation.

This is intended to allow visitors to make decisions about whether a
BugReport is likely a false positive. Currently there are no visitors
making use of this feature, so there are no tests.

When a BugReport is marked invalid, the invalidator must provide a key
that identifies the invaliation (intended to be the visitor type and a
context pointer of some kind). This allows us to reverse the decision
later on. Being able to reverse a decision about invalidation gives us more
flexibility, and allows us to formulate conditions like "this report is
invalid UNLESS the original argument is 'foo'". We can use this to
fine-tune our false-positive suppression (coming soon).

llvm-svn: 164446

11 years ago[analyzer] Look through OpaqueValueExprs when tracking a nil value.
Jordan Rose [Sat, 22 Sep 2012 01:24:49 +0000 (01:24 +0000)]
[analyzer] Look through OpaqueValueExprs when tracking a nil value.

This allows us to show /why/ a particular object is nil, even when it is
wrapped in an OpaqueValueExpr.

llvm-svn: 164445

11 years ago[analyzer] Better path notes for null pointers passed as arguments.
Jordan Rose [Sat, 22 Sep 2012 01:24:46 +0000 (01:24 +0000)]
[analyzer] Better path notes for null pointers passed as arguments.

Rather than saying "Null pointer value stored to 'foo'", we now say
"Passing null pointer value via Nth parameter 'foo'", which is much better.
The note is also now on the argument expression as well, rather than the
entire call.

This paves the way for continuing to track arguments back to their sources.

<rdar://problem/12211490>

llvm-svn: 164444

11 years agoUse llvm::getOrdinalSuffix to print ordinal numbers in diagnostics.
Jordan Rose [Sat, 22 Sep 2012 01:24:42 +0000 (01:24 +0000)]
Use llvm::getOrdinalSuffix to print ordinal numbers in diagnostics.

Just a refactoring of common infrastructure. No intended functionality change.

llvm-svn: 164443

11 years ago[analyzer] Check that an ObjCIvarRefExpr's base is non-null even as an lvalue.
Jordan Rose [Sat, 22 Sep 2012 01:24:38 +0000 (01:24 +0000)]
[analyzer] Check that an ObjCIvarRefExpr's base is non-null even as an lvalue.

Like with struct fields, we want to catch cases like this early,
so that we can produce better diagnostics and path notes:

  PointObj *p = nil;
  int *px = &p->_x; // should warn here
  *px = 1;

llvm-svn: 164442

11 years ago[analyzer] Check that a member expr is valid even when the result is an lvalue.
Jordan Rose [Sat, 22 Sep 2012 01:24:33 +0000 (01:24 +0000)]
[analyzer] Check that a member expr is valid even when the result is an lvalue.

We want to catch cases like this early, so that we can produce better
diagnostics and path notes:

  Point *p = 0;
  int *px = &p->x; // should warn here
  *px = 1;

llvm-svn: 164441

11 years agoAdd llvm::getOrdinalSuffix to get the appropriate -st, -nd, -rd, -th suffix.
Jordan Rose [Sat, 22 Sep 2012 01:24:21 +0000 (01:24 +0000)]
Add llvm::getOrdinalSuffix to get the appropriate -st, -nd, -rd, -th suffix.

Used by clang to print parameter indexes.

llvm-svn: 164440

11 years agoCasting: assert that pointer arguments to isa<> are non-null.
Jordan Rose [Sat, 22 Sep 2012 01:24:18 +0000 (01:24 +0000)]
Casting: assert that pointer arguments to isa<> are non-null.

This silences several analyzer warnings within LLVM, and provides a slightly
nicer crash experience when someone calls isa<>, cast<>, or dyn_cast<> with
a null pointer.

llvm-svn: 164439

11 years agoDenseMap: assert that we have found a bucket before we try to insert into it.
Jordan Rose [Sat, 22 Sep 2012 01:24:16 +0000 (01:24 +0000)]
DenseMap: assert that we have found a bucket before we try to insert into it.

This silences literally dozens of analyzer warnings on LLVM (since DenseMap
is such a commonly-used class).

llvm-svn: 164438

11 years agoFix bug which sometimes resulted in further diagnostics being produced after a
Richard Smith [Sat, 22 Sep 2012 00:53:56 +0000 (00:53 +0000)]
Fix bug which sometimes resulted in further diagnostics being produced after a
fatal error. Previously, if a fatal error was followed by a diagnostic which
was suppressed due to a SFINAETrap, we'd forget that we'd seen a fatal error.

llvm-svn: 164437

11 years agoMissed a few places where I didn't delete the obsolete (commented out) version of...
Jim Ingham [Sat, 22 Sep 2012 00:14:47 +0000 (00:14 +0000)]
Missed a few places where I didn't delete the obsolete (commented out) version of the breakpoint creation.

llvm-svn: 164436

11 years agoMIPS DSP: Add immediate leaves.
Akira Hatanaka [Sat, 22 Sep 2012 00:07:12 +0000 (00:07 +0000)]
MIPS DSP: Add immediate leaves.

llvm-svn: 164435

11 years agoMIPS DSP: Add predicates and instruction template.
Akira Hatanaka [Sat, 22 Sep 2012 00:06:06 +0000 (00:06 +0000)]
MIPS DSP: Add predicates and instruction template.

llvm-svn: 164434

11 years agoFix all the test case breakages caused by folks writing tests all over the place...
Jim Ingham [Sat, 22 Sep 2012 00:05:11 +0000 (00:05 +0000)]
Fix all the test case breakages caused by folks writing tests all over the place that depended explicitly
on the output of "break set".  Please don't do this sort of thing!!!!!

llvm-svn: 164433

11 years agoChange the new breakpoint creation output (primarily from "break set") to something...
Jim Ingham [Sat, 22 Sep 2012 00:04:04 +0000 (00:04 +0000)]
Change the new breakpoint creation output (primarily from "break set") to something more useful.

<rdar://problem/11333623>

llvm-svn: 164432

11 years agoAdd MIPS DSP register classes. Set actions of DSP vector operations and override
Akira Hatanaka [Fri, 21 Sep 2012 23:58:31 +0000 (23:58 +0000)]
Add MIPS DSP register classes. Set actions of DSP vector operations and override
TargetLowering's callback functions.

llvm-svn: 164431

11 years agoSelectionDAG node enums for MIPS DSP nodes.
Akira Hatanaka [Fri, 21 Sep 2012 23:52:47 +0000 (23:52 +0000)]
SelectionDAG node enums for MIPS DSP nodes.

llvm-svn: 164430

11 years agoAdd MIPS accumulator and DSP control registers.
Akira Hatanaka [Fri, 21 Sep 2012 23:48:37 +0000 (23:48 +0000)]
Add MIPS accumulator and DSP control registers.

llvm-svn: 164429

11 years agoAdd flags and feature bits for mips dsp.
Akira Hatanaka [Fri, 21 Sep 2012 23:41:49 +0000 (23:41 +0000)]
Add flags and feature bits for mips dsp.

llvm-svn: 164428

11 years agoFix a case where the new SROA pass failed to zap dead operands to
Chandler Carruth [Fri, 21 Sep 2012 23:36:40 +0000 (23:36 +0000)]
Fix a case where the new SROA pass failed to zap dead operands to
selects with a constant condition. This resulted in the operands
remaining live through the SROA rewriter. Most of the time, this just
caused some dead allocas to persist and get zapped by later passes, but
in one case found by Joerg, it caused a crash when we tried to *promote*
the alloca despite it having this dead use. We already have the
mechanisms in place to handle this, just wire select up to them.

llvm-svn: 164427

11 years agoAdd an --enable-backtraces option to configure to determine
Eric Christopher [Fri, 21 Sep 2012 23:03:29 +0000 (23:03 +0000)]
Add an --enable-backtraces option to configure to determine
whether or not we want to print out backtrace information. Useful
for libraries that don't need backtrace information on a crash.

rdar://11844710

llvm-svn: 164426

11 years agoAdd an MDBuilder utility for creating !tbaa.struct nodes.
Dan Gohman [Fri, 21 Sep 2012 23:00:37 +0000 (23:00 +0000)]
Add an MDBuilder utility for creating !tbaa.struct nodes.

llvm-svn: 164425

11 years ago[CMake] Respect LLVM_BUILD_RUNTIME.
Michael J. Spencer [Fri, 21 Sep 2012 22:49:06 +0000 (22:49 +0000)]
[CMake] Respect LLVM_BUILD_RUNTIME.

llvm-svn: 164424

11 years ago[CMake][tsan] Compile .S files for tsan as C instead of CXX.
Michael J. Spencer [Fri, 21 Sep 2012 22:39:39 +0000 (22:39 +0000)]
[CMake][tsan] Compile .S files for tsan as C instead of CXX.

Using CXX breaks if you add -stdlib=libc++ to CMAKE_CXX_FLAGS.

llvm-svn: 164422