Commit Graph

3063 Commits

Author SHA1 Message Date
Vitaly Buka 17def21749 Revert "Give external linkage and mangling to lambdas inside inline variables and variable templates."
To fix: runtime error: load of value 15, which is not a valid value for type 'clang::LVComputationKind'

This reverts commit r313827.

llvm-svn: 313856
2017-09-21 02:51:56 +00:00
Richard Smith fb130c6084 Give external linkage and mangling to lambdas inside inline variables and variable templates.
This implements the proposed approach in https://github.com/itanium-cxx-abi/cxx-abi/issues/33

llvm-svn: 313827
2017-09-20 22:17:55 +00:00
Sjoerd Meijer cc623ad071 Recommit "Add _Float16 as a C/C++ source language type"
This is a recommit of r312781; in some build configurations
variable names are omitted, so changed the new regression
test accordingly.

llvm-svn: 312794
2017-09-08 15:15:00 +00:00
Ilya Biryukov cbea95dd95 Fixed a crash in code completion.
Summary: The crash occured when FunctionDecl was parsed with an initializer.

Reviewers: bkramer, klimek, francisco.lopes

Reviewed By: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D37382

llvm-svn: 312788
2017-09-08 13:36:38 +00:00
Sjoerd Meijer 9aeedde7ff Revert "Add _Float16 as a C/C++ source language type"
The clang-with-lto-ubuntu bot didn't like the new regression
test, revert while I investigate the issue.

llvm-svn: 312784
2017-09-08 10:20:52 +00:00
Sjoerd Meijer ab36f33db8 Add _Float16 as a C/C++ source language type
This adds _Float16 as a source language type, which is a 16-bit floating point
type defined in C11 extension ISO/IEC TS 18661-3.

In follow up patches documentation and more tests will be added.

Differential Revision: https://reviews.llvm.org/D33719

llvm-svn: 312781
2017-09-08 09:42:32 +00:00
Erik Verbruggen 51ee12a9fb Fix templated type alias completion when using global completion cache
When we have enabled cache for global completions we did not have
diagnostics for Bar and could not complete Ba as in provided code
example.

template <typename T>
struct Foo { T member; };

template<typename T> using Bar = Foo<T>;

int main() {
   Ba
}

(This is the fixed version of r 311442, which was reverted in r311445.)

Patch by Ivan Donchevskii!

Differential Revision: https://reviews.llvm.org/D35355

llvm-svn: 312780
2017-09-08 09:31:13 +00:00
Alexey Bataev 070f43aee7 [OPENMP] Fix for PR34445: Reduction initializer segfaults at runtime in
move constructor.

Previously user-defined reduction initializer was considered as an
assignment expression, not as initializer. Fixed this by treating the
initializer expression as an initializer.

llvm-svn: 312638
2017-09-06 14:49:58 +00:00
Benjamin Kramer 0b94bfc709 std::function -> llvm::function_ref. NFC.
llvm-svn: 312336
2017-09-01 16:51:51 +00:00
Richard Smith 6b8e3c02ca [c++2a] P0683R1: Permit default member initializers for bit-fields.
This would be trivial, except that our in-memory and serialized representations
for FieldDecls assumed that this can't happen.

llvm-svn: 311867
2017-08-28 00:28:14 +00:00
Faisal Vali f241b0dcd6 [NFC] Remove a cstyle cast and replace some uses of Decl with NamedDecl during the processing of TemplateParameterLists.
llvm-svn: 311788
2017-08-25 18:24:20 +00:00
Volodymyr Sapsai b0f1aae9b3 [Parser] Correct initalizer typos before lambda capture type is deduced.
This is the same assertion as in https://reviews.llvm.org/D25206 that is
triggered when RecordLayoutBuilder tries to compute the size of a field
(for capture "typo_boo" in the test case) whose type hasn't been
deduced.

The fix is to add CorrectDelayedTyposInExpr call to the cases when we
aren't disambiguating between an Obj-C message send and a lambda
expression.

rdar://problem/31760839

Reviewers: rsmith, ahatanak

Reviewed By: arphaman

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D36853

llvm-svn: 311480
2017-08-22 17:55:19 +00:00
Erik Verbruggen aa603c3bef Revert r311442 (Fix templated type alias completion when using global completion cache)
Failing Tests (2):
    Clang :: CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp
    Clang :: SemaCXX/alias-template.cpp

llvm-svn: 311445
2017-08-22 10:54:40 +00:00
Erik Verbruggen 1ca8bbb078 Fix templated type alias completion when using global completion cache
When we have enabled cache for global completions we did not have
diagnostics for Bar and could not complete Ba as in provided code
example.

template <typename T>
struct Foo { T member; };

template<typename T> using Bar = Foo<T>;

int main() {
    Ba
}

Patch by Ivan Donchevskii!

Differential Revision: https://reviews.llvm.org/D35355

llvm-svn: 311442
2017-08-22 10:25:48 +00:00
Ilya Biryukov f315000613 Fixed a crash on replaying Preamble's PP conditional stack.
Summary:
The crash occurs when the first token after a preamble is a macro
expansion.
Fixed by moving replayPreambleConditionalStack from Parser into
Preprocessor. It is now called right after the predefines file is
processed.

Reviewers: erikjv, bkramer, klimek, yvvan

Reviewed By: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D36872

llvm-svn: 311330
2017-08-21 12:03:08 +00:00
Alex Lorenz 0b1ce8b8e6 Allow pretty platform names in availability attributes
rdar://32076651

llvm-svn: 310921
2017-08-15 14:42:01 +00:00
Richard Smith b115e5dda2 Rename cxx1z -> cxx17 across all diagnostic IDs.
llvm-svn: 310805
2017-08-13 23:37:29 +00:00
Richard Smith 6c716116df PR34163: Don't cache an incorrect key function for a class if queried between
the class becoming complete and its inline methods being parsed.

This replaces the hack of using the "late parsed template" flag to track member
functions with bodies we've not parsed yet; instead we now use the "will have
body" flag, which carries the desired implication that the function declaration
*is* a definition, and that we've just not parsed its body yet.

llvm-svn: 310776
2017-08-12 01:46:03 +00:00
Momchil Velikov 57c681f33e Place implictly declared functions at block scope
Such implicitly declared functions behave as if the enclosing block
contained the declaration extern int name() (C90, 6.3.3.2 Function calls),
thus their names should have block scope (C90, 6.1.2.1 Scope of identifiers).

This patch fixes https://bugs.llvm.org/show_bug.cgi?id=33224

Differential Revision: https://reviews.llvm.org/D33676

llvm-svn: 310616
2017-08-10 15:43:06 +00:00
Rafael Espindola 2e8a7d36ff Update for llvm change.
llvm-svn: 309885
2017-08-02 20:32:35 +00:00
Alex Lorenz 45b4014711 Recommit r308327 3rd time: Add a warning for missing
'#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files

The second recommit (r309106) was reverted because the "non-default #pragma
pack value chages the alignment of struct or union members in the included file"
warning proved to be too aggressive for external projects like Chromium
(https://bugs.chromium.org/p/chromium/issues/detail?id=749197). This recommit
makes the problematic warning a non-default one, and gives it the
-Wpragma-pack-suspicious-include warning option.

The first recommit (r308441) caused a "non-default #pragma pack value might
change the alignment of struct or union members in the included file" warning
in LLVM itself. This recommit tweaks the added warning to avoid warnings for
#includes that don't have any records that are affected by the non-default
alignment. This tweak avoids the previously emitted warning in LLVM.

Original message:

This commit adds a new -Wpragma-pack warning. It warns in the following cases:

- When a translation unit is missing terminating #pragma pack (pop) directives.
- When entering an included file if the current alignment value as determined
  by '#pragma pack' directives is different from the default alignment value.
- When leaving an included file that changed the state of the current alignment
  value.

rdar://10184173

Differential Revision: https://reviews.llvm.org/D35484

llvm-svn: 309386
2017-07-28 14:41:21 +00:00
Hans Wennborg b4ece98a34 Revert r309106 "Recommit r308327 2nd time: Add a warning for missing"
The warning fires on non-suspicious code in Chromium. Reverting until a
solution is figured out.

> Recommit r308327 2nd time: Add a warning for missing
> '#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files
>
> The first recommit (r308441) caused a "non-default #pragma pack value might
> change the alignment of struct or union members in the included file" warning
> in LLVM itself. This recommit tweaks the added warning to avoid warnings for
> #includes that don't have any records that are affected by the non-default
> alignment. This tweak avoids the previously emitted warning in LLVM.
>
> Original message:
>
> This commit adds a new -Wpragma-pack warning. It warns in the following cases:
>
> - When a translation unit is missing terminating #pragma pack (pop) directives.
> - When entering an included file if the current alignment value as determined
>   by '#pragma pack' directives is different from the default alignment value.
> - When leaving an included file that changed the state of the current alignment
>   value.
>
> rdar://10184173
>
> Differential Revision: https://reviews.llvm.org/D35484

llvm-svn: 309186
2017-07-26 21:29:24 +00:00
Alex Lorenz 5d48424a30 Recommit r308327 2nd time: Add a warning for missing
'#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files

The first recommit (r308441) caused a "non-default #pragma pack value might
change the alignment of struct or union members in the included file" warning
in LLVM itself. This recommit tweaks the added warning to avoid warnings for
#includes that don't have any records that are affected by the non-default
alignment. This tweak avoids the previously emitted warning in LLVM.

Original message:

This commit adds a new -Wpragma-pack warning. It warns in the following cases:

- When a translation unit is missing terminating #pragma pack (pop) directives.
- When entering an included file if the current alignment value as determined
  by '#pragma pack' directives is different from the default alignment value.
- When leaving an included file that changed the state of the current alignment
  value.

rdar://10184173

Differential Revision: https://reviews.llvm.org/D35484

llvm-svn: 309106
2017-07-26 12:20:57 +00:00
Alexey Bataev fa312f33f8 [OPENMP] Initial support for 'in_reduction' clause.
Parsing/sema analysis for 'in_reduction' clause for task-based
directives.

llvm-svn: 308768
2017-07-21 18:48:21 +00:00
Hans Wennborg f365d423a0 Revert r308441 "Recommit r308327: Add a warning for missing '#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files"
This seems to have broken the sanitizer-x86_64-linux buildbot. Reverting until
it's fixed, especially since this landed just before the 5.0 branch.

> This commit adds a new -Wpragma-pack warning. It warns in the following cases:
>
> - When a translation unit is missing terminating #pragma pack (pop) directives.
> - When entering an included file if the current alignment value as determined
>   by '#pragma pack' directives is different from the default alignment value.
> - When leaving an included file that changed the state of the current alignment
>   value.
>
> rdar://10184173
>
> Differential Revision: https://reviews.llvm.org/D35484

llvm-svn: 308455
2017-07-19 12:31:01 +00:00
Alex Lorenz 287f684c18 Recommit r308327: Add a warning for missing '#pragma pack (pop)'
and suspicious uses of '#pragma pack' in included files

This commit adds a new -Wpragma-pack warning. It warns in the following cases:

- When a translation unit is missing terminating #pragma pack (pop) directives.
- When entering an included file if the current alignment value as determined
  by '#pragma pack' directives is different from the default alignment value.
- When leaving an included file that changed the state of the current alignment
  value.

rdar://10184173

Differential Revision: https://reviews.llvm.org/D35484

llvm-svn: 308441
2017-07-19 11:30:41 +00:00
Alexey Bataev 169d96a203 [OPENMP] Initial support for 'task_reduction' clause.
Parsing/sema analysis of the 'task_reduction' clause.

llvm-svn: 308352
2017-07-18 20:17:46 +00:00
Alex Lorenz aa61922157 Revert r308327
I forgot to test clang-tools-extra which is now failing.

llvm-svn: 308328
2017-07-18 17:36:42 +00:00
Alex Lorenz ad273341a4 Add a warning for missing '#pragma pack (pop)' and suspicious uses
of '#pragma pack' in included files

This commit adds a new -Wpragma-pack warning. It warns in the following cases:

- When a translation unit is missing terminating #pragma pack (pop) directives.
- When entering an included file if the current alignment value as determined
  by '#pragma pack' directives is different from the default alignment value.
- When leaving an included file that changed the state of the current alignment
  value.

rdar://10184173

Differential Revision: https://reviews.llvm.org/D35484

llvm-svn: 308327
2017-07-18 17:23:51 +00:00
Alex Lorenz 9b9188d861 [index] Objective-C method declarations and message sends with
an empty first selector piece should store the location of the first ':'

rdar://33188656

llvm-svn: 307901
2017-07-13 10:50:21 +00:00
Hiroshi Inoue a5141c8d17 fix typos in comments; NFC
llvm-svn: 307886
2017-07-13 06:51:20 +00:00
Erik Verbruggen 795eee96b3 Fix invalid warnings for header guards in preambles
Fixes https://bugs.llvm.org/show_bug.cgi?id=33574

Differential Revision: https://reviews.llvm.org/D34882

llvm-svn: 307134
2017-07-05 09:44:07 +00:00
Richard Smith e03a654581 [modules ts] Declarations from a module interface unit are only visible outside
the module if declared in an export block. 

llvm-svn: 307115
2017-07-05 01:42:07 +00:00
Alex Lorenz 6c9af50cc8 Add a fixit for -Wobjc-protocol-property-synthesis
rdar://32132756

Differential Revision: https://reviews.llvm.org/D34886

llvm-svn: 307014
2017-07-03 10:12:24 +00:00
Hiroshi Inoue 533777f257 fix trivial typos in comments; NFC
llvm-svn: 306969
2017-07-02 06:12:49 +00:00
Bruno Cardoso Lopes df0ee34bc2 [Modules] Implement ODR-like semantics for tag types in C/ObjC
Allow ODR for ObjC/C in the sense that we won't keep more that
one definition around (merge them). However, ensure the decl
pass the structural compatibility check in C11 6.2.7/1, for that,
reuse the structural equivalence checks used by the ASTImporter.

Few other considerations:
- Create error diagnostics for tag types mismatches and thread
them into the structural equivalence checks.
- Note that by doing this we only support redefinition between types
that are considered "compatible types" by C.

This is mixed approach of the suggestions discussed in
http://lists.llvm.org/pipermail/cfe-dev/2017-March/053257.html

Differential Revision: https://reviews.llvm.org/D31778

rdar://problem/31909368

llvm-svn: 306918
2017-07-01 00:06:47 +00:00
George Burgess IV 779af828cd [Parse] Use normalized attr name for late-parsing checks.
llvm-svn: 306899
2017-06-30 22:33:24 +00:00
Hiroshi Inoue 939d932fbe fix trivial typos, NFC
llvm-svn: 306789
2017-06-30 05:40:31 +00:00
Akira Hatanaka 12ddceecde [Sema] Fix a crash-on-invalid when a template parameter list has a class
definition or non-reference class type.

The crash occurs when there is a template parameter list in a class that
is missing the closing angle bracket followed by a definition of a
struct. For example:

class C0 {
public:
  template<typename T, typename T1 = T // missing closing angle bracket
  struct S0 {};

  C0() : m(new S0<int>) {}
  S0<int> *m;
};

This happens because the parsed struct is added to the scope of the
enclosing class without having its access specifier set, which results
in an assertion failure in SemaAccess.cpp later.

This commit fixes the crash by adding the parsed struct to the enclosing
file scope and marking structs as invalid if they are defined in
template parameter lists.

rdar://problem/31783961
rdar://problem/19570630

Differential Revision: https://reviews.llvm.org/D33606

llvm-svn: 306317
2017-06-26 18:46:12 +00:00
Alex Lorenz 812012f3c9 [Parser][ObjC] Use an artificial EOF token while parsing lexed ObjC methods
This change avoid a crash that occurred when skipping to EOF while parsing an
ObjC interface/implementation.

rdar://31963299

Differential Revision: https://reviews.llvm.org/D34185

llvm-svn: 305719
2017-06-19 17:53:21 +00:00
Richard Smith b301806c4b PR33318: Add missing full-expression checking to static_assert expression.
This fixes missing lambda-captures for variables referenced only inside a
static_assert (!), among other things.

llvm-svn: 304760
2017-06-06 01:34:24 +00:00
Javed Absar 2a67c9ee39 Add support for #pragma clang section
This patch provides a means to specify section-names for global variables, 
functions and static variables, using #pragma directives. 
This feature is only defined to work sensibly for ELF targets.
One can specify section names as:
#pragma clang section bss="myBSS" data="myData" rodata="myRodata" text="myText"
One can "unspecify" a section name with empty string e.g.
#pragma clang section bss="" data="" text="" rodata=""

Reviewers: Roger Ferrer, Jonathan Roelofs, Reid Kleckner
Differential Revision: https://reviews.llvm.org/D33412

llvm-svn: 304705
2017-06-05 10:11:57 +00:00
Galina Kistanova 27daec6870 Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304646
2017-06-03 06:29:16 +00:00
Galina Kistanova 53ab424c0b Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304481
2017-06-01 21:29:45 +00:00
Galina Kistanova 387ab8b6da Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304479
2017-06-01 21:28:26 +00:00
Galina Kistanova 474f2ceff1 Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304478
2017-06-01 21:26:38 +00:00
Galina Kistanova 1aead4f56e Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304477
2017-06-01 21:23:52 +00:00
Galina Kistanova 6ef911c417 Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304475
2017-06-01 21:21:49 +00:00
Galina Kistanova d819d5bd68 Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304473
2017-06-01 21:19:06 +00:00
Galina Kistanova 7767425168 Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304472
2017-06-01 21:15:34 +00:00