Граф коммитов

44688 Коммитов

Автор SHA1 Сообщение Дата
Faisal Vali f2c64338dc test commit
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183486 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 05:19:33 +00:00
Richard Smith cafeb948e6 PR16243: Use CXXThisOverride during template instantiation, and fix up the
places which weren't setting it up properly. This allows us to get the right
cv-qualifiers for 'this' when it appears outside a method body in a class
template.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183483 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 02:33:37 +00:00
Eli Friedman 8150da3796 When we're synthesizing copy/move-assignment, we can't form a reference to an
invalid field; make sure we don't try.  Fixes <rdar://problem/14084171>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183479 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 01:48:56 +00:00
Adrian Prantl 4f97f85335 documentation: remove confusing reference to properties.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183475 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 01:10:48 +00:00
Adrian Prantl 5ae17a1770 ObjC Debug Info: Emit the names of accessors whenever they diverge from
the default names, not just when the isImplicit flag is set.

rdar://problem/14035789

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183474 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 01:10:45 +00:00
Adrian Prantl b5a50075d8 Improve documentation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183473 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 01:10:41 +00:00
Fariborz Jahanian 7523606638 blocks: fixes an ast bug when block pointer variable
is evaluated in a condition expression and then
dereferenced to envoke the block. This is
pr15663 and I applied a slight variation of the
patch with a test case. (patch is from
Arthur O'Dwyer). Also // rdar://14085217


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183471 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 00:48:14 +00:00
Tim Northover 1bea653e0d Diagnose malformed x86 inline asm using 'y' constraint.
X86's 'y' inline assembly constraint represents an MMX register, this change
prevents Clang from hitting an assertion when passed an incompatible type to
deal with.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183467 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 00:04:50 +00:00
Eli Friedman 86875b11db Perform dynamic alignment computations so that the data in TypeLocs is
correctly aligned.  Not performing such computations led to misaligned loads,
which crash on some platforms and are generally bad on other platforms.

The implementation of TypeLocBuilder::pushImpl is rather messy; code using
TypeLocBuilder accidentally assumes that partial TypeLocs are
laid out like a complete TypeLoc.  As a followup, I intend to work on
fixing the TypeLocBuilder API to avoid exposing partial TypeLocs; this should
substantially simplify the implemementation.

Fixes PR16144.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183466 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 00:04:31 +00:00
David Majnemer 585bee48ba Implement DR7
Disallowing deriving from classes that have private virtual base classes
except in instances where the deriving class would be able to cast
itself to the private virtual base via a different derivation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183462 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 23:43:20 +00:00
Anna Zaks 57c8736e7d [analyzer] Address Jordan’s code review for r183451
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183455 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 22:32:11 +00:00
Anna Zaks 6838710779 [analyzer] Ensure that pieces with invalid locations always get removed from the BugReport
The function in which we were doing it used to be conditionalized. Add a new unconditional
cleanup step.

This fixes PR16227 (radar://14073870) - a crash when generating html output for one of the test files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183451 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 22:02:58 +00:00
Anna Zaks 5955c37230 [analyzer] fixup the comment
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183450 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 22:02:55 +00:00
Jordan Rose 49a246f4fa [analyzer; new edges] Simplify edges in a C++11 for-range loop.
Previously our edges were completely broken here; now, the final result
is a very simple set of edges in most cases: one up to the "for" keyword
for context, and one into the body of the loop. This matches the behavior
for ObjC for-in loops.

In the AST, however, CXXForRangeStmts are handled very differently from
ObjCForCollectionStmts. Since they are specified in terms of equivalent
statements in the C++ standard, we actually have implicit AST nodes for
all of the semantic statements. This makes evaluation very easy, but
diagnostic locations a bit trickier. Fortunately, the problem can be
generally defined away by marking all of the implicit statements as
part of the top-level for-range statement.

One of the implicit statements in a for-range statement is the declaration
of implicit iterators __begin and __end. The CFG synthesizes two
separate DeclStmts to match each of these decls, but until now these
synthetic DeclStmts weren't in the function's ParentMap. Now, the CFG
keeps track of its synthetic statements, and the AnalysisDeclContext will
make sure to add them to the ParentMap.

<rdar://problem/14038483>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183449 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 21:53:45 +00:00
Argyrios Kyrtzidis c09f2a865c [libclang] CMake: add an option to control building libclang as a static library (off by default)
This avoids building libclang twice by default.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183437 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 19:51:37 +00:00
Daniel Jasper 65d2c38294 Fix incorrect line breaking before trailing block comments.
Before, clang-format would happily move a trailing block comment to a
new line, which normally changes the perceived binding of that comment.

E.g., it would move:
void f() { /* comment */
  ...
}
to:
void f() {
  /* comment */
  ...
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183420 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 16:08:57 +00:00
Joey Gouly 48a1e81715 Fix a crash with -Wassign-enum, where we didn't adjust the APInt type of the
constant. Also fix some spelling mistakes and formatting issues.

Reviewed by Richard Smith over IRC.

Fixes PR15069.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183409 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 13:48:00 +00:00
Hans Wennborg bf75e2b491 clang-check: add missing space in Makefile
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183406 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 13:24:44 +00:00
Benjamin Kramer a888813d46 clang-check: Link the static analyzer in the Makefile build too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183404 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 13:16:41 +00:00
Pavel Labath 373b807f36 Add support for static analysis to clang-check
Summary:
This adds a command line argument '-analyze' to clang-check which runs the
clang static analyzer on the source files.

Reviewers: klimek

CC: cfe-commits, revane

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183399 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 12:35:43 +00:00
Pavel Labath 63d5335aea ClangTool: strip -o from the command line
Summary:
This patch creates a new ArgumentsAdjuster, which removes all -o parameters from
the command line. This adjuster is inserted by default into the ClangTool pipeline.

Reviewers: klimek

CC: cfe-commits, revane

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183398 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 11:52:19 +00:00
Richard Smith 40cba90626 Implement DR1270: braces can be elided in all aggregate initialization, not
just copy-list-initialization in a variable declaration. This effectively
reverts r142147.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183397 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 11:41:05 +00:00
Hans Wennborg 649c6c50fd Disallow reinterpret_cast from pointer to bool on Windows
This became allowed by accident in r131201, but triggers an assert.
That patch added an exception to allow conversion from pointers to
narrow integral types for MSVC compatibility. However, a pointer can
already be converted to bool in a civilized manner; allowing conversion
via reinterpret_cast is a bad idea.

Fixes PR16222.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183394 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 09:16:36 +00:00
Daniel Jasper 9acb8b4355 Fix clang-format's expression parser for leading }s.
The leading "}" in the construct "} else if (..) {" was confusing the
expression parser. Thus, no fake parentheses were generated and the
indentation was broken in some cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183393 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 09:11:58 +00:00
Daniel Jasper ff1a2e519e Improve c-style cast detection.
Before:
return (my_int) aaaa;
template <> void f<int>(int i)SOME_ANNOTATION;
f("aaaa" SOME_MACRO(aaaa)"aaaa");

After:
return (my_int)aaaa;
template <> void f<int>(int i) SOME_ANNOTATION;
f("aaaa" SOME_MACRO(aaaa) "aaaa");

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183389 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 08:20:20 +00:00
Richard Smith f69dd33cfc When a static storage duration temporary appears in a constant expression, it
must be initialized by a constant expression (not just a core constant
expression), because we're going to emit it as a global. Core issue for this is
pending.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183388 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06 08:19:16 +00:00
Richard Trieu 4fe9644dc3 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
2013-06-06 02:22:29 +00:00
Jordan Rose fb6f75feaa [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
2013-06-06 01:57:24 +00:00
Jordan Rose 632182d0e2 [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
2013-06-06 01:57:19 +00:00
NAKAMURA Takumi 07eda94336 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
2013-06-06 01:14:58 +00:00
Anna Zaks 73b417f363 [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
2013-06-06 00:19:36 +00:00
Jordan Rose 1089a57a88 [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
2013-06-06 00:12:41 +00:00
Jordan Rose 574c7cf6d0 [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
2013-06-06 00:12:37 +00:00
Eric Christopher c47b6f3c9e 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
2013-06-05 23:58:15 +00:00
Fariborz Jahanian 9464a08a74 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
2013-06-05 18:46:14 +00:00
David Blaikie 993b39f4cd 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
2013-06-05 18:30:31 +00:00
Argyrios Kyrtzidis d62d9015c7 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
2013-06-05 17:52:24 +00:00
Peter Collingbourne 144a31f53b [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
2013-06-05 17:49:37 +00:00
Pavel Labath 88c200473d 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
2013-06-05 16:23:30 +00:00
Reid Kleckner a06d585468 [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
2013-06-05 15:58:29 +00:00
Benjamin Kramer 6f773e87ee Silence GCC warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183317 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-05 15:37:50 +00:00
Alexander Kornienko dda770b4a3 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
2013-06-05 15:08:20 +00:00
Alexander Kornienko 00895106f9 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
2013-06-05 14:09:10 +00:00
Timur Iskhodzhanov 2aae5ba15d 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
2013-06-05 14:05:50 +00:00
Timur Iskhodzhanov e825cd0a91 ... and actually run it
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183309 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-05 13:50:24 +00:00
Timur Iskhodzhanov d38dda9130 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
2013-06-05 13:49:11 +00:00
Timur Iskhodzhanov 4c44d2f5c5 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
2013-06-05 13:12:36 +00:00
Timur Iskhodzhanov d38a21f588 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
2013-06-05 12:24:46 +00:00
Alexander Kornienko e7b04868ea 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
2013-06-05 11:33:11 +00:00
NAKAMURA Takumi 4b9b292074 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
2013-06-05 06:54:06 +00:00