Commit Graph

144931 Commits

Author SHA1 Message Date
Rafael Espindola 8f326a5a39 Add a hasExternalStorageAsWritten helper. No functionality change.
It is possible that some of the current uses of
"getStorageClassAsWritten() == SC_Extern" should use this but I don't know
enough about SC_PrivateExtern to change and test them.

llvm-svn: 176606
2013-03-07 01:42:44 +00:00
Manman Ren 1e4272085d Debug Info: store the files and directories for each compile unit.
We now emit a line table for each compile unit. To reduce the prologue size
of each line table, the files and directories used by each compile unit are
stored in std::map<unsigned, std::vector< > > instead of std::vector< >.

The prologue for a lto'ed image can be as big as 93K. Duplicating 93K for each
compile unit causes a huge increase of debug info. With this patch, each
prologue will only emit the files required by the compile unit.

rdar://problem/13342023

llvm-svn: 176605
2013-03-07 01:42:00 +00:00
Nadav Rotem 96a4aa678c ArrayRef has a OneElt constructor. Beautify the code.
llvm-svn: 176604
2013-03-07 01:38:04 +00:00
Rafael Espindola ee86f00f6e Fix typo.
llvm-svn: 176603
2013-03-07 01:34:57 +00:00
Nadav Rotem 883304333d Switch from std::vector to ArrayRef. Speedup FoldBitCast by 5x.
llvm-svn: 176602
2013-03-07 01:30:40 +00:00
Jordan Rose b41977f852 [analyzer] Check for returning null references in ReturnUndefChecker.
Officially in the C++ standard, a null reference cannot exist. However,
it's still very easy to create one:

int &getNullRef() {
  int *p = 0;
  return *p;
}

We already check that binds to reference regions don't create null references.
This patch checks that we don't create null references by returning, either.

<rdar://problem/13364378>

llvm-svn: 176601
2013-03-07 01:23:25 +00:00
Jordan Rose 6f09928d5b [analyzer] Clean up a few doc comments for ProgramState and CallEvent.
No functionality change.

llvm-svn: 176600
2013-03-07 01:23:14 +00:00
Andrew Trick a0a5ca06b9 SimplifyCFG fix for volatile load/store.
Fixes rdar:13349374.

Volatile loads and stores need to be preserved even if the language
standard says they are undefined. "volatile" in this context means "get
out of the way compiler, let my platform handle it".

Additionally, this is the only way I know of with llvm to write to the
first page (when hardware allows) without dropping to assembly.

llvm-svn: 176599
2013-03-07 01:03:35 +00:00
Michael Liao d5cac37dc5 Fix two remaining issue after fixing PR15355 when CMOV is not available
- Phi nodes should be replaced/updated after lowering CMOV into branch
  because 'mainMBB' updating operand in Phi node is changed.
- Add EFLAGS in livein before lowering the 2nd CMOV. It's necessary as
  we will reuse the EFLAGS generated before the 1st lowered CMOV, which
  won't clobber EFLAGS. However, we need explicitly specify that.
- '-attr=-cmov' test case are added.

llvm-svn: 176598
2013-03-07 01:01:29 +00:00
Daniel Malea 33174017e0 Clean up LLDB CMake build output
- remove "-debug" flag from swig scripts
- use "echo -n" instead of "echo" in dummy target to avoid printing a useless newline

llvm-svn: 176597
2013-03-07 00:52:25 +00:00
Daniel Malea 3c216ace9b Fix running of LLDB tests with cmake+ninja+ccache
- Avoid passing 'ccache' as the test compiler. Instead, use first arg after ccache.

llvm-svn: 176596
2013-03-07 00:50:54 +00:00
Daniel Malea 4ebaace6b3 Fix Linux i386 build
- missing definitions were causing different definitions of type 'off_t', resulting in linker errors
- fix is to define _LARGEFILE_SOURCE and _FILE_OFFSET_BITS=64

llvm-svn: 176595
2013-03-07 00:48:53 +00:00
Han Ming Ong 0d03deeeb9 <rdar://problem/13119170>
Reap the child process (debugserver) when it is done.

llvm-svn: 176594
2013-03-06 23:59:34 +00:00
Howard Hinnant 6e41256f68 No functionality change at this time. I've split _LIBCPP_VISIBLE up into two flags: _LIBCPP_TYPE_VIS and _LIBCPP_FUNC_VIS. This is in preparation for taking advantage of clang's new __type_visibility__ attribute.
llvm-svn: 176593
2013-03-06 23:30:19 +00:00
Greg Clayton 084fad6a51 <rdar://problem/13362109>
LLDB was not parsing line tables correctly for DWARF in .o files after recent debug map changes. This has now been fixed. 

llvm-svn: 176592
2013-03-06 23:23:27 +00:00
Jason Molenda 4e7511efc7 Remove some tabs and extraneous space chars from ObjectFileMachO.cpp.
Noticed these while working on the last commit.

llvm-svn: 176590
2013-03-06 23:19:17 +00:00
Jason Molenda 255f9bbcf4 Retrieve the dyld shared cache mapping offset from the shared cache instead of hardcoding the value.
Read the version number of the dyld shared cache.
<rdar://problem/13311882> 

llvm-svn: 176589
2013-03-06 23:17:36 +00:00
Adrian Prantl a03a85a425 Ensure that DIType is regenerated after we visit an implementation
that adds ivars to an interface.

Fixes rdar://13175234

This is an update to r176116 that performs a smart caching of interfaces.

llvm-svn: 176584
2013-03-06 22:03:30 +00:00
Shankar Easwaran c44bc347cb [ELF] Order weak symbols properly
llvm-svn: 176583
2013-03-06 21:59:27 +00:00
Andrew Kaylor 7bdeab592d Skipping TestConstVariables on Linux.
The test was marked as expectedFailureLinux, but now it passes with gcc and some versions of clang.  Newer versions of clang introduce a failure due to bad DWARF information.

llvm-svn: 176581
2013-03-06 21:37:41 +00:00
Akira Hatanaka 0f693a8a77 [mips] Custom-legalize BR_JT.
In N64-static, GOT address is needed to compute the branch address.

llvm-svn: 176580
2013-03-06 21:32:03 +00:00
Greg Clayton 00108408ac Added tests to test for "settings set" with trailing whitespaces after the values.
llvm-svn: 176579
2013-03-06 21:17:06 +00:00
Andrew Kaylor 9e9f1db866 Adding support for DW_OP_stack_value in DWARFExpression::Evaluate
llvm-svn: 176578
2013-03-06 21:13:09 +00:00
Anna Zaks 23c85ed52b [analyzer] Pass the correct Expr to the bug reporter visitors when dealing with CompoundLiteralExpr
This allows us to trigger the IDC visitor in the added test case.

llvm-svn: 176577
2013-03-06 20:26:02 +00:00
Anna Zaks 6fe2fc633a [analyzer] IDC: Add config option; perform the idc check on first “null node” rather than last “non-null”.
The second modification does not lead to any visible result, but, theoretically, is what we should
have been looking at to begin with since we are checking if the node was assumed to be null in
an inlined function.

llvm-svn: 176576
2013-03-06 20:25:59 +00:00
Sean Callanan f58b12d8eb Added a little bit of logging to ClangFunction to
make it more obvious what's going on.

llvm-svn: 176575
2013-03-06 19:57:25 +00:00
Andrew Kaylor 60cdeb6aa8 Add support for non-register scalar values in DoMaterializeOneVariable.
llvm-svn: 176574
2013-03-06 19:35:33 +00:00
Howard Hinnant 65f58f3fe8 Have basic_istream::read call sgetn intead of sbumpc individual characters. This addresses http://llvm.org/bugs/show_bug.cgi?id=15427.
llvm-svn: 176573
2013-03-06 19:27:56 +00:00
Andrew Trick fcb37243f9 Generalize my previous fix for -print-options.
Always print options that differ from their implicit default. At least
for simple option types.

llvm-svn: 176572
2013-03-06 19:04:56 +00:00
Michael Liao a7699084b9 Remove tailing whitespaces
llvm-svn: 176570
2013-03-06 18:24:34 +00:00
Andrew Trick 946c2b32e6 Give -loop-vectorize an explicit default.
This way, clang -mllvm -print-options shows that the driver is overriding it.

llvm-svn: 176569
2013-03-06 18:22:22 +00:00
Howard Hinnant 3fb6c6e50d Correct silly type-o. Thanks Richard.
llvm-svn: 176568
2013-03-06 18:16:12 +00:00
Argyrios Kyrtzidis 7d23857a07 [PCH] When pre-validating the headers from the PCH, only validate non-system headers.
Stat'ing all the headers from the PCH to make sure they are up-to-date takes significant time.
In a particular source file (whose PCH file included Cocoa.h) from total -fsyntax-only time
12% was just stat calls. Change pre-validation to only check non-system headers.

There are some notable disadvantages:

-If a system header, that is not include-guarded, changes after the PCH was created, we will not
find it in the header info table and we will #import it, effectively #importing it twice, thus
we will emit some error due to a multiple definition and after that the "header was modified" error will likely
be emitted, for example something like:

NSDictionary.h:12:1: error: duplicate interface definition for class 'NSDictionary'
@interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration>
^
NSDictionary.h:12:12: note: previous definition is here
@interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration>
           ^
fatal error: file 'NSDictionary.h' has been modified since the precompiled header was built

Though we get the "header was modified" error, this is a bit confusing.

-Theoretically it is possible that such a system header will cause no errors but it will just cause an
unfortunate semantic change, though I find this rather unlikely.

The advantages:

-Reduces compilation time when using a huge PCH like the Cocoa ones
-System headers change very infrequent and when they do, users/build systems should be able to know that
re-building from scratch is needed.

Addresses rdar://13056262

llvm-svn: 176567
2013-03-06 18:12:50 +00:00
Argyrios Kyrtzidis 5c2a345e48 [PCH] For HeaderFileInfoTrait, hash the key using size & time of the file.
Previously the hash would be the filename portion of the path, which could be
different for a filename with different case or a symbolic link with a different
name completely.
This did not actually create any issue so far because by validating all headers
in the PCH we created uniqued FileEntries based on inodes, so an #include of
a symbolic link (refering to a file from the PCH) would end up with a FileEntry
with filename same as the one recorded in the PCH.

llvm-svn: 176566
2013-03-06 18:12:47 +00:00
Argyrios Kyrtzidis 61a3896d9f [PCH] We don't need to instantiate HeaderFileInfoTrait in ASTReader more than once.
We can just re-use the one from HeaderFileInfoLookupTable.

llvm-svn: 176565
2013-03-06 18:12:44 +00:00
Argyrios Kyrtzidis b42863e258 [PCH] Remove a couple of fields from serialization::reader::HeaderFileInfoTrait that are not used for anything.
llvm-svn: 176564
2013-03-06 18:12:41 +00:00
Fariborz Jahanian ff81b824a2 Spell Objective-C correctly.
llvm-svn: 176563
2013-03-06 17:55:30 +00:00
Shuxin Yang 408bdad5b4 Memory Dependence Analysis (not mem-dep test) take advantage of "invariant.load" metadata.
The "invariant.load" metadata indicates the memory unit being accessed is immutable.
A load annotated with this metadata can be moved across any store.

As I am not sure if it is legal to move such loads across barrier/fence, this
change dose not allow such transformation.

rdar://11311484

Thank Arnold for code review.

llvm-svn: 176562
2013-03-06 17:48:48 +00:00
Fariborz Jahanian 41bb7131b3 say objective-C in the warning and streamline
several diagnostics into one. // rdar://13094352

llvm-svn: 176560
2013-03-06 17:36:51 +00:00
Howard Hinnant 53b9ee061f The bitset(unsigned long long) constructor was broken by the constexpr additions only on 32 bit platforms. Fixed. This addresses http://llvm.org/bugs/show_bug.cgi?id=15444.
llvm-svn: 176559
2013-03-06 17:30:26 +00:00
Matt Kopec 7de484640e Improve/Cleanup ptrace wrapper and remove dependency on user.h
Patch by Ashok Thirumurthi.

llvm-svn: 176558
2013-03-06 17:20:48 +00:00
Dmitri Gribenko 15225aee17 Driver: add support for new style multiarch in Ubuntu 13.04
Patch by Sanne Wouda.

llvm-svn: 176557
2013-03-06 17:14:05 +00:00
Edwin Vane 0a4836ed0e New ASTMatchers and enhancement to hasOverloadedOperatorName
Added two new narrowing matchers:
* hasMethod: aplies a matcher to a CXXRecordDecl's methods until a match is made
  or there are no more methods.
* hasCanonicalType: applies a matcher to a QualType's canonicalType.

Enhanced hasOverloadedOperatorName to work on CXXMethodDecl as well as
CXXOperatorCallExpr.

Updated tests and docs.

Reviewers: klimek, gribozavr
llvm-svn: 176556
2013-03-06 17:02:57 +00:00
Reid Kleckner 063dfe3244 [msan] Block reports from interceptors during _Unwind_Backtrace
Summary:
I'm hitting a big recursive report from:
  uninit on strlen ->
  __msan::PrintWarningWithOrigin() ->
  __msan::GetStackTrace() ->
  __sanitizer::StackTrace::SlowUnwindStack() ->
  _Unwind_Backtrace() ->
  ... libgcc calls ->
  uninit on strlen() ->
  ... repeats

Reviewers: eugenis

Differential Revision: http://llvm-reviews.chandlerc.com/D497

llvm-svn: 176555
2013-03-06 16:11:58 +00:00
Reid Kleckner c193da57b8 [msan] pthread_join() returns int, not void*
pthread_join() returns an error code, not the result of the
pthread_create() function like I thought.

llvm-svn: 176554
2013-03-06 15:41:35 +00:00
Stefanus Du Toit 49fe6388b6 Test case for PR-15414 - nullptr_t functions
The use-null-ptr transform will transform calls to functions that return a
nullptr_t. Even if the function were to only return a null pointer and do
nothing else, this replacement would still be undesired as the behavior and
signature of the function could change in the future.

This adds an XFAILed test case to demonstrate the issue.

Reviewed by: Edwin Vane, Tareq Siraj

llvm-svn: 176553
2013-03-06 15:32:20 +00:00
Reid Kleckner 66c26e5e96 [sanitizers] Fix check failure on dealloc from new thread
Summary:
Adds a test for this case, which was reduced from a chromium build of
WebKit's DumpRenderTree.

Reviewers: eugenis

CC: glider

Differential Revision: http://llvm-reviews.chandlerc.com/D495

llvm-svn: 176552
2013-03-06 14:54:08 +00:00
Edwin Vane 105963d17c Fixed Use-Nullptr when replacing return(0)
Before fix, the paren expression was being replaced resulting in returnnullptr.
ParenExpr and implicit casts now ignored so we get return(nullptr) instead.

Added new test cases.

Fixes PR15398

Author: Ariel Bernal <ariel.j.bernal@intel.com>
llvm-svn: 176551
2013-03-06 14:51:34 +00:00
Alexey Samsonov a1c0a2a2c6 [Sanitize] Don't emit function attribute sanitize_address/thread/memory if the function is blacklisted.
llvm-svn: 176550
2013-03-06 10:54:18 +00:00
Greg Clayton 5d14fc061f Fixed enum printing for negative enums. There previously was no testing to validate that enum values were being displayed correctly.
Also added C++11 enum test cases to cover enums as int8_t, int16_t int32_t, int64_t, uint8_t, uint16_t, uint32_t, and uint64_t both for DWARF and dSYM cases. The DWARF being emitted by clang is missing the enum integer type, but the code is now ready to accept and deal with the integral type if it is supplied.

llvm-svn: 176548
2013-03-06 06:23:54 +00:00