Commit Graph

46144 Commits

Author SHA1 Message Date
Eli Friedman b2d617de2c Add a testcase which uses an UnresolvedUsingTypenameDecl as the base of an NNS.
llvm-svn: 184386
2013-06-20 00:04:23 +00:00
Michael Gottesman 6ef6e142c7 [clang-lit] Added the run_long_tests param option/long_tests feature to toggle execution of long running FileCheck tests.
This will allow for longer running FileCheck based tests to be committed to
clang for use on buildbots, preventing the normal make-check cycle from
increasing in time significantly.

This is a necessary change in order to commit the end-to-end arm neon intrinsic
tests since FileCheck takes ~20 seconds to run said test due to the large amount
of neon intrinsics.

To force a test to run only when --param run_long_tests=true is passed in use
the following requires statement:

// REQUIRES: long_tests

llvm-svn: 184385
2013-06-19 23:23:49 +00:00
Stephen Lin 19cee1871e Revert r184205 and associated patches while investigating issue with broken buildbot (possible interaction with LTO)
<rdar://problem/14209661>

llvm-svn: 184384
2013-06-19 23:23:19 +00:00
Argyrios Kyrtzidis 11b3ba7176 [libclang] Make sure crash-recovery for module-building does not interfere with libclang crash-recovery.
This tests llvm commit r184380.
rdar://14204560

llvm-svn: 184383
2013-06-19 23:15:35 +00:00
Eli Friedman d364078a32 Fix r184381 so the test doesn't fail. Sorry for the inconvenience, I thought I had checked it.
llvm-svn: 184382
2013-06-19 23:00:37 +00:00
Eli Friedman 5c85dd93de Extra test for diagnostic in Sema::BuildCXXNestedNameSpecifier.
llvm-svn: 184381
2013-06-19 22:58:30 +00:00
Eli Friedman 49605cdaf0 Remove dead code.
llvm-svn: 184379
2013-06-19 22:49:39 +00:00
Eli Friedman f26b81b62a Improve diagnostic for redeclaring static member function. Fixes PR16382.
llvm-svn: 184378
2013-06-19 22:43:55 +00:00
Richard Trieu 30f93859a9 Fix for PR 16367, display the name of a function in a diagnostic instead of
showing "(null)".

llvm-svn: 184377
2013-06-19 22:25:01 +00:00
Eli Friedman 705a7b4cb7 Add missing test for -Wunneeded-member-functions.
llvm-svn: 184371
2013-06-19 22:01:25 +00:00
David Blaikie b9c667d808 Debug Info: PR14763/r183329 - specify that non-trivial pass-by-value parameters are stored indirectly
This is to fix the location information for such parameters to refer to
the object accessible through the pointer rather than to the pointer
parameter itself.

llvm-svn: 184367
2013-06-19 21:53:53 +00:00
Alexander Kornienko a3555e2416 Fixed long-standing issue with incorrect length calculation of multi-line comments.
Summary:
A trailing block comment having multiple lines would cause extremely
high penalties if the summary length of its lines is more than the column limit.
Fixed by always considering only the last line of a multi-line block comment.
Removed a long-standing FIXME from relevant tests and added a motivating test
modelled after problem cases from real code.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

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

llvm-svn: 184340
2013-06-19 19:50:11 +00:00
Eli Friedman 00dfec6265 Delete dead code. (Array element types are always complete in C.)
llvm-svn: 184332
2013-06-19 19:03:14 +00:00
Samuel Benzaquen f226e97dff Enhancements for the DynTypedNode
Added ASTNodeKind as a standalone way to represent node kinds and their hierarchy.
This change is to support ongoing work on D815.

Reviewers: klimek

CC: cfe-commits
llvm-svn: 184331
2013-06-19 18:45:24 +00:00
Stephen Lin c467c873e6 Corrections to r184205 ('this'-return optimization) due to the wrong version of the patch being committed originally.
1) Removed useless return value of CGCXXABI::EmitConstructorCall and CGCXXABI::EmitVirtualDestructorCall and implementations
2) Corrected last portion of CodeGenCXX/constructor-destructor-return-this to correctly test for non-'this'-return of virtual destructor calls

llvm-svn: 184330
2013-06-19 18:10:35 +00:00
Fariborz Jahanian c0607ed68b documentation parsing: patch to make @class work for
class templates; and similarly, @function  works for 
function templates. // rdar://14124702

llvm-svn: 184329
2013-06-19 18:08:03 +00:00
Renato Golin 96d7cd9d10 Revert "Adds support for openSUSE ARM v5/v7 triples."
This reverts commit 312e51ca484976c2b1254952ff23d5162ca8edc2.

llvm-svn: 184324
2013-06-19 17:28:50 +00:00
Renato Golin b1c12ce4ef Adds support for openSUSE ARM v5/v7 triples.
Now, with a comma.

Patch by İsmail Dönmez

llvm-svn: 184323
2013-06-19 17:28:42 +00:00
Reid Kleckner d29f1342c2 [CodeGen] Move EHScopeStack into its own header
CGCleanup.h isn't meant to be included by all of CodeGen according to
John.

llvm-svn: 184321
2013-06-19 17:07:50 +00:00
Reid Kleckner 0a0c8895ea [Windows] Fix __declspec(property) when the getter returns a ref
This fixes an issue when parsing atlbase.h.

Patch by Will Wilson!

llvm-svn: 184319
2013-06-19 16:37:23 +00:00
Manuel Klimek a0c025f5d2 Completely revamp node binding for AST matchers.
This is in preparation for the backwards references to bound
nodes, which will expose a lot more about how matches occur.  Main
changes:
- instead of building the tree of bound nodes, we build a "set" of bound
  nodes and explode all possible match combinations while running
  through the matchers; this will allow us to also implement matchers
  that filter down the current set of matches, like "equalsBoundNode"
- take the set of bound nodes at the start of the match into
  consideration when doing memoization; as part of that, reevaluated
  that memoization gives us benefits that are large enough (it still
  does - the effect on common match patterns is up to an order of
  magnitude)
- reset the bound nodes when a node does not match, thus never leaking
  information from partial sub-matcher matches for failing matchers

Effects:
- we can now correctly "explode" combinatorial matches, for example:
  allOf(forEachDescendant(...bind("a")),
  forEachDescendant(...bind("b"))) will now trigger matches for all
  combinations of matching "a" and "b"s.
- we now never expose bound nodes from partial matches in matchers that
  did not match in the end - this fixes a long-standing issue

FIXMEs:
- rename BoundNodesTreeBuilder to BoundNodesBuilder or
  BoundNodesSetBuilder, as we don't build a tree any more; this is out
  of scope for this change, though
- we're seeing some performance regressions (around 10%), but I expect
  some performance tuning will get that back, and it's easily worth
  the increase in expressiveness for now

llvm-svn: 184313
2013-06-19 15:42:45 +00:00
Rafael Espindola 76993a01c9 Don't depend on PathV1.h including set.
llvm-svn: 184310
2013-06-19 15:31:27 +00:00
Reid Kleckner 7810af0a43 [ms-cxxabi] Emit and install appropriately mangled vbtables
In Itanium, dynamic classes have one vtable with several different
address points for dynamic base classes that can't share vtables.

In the MS C++ ABI, each vbtable that can't be shared gets its own
symbol, similar to how ctor vtables work in Itanium.  However, instead
of mangling the subobject offset into the symbol, the unique portions of
the inheritance path are mangled into the symbol to make it unique.

This patch implements the MSVC 2012 scheme for forming unique vbtable
symbol names.  MSVC 2010 use the same mangling with a different subset
of the path.  Implementing that mangling and possibly others is TODO.

Each vbtable is an array of i32 offsets from the vbptr that points to it
to another virtual base subobject.  The first entry of a vbtable always
points to the base of the current subobject, implying that it is the
same no matter which parent class contains it.

Reviewers: rjmccall

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

llvm-svn: 184309
2013-06-19 15:20:38 +00:00
Reid Kleckner 3793d5ed30 [Driver] Don't forward source file input args to gcc
gcc's inputs are already added by the InputInfoList passed to
Action::ConstructJob.

Fixes a regression from r183989.  This was manifesting when targetting
mingw as an extra input argument to gcc when assembling.  It presumably
affects other situations where clang calls gcc.

Prior to r183989, forwardToGCC() was returning false because the INPUT
option defined in OptParser.td had the DriverOption flag set on it.
LLVM's Option library does not set this flag for INPUT.

Reviewers: espindola

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

llvm-svn: 184308
2013-06-19 15:09:06 +00:00
James Molloy 4da7f88d2c Revert r184302 on Renato's behalf - it broke the bots and he's asked me to revert as he's unavailable.
llvm-svn: 184307
2013-06-19 15:03:14 +00:00
Alexander Kornienko 7285207486 Split long strings on word boundaries.
Summary: Split strings at word boundaries, when there are no spaces and slashes.

Reviewers: klimek

CC: cfe-commits

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

llvm-svn: 184304
2013-06-19 14:22:47 +00:00
Renato Golin f86ae72e6d Adds support for openSUSE ARM v5/v7 triples.
Patch by İsmail Dönmez

llvm-svn: 184302
2013-06-19 14:03:51 +00:00
Rafael Espindola 45f96f87c3 Fix pr16354.
We now reject things like

struct ABC {
  static double a;
};
register double ABC::a = 1.0;

llvm-svn: 184300
2013-06-19 13:41:54 +00:00
Andy Gibbs fa5026d9eb Silence 'set but not used' warning when building in release mode using gcc.
llvm-svn: 184299
2013-06-19 13:33:37 +00:00
Rafael Espindola 8be5c0550e Use llvm::sys::fs::can_execute.
llvm-svn: 184297
2013-06-19 13:24:29 +00:00
Pavel Labath 963f91b3a2 Fix a crash in the static analyzer (bug #16307)
Summary:
When processing a call to a function, which got passed less arguments than it
expects, the analyzer would crash.

I've also added a test for that and a analyzer warning which detects these
cases.

CC: cfe-commits

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

llvm-svn: 184288
2013-06-19 08:19:56 +00:00
NAKAMURA Takumi 9157b55c3c Fix a warning. [-Wunused-variable]
llvm-svn: 184284
2013-06-19 06:58:20 +00:00
NAKAMURA Takumi dc2e2fb9ce Revert r184249, "doc. parsing: Allow parameter name "..." for variadic functions/methods."
It crashes in the case;

/// Without any "param"s in the description.
int printf(const char *format, ...);

llvm-svn: 184283
2013-06-19 06:58:14 +00:00
Eli Friedman ecc32f1be0 Delete dead code.
llvm-svn: 184277
2013-06-19 02:07:51 +00:00
Manman Ren 9691f7fa35 Debug Info: support for gdwarf-2 gdwarf-3 gdwarf-4
These options will add a module flag with name "Dwarf Version".
The behavior flag is currently set to Warning, so when two values disagree,
a warning will be emitted.

llvm-svn: 184276
2013-06-19 01:46:49 +00:00
Eli Friedman f796cf1ade Add test coverage for serialization of dependent function template specializations.
llvm-svn: 184275
2013-06-19 01:38:21 +00:00
Adrian Prantl 1f56b2a4f1 Add some comments to r184252.
rdar://problem/14101097

llvm-svn: 184259
2013-06-18 23:32:21 +00:00
Anna Zaks d60a41d941 [analyzer] Do not create a CompoundVal for lvalue InitListExprs.
These should be treated like scalars. This fixes a crash reported in radar://14164698.

llvm-svn: 184257
2013-06-18 23:16:20 +00:00
Anna Zaks 0325646705 [analyzer] Do not report uninitialized value warnings inside swap functions.
This silences warnings that could occur when one is swapping partially initialized structs. We suppress
not only the assignments of uninitialized members, but any values inside swap because swap could
potentially be used as a subroutine to swap class members.

This silences a warning from std::try::function::swap() on partially initialized objects.

llvm-svn: 184256
2013-06-18 23:16:15 +00:00
Adrian Prantl c1a3fe7f9b Emit forward decls for structs with declarations only when we are
limiting debug info.

FIXME: There is still work left to do here, the testcase should work even with -flimit-debug-info.

rdar://problem/14101097

llvm-svn: 184252
2013-06-18 23:01:56 +00:00
Eli Friedman 5f508953bc Introduce a new mangling for protocol-qualified ObjC types in C++. This allows
to provide proper overloading, and also prevents mangling conflicts with
template arguments of protocol-qualified type.

This is a non-backward-compatible mangling change, but per discussion with
John, the benefits outweigh this cost.

Fixes <rdar://problem/14074822>.

llvm-svn: 184250
2013-06-18 22:41:37 +00:00
Fariborz Jahanian 5222608310 doc. parsing: Allow parameter name "..." for variadic functions/methods.
// rdar://14124644

llvm-svn: 184249
2013-06-18 22:40:39 +00:00
Eli Friedman cdf8b88285 Make sure the assembler-with-cpp hack for "#" works with multiple "#"s in
succession. Fixes PR16363.

llvm-svn: 184240
2013-06-18 21:33:38 +00:00
Argyrios Kyrtzidis dd7106375c When declaring an ObjC interface decl with a @compatibility_alias alias name, change the class name to the "real" one.
If we have something like

  @class NewImage;
  @compatibility_alias OldImage NewImage;
  @class OldImage;

the lookup for 'OldImage' will return the 'NewImage' decl ("@class NewImage").
In such a case, when creating the decl for "@class OldImage" use the real declaration name ("NewImage"),
instead of the alias one ("OldImage"), otherwise we will break IdentifierResolver and redecls-chain invariants.

Fixes crash of rdar://14112291.

llvm-svn: 184238
2013-06-18 21:26:33 +00:00
Rafael Espindola fc92e84586 Use llvm::sys::fs::can_write.
llvm-svn: 184234
2013-06-18 20:58:25 +00:00
Stephen Lin 8f99e9413f Partially revert r184225 test changes and make a smaller and more generic fix.
llvm-svn: 184232
2013-06-18 20:51:51 +00:00
Michael Gottesman 1534399059 [multiprecision-builtins] Added missing builtin __builtin_{add,sub}cb for {add,sub} with carry for bytes.
I have had several people ask me about why this builtin was not available in
clang (since it seems like a logical conclusion). This patch implements said
builtins.

Relevant tests are included as well. I also updated the Clang language extension reference.

rdar://14192664.

llvm-svn: 184227
2013-06-18 20:40:40 +00:00
Stephen Lin 6d51d86698 Fix C++ constructor/destructor tests when run on ARM
llvm-svn: 184225
2013-06-18 20:24:04 +00:00
Richard Smith 39b7968ccb DR14, DR101, and part of DR1: fix handling of extern "C" declarations in
namespaces, by treating them just like we treat extern "C" declarations in
function scope.

llvm-svn: 184223
2013-06-18 20:15:12 +00:00
Rafael Espindola f9e9bb8858 Use llvm::sys::fs::GetUniqueID.
llvm-svn: 184218
2013-06-18 19:40:07 +00:00
Eli Friedman 0e5d677fc3 Correctly compute the index of the first string format argument when deciding
whether to emit a -Wformat-security warning.  <rdar://problem/14178260>.

llvm-svn: 184214
2013-06-18 18:10:01 +00:00
Richard Smith 1a90f5956d PR14503: Don't assert if a constexpr constructor temploid instantiates to a
constructor that does not initialize all members, and that constructor is used
to initialize a global.

llvm-svn: 184211
2013-06-18 17:51:51 +00:00
Fariborz Jahanian 0649923b57 Objective-C: Fixes a typo correction bug where a
selector would be correted to identical selector name
in certain corner cases. // rdar://7853549

llvm-svn: 184208
2013-06-18 17:10:58 +00:00
Stephen Lin a637fb8ccd CodeGen: Have 'this'-returning constructors and destructors to take advantage of the new backend 'returned' attribute.
The backend will now use the generic 'returned' attribute to form tail calls where possible, as well as avoid save-restores of 'this' in some cases (specifically the cases that matter for the ARM C++ ABI).

This patch also reverts a prior front-end only partial implementation of these optimizations, since it's no longer required.

llvm-svn: 184205
2013-06-18 17:00:49 +00:00
Fariborz Jahanian 9917fcad11 Fix buildbot failure.
llvm-svn: 184199
2013-06-18 15:54:30 +00:00
Fariborz Jahanian 4cc5552b9b Objective-C [qoi]: privide typo correction for selectors
in addition of receiver having static type, but also when
receiver has dynamic type (of 'id' variety) as well as when
receiver is of 'Class' type vareity. // rdar://7853549

llvm-svn: 184195
2013-06-18 15:31:36 +00:00
Reid Kleckner 5d0708893d Remove option emitter from clang-tblgen
The CMake build was still using it because I forgot to s/CLANG/LLVM/ in
the tablegen() call.  The Makefile build is already using llvm-tblgen.

llvm-svn: 184192
2013-06-18 15:25:00 +00:00
Rafael Espindola e8c40ef783 Remove duplicated file and directory.
llvm-svn: 184188
2013-06-18 14:09:48 +00:00
Bill Wendling da1e3e737a Update to pass in pointers intead of references.
llvm-svn: 184176
2013-06-18 07:22:05 +00:00
Bob Wilson 87b3a189ef size_t on Darwin AAPCS targets is "unsigned long". <rdar://problem/14136459>
Some embedded targets use ARM's AAPCS with iOS header files that define size_t
as unsigned long, which conflicts with the usual AAPCS definition of size_t
as unsigned int.

llvm-svn: 184171
2013-06-18 05:36:04 +00:00
Dmitri Gribenko 3f31bd185a Simplify a loop in ProcessCodeCompleteResults(). Pointed out by David Blaikie
llvm-svn: 184169
2013-06-18 04:41:50 +00:00
Dmitri Gribenko 9fdd7e6d27 ArrayRef'ize CodeCompletionContext::getNumSelIdents()
llvm-svn: 184168
2013-06-18 04:02:26 +00:00
Larisse Voufo bf4aa57398 contextual conversion fix: C++98 compatibility warning.
llvm-svn: 184167
2013-06-18 03:08:53 +00:00
John McCall 1fe2a8c87e Add support for -fpcc-struct-return. Patch by Arthur O'Dwyer!
llvm-svn: 184166
2013-06-18 02:46:29 +00:00
Larisse Voufo 9f380c55ce r184100 Fix -- Updated test cases for contextual conversion
llvm-svn: 184165
2013-06-18 01:27:47 +00:00
Adrian Prantl de5fde0b05 Remove an ugly hack that was meant to eliminate the breakpoint ambiguity
between a block assignment and the entry of the block function. In reality
this wouldn't work anyway because blocks are predominantly created
on-the-fly inside of an ObjC method invocation.
The proper fix for the ambiguity is to use -gcolumn-info to differentiate
the breakpoints.

This is expected to break some block-related darwin-gdb tests.

rdar://problem/14039866

llvm-svn: 184157
2013-06-18 00:27:36 +00:00
Eli Friedman 1d93a9e988 Delete dead code.
llvm-svn: 184154
2013-06-18 00:22:17 +00:00
Eric Christopher eec89c202e Accept and ignore -fdebug-types-section for now. This will be used
later with dwarf4 type hashing.

llvm-svn: 184152
2013-06-18 00:03:50 +00:00
Eric Christopher 2062ec68b7 FileCheck-ize.
llvm-svn: 184151
2013-06-18 00:03:46 +00:00
Eli Friedman 9dd947040c Add a missing testcase for ObjC ivar encoding for a C++ class with a vptr.
Found by skimming over lcov report.

llvm-svn: 184150
2013-06-17 23:57:41 +00:00
Richard Smith 9924772d5f Turn Clang 3.3 boxes on C++ status from yellow to green now we're releasing it.
llvm-svn: 184149
2013-06-17 23:54:23 +00:00
Richard Smith 26eed76ec7 Point link at correct location for Clang 3.3 release notes.
llvm-svn: 184148
2013-06-17 23:53:08 +00:00
Eli Friedman 2dcbdc0606 Fix source range of CXXNewExpr with parentheses around the type. PR15569.
llvm-svn: 184139
2013-06-17 22:35:10 +00:00
Eli Friedman 40a4becb11 Compute the visibility of static local variables consistently. Fixes PR16208.
llvm-svn: 184137
2013-06-17 21:51:45 +00:00
Eli Friedman 66b9e9e9fe Fix Expr::Classify to correctly classify ExtVectorElementExprs. PR16204.
llvm-svn: 184123
2013-06-17 21:09:57 +00:00
Rafael Espindola a418418f63 Cleanup linkage computation for static locals.
With this patch we assign VisibleNoLinkage to static locals in inline functions.
This lets us simplify CodeGen a bit.

llvm-svn: 184114
2013-06-17 20:04:51 +00:00
Rafael Espindola 3d4276e3cf Use atomic instructions on Bitrig armv6. Patch by Patrick Wildt.
llvm-svn: 184113
2013-06-17 20:00:15 +00:00
Manman Ren 9bb34d66b3 X86 intrinsics: cmpge|gt|nge|ngt_ss|_sd
These intrinsics should return the comparision result in the low bits and keep 
the high bits of the first source operand.

When calling to builtin functions, the source operands are swapped and the high
bits of the second source operand are kept. To fix the issue, an extra
shufflevector is used.

rdar://14153896

llvm-svn: 184110
2013-06-17 19:42:49 +00:00
Rafael Espindola 09ce33ded0 Revert "Updated test cases for contextual conversion"
This reverts commit r184100.

It was faling on some bots:
http://bb.pgr.jp/builders/cmake-clang-i686-mingw32/builds/1973/steps/test_clang/logs/Clang%20%3A%3A%20SemaCXX__cxx1y-contextual-conversion-tweaks.cpp

llvm-svn: 184108
2013-06-17 19:26:19 +00:00
Larisse Voufo 249f9277a4 Updated test cases for contextual conversion
llvm-svn: 184100
2013-06-17 18:41:38 +00:00
Richard Smith 1a359c5b01 Avoid using __SIZE_TYPE__ in a -std=c++98 -pedantic-errors test, because that
triggers an error on MS targets where __SIZE_TYPE__ expands to 'long long'.

llvm-svn: 184096
2013-06-17 18:05:42 +00:00
Fariborz Jahanian aaddc09b39 unbreak buildbot for now.
llvm-svn: 184093
2013-06-17 17:41:13 +00:00
Rafael Espindola 1600a53bc0 Include PathV1.h only where it is used.
llvm-svn: 184090
2013-06-17 17:23:47 +00:00
Serge Pavlov f7c1a2152a Clean up empty struct/union recognition.
Make use of getTypeSizeInChars to detect structs/unions of zero size. It allows
more accurate detection of types of zero size. It however has a side effect -
sequence of used types may change, that is why the test 'override-layout' was
modified.

llvm-svn: 184088
2013-06-17 17:18:51 +00:00
Fariborz Jahanian 7548167845 Objective-C [qoi]: Provide fixit hint when message with typo
is sent to a receiver object. This is wip. // rdar://7853549

llvm-svn: 184086
2013-06-17 17:10:54 +00:00
Reid Kleckner 724c21c05b [Driver] Remove the using namespace directives from headers
This adds a bunch of llvm::opt name specifiers to all the uses of types
from that namespace.

Reviewers: espindola

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

llvm-svn: 184079
2013-06-17 13:59:19 +00:00
Alexander Kornienko afaa8f556b Fix a problem in ExpressionParser leading to trailing comments affecting indentation of an expression after a line break.
Summary:
E.g. the second line in 

return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
           b; //

is indented 4 characters more than in

return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
       b;

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

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

llvm-svn: 184078
2013-06-17 13:19:53 +00:00
Reid Kleckner 3ff679a19a Try to fix the bots with a forward decl.
llvm-svn: 184077
2013-06-17 13:05:47 +00:00
Alexander Kornienko 4d26b6efef Fixes incorrect indentation of line comments after break and re-alignment.
Summary:
Selectively propagate the information about token kind in
WhitespaceManager::replaceWhitespaceInToken.For correct alignment of new
segments of line comments in order to align them correctly. Don't set
BreakBeforeParameter in breakProtrudingToken for line comments, as it introduces
a break after the _next_ parameter. Added tests for related functions.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

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

llvm-svn: 184076
2013-06-17 12:59:44 +00:00
Reid Kleckner 2ab0ac5360 [AST] Don't include RecursiveASTVisitor.h in ASTContext.h
The untemplated implementation of getParents() doesn't need to be in a
header file.

RecursiveASTVisitor.h is full of repeated macro expansion.  Moving this
include to ASTContext.cpp speeds up compilation of
LambdaMangleContext.cpp, a small C++ file with few includes, from 3.7s
to 2.8s for me locally.  I haven't measured a full build, but it can't
hurt.

I had to fix a few static analyzer files that were depending on
transitive includes of C++ AST headers.

Reviewers: rsmith, klimek

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

llvm-svn: 184075
2013-06-17 12:56:08 +00:00
Larisse Voufo e4fb3dc7d4 Corrected status of support for contextual conversion from full to SVN
llvm-svn: 184073
2013-06-17 05:37:15 +00:00
Richard Smith 3b08dcd4cc Remove unused file.
llvm-svn: 184070
2013-06-17 01:34:23 +00:00
Richard Smith f2c9afceef C++11: don't warn about the deprecated 'register' keyword if it's combined with
an asm label.

llvm-svn: 184069
2013-06-17 01:34:01 +00:00
Richard Smith 37ba45a3c5 Add warning group -Wdeprecated-register for C++11 warning on 'register' being
deprecated.

llvm-svn: 184068
2013-06-17 00:01:58 +00:00
Richard Smith 895d6952d6 Add tests for C++ DR100-150.
llvm-svn: 184057
2013-06-16 08:00:51 +00:00
Richard Smith d9576c9484 Add testcase for DR39 from PR5916.
llvm-svn: 184056
2013-06-16 05:11:56 +00:00
Richard Smith 089ee1554c PR16339: Don't produce a diagnostic pointing at the whitespace between a '#if'
and a '!defined(X)' if we find a broken header guard. This is suboptimal; we
should point the diagnostic at the 'X' token not the 'if' token, but it fixes
the crash.

llvm-svn: 184054
2013-06-16 05:05:39 +00:00
Larisse Voufo d1336faf53 Fixed one buildbot-failure-causing bug...
llvm-svn: 184053
2013-06-16 04:34:07 +00:00
Dmitri Gribenko 070a10e63a ArrayRef'ize Sema::CodeComplete*
Patch by Robert Wilhelm.

llvm-svn: 184052
2013-06-16 03:47:57 +00:00
Larisse Voufo 492a6af72f Updated status of support for contextual conversion from partial to full
llvm-svn: 184049
2013-06-15 20:26:23 +00:00
Larisse Voufo 0f1394c86e Updated the support for contextual conversion tweaks (n3323) with a previously overlooked part: implicitly converting array sizes to size_t, rather than contextually converting them to some unique type.
llvm-svn: 184048
2013-06-15 20:17:46 +00:00
Faisal Vali d667641542 A quick fix to allow return type deduction on member templates
by ensuring DiagnoseUseOfDecl is called both on the found decl and the
decl being used (i.e the specialization in the case of member templates) whenever they are different.
Per the exchange captured in
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130610/081636.html
a more comprehensive fix that allows both decls to be passed into DiagnoseUseOfDecl is (or should be) forthcoming relatively soon.

llvm-svn: 184043
2013-06-15 11:54:37 +00:00
Ed Schouten 60afa2d923 Emit native implementations of atomic operations on FreeBSD/armv6.
Just like on Linux, FreeBSD/armv6 assumes the system supports
ldrex/strex unconditionally. It is also used by the kernel. We can
therefore enable support for it, like we do on Linux.

While there, change one of the unit tests to explicitly test against
armv5 instead of armv7, as it actually tests whether libcalls are
emitted.

llvm-svn: 184040
2013-06-15 09:40:14 +00:00
Richard Smith 6b6f8aac72 PR16263: Implement current direction of core issue 1376. Binding a reference to
the result of a cast-to-reference-type lifetime-extends the object to which the
reference inside the cast binds.

This requires us to look for subobject adjustments on both the inside and the
outside of the MaterializeTemporaryExpr when looking for a temporary to
lifetime-extend (which we also need for core issue 616, and possibly 1213).

llvm-svn: 184024
2013-06-15 00:30:29 +00:00
Richard Smith 82c9b5183f Fix handling of const_cast from prvalue to rvalue reference: such a cast is
only permitted if the source object is of class type, and should materialize a
temporary for the reference to bind to.

llvm-svn: 184017
2013-06-14 22:27:52 +00:00
Eli Friedman ddee9a91a2 Fix comments referring to non-existent types.
llvm-svn: 184007
2013-06-14 21:28:56 +00:00
Eli Friedman 31a5bcc24e Unify return type checking for functions and ObjC methods. Move all the
random checks for ObjC object return types to SemaType.cpp.

Fixes issue with ObjC method type checking reported on cfe-dev.

llvm-svn: 184006
2013-06-14 21:14:10 +00:00
Richard Smith ab2436ee83 Suppress the c++11 -Wdeprecated warning for 'register' if it is expanded from a
macro defined in a system header. glibc uses it in macros, apparently.

llvm-svn: 184005
2013-06-14 21:05:24 +00:00
Reid Kleckner 898229ab4b [Driver] Refactor clang driver to use LLVM's Option library
The big changes are:
- Deleting Driver/(Arg|Opt)*
- Rewriting includes to llvm/Option/ and re-sorting
- 'using namespace llvm::opt' in clang::driver
- Fixing the autoconf build by adding option everywhere

As discussed in the review, this change includes using directives in
header files.  I'll make follow up changes to remove those in favor of
name specifiers.

Reviewers: espindola

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

llvm-svn: 183989
2013-06-14 17:17:23 +00:00
Alexander Kornienko be633908be Don't remove backslashes from block comments.
Summary:
Don't remove backslashes from block comments. Previously this
/* \    \ \ \ \ \
*/
would be turned to this:
/*
*/
which spoils some kinds of ASCII-art, people use in their comments. The behavior
was related to handling escaped newlines in block comments inside preprocessor
directives. This patch makes handling it in a more civilized way.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

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

llvm-svn: 183978
2013-06-14 11:46:10 +00:00
Chandler Carruth c41c8b3a4a Fix the warning for divide by zero to be a bit more robust. ;]
Previously, it only ever fired for zeros which formed null pointers.
Now, hilariously, in C++98 this was almost anything. Including tricks
like warning on the divisor in this code:

typedef char c3[3];
size_t f(c3* ptr) {
  return (sizeof(ptr) / sizeof(*ptr)) / (size_t)(!(sizeof(ptr) % sizeof(*ptr)));
}

Why the RHS of the outer divide is a null pointer constant is a sordid
tale of sorrow. Anyways, the committee fixed this for C++11 and onward
as part of core isssue 903, and Richard recently implemented this fix
causing the warning to go away here (and elsewhere).

This patch restores the warning here and adds it for numerous other
somewhat obvious gaffes:

int g(int x) {
  return x / (int)(0.0);
}

The patch is essentially just using the full power of our constant
folding in Clang to produce the warning, but insisting that it must fold
to an *integer* which is zero so that we don't get false positives
anywhere.

llvm-svn: 183970
2013-06-14 08:57:18 +00:00
Richard Smith a509f2fdfa Emit initializers for static-storage-duration temporaries as constants where
possible.

llvm-svn: 183967
2013-06-14 03:07:01 +00:00
Rui Ueyama a6239aef11 [docs] Fix wrong clang-format example.
llvm-svn: 183963
2013-06-14 02:12:06 +00:00
Tim Northover fbb56b7bd9 Remove implicit fallthrough from AArch64 to Mips in lib selection
Nothing useful to AArch64 will (should!) be found in any Mips-specific
directories.

Patch by Luke Zarko.

llvm-svn: 183956
2013-06-13 22:54:55 +00:00
Richard Smith 5c508fc261 Avoid fallthrough in header, to allow external users of Clang libraries to
build with Clang's -Wimplicit-fallthrough warning enabled. The fallthrough
was not making this code better.

llvm-svn: 183952
2013-06-13 22:07:02 +00:00
Eli Friedman d4b6e7a9b7 Fix the linkage of static locals inside a CapturedStmt. (Found in the
process of trying to fix the related issue for block literals.)

llvm-svn: 183951
2013-06-13 21:50:44 +00:00
Rafael Espindola dcf73d2275 Don't depend on the transitive inclusion of PathV1.h.
llvm-svn: 183945
2013-06-13 21:09:29 +00:00
Rafael Espindola 18556de316 Use the sys::RemoveFileOnSignal that takes a StringRef.
llvm-svn: 183944
2013-06-13 21:02:40 +00:00
Eli Friedman ef10282a0f Followup to r183931 to fix the lambda conversion-to-block-pointer member.
llvm-svn: 183942
2013-06-13 20:56:27 +00:00
Rafael Espindola cb4bb19070 Use the sys::ExecuteAndWait that takes StringRefs.
Also don't depend on Program.h including PathV1.h.

llvm-svn: 183935
2013-06-13 20:08:52 +00:00
Eli Friedman 8f54e136f4 Fix a small bug in the linkage computation for the lambda conversion-to-function-pointer member.
llvm-svn: 183931
2013-06-13 19:39:48 +00:00
Rafael Espindola 0725a7d972 Update for llvm change.
llvm-svn: 183930
2013-06-13 19:25:45 +00:00
Rafael Espindola 3b3a166ce6 Allow clang to build __clear_cache on ARM.
__clear_cache is special. It needs no signature, but is a real function in
compiler_rt or libgcc.

Patch by Andrew Turner.

llvm-svn: 183926
2013-06-13 18:34:17 +00:00
Richard Smith 77ad7a2d3d Clean up test to appease NDEBUG builds.
llvm-svn: 183924
2013-06-13 18:07:12 +00:00
Rafael Espindola dd6b1d5273 InheritViz.cpp uses sys::Path, include PathV1.h
llvm-svn: 183922
2013-06-13 17:35:20 +00:00
Rafael Espindola 7f20dfb746 Use version of DisplayGraph that takes a StringRef.
llvm-svn: 183916
2013-06-13 16:57:07 +00:00
Tim Northover 92509c1c0c Teach clang about the armv4/armv4t distinction
When choosing a default CPU, clang used to pick ARM7TDMI (which has Thumb) even
when the more restrictive armv4 triple was specified. This should fix that.

Patch by Jeroen Hofstee.

llvm-svn: 183905
2013-06-13 15:02:46 +00:00
Benjamin Kramer 33d4330393 Modernize some low-hanging PathV1 uses.
llvm-svn: 183903
2013-06-13 14:26:04 +00:00
Benjamin Kramer 601a2d847b libclang: Remove clang::RemapFiles, it's dead code.
llvm-svn: 183902
2013-06-13 13:57:48 +00:00
Benjamin Kramer e3868e46fb libclang: Port CIndexer::getClangResourcesPath to PathV2. No functionality change.
llvm-svn: 183901
2013-06-13 13:56:37 +00:00
Sylvestre Ledru 93c47b74bb Add Ubuntu Saucy to the list of known Ubuntu releases
Thanks to Dmitry Shachnev for the patch
See bug #16317

llvm-svn: 183899
2013-06-13 11:52:27 +00:00
Manuel Klimek 9d83fcfaf6 Make it clear in Decl::hasBody that it can return true on redeclarations.
llvm-svn: 183896
2013-06-13 09:05:19 +00:00
Richard Smith ab341c62b3 More for PR12457: fix handling of __builtin_isinf_sign and test.
llvm-svn: 183890
2013-06-13 06:31:13 +00:00
Richard Smith 8889a3d3b5 Towards PR12457: constant expression evaluation support for __builtin_parity{,l,ll}, __builtin_ffs{,l,ll}, and __builtin_fpclassify.
llvm-svn: 183889
2013-06-13 06:26:32 +00:00
Larisse Voufo 27ef14f098 Updated C++1y status for contextual conversions to 'partial' (without review)
llvm-svn: 183888
2013-06-13 06:04:33 +00:00
Richard Smith 80b3c8e32f Fix part of PR12457. Patch by Justin Bogner!
llvm-svn: 183886
2013-06-13 05:04:16 +00:00
Richard Smith f24e6e747b Fix some confusing diagnostic wording. s/implicit default/implicit/ if we're
not actually talking about a default constructor.

llvm-svn: 183885
2013-06-13 03:34:55 +00:00
Richard Smith d577fbbd1c C++11: If a class has a user-declared copy operation or destructor, the
implicit definition of a copy operation is deprecated. Add a warning for this
to -Wdeprecated. This warning is disabled by default for now, pending
investigation into how common this situation is.

llvm-svn: 183884
2013-06-13 03:23:42 +00:00
Richard Smith 4055de40ab Implement core issue 903: only integer literals with value 0 and prvalues of
type std::nullptr_t are null pointer constants from C++11 onwards.

llvm-svn: 183883
2013-06-13 02:46:14 +00:00
Richard Smith f026b60099 In C++11, promote access declaration diagnostic from warning to error. There
doesn't seem to be any value in even adding a -W flag for this.

llvm-svn: 183882
2013-06-13 02:12:17 +00:00
Richard Smith 8ca78a16f4 Add -Wdeprecated warnings and fixits for things deprecated in C++11:
- 'register' storage class
 - dynamic exception specifications

Only the former check is enabled by default for now (the latter might be quite noisy).

llvm-svn: 183881
2013-06-13 02:02:51 +00:00
Richard Smith 2eabf78eb6 When copy-initializing a temporary for a reference binding, don't allow use of
explicit constructors.

llvm-svn: 183879
2013-06-13 00:57:57 +00:00
Nick Lewycky 2c308503ea Include the unexpanded packs in the initializer expression when checking a
pack expanded constructor initializer list. Fixes PR16303!

llvm-svn: 183878
2013-06-13 00:45:47 +00:00
Richard Smith a1c9d4d932 Simplify: we don't need any special-case lifetime extension when initializing
declarations of reference type; they're handled by the general case handling of
MaterializeTemporaryExpr.

llvm-svn: 183875
2013-06-12 23:38:09 +00:00
Richard Smith 0603bbb53c Don't suggest putting 'operator new' or 'operator delete' in a namespace to fix a two-phase lookup issue. That's not permitted.
llvm-svn: 183874
2013-06-12 22:56:54 +00:00
Richard Smith cc1b96d356 PR12086, PR15117
Introduce CXXStdInitializerListExpr node, representing the implicit
construction of a std::initializer_list<T> object from its underlying array.
The AST representation of such an expression goes from an InitListExpr with a
flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr
containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr).

This more detailed representation has several advantages, the most important of
which is that the new MaterializeTemporaryExpr allows us to directly model
lifetime extension of the underlying temporary array. Using that, this patch
*drastically* simplifies the IR generation of this construct, provides IR
generation support for nested global initializer_list objects, fixes several
bugs where the destructors for the underlying array would accidentally not get
invoked, and provides constant expression evaluation support for
std::initializer_list objects.

llvm-svn: 183872
2013-06-12 22:31:48 +00:00
Richard Smith e3b28bc363 Move detection of reference members binding to temporaries from building of
CXXCtorInitializers to the point where we perform the questionable lifetime
extension. This exposed a selection of false negatives in the warning.

llvm-svn: 183869
2013-06-12 21:51:50 +00:00
Richard Trieu 33a4b3db0d Introducing -Wheader-guard, a warning that checks header guards actually work
properly.  This warning checks that the #ifndef and #define directives at
the beginning of a header refer to the same macro name.  Includes a fix-it
hint to correct the header guard.

llvm-svn: 183867
2013-06-12 21:20:57 +00:00
Rafael Espindola a3346d8765 Use the global functions instead of the Program methods.
llvm-svn: 183861
2013-06-12 20:44:26 +00:00
Richard Smith 736a947bdc Reapply r183721, reverted in r183776, with a fix for a bug in the former (we
were lacking ExprWithCleanups nodes in some cases where the new approach to
lifetime extension needed them).

Original commit message:

Rework IR emission for lifetime-extended temporaries. Instead of trying to walk
into the expression and dig out a single lifetime-extended entity and manually
pull its cleanup outside the expression, instead keep a list of the cleanups
which we'll need to emit when we get to the end of the full-expression. Also
emit those cleanups early, as EH-only cleanups, to cover the case that the
full-expression does not terminate normally. This allows IR generation to
properly model temporary lifetime when multiple temporaries are extended by the
same declaration.

We have a pre-existing bug where an exception thrown from a temporary's
destructor does not clean up lifetime-extended temporaries created in the same
expression and extended to automatic storage duration; that is not fixed by
this patch.

llvm-svn: 183859
2013-06-12 20:42:33 +00:00