]> granicus.if.org Git - clang/log
clang
11 years agoDon't create a StringRef from a temporary string.
Richard Trieu [Thu, 6 Jun 2013 02:22:29 +0000 (02:22 +0000)]
Don't create a StringRef from a temporary string.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183372 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Look through ExprWithCleanups to see if an expr's consumed.
Jordan Rose [Thu, 6 Jun 2013 01:57:24 +0000 (01:57 +0000)]
[analyzer] Look through ExprWithCleanups to see if an expr's consumed.

We based decisions during analysis and during path generation on whether
or not an expression is consumed, so if a top-level expression has
cleanups it's important for us to look through that.

<rdar://problem/14076125>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183368 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Improve debug output for PathDiagnosticPieces.
Jordan Rose [Thu, 6 Jun 2013 01:57:19 +0000 (01:57 +0000)]
[analyzer] Improve debug output for PathDiagnosticPieces.

You can now dump a single PathDiagnosticPiece or PathDiagnosticLocation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183367 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoclang/unittests/Format/FormatTest.cpp: Suppress utf8 literals with _MSC_VER. MS cl...
NAKAMURA Takumi [Thu, 6 Jun 2013 01:14:58 +0000 (01:14 +0000)]
clang/unittests/Format/FormatTest.cpp: Suppress utf8 literals with _MSC_VER. MS cl.exe is unaware of BOM-less utf8 source files.

FIXME: Encode Cyrillic and CJK characters below to appease MS compilers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183366 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Fix a crash that occurs when processing an rvalue array.
Anna Zaks [Thu, 6 Jun 2013 00:19:36 +0000 (00:19 +0000)]
[analyzer] Fix a crash that occurs when processing an rvalue array.

When processing ArrayToPointerDecay, we expect the array to be a location, not a LazyCompoundVal.
Special case the rvalue arrays by using a location to represent them. This case is handled similarly
elsewhere in the code.

Fixes PR16206.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183359 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; new edges] Don't crash if the top-level entry edge is missing.
Jordan Rose [Thu, 6 Jun 2013 00:12:41 +0000 (00:12 +0000)]
[analyzer; new edges] Don't crash if the top-level entry edge is missing.

We previously asserted that there was a top-level function entry edge, but
if the function decl's location is invalid (or within a macro) this edge
might not exist. Change the assertion to an actual check, and don't drop
the first path piece if it doesn't match.

<rdar://problem/14070304>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183358 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; new edges] Ignore self-edges, not all edges with the same location.
Jordan Rose [Thu, 6 Jun 2013 00:12:37 +0000 (00:12 +0000)]
[analyzer; new edges] Ignore self-edges, not all edges with the same location.

The edge optimizer needs to see edges for, say, implicit casts (which have
the same source location as their operand) to uniformly simplify the
entire path. However, we still don't want to produce edges from a statement
to /itself/, which could occur when two nodes in a row have the same
statement location.

This necessitated moving the check for redundant notes to after edge
optimization, since the check relies on notes being adjacent in the path.

<rdar://problem/14061675>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183357 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoIf we're splitting the dwarf for fission and don't want to use the
Eric Christopher [Wed, 5 Jun 2013 23:58:15 +0000 (23:58 +0000)]
If we're splitting the dwarf for fission and don't want to use the
integrated assembler then go ahead and still split the dwarf anyhow.

Add two tests, one to exercise existing behavior of not splitting
when we're just emitting assembly files and the other to test
that we split when we're not in integrated as mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183355 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoObjective-C: Provide fixit with suggested spelling correction
Fariborz Jahanian [Wed, 5 Jun 2013 18:46:14 +0000 (18:46 +0000)]
Objective-C: Provide fixit with suggested spelling correction
for -Wundeclared-selector warnings. // rdar://14039037

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183331 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPR14763: Debug info for non-trivial record parameters
David Blaikie [Wed, 5 Jun 2013 18:30:31 +0000 (18:30 +0000)]
PR14763: Debug info for non-trivial record parameters

There seems to have been some erroneous code attempting to describe the
ABI of parameters (non-trivial record parameters are passed by
reference). This would break the type of the function (especially when
it caused a mismatch between the type of a declaration & a definition)
causing PR14763 and PR14645.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183329 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoWhen the template specialization header is missing, set a valid source location for...
Argyrios Kyrtzidis [Wed, 5 Jun 2013 17:52:24 +0000 (17:52 +0000)]
When the template specialization header is missing, set a valid source location for the template keyword when recovering.

Otherwise ClassTemplateSpecializationDecl::getSourceRange() will mistakenly consider itself as an implicit partial specialization
and lead to a crash.

Fixes rdar://14063074

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183325 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[ms-cxxabi] Thread GlobalDecls through to CodeGenModule::getFunctionLinkage.
Peter Collingbourne [Wed, 5 Jun 2013 17:49:37 +0000 (17:49 +0000)]
[ms-cxxabi] Thread GlobalDecls through to CodeGenModule::getFunctionLinkage.

This is so that we can give destructor variants different linkage later.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183324 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoclang-check: Enable specification of additional compiler arguments
Pavel Labath [Wed, 5 Jun 2013 16:23:30 +0000 (16:23 +0000)]
clang-check: Enable specification of additional compiler arguments

Summary:
This adds two command-line parameters: -extra-arg and -extra-arg-before, which
enable the user to pass additional parameters to the compiler command.

Reviewers: klimek

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183320 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[ms-cxxabi] Fix vbptr offsets in memptrs when the vbptr is in an nvbase
Reid Kleckner [Wed, 5 Jun 2013 15:58:29 +0000 (15:58 +0000)]
[ms-cxxabi] Fix vbptr offsets in memptrs when the vbptr is in an nvbase

Also addresses a review comment from John from on r180985 by removing
the "== -1" check, since it's now reusing the correct code which has the
comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183318 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSilence GCC warning.
Benjamin Kramer [Wed, 5 Jun 2013 15:37:50 +0000 (15:37 +0000)]
Silence GCC warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183317 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdded test with characters using four bytes in UTF-8 representation.
Alexander Kornienko [Wed, 5 Jun 2013 15:08:20 +0000 (15:08 +0000)]
Added test with characters using four bytes in UTF-8 representation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183315 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUTF-8 support for clang-format.
Alexander Kornienko [Wed, 5 Jun 2013 14:09:10 +0000 (14:09 +0000)]
UTF-8 support for clang-format.

Summary:
Detect if the file is valid UTF-8, and if this is the case, count code
points instead of just using number of bytes in all (hopefully) places, where
number of columns is needed. In particular, use the new
FormatToken.CodePointCount instead of TokenLength where appropriate.
Changed BreakableToken implementations to respect utf-8 character boundaries
when in utf-8 mode.

Reviewers: klimek, djasper

Reviewed By: djasper

CC: cfe-commits, rsmith, gribozavr
Differential Revision: http://llvm-reviews.chandlerc.com/D918

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183312 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRecommit r183298+r183300 'Get rid of VTableContext::ComputeMethodVTableIndices()...
Timur Iskhodzhanov [Wed, 5 Jun 2013 14:05:50 +0000 (14:05 +0000)]
Recommit r183298+r183300 'Get rid of VTableContext::ComputeMethodVTableIndices() and VTableContext::getNumVirtualFunctionPointers()'

In r183298, I've used llvm::SmallPtrSet<..., 8> instead of llvm::SmallVector<..., 8> for NewVirtualFunctionsTy by mistake.
This only manifested when a class had more than 8 virtual functions, which wasn't covered by unit-tests

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183310 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago... and actually run it
Timur Iskhodzhanov [Wed, 5 Jun 2013 13:50:24 +0000 (13:50 +0000)]
... and actually run it

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183309 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd a test for the breakage from r183298
Timur Iskhodzhanov [Wed, 5 Jun 2013 13:49:11 +0000 (13:49 +0000)]
Add a test for the breakage from r183298

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183308 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUnrevert the tests from r183298 as they pass with both old and new code
Timur Iskhodzhanov [Wed, 5 Jun 2013 13:12:36 +0000 (13:12 +0000)]
Unrevert the tests from r183298 as they pass with both old and new code

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183306 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRevert r183298 and r183300 as the former broke the virtual function lookup in libcxx...
Timur Iskhodzhanov [Wed, 5 Jun 2013 12:24:46 +0000 (12:24 +0000)]
Revert r183298 and r183300 as the former broke the virtual function lookup in libcxx __locale

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183305 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMake clang tools ignore -fcolor-diagnostics and -fdiagnostics-color retrieved from...
Alexander Kornienko [Wed, 5 Jun 2013 11:33:11 +0000 (11:33 +0000)]
Make clang tools ignore -fcolor-diagnostics and -fdiagnostics-color retrieved from the compilation database.

Summary:
Clang tools' diagnostic output could be force colored when a command
line from the compilation database contains -fcolor-diagnostics or
-fdiagnostics-color. This is not what we want e.g. for vim integration.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits, revane, jordan_rose
Differential Revision: http://llvm-reviews.chandlerc.com/D917

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183304 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoASTTests/DeclTest.cpp: Tweak on msvc target to add "-fno-ms-extensions".
NAKAMURA Takumi [Wed, 5 Jun 2013 06:54:06 +0000 (06:54 +0000)]
ASTTests/DeclTest.cpp: Tweak on msvc target to add "-fno-ms-extensions".

MS extensions don't prefer imaginary suffix even with -std=c++11.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183301 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix fallout from r183298, unused function (CollectPrimaryBases) causing the -Werror...
David Blaikie [Wed, 5 Jun 2013 06:50:40 +0000 (06:50 +0000)]
Fix fallout from r183298, unused function (CollectPrimaryBases) causing the -Werror build to fail

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183300 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix the DUMP_OVERRIDERS macro in the VTableBuilder.cpp
Timur Iskhodzhanov [Wed, 5 Jun 2013 06:40:07 +0000 (06:40 +0000)]
Fix the DUMP_OVERRIDERS macro in the VTableBuilder.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183299 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoGet rid of VTableContext::ComputeMethodVTableIndices() and VTableContext::getNumVirtu...
Timur Iskhodzhanov [Wed, 5 Jun 2013 06:36:37 +0000 (06:36 +0000)]
Get rid of VTableContext::ComputeMethodVTableIndices() and VTableContext::getNumVirtualFunctionPointers(); also add some tests for the VTable indices output to make sure we don't regress

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183298 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPR16214: Debug Info: -flimit-debug-info doesn't omit definitions for types used via...
David Blaikie [Wed, 5 Jun 2013 05:32:23 +0000 (05:32 +0000)]
PR16214: Debug Info: -flimit-debug-info doesn't omit definitions for types used via typedefs

In an effort to make -flimit-debug-info more consistent I over-shot the
mark & made types used via typedefs never produce definitions in the
debug info (even if the type was used in a way that would require a
definition).

The fix for this is to do exactly what I was hoping to do at some point
- plumb the declaration/definition choice through the various layers of
"CreateType" in CGDebugInfo. In this way we can produce declarations
whenever they are sufficient & definitions otherwise - including when
qualifiers are used, for example (discovered in PR14467). This may not
be complete (there may be other types/situations where we need to
propagate the "declaration/definition" choice) but it lays the basic
foundation which we can enhance in future iterations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183296 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDefault to PIE and using stack protection on OpenBSD.
Rafael Espindola [Wed, 5 Jun 2013 04:28:55 +0000 (04:28 +0000)]
Default to PIE and using stack protection on OpenBSD.

Patch by Matthew Dempsky.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183295 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImplement SparcV9ABIInfo::EmitVAArg.
Jakob Stoklund Olesen [Wed, 5 Jun 2013 03:00:18 +0000 (03:00 +0000)]
Implement SparcV9ABIInfo::EmitVAArg.

This could actually be implemented with the LLVM IR va_arg instruction,
but it doesn't seem to offer any advantages over accessing the va_list
pointer directly.

Using the va_list pointer directly makes it possible to perform type
coercion directly from the argument array, and the va_list updates are
exposed to the optimizers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183292 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix CoerceIntOrPtrToIntOrPtr on big-endian targets.
Jakob Stoklund Olesen [Wed, 5 Jun 2013 03:00:13 +0000 (03:00 +0000)]
Fix CoerceIntOrPtrToIntOrPtr on big-endian targets.

Type coercion for argument passing is equivalent to storing the source
type and loading the destination type from the same pointer. On
big-endian targets, this means that the high bits of integers are
preserved.

This patch fixes the CoerceIntOrPtrToIntOrPtr() function on big-endian
targets by inserting the required shift instructions to preserve the
high bits instead of the low bits.

This is used by SparcABIInfo when passing small structs in the high bits
of registers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183291 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoHeed ABIArgInfo::getInReg() for return values.
Jakob Stoklund Olesen [Wed, 5 Jun 2013 03:00:09 +0000 (03:00 +0000)]
Heed ABIArgInfo::getInReg() for return values.

The 'inreg' attribute can also be applied to function return values in
LLVM IR. The SPARC v9 backend is using the flag when returning structs
containing 32-bit floats.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183290 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoModel temporary lifetime-extension explicitly in the AST. Use this model to
Richard Smith [Wed, 5 Jun 2013 00:46:14 +0000 (00:46 +0000)]
Model temporary lifetime-extension explicitly in the AST. Use this model to
handle temporaries which have been lifetime-extended to static storage duration
within constant expressions. This correctly handles nested lifetime extension
(through reference members of aggregates in aggregate initializers) but
non-constant-expression emission hasn't yet been updated to do the same.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183283 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[ms-cxxabi] Factor out some loops into helpers for readability
Reid Kleckner [Tue, 4 Jun 2013 21:32:29 +0000 (21:32 +0000)]
[ms-cxxabi] Factor out some loops into helpers for readability

No functionality change, covered by the existing virtual base adjustment
tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183251 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[libclang] When annotating tokens, don't override a property annotation with a getter...
Argyrios Kyrtzidis [Tue, 4 Jun 2013 18:24:30 +0000 (18:24 +0000)]
[libclang] When annotating tokens, don't override a property annotation with a getter/setter method annotation.

rdar://13764549

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183242 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAnalysis: Add a CFG successor to a SwitchStmt if it is both empty and fully covered
David Majnemer [Tue, 4 Jun 2013 17:38:44 +0000 (17:38 +0000)]
Analysis: Add a CFG successor to a SwitchStmt if it is both empty and fully covered

Consider the case where a SwitchStmt satisfied isAllEnumCasesCovered()
as well as having no cases at all (i.e. the enum it covers has no
enumerators).

In this case, we should add a successor to repair the CFG.

This fixes PR16212.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183237 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdded Lexer::getBufferEnd().
Alexander Kornienko [Tue, 4 Jun 2013 16:58:03 +0000 (16:58 +0000)]
Added Lexer::getBufferEnd().

Summary:
There's Lexer::getBufferStart(), and we need getBufferEnd() to access
the whole input buffer in clang::format::reformat. We don't want to
rely on the fact that the Lexer::BufferEnd always points to '\0', as there can
be embedded '\0's as well.

Reviewers: jordan_rose

Reviewed By: jordan_rose

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183236 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoObjective-C encoding. Fixes up encodeing for
Fariborz Jahanian [Tue, 4 Jun 2013 16:04:37 +0000 (16:04 +0000)]
Objective-C encoding. Fixes up encodeing for
arrays of empty structs. // rdar://14053082
(also pr13062).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183234 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoParser/Registry argument enhancements.
Samuel Benzaquen [Tue, 4 Jun 2013 15:46:22 +0000 (15:46 +0000)]
Parser/Registry argument enhancements.

Summary:
 Parser/Registry argument enhancements.
  - 2 argument support.
  - unsigned values support.

Reviewers: klimek

CC: cfe-commits, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D915

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183231 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoEnables chaining of argument adjusters in clang tools.
Manuel Klimek [Tue, 4 Jun 2013 14:44:44 +0000 (14:44 +0000)]
Enables chaining of argument adjusters in clang tools.

This enables changing clang-check to get extra arguments.

Patch by Pavel Labath.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183227 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix a typo (chek => check)
Sylvestre Ledru [Tue, 4 Jun 2013 13:43:50 +0000 (13:43 +0000)]
Fix a typo (chek => check)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183223 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix linkage computation for local types in template functions.
Rafael Espindola [Tue, 4 Jun 2013 13:43:35 +0000 (13:43 +0000)]
Fix linkage computation for local types in template functions.

Template functions (and member functions of class templates) present the same
problem as inline functions. They need to be uniqued, so we need to assign
VisibleNoLinkage linkage to types defined in them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183222 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix typo in comment. Found by -Wdocumentation.
Benjamin Kramer [Tue, 4 Jun 2013 09:13:21 +0000 (09:13 +0000)]
Fix typo in comment. Found by -Wdocumentation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183217 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoReset the release notes for the 3.4 release.
Bill Wendling [Tue, 4 Jun 2013 06:17:46 +0000 (06:17 +0000)]
Reset the release notes for the 3.4 release.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183211 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRephrase asm_mismatched_size_modifier diagnostic. <rdar://problem/14050339>
Bob Wilson [Tue, 4 Jun 2013 06:10:09 +0000 (06:10 +0000)]
Rephrase asm_mismatched_size_modifier diagnostic. <rdar://problem/14050339>

The text of this diagnostic was unnecessarily specific to the current ARM
implementation of validateConstraintModifier, and it gave a potentially
confusing suggestion for fixing the problem. The ARM-specific issue is not
a big deal since that is the only target that currently does any checking of
asm operand modifiers, but until my change in 183172 it was still wrong for
output operands in the way that it referred to the value being truncated when
put into a register, since output operands are retrieved from the registers
instead of being put into them. The bigger problem is that its suggestion to
"use a modifier" is wrong and confusing in the case where a "q" modifier is
incorrectly used with an "r" constraint. In that case, the solution might
well be to remove the modifier or perhaps change the constraint. It's better
to just leave the diagnostic message more generic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183209 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove some unreachable (and wrong) code and replace it with an assertion.
Richard Smith [Tue, 4 Jun 2013 04:45:03 +0000 (04:45 +0000)]
Remove some unreachable (and wrong) code and replace it with an assertion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183206 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdding support for MSVC #pragma detect_mismatch functionality by emitting a FAILIFMIS...
Aaron Ballman [Tue, 4 Jun 2013 02:07:14 +0000 (02:07 +0000)]
Adding support for MSVC #pragma detect_mismatch functionality by emitting a FAILIFMISMATCH linker command into the object file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183178 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoBound member function diagnostic - suggest no-args calls and note overload candidates
David Blaikie [Tue, 4 Jun 2013 00:28:46 +0000 (00:28 +0000)]
Bound member function diagnostic - suggest no-args calls and note overload candidates

Still missing cases for templates, but this is a step in the right
direction. Also omits suggestions that would be ambiguous (eg: void
func(int = 0); + void func(float = 0); func;)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183173 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDo not report -Wasm-operand-widths for ARM output operands. <rdar://14050337>
Bob Wilson [Mon, 3 Jun 2013 23:57:13 +0000 (23:57 +0000)]
Do not report -Wasm-operand-widths for ARM output operands. <rdar://14050337>

We're getting reports of this warning getting triggered in cases where it
is not adding any value. There is no asm operand modifier that you can use
to silence it, and there's really nothing wrong with having an LDRB, for
example, with a "char" output.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183172 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Enable the new edge algorithm by default.
Jordan Rose [Mon, 3 Jun 2013 23:00:19 +0000 (23:00 +0000)]
[analyzer] Enable the new edge algorithm by default.

...but don't yet migrate over the existing plist tests. Some of these
would be trivial to migrate; others could use a bit of inspection first.
In any case, though, the new edge algorithm seems to have proven itself,
and we'd like more coverage (and more usage) of it going forwards.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183165 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; new edges] Omit subexpression back-edges that span multiple lines.
Jordan Rose [Mon, 3 Jun 2013 23:00:09 +0000 (23:00 +0000)]
[analyzer; new edges] Omit subexpression back-edges that span multiple lines.

A.1 -> A -> B
becomes
A.1 -> B

This only applies if there's an edge from a subexpression to its parent
expression, and that is immediately followed by another edge from the
parent expression to a subsequent expression. Normally this is useful for
bringing the edges back to the left side of the code, but when the
subexpression is on a different line the backedge ends up looking strange,
and may even obscure code. In these cases, it's better to just continue
to the next top-level statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183164 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; new edges] Don't eliminate subexpr edge cycles if the line is long.
Jordan Rose [Mon, 3 Jun 2013 23:00:05 +0000 (23:00 +0000)]
[analyzer; new edges] Don't eliminate subexpr edge cycles if the line is long.

Specifically, if the line is over 80 characters, or if the top-level
statement spans mulitple lines, we should preserve sub-expression edges
even if they form a simple cycle as described in the last commit, because
it's harder to infer what's going on than it is for shorter lines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183163 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; new edges] Eliminate "cycle edges" for a single subexpression.
Jordan Rose [Mon, 3 Jun 2013 23:00:00 +0000 (23:00 +0000)]
[analyzer; new edges] Eliminate "cycle edges" for a single subexpression.

Generating context arrows can result in quite a few arrows surrounding a
relatively simple expression, often containing only a single path note.

|
1 +--2---+
v/       v
auto m = new m // 3 (the path note)
|\       |
5 +--4---+
v

Note also that 5 and 1 are two ends of the "same" arrow, i.e. they go from
event to event. 3 is not an arrow but the path note itself.

Now, if we see a pair of edges like 2 and 4---where 4 is the reverse of 2
and there is optionally a single path note between them---we will
eliminate /both/ edges. Anything more complicated will be left as is
(more edges involved, an inlined call, etc).

The next commit will refine this to preserve the arrows in a larger
expression, so that we don't lose all context.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183162 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; new edges] Extra test case.
Jordan Rose [Mon, 3 Jun 2013 22:59:56 +0000 (22:59 +0000)]
[analyzer; new edges] Extra test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183161 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; new edges] Improve enclosing contexts for logical expressions.
Jordan Rose [Mon, 3 Jun 2013 22:59:53 +0000 (22:59 +0000)]
[analyzer; new edges] Improve enclosing contexts for logical expressions.

The old edge builder didn't have a notion of nested statement contexts,
so there was no special treatment of a logical operator inside an if
(or inside another logical operator). The new edge builder always tries
to establish the full context up to the top-level statement, so it's
important to know how much context has been established already rather
than just checking the innermost context.

This restores some of the old behavior for the old edge generation:
the context of a logical operator's non-controlling expression is the
subexpression in the old edge algorithm, but the entire operator
expression in the new algorithm.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183160 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; new edges] Include context for edges to sub-expressions.
Jordan Rose [Mon, 3 Jun 2013 22:59:48 +0000 (22:59 +0000)]
[analyzer; new edges] Include context for edges to sub-expressions.

The current edge-generation algorithm sometimes creates edges from a
top-level statement A to a sub-expression B.1 that's not at the start of B.
This creates a "swoosh" effect where the arrow is drawn on top of the
text at the start of B. In these cases, the results are clearer if we see
an edge from A to B, then another one from B to B.1.

Admittedly, this does create a /lot/ of arrows, some of which merely hop
into a subexpression and then out again for a single note. The next commit
will eliminate these if the subexpression is simple enough.

This updates and reuses some of the infrastructure from the old edge-
generation algorithm to find the "enclosing statement" context for a
given expression. One change in particular marks the context of the
LHS or RHS of a logical binary operator (&&, ||) as the entire operator
expression, rather than the subexpression itself. This matches our behavior
for ?:, and allows us to handle nested context information.

<rdar://problem/13902816>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183159 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; new edges] Include a top-level function entry edge while optimizing.
Jordan Rose [Mon, 3 Jun 2013 22:59:45 +0000 (22:59 +0000)]
[analyzer; new edges] Include a top-level function entry edge while optimizing.

Although we don't want to show a function entry edge for a top-level path,
having it makes optimizing edges a little more uniform.

This does not affect any edges now, but will affect context edge generation
(next commit).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183158 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCFG: In a DeclStmt, skip anything that's not a VarDecl.
Jordan Rose [Mon, 3 Jun 2013 22:59:41 +0000 (22:59 +0000)]
CFG: In a DeclStmt, skip anything that's not a VarDecl.

Neither the compiler nor the analyzer are doing anything with non-VarDecl
decls in the CFG, and having them there creates extra nodes in the
analyzer's path diagnostics. Simplify the CFG (and the path edges) by
simply leaving them out. We can always add interesting decls back in when
they become relevant.

Note that this only affects decls declared in a DeclStmt, and then only
those that appear within a function body.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183157 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPacify compilers that think you can drop off a fully covered switch.
Benjamin Kramer [Mon, 3 Jun 2013 21:26:13 +0000 (21:26 +0000)]
Pacify compilers that think you can drop off a fully covered switch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183155 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUnresolvedMemberExpr should have an expr location of the member (not the base)
David Blaikie [Mon, 3 Jun 2013 19:46:44 +0000 (19:46 +0000)]
UnresolvedMemberExpr should have an expr location of the member (not the base)

This matches the behavior of MemberExpr and makes diagnostics such as
"reference to non-static member function must be called" more legible in
the case that the base & member are split over multiple lines (prior to
this change the diagnostic would point to the base, not the member -
making it very unclear in chained multi-line builder-style calls)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183149 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago__uint128_t is only available on 64 bit platforms, only test it when it's around.
Benjamin Kramer [Mon, 3 Jun 2013 19:37:18 +0000 (19:37 +0000)]
__uint128_t is only available on 64 bit platforms, only test it when it's around.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183146 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd support for .bind("foo") expressions on the dynamic matchers.
Samuel Benzaquen [Mon, 3 Jun 2013 19:31:08 +0000 (19:31 +0000)]
Add support for .bind("foo") expressions on the dynamic matchers.

Summary: Add support on the parser, registry, and DynTypedMatcher for binding IDs dynamically.

Reviewers: klimek

CC: cfe-commits, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D911

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183144 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoConvert some Unicode whitespace to ASCII whitespace.
Richard Smith [Mon, 3 Jun 2013 17:00:25 +0000 (17:00 +0000)]
Convert some Unicode whitespace to ASCII whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183116 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMoved FormatToken to a separate header.
Alexander Kornienko [Mon, 3 Jun 2013 16:45:03 +0000 (16:45 +0000)]
Moved FormatToken to a separate header.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183115 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoLet clang-format remove empty lines before "}".
Daniel Jasper [Mon, 3 Jun 2013 16:16:41 +0000 (16:16 +0000)]
Let clang-format remove empty lines before "}".

These lines almost never aid readability.

Before:
void f() {
  int i;  // some variable

}

After:
void f() {
  int i;  // some variable
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183112 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix memory leak for APValues that do memory allocation.
Manuel Klimek [Mon, 3 Jun 2013 13:51:33 +0000 (13:51 +0000)]
Fix memory leak for APValues that do memory allocation.

This patch ensures that APValues are deallocated with the ASTContext by
registering a deallocation function for APValues to the ASTContext.

Original version of the patch by James Dennett.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183101 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImprove detection preventing certain kind of formatting patterns.
Daniel Jasper [Mon, 3 Jun 2013 09:54:46 +0000 (09:54 +0000)]
Improve detection preventing certain kind of formatting patterns.

An oversight in this detection made clang-format unable to format
the following nicely:
void aaaaaaaaaaaaaaaaaaa<aaaaaaaaaaaaaaaaaaaaaaaaaaa,
                         bbbbbbbbbbbbbbbbbbbbbbbbbb>(
    cccccccccccccccccccccccccccc);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183097 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix line-breaking problem caused by comment.
Daniel Jasper [Mon, 3 Jun 2013 08:42:05 +0000 (08:42 +0000)]
Fix line-breaking problem caused by comment.

Before, clang-format would not find a solution for formatting:
if ((aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ||
     bbbbbbbbbbbbbbbbbb) && // aaaaaaaaaaaaaaaa
    cccccc) {
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183096 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDo not walk through member-accesses on bitfields when looking for the object
Richard Smith [Mon, 3 Jun 2013 07:13:35 +0000 (07:13 +0000)]
Do not walk through member-accesses on bitfields when looking for the object
which is lifetime-extended by a reference binding. An additional temporary is
created for such a bitfield access (although we have no explicit AST
representation for it).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183095 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRefactor constant expression evaluation to associate the complete object of a
Richard Smith [Mon, 3 Jun 2013 05:03:02 +0000 (05:03 +0000)]
Refactor constant expression evaluation to associate the complete object of a
materialized temporary with the corresponding MaterializeTemporaryExpr. This is
groundwork for providing C++11's guaranteed static initialization for global
references bound to lifetime-extended temporaries (if the initialization is a
constant expression).

In passing, fix a couple of bugs where some evaluation failures didn't trigger
diagnostics, and a rejects-valid where potential constant expression testing
would assume that it knew the dynamic type of *this and would reject programs
which relied on it being some derived type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183093 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix a couple of bugs where jump diagnostics would not notice that a variable
Richard Smith [Mon, 3 Jun 2013 01:05:37 +0000 (01:05 +0000)]
Fix a couple of bugs where jump diagnostics would not notice that a variable
has an initializer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183092 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix handling of pointers-to-members and comma expressions when
Richard Smith [Mon, 3 Jun 2013 00:17:11 +0000 (00:17 +0000)]
Fix handling of pointers-to-members and comma expressions when
lifetime-extending temporaries in reference bindings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183089 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAllow paren casted throw statements inside of ternary expressions
David Majnemer [Sun, 2 Jun 2013 08:40:42 +0000 (08:40 +0000)]
Allow paren casted throw statements inside of ternary expressions

clang would incorrectly not allow the following:

int x = true ? (throw 1) : 2;

The problem exists because we don't see beyond the parens.
This, in turn, causes us to believe that we are choosing between void
and int which we diagnose as an error.

Instead, allow clang to see the 'throw' inside the parens.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183085 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoProperly consider the range of enum for range comparisons in C mode
David Majnemer [Sun, 2 Jun 2013 08:11:22 +0000 (08:11 +0000)]
Properly consider the range of enum for range comparisons in C mode

In some cases, clang applies the C++ rules for computing the range of a
value when said value is an enum.

Instead, apply C semantics when in C mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183084 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPR12848: When emitting a local variable declared 'constexpr', always initialize it...
Richard Smith [Sun, 2 Jun 2013 00:09:52 +0000 (00:09 +0000)]
PR12848: When emitting a local variable declared 'constexpr', always initialize it with a store or a memcpy, not by emitting the initializer expression. This is not required for correctness, but more closely aligns with people's expectations, and is cheap (since we've already evaluated the initializer).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183082 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImprove recognition of template parameters.
Daniel Jasper [Sat, 1 Jun 2013 18:56:00 +0000 (18:56 +0000)]
Improve recognition of template parameters.

Before: return a<b &&c> d;
After:  return a < b && c > d;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183077 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Malloc checker should only escape the receiver when “[O init..]” is called.
Anna Zaks [Fri, 31 May 2013 23:47:32 +0000 (23:47 +0000)]
[analyzer] Malloc checker should only escape the receiver when “[O init..]” is called.

Jordan has pointed out that it is valuable to warn in cases when the arguments to init escape.
For example, NSData initWithBytes id not going to free the memory.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183062 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix the indentation on the AST visitors used in -Wloop-analysis.
Richard Trieu [Fri, 31 May 2013 22:46:45 +0000 (22:46 +0000)]
Fix the indentation on the AST visitors used in -Wloop-analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183056 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Fix a false positive reported on rare strange code, which happens to be...
Anna Zaks [Fri, 31 May 2013 22:39:13 +0000 (22:39 +0000)]
[analyzer] Fix a false positive reported on rare strange code, which happens to be in JSONKit

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183055 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoObjective-C: Fixes an ivar lookup bug where
Fariborz Jahanian [Fri, 31 May 2013 21:51:12 +0000 (21:51 +0000)]
Objective-C: Fixes an ivar lookup bug where
'ivar' was used inside a record/union used
as argument to __typeof. // rdar14037151 pr5984

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183048 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPut the PR16167 tests together
David Majnemer [Fri, 31 May 2013 21:29:50 +0000 (21:29 +0000)]
Put the PR16167 tests together

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183046 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix style bug introduced in r183033.
Ed Schouten [Fri, 31 May 2013 20:12:49 +0000 (20:12 +0000)]
Fix style bug introduced in r183033.

I renamed the function at one point in time, but forgot to fix the
layout of the arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183036 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd support for optimized (non-generic) atomic libcalls.
Ed Schouten [Fri, 31 May 2013 19:27:59 +0000 (19:27 +0000)]
Add support for optimized (non-generic) atomic libcalls.

For integer types of sizes 1, 2, 4 and 8, libcompiler-rt (and libgcc)
provide atomic functions that pass parameters by value and return
results directly.

libgcc and libcompiler-rt only provide optimized libcalls for
__atomic_fetch_*, as generic libcalls on non-integer types would make
little sense. This means that we can finally make __atomic_fetch_* work
on architectures for which we don't provide these operations as builtins
(e.g. ARM).

This should fix the dreaded "cannot compile this atomic library call
yet" error that would pop up once every while.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183033 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSlightly extend matching for atomic loads.
Ed Schouten [Fri, 31 May 2013 19:18:14 +0000 (19:18 +0000)]
Slightly extend matching for atomic loads.

Also add the "=" to the matched pattern, to see whether we actually save
the loaded value.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183029 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTestcase for r183015.
Benjamin Kramer [Fri, 31 May 2013 17:01:30 +0000 (17:01 +0000)]
Testcase for r183015.

I hate svn add.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183019 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; new edges] add simplifySimpleBranches() to reduce edges for branches.
Ted Kremenek [Fri, 31 May 2013 16:56:54 +0000 (16:56 +0000)]
[analyzer; new edges] add simplifySimpleBranches() to reduce edges for branches.

In many cases, the edge from the "if" to the condition, followed by an edge from the branch condition to the target code, is uninteresting.

In such cases, we should fold the two edges into one from the "if" to the target.

This also applies to loops.

Implements <rdar://problem/14034763>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183018 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDisable non-standard library builtins in non-gnu language modes.
Benjamin Kramer [Fri, 31 May 2013 16:29:28 +0000 (16:29 +0000)]
Disable non-standard library builtins in non-gnu language modes.

Fixes PR16138.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183015 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImprove clang-format's c-style cast detection.
Daniel Jasper [Fri, 31 May 2013 16:14:28 +0000 (16:14 +0000)]
Improve clang-format's c-style cast detection.

Before:
  x[(uint8) y];
  x = (uint8) y;
  void f() { x = (uint8) y; }
  #define AA(X) sizeof(((X *) NULL)->a)

After:
  x[(uint8)y];
  x = (uint8)y;
  void f() { x = (uint8)y; }
  #define AA(X) sizeof(((X *)NULL)->a)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183014 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix test error caused by r183008.
Daniel Jasper [Fri, 31 May 2013 15:15:41 +0000 (15:15 +0000)]
Fix test error caused by r183008.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183010 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImprove clang-format's error recovery.
Daniel Jasper [Fri, 31 May 2013 14:56:29 +0000 (14:56 +0000)]
Improve clang-format's error recovery.

If a "}" is found inside parenthesis, this is probably a case of
missing parenthesis. This enables continuing to format after stuff code
like:

class A {
  void f(
};
..

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183009 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMake formatting of empty blocks more consistent.
Daniel Jasper [Fri, 31 May 2013 14:56:20 +0000 (14:56 +0000)]
Make formatting of empty blocks more consistent.

With this patch, the simplified rule is:
If the block is part of a declaration (class, namespace, function,
enum, ..), merge an empty block onto a single line. Otherwise
(specifically for the compound statements of if, for, while, ...),
keep the braces on two separate lines.

The reasons are:
- Mostly the formatting of empty blocks does not matter much.
- Empty compound statements are really rare and are usually just
  inserted while still working on the code. If they are on two lines,
  inserting code is easier. Also, overlooking the "{}" of an
  "if (...) {}" can be really bad.
- Empty declarations are not uncommon, e.g. empty constructors. Putting
  them on one line saves vertical space at no loss of readability.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183008 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoProperly format nested conditional operators.
Daniel Jasper [Fri, 31 May 2013 14:56:12 +0000 (14:56 +0000)]
Properly format nested conditional operators.

Before:
bool aaaaaa = aaaaaaaaaaaaa //
                  ? aaaaaaaaaaaaaaa
                  : bbbbbbbbbbbbbbb //
                  ? ccccccccccccccc
                  : ddddddddddddddd;

After:
bool aaaaaa = aaaaaaaaaaaaa //
                  ? aaaaaaaaaaaaaaa
                  : bbbbbbbbbbbbbbb //
                        ? ccccccccccccccc
                        : ddddddddddddddd;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183007 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix detection/formatting of braced lists in ternary expressions.
Daniel Jasper [Fri, 31 May 2013 10:09:55 +0000 (10:09 +0000)]
Fix detection/formatting of braced lists in ternary expressions.

Before:
foo = aaaaaaaaaaa ? vector<int> {
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaa
}
: vector<int>{ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, bbbbb };

After:
foo = aaaaaaaaaaa ? vector<int>{ aaaaaaaaaaaaaaaaaaaaaaaaaaa,
                                 aaaaaaaaaaaaaaaaaaaa, aaaaa }
                  : vector<int>{ bbbbbbbbbbbbbbbbbbbbbbbbbbb,
                                 bbbbbbbbbbbbbbbbbbbb, bbbbb };

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182992 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; new edges] in splitBranchConditionEdges() do not check that predecessor...
Ted Kremenek [Fri, 31 May 2013 06:11:17 +0000 (06:11 +0000)]
[analyzer; new edges] in splitBranchConditionEdges() do not check that predecessor edge has source in the same lexical scope as the target branch.

Fixes <rdar://problem/14031292>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182987 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer;alternate arrows] Rename 'adjustBranchEdges' to 'splitBranchConditionEdges'.
Ted Kremenek [Fri, 31 May 2013 06:11:11 +0000 (06:11 +0000)]
[analyzer;alternate arrows] Rename 'adjustBranchEdges' to 'splitBranchConditionEdges'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182986 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix handling of braced-init-list as reference initializer within aggregate
Richard Smith [Fri, 31 May 2013 02:56:17 +0000 (02:56 +0000)]
Fix handling of braced-init-list as reference initializer within aggregate
initialization. Previously we would incorrectly require an extra set of braces
around such initializers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182983 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Always use ccc-analyzer when running scan-build on buildbot
Anna Zaks [Fri, 31 May 2013 02:31:09 +0000 (02:31 +0000)]
[analyzer] Always use ccc-analyzer when running scan-build on buildbot

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182982 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Add --override-compiler option to scan-build.
Anna Zaks [Fri, 31 May 2013 02:31:07 +0000 (02:31 +0000)]
[analyzer] Add --override-compiler option to scan-build.

The new advanced option ensures ccc-analyze is used even when better
interposition methods are available.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182981 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[PCH] Fix crash with valid code, related to anonymous field initializers.
Argyrios Kyrtzidis [Thu, 30 May 2013 23:59:46 +0000 (23:59 +0000)]
[PCH] Fix crash with valid code, related to anonymous field initializers.

In a certain code-path we were not deserializing an anonymous field initializer correctly,
leading to a crash when trying to IRGen it.

This is a simpler version of a patch by Yunzhong Gao!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182974 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoWalk over MaterializeTemporaryExpr when reverting an initializer to its
Richard Smith [Thu, 30 May 2013 22:40:16 +0000 (22:40 +0000)]
Walk over MaterializeTemporaryExpr when reverting an initializer to its
syntactic form in template instantiation. Previously, this blocked the
reversion and we ended up losing inner CXXBindTemporaryExprs (and thus
forgetting to call destructors!).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182969 91177308-0d34-0410-b5e6-96231b3b80d8