Commit Graph

48259 Commits

Author SHA1 Message Date
Matthew Curtis 274a9cc84b Gracefully (and correctly) handle init of multiple union members
We now emit warnings when doing so and code generation is consistent
with GCC. Note that the C99 spec is unclear as to the precise
behavior.

See also ...
Bug:
  http://llvm.org/bugs/show_bug.cgi?id=16644 and

cfe-dev discussion:
  http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-September/031918.html

llvm-svn: 191890
2013-10-03 12:14:24 +00:00
Faisal Vali 8ec4036669 Teach TreeTransform and family how to transform generic lambdas within templates and nested within themselves.
This does not yet include capturing (that is next).

Please see test file for examples.

This patch was LGTM'd by Doug:
http://llvm-reviews.chandlerc.com/D1784
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130930/090048.html

When I first committed this patch - a bunch of buildbots were unable to compile the code that VS2010 seemed to compile.  Seems like there was a dependency on Sema/Template.h which VS did not seem to need, but I have now added for the other compilers.  It still compiles on Visual Studio 2010 - lets hope the buildbots remain quiet (please!)

llvm-svn: 191879
2013-10-03 06:29:33 +00:00
Timur Iskhodzhanov 6745522f89 Extract ABI-specific parts of MangleContext into separate classes
Reviewed at http://llvm-reviews.chandlerc.com/D1807

llvm-svn: 191878
2013-10-03 06:26:13 +00:00
Faisal Vali 10a00ee485 Revert changes from the nested lambdas commit till i figure out
why the buildbots are failing.

llvm-svn: 191876
2013-10-03 05:58:37 +00:00
Faisal Vali ba78d34347 Teach TreeTransform and family how to transform generic lambdas within templates and nested within themselves.
This does not yet include capturing (that is next).

Please see test file for examples.

This patch was LGTM'd by Doug:
http://llvm-reviews.chandlerc.com/D1784

llvm-svn: 191875
2013-10-03 05:32:48 +00:00
Craig Topper d867805739 Change __builtin_ia32_bextri_u64 to take an i64imm to match up with LLVM backend changes.
An explicit cast is still needed in tbmintrin.h to convert any big integer down to i32imm.

Patch from Yunzhong Gao.

llvm-svn: 191872
2013-10-03 04:21:19 +00:00
Fariborz Jahanian 8c45e283f2 ObjectiveC migrator: Add individual options and
enable them for distinct feature migration.
// rdar://15003157

llvm-svn: 191863
2013-10-02 22:49:59 +00:00
Fariborz Jahanian 2bfa2b9198 ObjectiveC migrator: Add more options one for each
kind of migration. // rdar://15003157

llvm-svn: 191858
2013-10-02 21:58:13 +00:00
Fariborz Jahanian c121386170 ObjectiveC migrator. Starting distiguising different
migrations under their own option. 
wip and // rdar://15003157

llvm-svn: 191855
2013-10-02 21:32:39 +00:00
Mark Lacey 5ea993bb59 Use the CGCXXABI member on CodeGenTypes.
CodeGenTypes already has a reference to a CGCXXABI. Use this directly
rather than going through CodeGenModule to get to the same information.

This is consistent with other references to CGCXXABI in CodeGenTypes
functions defined in CGCall.cpp.

llvm-svn: 191854
2013-10-02 20:35:23 +00:00
Kaelyn Uhrain 653ff2431b Speed up CorrectTypo by avoiding lookups on unreasonable candidates.
llvm-svn: 191846
2013-10-02 18:26:35 +00:00
Fariborz Jahanian 182486c9d9 Objective-C migrator. Simplify migrator option
processing in preparation for adding several more
options. // rdar://15003157

llvm-svn: 191842
2013-10-02 17:08:12 +00:00
Timur Iskhodzhanov 40c585a568 Fix crashes when creating global instances of polymorphic classes without fields
Reviewed at http://llvm-reviews.chandlerc.com/D1795

llvm-svn: 191839
2013-10-02 16:03:16 +00:00
Reid Kleckner 4d185105e9 Accept #pragma warning(push, 0) without warning
This partially addresses PR17435, but it doesn't actually implement the
pragma.  If we implement it, we should map levels 1-4 to something like
-Wall and level 0 to something like -w.

llvm-svn: 191833
2013-10-02 15:19:23 +00:00
Daniel Jasper 164c8e1810 clang-format: Fix clang-format-diff.py according to diff specification.
Patch by Alp Toker. Many thanks!

Original descriptions:
clang-format-diff incorrectly modifies unchanged lines due to an error
in diff parsing.

The unified diff format has a default line change count of 1, and 0 may
be specified to indicate that no lines have been added. This patch
updates the parser to accurately reflect the diff specification.

This also has the benefit of stabilising the operation so it will
produce the same output when run multiple times on the same changeset,
which was previously not the case.

No tests added because this script is not currently tested (though we
should look into that!)

llvm-svn: 191820
2013-10-02 13:59:03 +00:00
Patrik Hagglund 375d6c1ee0 Fix gcc -Wunused-but-set-variable warning in r191634.
llvm-svn: 191817
2013-10-02 10:59:08 +00:00
Joey Gouly 75987a65f3 [ARM] Add a builtin to allow you to use the 'sevl' instruction.
llvm-svn: 191816
2013-10-02 10:00:18 +00:00
Nick Lewycky ce550076d0 Fix build breakage, missed committing a chunk of a patch.
llvm-svn: 191809
2013-10-02 02:33:11 +00:00
Nick Lewycky 2d84e84236 Thread a SourceLocation into the EmitCheck for "load_invalid_value". This occurs
when scalars are loaded / undergo lvalue-to-rvalue conversion.

llvm-svn: 191808
2013-10-02 02:29:49 +00:00
Jordan Rose 44e066c72a [analyzer] Add missing return after function pointer null check.
Also add some tests that there is actually a message and that the bug is
actually a hard error. This actually behaved correctly before, because:

- addTransition() doesn't actually add a transition if the new state is null;
  it assumes you want to propagate the predecessor forward and does nothing.
- generateSink() is called in order to emit a bug report.
- If at least one new node has been generated, the predecessor node is /not/
  propagated forward.

But now it's spelled out explicitly.

Found by Richard Mazorodze, who's working on a patch that may require this.

llvm-svn: 191805
2013-10-02 01:20:28 +00:00
Manman Ren 8a35855cb1 Debug Info: update testing cases when the derived-from field of a
DW_TAG_pointer_type is updated to use DITypeRef.

Paired commit with r191800.

llvm-svn: 191801
2013-10-01 23:46:19 +00:00
Kaelyn Uhrain 07e627263f Fix a typo suggestion regression introduced by r191544.
llvm-svn: 191798
2013-10-01 22:00:28 +00:00
Nick Lewycky 5fa40c3b9e No functionality change. Reflow lines that could fit on one line. Break lines
that had 80-column violations. Remove spurious emacs mode markers on .cpp files.

llvm-svn: 191797
2013-10-01 21:51:38 +00:00
Fariborz Jahanian 8f5225b3a7 ObjectiveC migrator: When doing migration, migrator must suggest
migration of headers which have become system headers by user having put
the .system_framework in the sdk directory.
// rdar://15066802

llvm-svn: 191796
2013-10-01 21:16:29 +00:00
Rafael Espindola fc74c81451 Revert commits r190613, r190560 and r190557.
The added a cmake invocation to null builds, making them a lot slower.

llvm-svn: 191784
2013-10-01 17:31:40 +00:00
Warren Hunt 2731e3e4ef Fixing implementation of bittestandset in Intrin.h.
llvm-svn: 191783
2013-10-01 17:12:40 +00:00
Ariel J. Bernal 31c181b061 Fixed replacements for files with relative paths are not applied.
Replacements were no applied when using a compilation database with paths in the
compilation command relative to the compile directory. This patch makes those
paths abosulte.

llvm-svn: 191776
2013-10-01 14:59:00 +00:00
Alexander Kornienko 1f80396d03 Refactoring: split addTokenToState into two methods.
Summary: Pure refactoring, should be no semantic changes.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 191772
2013-10-01 14:41:18 +00:00
Tim Northover a77b7b8427 Typo in ARM __attribute__((interrupt)) documentation
llvm-svn: 191771
2013-10-01 14:39:43 +00:00
Tim Northover a484bc00ff Implement ARM GNU-style interrupt attribute
This attribute allows users to use a modified C or C++ function as an ARM
exception-handling function and, with care, to successfully return control to
user-space after the issue has been dealt with.

rdar://problem/14207019

llvm-svn: 191769
2013-10-01 14:34:25 +00:00
Tim Northover 6a6b63b464 Move checkStringLiteralArgument into Sema class
It's a useful function to have around for target-specific attributes.

llvm-svn: 191768
2013-10-01 14:34:18 +00:00
Timur Iskhodzhanov 4d490a3570 Run the -cxx-abi test in 32-bit mode as the 64-bit one crashes on the bots
llvm-svn: 191760
2013-10-01 14:10:03 +00:00
Timur Iskhodzhanov 156bedf8e5 Author a FIXME in a test now that PR12784 is fixed
llvm-svn: 191758
2013-10-01 13:56:35 +00:00
Amara Emerson 4cdb87b2d5 [ARM] Add -mfpu=none option to the driver.
llvm-svn: 191736
2013-10-01 10:20:54 +00:00
Alexey Bataev d5af8e472d [OpenMP] Added parsing and semantic analysis for firstprivate clause
llvm-svn: 191730
2013-10-01 05:32:34 +00:00
Faisal Vali 49b4c1f0c8 Fix computation of linkage within nested lambdas.
When nested C++11 lambdas are used in NSDMI's - this patch prevents infinite recursion by computing the linkage of any nested lambda by determining the linkage of the outermost enclosing lambda (which might inherit its linkage from its parent).

See http://llvm-reviews.chandlerc.com/D1783 for Doug's approval.

[On a related note, I need this patch so as to pass tests of transformations of nested lambdas returned from member functions]

llvm-svn: 191727
2013-10-01 02:51:53 +00:00
Eli Friedman 3be1a1c0b5 Fix typo correction usage of SemaAccess.cpp.
When we check access for lookup results, make sure we propagate the
result's access to the access control APIs; this can be different from
the natural access of the declaration depending on the path used by the lookup.

PR17394.

llvm-svn: 191726
2013-10-01 02:44:48 +00:00
Richard Smith e4aaac506c Revert r191586 and r191695. They cause crashes when building with
-relaxed-aliasing.

llvm-svn: 191725
2013-10-01 02:20:23 +00:00
Eli Friedman 4a962f03be Tweak changes in r186464 to avoid a crash.
Currently, IR generation can't handle file-scope compound literals with
non-constant initializers in C++.

Fixes PR17415 (the first crash in the bug).

(We should probably change (T){1,2,3} to use the same codepath as T{1,2,3} in
C++ eventually, given that the semantics of the latter are actually defined by
the standard.)

llvm-svn: 191719
2013-10-01 00:28:29 +00:00
Richard Smith dd0bc7b560 Remove support for arrays of runtime bound in C++1y, now they have been voted
out of the working paper. This reverts r179962 and r179992.

llvm-svn: 191718
2013-10-01 00:19:43 +00:00
Weiming Zhao 53a797ce7b Fix PR 12730: Add _GCC_HAVE_SYNC_COMPARE_AND_SWAP macros for ARM
llvm-svn: 191707
2013-09-30 22:51:32 +00:00
Warren Hunt 3f98794718 Changing __X86_64__ to __x86_64__ in Intrin.h.
llvm-svn: 191700
2013-09-30 21:08:05 +00:00
Manman Ren e5c2d919b6 Turn struct-path aware TBAA on by default.
Use -no-struct-path-tbaa to turn it off.

llvm-svn: 191695
2013-09-30 19:35:19 +00:00
David Blaikie 8b03ef8388 Remove unused variable introduced in 191666
llvm-svn: 191682
2013-09-30 17:30:41 +00:00
Yunzhong Gao f4e0b1047a Adding intrinsics to the clang front end for the x86 TBM instruction set.
Differential Revision: http://llvm-reviews.chandlerc.com/D1751

llvm-svn: 191681
2013-09-30 17:25:14 +00:00
Edwin Vane d544aa79c9 Moving style option formatting to libFormat
The help text for clang-format's -style option and the function that processes
its value is moved to libFormat in this patch. The goal is to enable other
tools that use libFormat and also have a -style option to behave consistently
with clang-format.

llvm-svn: 191666
2013-09-30 13:31:48 +00:00
Manuel Klimek 5843add31e Fix use-after-free.
TemplateDeclInstantiator takes the MultiLevelArgumentList by const-ref
and stores a const-ref member. Thus, we must not pass a temporary
into the constructor.

llvm-svn: 191665
2013-09-30 13:29:01 +00:00
Daniel Jasper eabede6d1b clang-format: Improve alignment after 'return'.
Previously, comments, could totally confuse it.

Before:
  return
             // true if code is one of a or b.
             code == a ||
         code == b;

After:
  return
      // true if code is one of a or b.
      code == a || code == b;

llvm-svn: 191654
2013-09-30 08:29:03 +00:00
Chandler Carruth 92bd47aaa5 Add a bunch of other GCC '-f' options and ignore them. This covers every
such option I've been able to find in the wild in our build system.

Note that I haven't added test cases for this. I can do so if folks
want, but they're *really* boring considering that this is all generated
code to parse and ignore unsued options.

llvm-svn: 191653
2013-09-30 07:46:08 +00:00
Chandler Carruth 2196c4256d Switch one of the ignored boolean flag multiclasses to not have an 'f'
prefix. Sort the ignored boolean 'f' flags at the bottom of this file.
No functionality changed.

llvm-svn: 191651
2013-09-30 03:55:06 +00:00
NAKAMURA Takumi 6d18236d37 SemaTemplateDeduction.cpp: Suppress a warning. [-Wunused-variable]
llvm-svn: 191648
2013-09-30 00:14:27 +00:00
Faisal Vali 98b8e18379 Revert the linkage fix.
I got a bunch of buildbot failures that i don't understand - sorry.

llvm-svn: 191647
2013-09-29 20:27:06 +00:00
Faisal Vali f9a9af3c3d Remove an unnecessary overload from ASTLambda.h
As Richard pointed out to me, dyn_cast is very cheap - there is no real benefit from adding cluttery overloads to only avoid that cast.
No functionality change.

llvm-svn: 191646
2013-09-29 20:15:45 +00:00
Faisal Vali db29268b10 Fix computation of linkage within nested lambdas.
When nested lambdas are used in NSDMI's - this prevents infinite recursion.

See http://llvm-reviews.chandlerc.com/D1783 for Doug's approval regarding the code, and then request for some tests.

[On a related note, I need this patch so as to pass tests of transformations of nested lambdas returned from member functions]

llvm-svn: 191645
2013-09-29 20:00:15 +00:00
Manuel Klimek 7491eaa24d Add section on VS integration to the ClangFormat documentation.
llvm-svn: 191642
2013-09-29 17:49:50 +00:00
Faisal Vali 850da1a3a2 Fix windows newlines :(
llvm-svn: 191641
2013-09-29 17:08:32 +00:00
Daniel Jasper 6e16d54266 Fix misspelling of -fmodules-decluse.
llvm-svn: 191640
2013-09-29 12:40:54 +00:00
Daniel Jasper 0b1f76b658 clang-format: Fix assertion on incomplete string literals.
Before, this could would lead to an assert:
  llvm::errs() << "
               << a;

llvm-svn: 191639
2013-09-29 12:02:57 +00:00
Faisal Vali 571df12581 Implement conversion to function pointer for generic lambdas without captures.
The general strategy is to create template versions of the conversion function and static invoker and then during template argument deduction of the conversion function, create the corresponding call-operator and static invoker specializations, and when the conversion function is marked referenced generate the body of the conversion function using the corresponding static-invoker specialization.  Similarly, Codegen does something similar - when asked to emit the IR for a specialized static invoker of a generic lambda, it forwards emission to the corresponding call operator. 

This patch has been reviewed in person both by Doug and Richard.  Richard gave me the LGTM.

A few minor changes:
  - per Richard's request i added a simple check to gracefully inform that captures (init, explicit or default) have not been added to generic lambdas just yet (instead of the assertion violation).
  - I removed a few lines of code that added the call operators instantiated parameters to the currentinstantiationscope. Not only did it not handle parameter packs, but it is more relevant in the patch for nested lambdas which will follow this one, and fix that problem more comprehensively.
  - Doug had commented that the original implementation strategy of using the TypeSourceInfo of the call operator to create the static-invoker was flawed and allowed const as a member qualifier to creep into the type of the static-invoker.  I currently kludge around it - but after my initial discussion with Doug, with a follow up session with Richard, I have added a FIXME so that a more elegant solution that involves the use of TrivialTypeSourceInfo call followed by the correct wiring of the template parameters to the functionprototypeloc is forthcoming.

Thanks! 
 

llvm-svn: 191634
2013-09-29 08:45:24 +00:00
Ed Schouten d062146896 Add character set related __STDC_* definitions.
Clang uses UTF-16 and UTF-32 for its char16_t's and char32_t's
exclusively. This means that we can define __STDC_UTF_16__ and
__STDC_UTF_32__ unconditionally.

While there, define __STDC_MB_MIGHT_NEQ_WC__ for FreeBSD. FreeBSD's
wchar_t's don't encode characters as ISO-10646; the encoding depends on
the locale used. Because the character set used might not be a superset
of ASCII, we must define __STDC_MB_MIGHT_NEQ_WC__.

llvm-svn: 191631
2013-09-29 07:54:52 +00:00
Richard Smith 1cdec019e8 Implement C++1y sized deallocation (n3778). This is not enabled by -std=c++1y;
instead, it's enabled by the -cc1 flag -fsized-deallocation, until we sort out
the backward-compatibility issues.

llvm-svn: 191629
2013-09-29 04:40:38 +00:00
Richard Smith ee84919175 Remove commented-out entry for ARBs, they're not in C++1y any more.
llvm-svn: 191627
2013-09-28 19:09:34 +00:00
Benjamin Kramer 5352717508 The second parameter of nexttoward is always long double.
llvm-svn: 191623
2013-09-28 17:41:03 +00:00
James Dennett 0f7691ad20 Documentation: minor fixes/improvements to documentation of DependentScopeDeclRefExpr.
llvm-svn: 191622
2013-09-28 16:30:01 +00:00
Benjamin Kramer 602623f9ae Make helper function static.
llvm-svn: 191615
2013-09-28 15:08:41 +00:00
Benjamin Kramer 20c28bebf9 Refactor comment merging.
- We scan for whitespace between comments anyways, remember any newlines seen
  along the way.
- Use this newline number to decide whether two comments are adjacent.
- Since the newline check is now free remove the caching and unused code.
- Remove unnecessary boolean state from the comment list.
- No behavioral change.

llvm-svn: 191614
2013-09-28 15:06:27 +00:00
Simon Atanasyan ee1accf14e Separate construction of bi-arch path suffix from construction of
multi-library path suffix.

The code calculates MIPS toolchain specific multi-lib path suffixes like
mips16/soft-float/el is moved to the separate function
findMultiLibSuffix(). This function called during GCC installation
detection and result is stored for the future using.

The patch reviewed by Rafael Espindola.
http://llvm-reviews.chandlerc.com/D1738

llvm-svn: 191612
2013-09-28 13:45:11 +00:00
Richard Smith 5b013f5050 Add compat/extension warnings for init captures.
llvm-svn: 191609
2013-09-28 05:38:27 +00:00
Richard Smith 846f13ca14 Add extra testing for init-captures.
llvm-svn: 191608
2013-09-28 05:23:21 +00:00
Richard Smith b438e62aba Mark lambda init-captures as complete.
llvm-svn: 191607
2013-09-28 04:37:56 +00:00
Richard Smith 75e3f695fb Switch from putting init capture VarDecls in the surrounding DeclContext to
putting them in the call operator's DeclContext. This better matches the
language wording and avoids some cases where code gets confused by them for
namespace-scope lambdas and the like.

llvm-svn: 191606
2013-09-28 04:31:26 +00:00
Richard Smith bb13c9a49d Per latest drafting, switch to implementing init-captures as if by declaring
and capturing a variable declaration, and complete the implementation of them.

llvm-svn: 191605
2013-09-28 04:02:39 +00:00
Jordan Rose 3553bb384b [analyzer] Make inlining decisions based on the callee being variadic.
...rather than trying to figure it out from the call site, and having
people complain that we guessed wrong and that a prototype-less call is
the same as a variadic call on their system. More importantly, fix a
crash when there's no decl at the call site (though we could have just
returned a default value).

<rdar://problem/15037033>

llvm-svn: 191599
2013-09-28 02:04:19 +00:00
Warren Hunt 41a993f6f8 Typo correction: _int64 -> __int64.
llvm-svn: 191592
2013-09-28 00:15:41 +00:00
Warren Hunt d6ffae91d5 Implements some of the more commonly used intrinsics in Intrin.h
Differential Revision: http://llvm-reviews.chandlerc.com/D1766

llvm-svn: 191590
2013-09-27 23:57:26 +00:00
Kaelyn Uhrain 30943ce6fd Don't suggest namespaces if the next token is a '.'
llvm-svn: 191589
2013-09-27 23:54:23 +00:00
Manman Ren 4f04263347 TBAA: use the same format for scalar TBAA and struct-path aware TBAA.
Struct-path aware TBAA generates tags to specify the access path,
while scalar TBAA only generates tags to scalar types.

llvm-svn: 191586
2013-09-27 23:06:41 +00:00
Fariborz Jahanian 5d783df5f7 ObjectiveC migrator. Infer property from getters only
if property name is a valid identifier in the underlying
language. // rdar://15044184

llvm-svn: 191584
2013-09-27 22:55:54 +00:00
Chandler Carruth 826eec5913 Implementation of N3760 which is planned to be voted into C++14's draft
tomorrow is complete.

There is a missing warning due to a serious issue with template
instantiation in Clang (and potentially in the core language).

llvm-svn: 191577
2013-09-27 22:30:27 +00:00
Chandler Carruth 2acfb22d23 Fix a bug where we failed to diagnose class template specialization
uses.

This fixes one of the two remaining failures to implement [[deprecated]]
as specified for C++14.

llvm-svn: 191572
2013-09-27 22:14:40 +00:00
Douglas Gregor 30e9b6c47d Note that modules are supported for C/Objective-C, and have syntax in ObjC.
llvm-svn: 191562
2013-09-27 21:23:28 +00:00
Justin Bogner bb971c98ea docs: Document CXXLiteralOperatorName and CXXUsingDirective
llvm-svn: 191560
2013-09-27 21:10:54 +00:00
Justin Bogner 753df2fac4 docs: Remove note about Identifiers being used for C++ operators
C++ operators are represented by CXXOperatorName now, which is already
documented.

llvm-svn: 191559
2013-09-27 21:10:51 +00:00
Rafael Espindola 13ca93c0e3 Update the help text.
llvm-svn: 191554
2013-09-27 20:42:38 +00:00
Rafael Espindola ea1ba0adfc Replace -fobjc-default-synthesize-properties with disable-objc-default-synthesize-properties.
We want the modern behavior most of the time, so inverting the option simplifies
the driver and the tests.

llvm-svn: 191551
2013-09-27 20:21:48 +00:00
Chandler Carruth 09445c4836 Implement N3760, support for the [[deprecated]] attribute.
This motion appears to have consensus in the C++ committee and is
expected to be voted into the C++14 draft tomorrow during the formal
vote.

No extension warning in C++11 as attributes not specified in the
standard using the standard syntax in C++11 have implementation defined
meaning, and we define the meaning proposed for C++14.

There is one bug exposed as we do not warn on a deprecated template
specialization. I've left a FIXME in the test case and will dig into
that next.

Also, I will add a few more exhaustive test cases of the other features
specified for this attribute in a follow-up commit.

llvm-svn: 191550
2013-09-27 20:20:17 +00:00
Richard Smith dca0c7a5fb Mark variable template implementation as complete. Nearly all of the credit
here goes to Larisse Voufo.

llvm-svn: 191549
2013-09-27 20:19:41 +00:00
Richard Smith 8809a0c95e Variable templates: handle instantiation of static data member templates
appropriately, especially when they appear within class templates.

llvm-svn: 191548
2013-09-27 20:14:12 +00:00
Richard Smith 23e43cdda6 Comment out links for papers that aren't up yet.
llvm-svn: 191547
2013-09-27 19:55:03 +00:00
Kaelyn Uhrain 46b6cdcc9c Don't give suggest things like function names on the left side of "=".
llvm-svn: 191545
2013-09-27 19:40:16 +00:00
Kaelyn Uhrain 3dfff19658 Avoid the hard-coded limit on the number of typo corrections attempted.
Move some tests from typo-correction.cpp to typo-correction-pt2.cpp
because they were running afoul of the hard-coded limit of 20 typos
corrected. Some of the tests after it were still working due to the
limit not applying to cached corrections and in cases where a non-NULL
MemberContext is passed in to Sema::CorrectTypo.  Most of the moved tests
still passed after being moved, but the test involving "data_struct" had
only been passing because the test had exceeded that limit so a fix for
it is also included (most of the changes to ParseStmt.cpp are shared with
and originated from another typo correction impovement that was split
into a separate commit).

llvm-svn: 191544
2013-09-27 19:40:12 +00:00
Kaelyn Uhrain 0e23844f57 Cache the location of failed typo corrections so that typo correction
isn't repeatedly attempted for the same identifier at the same location.

llvm-svn: 191543
2013-09-27 19:40:08 +00:00
Benjamin Kramer 8ba47d017b Fix typo: Dellocation.
llvm-svn: 191542
2013-09-27 19:35:09 +00:00
Richard Smith 36f11c56ed Fix formatting goof.
llvm-svn: 191541
2013-09-27 19:12:22 +00:00
Richard Smith 3ca005bd01 Update status:
* generic lambdas are now partially supported
 * add papers from formal motions in committee

llvm-svn: 191540
2013-09-27 19:11:33 +00:00
Hans Wennborg 260ff405a7 clang-cl: pass /FI options to fallback
We started parsing /FI in r191442, and now we can pass it on to the
fallback too.

llvm-svn: 191537
2013-09-27 17:54:18 +00:00
Edwin Vane 88ef9ad84e Adding pre/post conditions for some Replacement handling functions
The vector version of shiftedCodePosition() requires Replacements to be
in sorted order.

Turned existing comment about sorting for deduplicate() into an exact
post condition.

llvm-svn: 191536
2013-09-27 17:52:45 +00:00
Benjamin Kramer e7800df48b SourceManager: Open code isInMainFile.
- We really shouldn't compute line numbers for every file that is asked if it's
  the main file, it destroys the lazy computation.
- Invalid locations are no longer accounted to the main file, no other
  functionality change.

llvm-svn: 191535
2013-09-27 17:12:50 +00:00
Timur Iskhodzhanov 428d042828 Quick-fix the test for no-asserts build
llvm-svn: 191534
2013-09-27 17:07:56 +00:00
Rafael Espindola 339d875cc1 Remove method that always returns true.
llvm-svn: 191533
2013-09-27 16:58:26 +00:00
Jordan Rose a63d1dbddf [analyzer] Allow pre/post-statement checkers for UnaryOperator.
Found by Arthur Yoo.

llvm-svn: 191532
2013-09-27 16:47:52 +00:00
Faisal Vali 7c9f3ca21a Fix the test files by removing the unnecessary -emit-llvm flag (should address Matt Beaumont-Gay's concern regarding failure on a read-only filesystem)
llvm-svn: 191531
2013-09-27 16:45:48 +00:00
Alexander Kornienko 45dc1b2fd3 Added a comment and another test for the UT_ForIndentation option
llvm-svn: 191530
2013-09-27 16:40:11 +00:00
Alexander Kornienko 8ba68f6802 Updated examples of UseTab option
llvm-svn: 191529
2013-09-27 16:19:25 +00:00
Alexander Kornienko 45ca09b3f5 Updated clang-format style options doc.
llvm-svn: 191528
2013-09-27 16:16:55 +00:00
Alexander Kornienko 3c3d09c885 Implemented tab usage only for indentation (http://llvm.org/PR17363)
Summary:
Changed UseTab to be a enum with three options: Never, Always,
ForIndentation (true/false are still supported when reading .clang-format).
IndentLevel should currently be propagated correctly for all tokens, except for
block comments. Please take a look at the general idea before I start dealing
with block comments.

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits

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

llvm-svn: 191527
2013-09-27 16:14:22 +00:00
Timur Iskhodzhanov 8b5987eba5 Abstract out the emission of vtables, add basic support for vtable emission when using -cxx-abi microsoft
Reviewed at http://llvm-reviews.chandlerc.com/D1532

llvm-svn: 191523
2013-09-27 14:48:01 +00:00
Alexander Kornienko db4c21f994 Correctly indent with tabs when whitespace starts from the column not divisible by TabWidth.
Summary:
The width of the first inserted tab character depends on the initial
column, so we need to handle the first tab in a special manner.

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits

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

llvm-svn: 191497
2013-09-27 09:45:40 +00:00
Daniel Jasper f3167903b8 clang-format: Improve formatting of functions with multiple trailing tokens.
Before:
  void SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaa,
                    aaaaaaaaaaaaaaaaaaaaaaaaaa) override
  final;

After:
  void SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaa,
                    aaaaaaaaaaaaaaaaaaaaaaaaaa) override final;

llvm-svn: 191494
2013-09-27 08:29:16 +00:00
David Majnemer 68c880b5f9 AST: Handle multidimensional arrays inside of __uuidof()
We previously handled one-dimensional arrays but didn't consider the
general case.  The fix is simple: keep going through subsequent
dimensions until we get to the base element.

llvm-svn: 191493
2013-09-27 07:57:34 +00:00
Daniel Jasper 69bd8fb79a clang-format: Fix formatting bug with comment in weird place.
Before:
  template <typename T>
  // T should be one of {A, B}.
      void f() {}

After:
  template <typename T>
  // T should be one of {A, B}.
  void f() {}

llvm-svn: 191492
2013-09-27 07:49:08 +00:00
David Majnemer 143c55ead2 AST: Handle qualified array types in typeid() expressions
The intent of getTypeOperand() was to yield an unqualified type.
However QualType::getUnqualifiedType() does not strip away qualifiers on
arrays.

N.B.  This worked fine when typeid() was applied to an expression
because we would inject as implicit cast to the unqualified array type
in the AST.

llvm-svn: 191487
2013-09-27 07:04:31 +00:00
Nick Lewycky acfcd0d51b Add -fno-unsigned-char and ignore it. We already support -fno-signed-char, add
both flags to the driver test.

llvm-svn: 191486
2013-09-27 05:06:31 +00:00
NAKAMURA Takumi f2bc8f35a2 NumericLiteralParser::ParseNumberStartingWithZero(): Try to appease MSC16's miscompilation.
Investigating yet. It seems msc16 miscompiles s[1] to be folded.

llvm-svn: 191485
2013-09-27 04:42:28 +00:00
David Majnemer c185aa7d92 Sema: Respect -fdelayed-template-parsing when parsing constexpr functions
Functions declared as constexpr must have their parsing delayed in
-fdelayed-template-parsing mode so as not to upset later template
instantiation.

N.B. My reading of the standard makes it seem like delayed template
parsing is at odds with constexpr.  We may want to make refinements in
other places in clang to make constexpr play nicer with this feature.

This fixes PR17334.

llvm-svn: 191484
2013-09-27 04:14:12 +00:00
Craig Topper 61f71c3903 Remove some stray underscores from copyright block. Fix first line length to match length of the one after the copyright block.
llvm-svn: 191483
2013-09-27 03:57:18 +00:00
Fariborz Jahanian 7c1a445c9e ObjectiveC migrator: Donlt annotate NS_RETURNS_INNER_POINTER
on class methods, as it makes no sense. // rdar://15069200

llvm-svn: 191468
2013-09-26 22:43:41 +00:00
Fariborz Jahanian 73466cafc1 ObjectiveC migrator: function pointer is not an
inner pointer for annotation to
objc_returns_inner_pointer purposes.
// rdar://15044991

llvm-svn: 191465
2013-09-26 21:43:47 +00:00
Adrian Prantl 179af903d2 Debug info: Fix a crash when trying to construct a type with redundant
ownership qualifiers.
Fixes rdar://problem/14990656.

llvm-svn: 191463
2013-09-26 21:35:50 +00:00
Faisal Vali 6440fcbee0 Remove an unused variable - thanks to Nick Lewycky for pointing this out!
llvm-svn: 191462
2013-09-26 21:32:23 +00:00
Kaelyn Uhrain f73430183a Fix error recovery when a return type correction includes a new name specifier.
llvm-svn: 191459
2013-09-26 21:13:05 +00:00
Bob Wilson a1b4206a70 Fix up fallout from r187156.
The previous change caused the driver to translate -Wa,-L to the
-msave-temp-labels option for cc1as, but cc1as did not accept that option.
This patch follows the same approach used for similar options (-relax-all,
-noexecstack) in the previous patch.

llvm-svn: 191458
2013-09-26 21:00:51 +00:00
Faisal Vali 2b391ab708 Implement a rudimentary form of generic lambdas.
Specifically, the following features are not included in this commit:
  - any sort of capturing within generic lambdas 
  - generic lambdas within template functions and nested 
    within other generic lambdas
  - conversion operator for captureless lambdas
  - ensuring all visitors are generic lambda aware
  (Although I have gotten some useful feedback on my patches of the above and will be incorporating that as I submit those patches for commit)

As an example of what compiles through this commit:

template <class F1, class F2>
struct overload : F1, F2 {
    using F1::operator();
    using F2::operator();
    overload(F1 f1, F2 f2) : F1(f1), F2(f2) { }
  };

  auto Recursive = [](auto Self, auto h, auto ... rest) {
    return 1 + Self(Self, rest...);
  };
  auto Base = [](auto Self, auto h) {
      return 1;
  };
  overload<decltype(Base), decltype(Recursive)> O(Base, Recursive);
  int num_params =  O(O, 5, 3, "abc", 3.14, 'a');

Please see attached tests for more examples.

This patch has been reviewed by Doug and Richard.  Minor changes (non-functionality affecting) have been made since both of them formally looked at it, but the changes involve removal of supernumerary return type deduction changes (since they are now redundant, with richard having committed a recent patch to address return type deduction for C++11 lambdas using C++14 semantics). 



Some implementation notes:

  - Add a new Declarator context => LambdaExprParameterContext to 
    clang::Declarator to allow the use of 'auto' in declaring generic
    lambda parameters
      
  - Add various helpers to CXXRecordDecl to facilitate identifying
    and querying a closure class
  
  - LambdaScopeInfo (which maintains the current lambda's Sema state)
    was augmented to house the current depth of the template being
    parsed (id est the Parser calls Sema::RecordParsingTemplateParameterDepth)
    so that SemaType.cpp::ConvertDeclSpecToType may use it to immediately 
    generate a template-parameter-type when 'auto' is parsed in a generic
    lambda parameter context.  (i.e we do NOT use AutoType deduced to 
    a template parameter type - Richard seemed ok with this approach).  
    We encode that this template type was generated from an auto by simply
    adding $auto to the name which can be used for better diagnostics if needed.

  - SemaLambda.h was added to hold some common lambda utility
    functions (this file is likely to grow ...)
    
  - Teach Sema::ActOnStartOfFunctionDef to check whether it
    is being called to instantiate a generic lambda's call
    operator, and if so, push an appropriately prepared
    LambdaScopeInfo object on the stack.
    
  - various tests were added - but much more will be needed.

There is obviously more work to be done, and both Richard (weakly) and Doug (strongly) 
have requested that LambdaExpr be removed form the CXXRecordDecl LambdaDefinitionaData
in a future patch which is forthcoming.

A greatful thanks to all reviewers including Eli Friedman, James Dennett, 
and especially the two gracious wizards (Richard Smith and Doug Gregor) 
who spent hours providing feedback (in person in Chicago and on the mailing lists).  
And yet I am certain that I have allowed unidentified bugs to creep in; bugs, that I will do my best to slay, once identified!

Thanks!

llvm-svn: 191453
2013-09-26 19:54:12 +00:00
Kaelyn Uhrain deedc3a6bd Fix a bug in the typo correction replacement location.
I noticed the wrong text was being replaced with the correction while
working on expanding the "namespace-aware" typo correction to include
classes.

llvm-svn: 191450
2013-09-26 19:10:34 +00:00
Kaelyn Uhrain 95995be7a3 Teach typo correction to look inside of classes like it does namespaces.
Unlike with namespaces, searching inside of classes requires also
checking the access to correction candidates (i.e. don't suggest a
correction to a private class member for a correction occurring outside
that class and its methods or friends).

Included is a small (one line) fix for a bug, that was uncovered while
cleaning up the unit tests, where the decls from a TypoCorrection candidate
were preserved in new TypoCorrection candidates that are derived (copied)
from the old TypoCorrection--notably when creating a new candidate by
changing the NestedNameSpecifier associated with the base idenitifer.

llvm-svn: 191449
2013-09-26 19:10:29 +00:00
Richard Smith 52d0211ce3 Add macro test from N3781.
llvm-svn: 191444
2013-09-26 18:15:22 +00:00
Richard Smith 7f2707a7f4 Per updates to D3781, allow underscore under ' in a pp-number, and allow ' in a #line directive.
llvm-svn: 191443
2013-09-26 18:13:20 +00:00
Reid Kleckner af1acd9a5e clang-cl: Add /FI (forced include) as an alias for -include
Patch by Jeff Muizelaar, with added test case.

llvm-svn: 191442
2013-09-26 17:41:14 +00:00
Jordan Rose 3d08340b3c [driver] Ignore -fno-var-tracking; it's a GCC option we don't support.
-fvar-tracking (which IIUC is on by default in GCC) will still generate
an error.

llvm-svn: 191439
2013-09-26 17:03:34 +00:00
Rafael Espindola 64437be2c2 Remove fno_builtin_strcat and fno_builtin_strcpy.
They are already handled by the generic fno_bultin_, which also
avoids unused warnings.

llvm-svn: 191437
2013-09-26 16:45:27 +00:00
Benjamin Kramer 9b1dfe8b56 Mark an impossible path as unreachable to pacify GCC.
llvm-svn: 191436
2013-09-26 16:36:08 +00:00
Rafael Espindola c2b696d812 Remove -fbuiltin-strcat and -fbuiltin-strcpy.
These options don't exist in gcc and clang was not handling them.

llvm-svn: 191435
2013-09-26 16:21:53 +00:00
Rafael Espindola 07bed1386e Ignore unknown -fno-builtin-*.
This matches gcc's behavior.

llvm-svn: 191434
2013-09-26 16:15:40 +00:00
Rafael Espindola da3bfe06ad Remove unused parameter.
llvm-svn: 191433
2013-09-26 15:52:26 +00:00
Rafael Espindola fa74eee737 Ignore some -f options that are supported by gcc.
It is possible that we should say some of these are unsupported, but this is
not any worse than the old behavior of ignoring all unknown -f options.

llvm-svn: 191429
2013-09-26 13:10:14 +00:00
Benjamin Kramer 39c4924db9 Remove tabs.
llvm-svn: 191427
2013-09-26 12:16:47 +00:00
Richard Smith 99dc071104 Fix buildbot breakage.
llvm-svn: 191424
2013-09-26 05:57:03 +00:00
Richard Smith 1e130489b3 Replace a bool with an enum for clarity, based on review comment from James Dennett.
llvm-svn: 191420
2013-09-26 04:19:11 +00:00
Richard Smith 10b55fc85e If a partial specialization of a member template is declared within a class
template and defined outside it, don't instantiate it twice when instantiating
the surrounding class template specialization. That would cause us to reject
the code because we think two partial specializations instantiated to produce
the same signature.

llvm-svn: 191418
2013-09-26 03:49:48 +00:00
Richard Smith fde9485297 Implement C++1y digit separator proposal (' as a digit separator). This is not
yet approved by full committee, but was unanimously supported by EWG.

llvm-svn: 191417
2013-09-26 03:33:06 +00:00
Alexey Bataev 7d2960bd2a [OPENMP] Improved variable lookup procedure for threadprivate variables.
llvm-svn: 191416
2013-09-26 03:24:06 +00:00
Hans Wennborg 736a02931e Provide inline definitions of _Unwind_GetIP etc. for ARM in unwind.h
These symbols were showing up as undefined when trying to link programs on
Android. We should match libgcc's behaviour and provide inline definitions
of these on ARM.

It seems unwind.h on ARM/Darwin doesn't provide inline definitions, so we
just declare them for that platform.

llvm-svn: 191406
2013-09-25 22:34:03 +00:00
Reid Kleckner c5cc338ab3 Remove unused param from MicrosoftMangle::mangleCallingConvention()
llvm-svn: 191405
2013-09-25 22:28:52 +00:00
Mark Lacey ac57690895 Update NumTypeBits on Type to match the actual number of used bits.
llvm-svn: 191404
2013-09-25 22:25:21 +00:00
Fariborz Jahanian b7c5f74264 ObjectiveC: Handle the case of qualifying protocols
declared in a typedef declaraton used as super
class of an ObjC class. Curretnly, these protocols
are dropped from the class hierarchy. Test shows that
it is now included. // rdar://15051465

llvm-svn: 191395
2013-09-25 19:36:32 +00:00
Rafael Espindola cf526ee99c Produce an error for unknown -f options.
llvm-svn: 191394
2013-09-25 19:07:08 +00:00
Reid Kleckner 95e036c669 PR17359: Fix off-by-one OOB on _Pragma("") and an unescaping bug
Previously the code would reduce a run of backslashes to a single
backslash, and now it will properly leave behind every other backslash.

llvm-svn: 191382
2013-09-25 16:42:48 +00:00
Jordan Rose 1ccc43d50e [analyzer] Handle destructors for the argument to C++ 'delete'.
Now that the CFG includes nodes for the destructors in a delete-expression,
process them in the analyzer using the same common destructor interface
currently used for local, member, and base destructors. Also, check for when
the value is known to be null, in which case no destructor is actually run.

This does not yet handle destructors for deleted /arrays/, which may need
more CFG work. It also causes a slight regression in the location of
double delete warnings; the double delete is detected at the destructor
call, which is implicit, and so is reported on the first access within the
destructor instead of at the 'delete' statement. This will be fixed soon.

Patch by Karthik Bhat!

llvm-svn: 191381
2013-09-25 16:06:17 +00:00
Rafael Espindola cc707bc989 Produce an error if a -cc1 only option is passed to the driver.
llvm-svn: 191380
2013-09-25 15:54:41 +00:00
Rafael Espindola cbbe1d4454 Use -Xclang to pass -internal-isystem and -internal-externc-isystem to -cc1.
They are cc1 options only, so the driver was ignoring them.

llvm-svn: 191379
2013-09-25 15:47:05 +00:00
Rafael Espindola a844427cfa Move --relocatable-pch to Options.td.
It is a valid driver option (we have tests for that), so it should not be
marked as NoDriverOption.

No functionality change other than it showing in --help.

llvm-svn: 191377
2013-09-25 15:26:06 +00:00
Rafael Espindola 900485ab5f Don't pass -print-stats to the driver, it is a -cc1 option only.
llvm-svn: 191376
2013-09-25 15:21:56 +00:00
Daniel Jasper d94bff3721 clang-format: Option to removing the space before assignment operators.
Patch contributed by Aaron Wishnick. Thank you!

llvm-svn: 191375
2013-09-25 15:15:02 +00:00
Rafael Espindola 4c06c418ae Remove unused option.
llvm-svn: 191373
2013-09-25 14:31:29 +00:00
Benjamin Kramer 8b1a6bd8d0 Sema: Simplify code a bit, plug a potential leak.
No intended functionality change.

llvm-svn: 191370
2013-09-25 13:10:11 +00:00
NAKAMURA Takumi 64b1292bc2 StaticAnalyzer/Core/RegionStore.cpp: Prune one last "\param IsConst", as fixup to r191342. [-Wdocumentation]
llvm-svn: 191360
2013-09-25 08:17:20 +00:00
Richard Smith 4db51c23a4 Refactor to use C++1y 'auto' semantics directly in lambdas with no specified
return type in C++1y mode. No functionality change intended. Extracted and
tweaked from a patch by Faisal Vali!

llvm-svn: 191354
2013-09-25 05:02:54 +00:00
Fariborz Jahanian 7391a7b5aa ObjectiveC migrator. Don't suggest @property for
methods which look like getters but belong to
known family of methods. // rdar://15044058

llvm-svn: 191347
2013-09-25 00:17:07 +00:00
Argyrios Kyrtzidis 18d37b539e [libclang] python: fix return type of clang_Type_getSizeOf().
Patch by Loïc Jaquemet!

llvm-svn: 191346
2013-09-25 00:14:43 +00:00
Argyrios Kyrtzidis 16834f1cf9 [libclang] Provide location for attributes and expose 'packed' attribute.
Patch by Loïc Jaquemet!

llvm-svn: 191345
2013-09-25 00:14:38 +00:00
Anton Yartsev 424ad95fa7 [analyzer] This patch removes passing around of const-invalidation vs regular-invalidation info by passing around a datastructure that maps regions and symbols to the type of invalidation they experience. This simplifies the code and would allow to associate more different invalidation types in the future.
With this patch things like preserving contents of regions (either hi- or low-level ones) or processing of the only top-level region can be implemented easily without passing around extra parameters.

This patch is a first step towards adequate modeling of memcpy() by the CStringChecker checker and towards eliminating of majority of false-positives produced by the NewDeleteLeaks checker.

llvm-svn: 191342
2013-09-24 23:47:29 +00:00
Eli Friedman 3ce27103d9 Allow dynamic_cast to void* even with -fno-rtti.
PR17346.

llvm-svn: 191340
2013-09-24 23:21:41 +00:00
Eli Friedman 1f5d8882f9 Fix -Wmissing-variable-declarations regression.
This issue was introduced in r181677.

PR17349.

llvm-svn: 191339
2013-09-24 23:10:08 +00:00
Richard Smith 5acb759f39 Avoid a signed/unsigned comparison warning with compilers that don't know how
to handle constant expressions.

llvm-svn: 191336
2013-09-24 22:13:21 +00:00
Fariborz Jahanian 7797c0d0f7 ObjectiveC migrator: provide space between the property
keyword and the rest on suggested property. // rdar://15069044

llvm-svn: 191335
2013-09-24 21:27:58 +00:00
Fariborz Jahanian aaabfcdffe ObjectiveC migrator: Another test for my last patch.
// rdar://15044991

llvm-svn: 191334
2013-09-24 20:31:24 +00:00
Fariborz Jahanian 10b7435ceb ObjectiveC migrator: iDOn't mangle names when
NS_RETURNS_INNER_POINTER annotation is suggested on
a property. // rdar://15044991

llvm-svn: 191332
2013-09-24 20:20:52 +00:00
Rafael Espindola 4f3f5ade54 Produce an error for unknown -m options.
llvm-svn: 191328
2013-09-24 19:35:01 +00:00
Yunzhong Gao 1f6aeebe76 Adding -mtbm and -mno-tbm command line options to the clang front end for the
x86 TBM instruction set. Also adding a __TBM__ macro if the TBM feature is
enabled. Otherwise there should be no functionality change to existing features.

Phabricator code review is located here: http://llvm-reviews.chandlerc.com/D1693

llvm-svn: 191326
2013-09-24 19:00:58 +00:00
Hans Wennborg b6331dcb51 clang-cl: fix passing optimization level to cl.exe in /fallback mode
We were previously mostly passing it through, but -O0 and -O3 are not valid
options to cl.exe.

We should translate -O0 to /Od and -O3 to /Ox. -O{1,2,s} get passed through.

llvm-svn: 191323
2013-09-24 18:17:21 +00:00
Hans Wennborg 263c213061 clang-cl: pass /nologo when falling back to cl.exe
llvm-svn: 191316
2013-09-24 17:36:21 +00:00
Fariborz Jahanian 0dded8ab04 Revert my patch in r191155 to allow forward
class/protocol decls in @implementation and
fixup modern rewriter to handle that.
// rdar://15066233

llvm-svn: 191311
2013-09-24 17:03:07 +00:00
Rafael Espindola 96a051367b Use a valid option (-msse) for testing QA_OVERRIDE_GCC3_OPTIONS.
llvm-svn: 191300
2013-09-24 13:37:21 +00:00
Rafael Espindola bfd88f2c7e Remove a use of OPT_m_Joined.
This patch turns the -mv* hexagon options into aliases. We should really produce
errors for invalid versions in the driver, but this patch preserves the old
behavior for now.

llvm-svn: 191298
2013-09-24 13:28:24 +00:00
Daniel Jasper 9a59e2c688 Fix uninitialized value bug discovered buy msan buildbot.
llvm-svn: 191292
2013-09-24 12:30:27 +00:00
Daniel Jasper ca9f73812c Add -fmodule-map-file option.
With this option, arbitrarily named module map files can be specified
to be loaded as required for headers in the respective (sub)directories.

This, together with the extern module declaration allows for specifying
module maps in a modular fashion without the need for files called
"module.map".

Among other things, this allows a directory to contain two modules that
are completely independent of one another.

Review: http://llvm-reviews.chandlerc.com/D1697.
llvm-svn: 191284
2013-09-24 09:27:13 +00:00
Daniel Jasper ba7f2f7110 Module use declarations (II)
Review: http://llvm-reviews.chandlerc.com/D1546.

I have picked up this patch form Lawrence
(http://llvm-reviews.chandlerc.com/D1063) and did a few changes.

From the original change description (updated as appropriate):
This patch adds a check that ensures that modules only use modules they
have so declared. To this end, it adds a statement on intended module
use to the module.map grammar:

  use module-id

A module can then only use headers from other modules if it 'uses' them.
This enforcement is off by default, but may be turned on with the new
option -fmodules-decluse.

When enforcing the module semantics, we also need to consider a source
file part of a module. This is achieved with a compiler option

-fmodule-name=<module-id>.

The compiler at present only applies restrictions to the module directly
being built.

llvm-svn: 191283
2013-09-24 09:14:14 +00:00
Simon Atanasyan 22127cee34 [Mips] Support -mnan=2008 option. Define "__mips_nan2008" macros and pass
this option to the assembler.

llvm-svn: 191282
2013-09-24 09:09:16 +00:00
Richard Smith b12cf6ceb7 Hopefully unbreak bots which are seeing an assert in this test. Temporary, real
fix to come once I've tracked down the problem (which is pre-existing and not
related to the change which introduced this test).

llvm-svn: 191279
2013-09-24 05:07:58 +00:00
Richard Smith 300e0c36a3 Implement restriction that a partial specialization must actually specialize
something, for variable templates.

llvm-svn: 191278
2013-09-24 04:49:23 +00:00
NAKAMURA Takumi 788af10a8a CGBuiltin.cpp: Prune a stray default: label. [-Wcovered-switch-default]
llvm-svn: 191277
2013-09-24 04:37:50 +00:00
Richard Smith 2a98862be2 Handle standard libraries that miss out the space when defining the standard
literal operators. Also, for now, allow the proposed C++1y "il", "i", and "if"
suffixes too. (Will revert the latter if LWG decides not to go ahead with that
change after all.)

llvm-svn: 191274
2013-09-24 04:06:10 +00:00
Alexey Bataev 756c196f14 [OPENMP] Bug fixes and improvements.
1. Fixed constructor of shared clause.
2. Some macros for clauses processing are replaced by private template methods.
3. Additional checks in sema analysis of OpenMP clauses.

llvm-svn: 191265
2013-09-24 03:17:45 +00:00
Jiangning Liu 036f16dc8c Initial support for Neon scalar instructions.
Patch by Ana Pazos.

1.Added support for v1ix and v1fx types.
2.Added Scalar Pairwise Reduce instructions.
3.Added initial implementation of Scalar Arithmetic instructions.

llvm-svn: 191264
2013-09-24 02:48:06 +00:00
Rafael Espindola 25f007f054 Remove unused option.
gcc doesn't support "gcc -m sse" and this was not tested in clang and only
used for link argument on darwin, so this was very likely just a bug.

llvm-svn: 191251
2013-09-24 00:10:56 +00:00
Hans Wennborg f4aee18086 clang-cl: print diagnostics as "error(clang): foo" in /fallback mode
This solves two problems:

1) MSBuild will not flag the build as unsuccessful just because we print
   an error in the output, since "error(clang):" doesn't seem to match
   the regex it's using.

2) It becomes more clear that the diagnostic is coming from clang as
   supposed to cl.exe.

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

llvm-svn: 191250
2013-09-24 00:08:55 +00:00
Rafael Espindola 8a2d496e18 Produce errors for unknown options.
This doesn't change a lot since clang still thinks it knows all of the
-f*, -m* and -W* options for example.

Other than the options clang explicitly claims to know, this fixes pr9701.

llvm-svn: 191249
2013-09-23 23:55:25 +00:00
Eli Friedman 3cd55f49ab Fix argument types of some AVX2 intrinsics.
This fix makes our headers consistent with gcc.

PR17312.

llvm-svn: 191248
2013-09-23 23:52:04 +00:00
Fariborz Jahanian 1a73b8f7d2 Remove extra space.
llvm-svn: 191246
2013-09-23 23:48:04 +00:00
Rafael Espindola 52ddfb3c16 Fix an incomplete copy and paste in my previous patch.
llvm-svn: 191245
2013-09-23 23:43:34 +00:00
Eli Friedman f9d8c6cebb Add _mm_stream_si64 intrinsic.
While I'm here, also fix the alignment computation for the whole family of
intrinsics.

PR17298.

llvm-svn: 191243
2013-09-23 23:38:39 +00:00
Rafael Espindola 05ccc50ba4 Add tests on how clang currently handles some unknown options.
This is not to say this is the desired behavior, but it makes sure we notice
if it changes.

llvm-svn: 191242
2013-09-23 23:27:32 +00:00
Fariborz Jahanian c71eb6adc3 ObjectiveC migrator. When migrating to property declaration
use Cocoa's naming convention for properties of ObjC
object type. // rdar://15045005

llvm-svn: 191240
2013-09-23 23:18:46 +00:00
Richard Smith 0b5511971e Revert change accidentally committed in r191150.
llvm-svn: 191237
2013-09-23 23:12:22 +00:00
Fariborz Jahanian 02bdb16524 ObjectiveC migrator: Infer NS_OPTIONS when if there is at
least one hex enumerator, all others are also
hex enumerator (0 enumerator is excepted). 
// rdar://15044304

llvm-svn: 191222
2013-09-23 20:27:06 +00:00
Kostya Serebryany bedc616804 Enable -fsanitize=use-after-return by default under -fsanitize=address
Summary:
We enable ASAN's use-after-return instrumentation at compile-time,
but still keep it disabled at run-time.
This enables the users to flip the flag at run-time using environment variable
ASAN_OPTIONS=detect_stack_use_after_return=1 instead of using a separate build.
If UAR detection is disabled at run-time, this extra compile-time instrumentation
costs very small slowdown. On SPEC 2006 14 tests are not affected at all,
4 tests get ~ 1% slowdown and 453.povray gets 4%.

Reviewers: samsonov

Reviewed By: samsonov

CC: llvm-commits

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

llvm-svn: 191186
2013-09-23 09:52:37 +00:00
Richard Smith 90061908f6 PR16529: Don't forget to add the CXXFunctionalCastExpr type sugar to an
InitListExpr for a C++11-style T{...} construction, if initialization
registered a destructor for it.

llvm-svn: 191182
2013-09-23 02:20:00 +00:00
Benjamin Kramer b8f33f1690 Make sort predicate match the qsort convention.
llvm-svn: 191177
2013-09-22 15:02:02 +00:00
Benjamin Kramer 04bf187e12 Fix array_pod_sort predicates after LLVM change.
llvm-svn: 191176
2013-09-22 14:10:29 +00:00
Benjamin Kramer 402f807d9d array_pod_sort loses some type safety, better use the right types.
llvm-svn: 191174
2013-09-22 12:53:24 +00:00