Commit Graph

161416 Commits

Author SHA1 Message Date
Daniel Jasper 4478e5245e clang-format: Improve linebreaking and indentation for ObjC calls.
Before:
  popup_wdow_.reset([[RenderWidgetPopupWindow alloc]
      iniithContentRect:
          NSMakRet(origin_global.x, origin_global.y, pos.width(), pos.height())
                syeMask:NSBorderlessWindowMask
                  bking:NSBackingStoreBuffered
                    der:NO]);
  [self param:function( //
      parameter)]

After:
  popup_wdow_.reset([[RenderWidgetPopupWindow alloc]
      iniithContentRect:NSMakRet(origin_global.x, origin_global.y, pos.width(),
                                 pos.height())
                syeMask:NSBorderlessWindowMask
                  bking:NSBackingStoreBuffered
                    der:NO]);
  [self param:function( //
                  parameter)]

llvm-svn: 194267
2013-11-08 17:33:24 +00:00
Jordan Rose 09e604333e Add ImmutableSet profiling info for 'bool'.
Useful for tri-state maps: true, false, and "no data yet".

llvm-svn: 194266
2013-11-08 17:23:49 +00:00
Jordan Rose 5650bcb18e Revert 'Tweak ContainerNonEmptyMap with "int" instead of "bool"'.
I've added the missing ImutProfileInfo [sic] specialization for bool,
so this patch on r194235 is no longer needed.

This reverts r194244 / 2baea2887dfcf023c8e3560e5d4713c42eed7b6b.

llvm-svn: 194265
2013-11-08 17:23:33 +00:00
Tim Northover 93bcc66e73 ARM: fold prologue/epilogue sp updates into push/pop for code size
ARM prologues usually look like:
    push {r7, lr}
    sub sp, sp, #4

If code size is extremely important, this can be optimised to the single
instruction:
    push {r6, r7, lr}

where we don't actually care about the contents of r6, but pushing it subtracts
4 from sp as a side effect.

This should implement such a conversion, predicated on the "minsize" function
attribute (-Oz) since I've yet to find any code it actually makes faster.

llvm-svn: 194264
2013-11-08 17:18:07 +00:00
Artyom Skrobov 202ff08f97 [ARM] Handling for coprocessor instructions that are undefined starting from ARMv8 (Thumb encodings)
llvm-svn: 194263
2013-11-08 16:25:50 +00:00
Artyom Skrobov d2116a4ef7 [ARM] Handling for coprocessor instructions that are undefined starting from ARMv8 (ARM encodings)
llvm-svn: 194262
2013-11-08 16:17:14 +00:00
Artyom Skrobov e686cec7d4 [ARM] Handling for coprocessor instructions that are undefined starting from ARMv8 (ARM encodings)
llvm-svn: 194261
2013-11-08 16:16:30 +00:00
Artyom Skrobov 08b2257f14 Export MCDisassembler's SubtargetInfo, to allow architecture-aware disassembly
llvm-svn: 194260
2013-11-08 16:07:43 +00:00
Arnaud A. de Grandmaison 3b52f0b135 CalculateSpillWeights cleanup: remove unneeded includes
llvm-svn: 194259
2013-11-08 15:13:05 +00:00
Zoran Jovanovic 2914d2d980 Test for microMIPS trap instructions.
llvm-svn: 194258
2013-11-08 14:55:31 +00:00
NAKAMURA Takumi 0d82bac470 llvm-ar: Let opening a directory failed in llvm-ar.
Linux cannot open directories with open(2), although cygwin and *bsd can.

Motivation: The test, Object/directory.ll, had been failing with --target=cygwin on Linux. XFAIL was improper for host issues.
llvm-svn: 194257
2013-11-08 12:35:56 +00:00
Timur Iskhodzhanov 2c9341f979 Thread the info about vbptr sharing through ASTRecordLayout
Reviewed at http://llvm-reviews.chandlerc.com/D2120

llvm-svn: 194256
2013-11-08 11:45:35 +00:00
Matheus Almeida a3bac16950 [mips][msa] Update encoding of LDI instruction.
The encoding was updated in MSA r1.07.

llvm-svn: 194255
2013-11-08 10:43:11 +00:00
Benjamin Kramer 6d9d34b5a6 Remove diagnostic leftover from the ancient times when C++1y support was incomplete.
llvm-svn: 194254
2013-11-08 09:48:11 +00:00
Artyom Skrobov 8653443902 [ARM] In ARMAsmParser, MatchCoprocessorOperandName() permitted p10 and p11 as operands for coprocessor instructions, resulting in encodings that clash with FP/NEON instruction encodings
llvm-svn: 194253
2013-11-08 09:16:31 +00:00
Peter Collingbourne c7ae6101a4 Revert r194247 conditional on non-MSVC.
These definitions are required by the standard.  MSVC rejecting them
appears to be a bug.

llvm-svn: 194252
2013-11-08 08:54:53 +00:00
Bill Wendling 523bea8a39 Remove ^M from the file.
llvm-svn: 194251
2013-11-08 08:13:15 +00:00
Alp Toker 07ce1d0282 clang-format: Write files atomically
Switch clang-format over to Rewriter::overwriteChangedFiles().

The previous implementation was attempting to stream back directly to the
original file and failing if it was already memory mapped by MemoryBuffer,
an operation unsupported by Windows.

MemoryBuffer generally mmaps files larger than the physical page size so
this will have been difficult to reproduce consistently.

This change also reduces flicker in code editors and IDEs on all platforms
when reformatting in-place.

Note that other incorrect uses of MemoryBuffer exist in LLVM/clang and
will need a similar fix.

A test should be added for Windows when libFormat performance issues are
fixed (it takes longer than a day to format a 1MB file at present!)

llvm-svn: 194250
2013-11-08 08:07:19 +00:00
Alp Toker e994ebda14 Improve the missing ASM parser test for MS-style assembly
It's better to test clang-check rather than the internal c-index-test utility.

Also adds a target so we can remove the XFAILs.

Thanks to Richard Barton for spotting the test failure on ARM.

Test originally from r193685.

llvm-svn: 194249
2013-11-08 06:50:48 +00:00
Daniel Jasper 7039f18d82 Add .clang-format without column limit to subdirectory tests/.
A column limit in the test folder can lead to trouble as the RUN, CHECK,
etc. comments can potentially be broken over multiple lines changing
their meaning. Without column limit, clang-format will simply keep the
test author's line breaks.

llvm-svn: 194248
2013-11-08 06:45:35 +00:00
NAKAMURA Takumi 55380c4e54 clang-query: Unbreak msvc.
llvm-svn: 194247
2013-11-08 06:29:09 +00:00
NAKAMURA Takumi 421753fea7 clang/test/CXX/drs/dr1xx.cpp: Add explicit triple x86_64-unknown-unknown to satisfy check7a and check8a since r194240.
For i686 targets and LLP64 targets, we can see;
  error: 'error' diagnostics seen but not expected:
    File clang/test/CXX/drs/dr1xx.cpp Line 761: 'check7a' declared as an array with a negative size
    File clang/test/CXX/drs/dr1xx.cpp Line 765: 'check8a' declared as an array with a negative size
  2 errors generated.

llvm-svn: 194246
2013-11-08 05:16:50 +00:00
Jason Molenda 02706c3216 Add History subclasses for Thread, Unwind, RegisterContext.
Still working out some of the details of these classes but 
I wanted to get the overall structure checked in.
<rdar://problem/15314068> 

llvm-svn: 194245
2013-11-08 04:59:54 +00:00
NAKAMURA Takumi d23177a27e StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp: Tweak ContainerNonEmptyMap with "int" instead of "bool", to appease building since r194235.
In ADT/ImmutableSet, ImutProfileInfo<bool> cannot be matched to ImutProfileInteger.
I didn't have idea it'd the right way if PROFILE_INTEGER_INFO(bool) could be added there.

llvm-svn: 194244
2013-11-08 04:00:53 +00:00
David Majnemer f0388e77f7 Fix tests effected by r194221
GEP expressions were folded differently from before, change the tests to
reflect this.

llvm-svn: 194243
2013-11-08 03:06:45 +00:00
Douglas Gregor 9f2ed47133 s/DebugPrint/dump/g
llvm-svn: 194242
2013-11-08 02:16:10 +00:00
Daniel Jasper b302f9a0fb clang-format: Properly indent ObjC calls wrapped before first selector
Before:
  [self // break
      a:a
     aa:aa
  aaaaa:aaa];

After:
  [self // break
          a:a
         aa:aa
      aaaaa:aaa];

llvm-svn: 194241
2013-11-08 02:08:01 +00:00
Richard Smith c8f7fd10a9 Tests for core issue 170-200.
llvm-svn: 194240
2013-11-08 02:05:54 +00:00
Douglas Gregor c9f019ab0f Objective-C++ ARC: Improve the conversion to a const __unsafe_unretained reference.
Under ARC++, a reference to a const Objective-C pointer is implicitly
treated as __unsafe_unretained, and can be initialized with (e.g.) a
__strong lvalue. Make sure this behavior does not break template
argument deduction and (related) that partial ordering still prefers a
'T* const&' template over a 'T const&' template when this case kicks
in. Fixes <rdar://problem/14467941>.

llvm-svn: 194239
2013-11-08 02:04:24 +00:00
Fariborz Jahanian 22626e7b49 ObjectiveC migrator. Added a dropped check in my
last patch.

llvm-svn: 194238
2013-11-08 02:00:22 +00:00
Douglas Gregor 2ee1d99d00 Fix a bogus assert I introduced in r194224
llvm-svn: 194237
2013-11-08 01:20:25 +00:00
Jordan Rose 51327f9237 [analyzer] Add IdenticalExprChecker, to find copy-pasted code.
This syntactic checker looks for expressions on both sides of comparison
operators that are structurally the same. As a special case, the
floating-point idiom "x != x" for "isnan(x)" is left alone.

Currently this only checks comparison operators, but in the future we could
extend this to include logical operators or chained if-conditionals.

Checker by Per Viberg!

llvm-svn: 194236
2013-11-08 01:15:39 +00:00
Jordan Rose 1a4ae202c7 [analyzer] Track whether an ObjC for-in loop had zero iterations.
An Objective-C for-in loop will have zero iterations if the collection is
empty. Previously, we could only detect this case if the program asked for
the collection's -count /before/ the for-in loop. Now, the analyzer
distinguishes for-in loops that had zero iterations from those with at
least one, and can use this information to constrain the result of calling
-count after the loop.

In order to make this actually useful, teach the checker that methods on
NSArray, NSDictionary, and the other immutable collection classes don't
change the count.

<rdar://problem/14992886>

llvm-svn: 194235
2013-11-08 01:15:35 +00:00
Jordan Rose 236dbd25e7 [analyzer] Specialize "loop executed 0 times" for for-in and for-range loops.
The path note that says "Loop body executed 0 times" has been changed to
"Loop body skipped when range is empty" for C++11 for-range loops, and to
"Loop body skipped when collection is empty" for Objective-C for-in loops.

Part of <rdar://problem/14992886>

llvm-svn: 194234
2013-11-08 01:15:30 +00:00
Fariborz Jahanian ec7cea925e ObjectiveC migrator. Fixes an obscure bug where
NS_RETURNS_INNER_POINTER ends up unintentionally 
on the @property under -objcmt-migrate-all 
// rdar://15396636

llvm-svn: 194233
2013-11-08 01:15:17 +00:00
Sean Callanan a464f3d43a Changed the ABIs and ClangFunction to take a
llvm::ArrayRef of arguments rather than taking
a fixed number of possibly-NULL pointers to
arguments.

Also changed ClangFunction::GetThreadPlanToCallFunction
to take the address of the argument struct by value
instead of by reference, since it doesn't actually
modify the value passed into it.

llvm-svn: 194232
2013-11-08 01:14:26 +00:00
Will Dietz 949ec546c4 ubsan: Only emit constants for filenames and type descriptors once.
Produces neater IR in significantly less time.

(~18% faster -O0 compile time for sqlite3 with -fsanitize=undefined)

llvm-svn: 194231
2013-11-08 01:09:22 +00:00
Peter Collingbourne 0dc0e6d32c Silence GCC warning.
llvm-svn: 194230
2013-11-08 01:08:12 +00:00
Daniel Jasper 165b29e2d2 clang-format: Make breaking before ternary operators configurable.
llvm-svn: 194229
2013-11-08 00:57:11 +00:00
Douglas Gregor 688b6c01ce Eliminate an unnecessary .c_str()
llvm-svn: 194228
2013-11-08 00:38:03 +00:00
Peter Collingbourne 8b1265b353 Introduce clang-query tool.
This tool is for interactive exploration of the Clang AST using AST matchers.
It currently allows the user to enter a matcher at an interactive prompt
and view the resulting bindings as diagnostics, AST pretty prints or AST
dumps. Example session:

$ cat foo.c
void foo(void) {}
$ clang-query foo.c --
clang-query> match functionDecl()

Match #1:

foo.c:1:1: note: "root" binds here
void foo(void) {}
^~~~~~~~~~~~~~~~~
1 match.

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

llvm-svn: 194227
2013-11-08 00:08:23 +00:00
Manuel Klimek 6408301421 Adds the ability to inject a DiagnosticConsumer into ClangTools.
llvm-svn: 194226
2013-11-07 23:18:05 +00:00
Douglas Gregor 594b8c934f Modules: Teach the preprocessor to recognize 'import' only after an '@'.
The preprocessor currently recognizes module declarations to load a
module based on seeing the 'import' keyword followed by an
identifier. This sequence is fairly unlikely in C (one would need a
type named 'import'), but is more common in Objective-C (where a
variable named 'import' can cause problems). Since import declarations
currently require a leading '@', recognize that in the preprocessor as
well. Fixes <rdar://problem/15084587>.

llvm-svn: 194225
2013-11-07 22:55:02 +00:00
Douglas Gregor 4b60a1594d Re-instate contextual conversion to Objective-C pointers in message sends.
When performing an Objective-C message send to a value of class type,
perform a contextual conversion to an Objective-C pointer type. We've
had this for a long time, but it recently regressed. Fixes
<rdar://problem/15234703>.

llvm-svn: 194224
2013-11-07 22:34:54 +00:00
Peter Collingbourne a2334162cf Introduce MatchFinder::matchAST.
Differential Revision: http://llvm-reviews.chandlerc.com/D2115

llvm-svn: 194223
2013-11-07 22:30:36 +00:00
Peter Collingbourne 2b94713053 Re-introduce MatchFinder::addDynamicMatcher.
Differential Revision: http://llvm-reviews.chandlerc.com/D2114

llvm-svn: 194222
2013-11-07 22:30:32 +00:00
David Majnemer d3d140da36 IR: Properly canonicalize PointerType in ConstantExpr GEPs
No additional test was needed, Other/constant-fold-gep.ll detects this
just fine.

llvm-svn: 194221
2013-11-07 22:29:42 +00:00
David Majnemer bd4fef4a89 IR: Do not canonicalize constant GEPs into an out-of-bounds array access
Summary:
Consider a GEP of:
i8* getelementptr ({ [2 x i8], i32, i8, [3 x i8] }* @main.c, i32 0, i32 0, i64 0)

If we proceeded to GEP the aforementioned object by 8, would form a GEP of:
i8* getelementptr ({ [2 x i8], i32, i8, [3 x i8] }* @main.c, i32 0, i32 0, i64 8)

Note that we would go through the first array member, causing an
out-of-bounds accesses.  This is problematic because we might get fooled
if we are trying to evaluate loads using this GEP, for example, based
off of an object with a constant initializer where the array is zero.

This fixes PR17732.

Reviewers: nicholas, chandlerc, void

Reviewed By: void

CC: llvm-commits, echristo, void, aemerson

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

llvm-svn: 194220
2013-11-07 22:15:53 +00:00
Bill Wendling b805c68f4d Run clang-format on file.
llvm-svn: 194219
2013-11-07 20:18:21 +00:00
Bill Wendling 8890460431 Move copying of global initializers below the cloning of functions.
The BlockAddress doesn't have access to the correct basic blocks until the
functions have been cloned. This causes the BlockAddress to point to the old
values. Just wait until the functions have been cloned before copying the
initializers.
PR13163

llvm-svn: 194218
2013-11-07 20:14:51 +00:00