Commit Graph

2048 Commits

Author SHA1 Message Date
Vassil Vassilev 916d8be252 Allocate after the early exit checks. NFC.
llvm-svn: 283448
2016-10-06 13:18:06 +00:00
Vassil Vassilev d1a88130c4 [modules] Allow VarDecls with initializers to use special var abbrev.
Update storage sizes to fit the (past) changes in the VarDecl's data model.
Update some comments.

Patch partially reviewed by Richard Smith as part of https://reviews.llvm.org/D24508

llvm-svn: 283444
2016-10-06 13:04:54 +00:00
Mehdi Amini 99d1b29503 Use StringRef for MemoryBuffer identifier API (NFC)
llvm-svn: 283043
2016-10-01 16:38:28 +00:00
Richard Smith 96269c59ea P0035R4: add std::align_val_t overloads of operator new/delete in C++17 mode.
llvm-svn: 282800
2016-09-29 22:49:46 +00:00
Aleksei Sidorin a693b37e14 [ASTImporter] Implement some expression-related AST node import (part 2)
* Some code cleanup
* Add tests not present in http://reviews.llvm.org/D14286
* Integrate a test suite from Serge Pavlov (http://reviews.llvm.org/D14224)
* ArrayTypeTraitExpr: serialize sub-expression to avoid keeping it undefined
* Implement import of some nodes:
  - ArrayTypeTraitExpr
  - ExpressionTraitExpr
  - OpaqueValueExpr
  - ArraySubscriptExpr
  - ExplicitCastExpr
  - ImplicitValueInitExpr
  - OffsetOfExpr
  - CXXThisExpr
  - CXXThrowExpr
  - CXXNoexceptExpr
  - CXXDefaultArgExpr
  - CXXScalarValueInitExpr
  - CXXBindTemporaryExpr
  - CXXTemporaryObjectExpr
  - MaterializeTemporaryExpr
  - ExprWithCleanups

  - StaticAssertDecl
  - FriendDecl

  - DecayedType

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

llvm-svn: 282572
2016-09-28 10:16:56 +00:00
Alexander Shaposhnikov fbc4d68e71 Remove excessive padding from RedeclarableResult
This diff reorders the fields of the class RedeclarableResult 
to remove excessive padding.

Test plan: make -j8 check-clang

Differential revision: https://reviews.llvm.org/D24754

llvm-svn: 282322
2016-09-24 04:21:53 +00:00
Alexander Shaposhnikov 96cbe7b9a7 Remove excessive padding from ObjCCategoriesVisitor
This diff reorders the fields of ObjCCategoriesVisitor 
to remove excessive padding. 

Test plan: make -j8 check-clang

Differential revision: https://reviews.llvm.org/D24753

llvm-svn: 282318
2016-09-24 02:07:19 +00:00
Eric Liu 762b4887c2 Revert "[modules] When merging one definition into another, propagate the list of re-exporting modules from the discarded definition to the retained definition."
This reverts commit r281429.

llvm-svn: 281452
2016-09-14 10:05:10 +00:00
Richard Smith 1c16d1b576 [modules] When merging one definition into another, propagate the list of
re-exporting modules from the discarded definition to the retained definition.

llvm-svn: 281429
2016-09-14 01:05:35 +00:00
Manman Ren e6be26c8d4 ObjectiveC generics: Add ObjCTypeParamType in the type system.
We also need to add ObjCTypeParamTypeLoc. ObjCTypeParamType supports the
representation of "T <protocol>" where T is a type parameter. Before this,
we use TypedefType to represent the type parameter for ObjC.

ObjCTypeParamType has "ObjCTypeParamDecl *OTPDecl" and it extends from
ObjCProtocolQualifiers. It is a non-canonical type and is canonicalized
to the underlying type with the protocol qualifiers.

rdar://24619481
rdar://25060179

Differential Revision: http://reviews.llvm.org/D23079

llvm-svn: 281355
2016-09-13 17:25:08 +00:00
Richard Trieu ffa532d7a1 Fix interaction between serialization and c++1z feature.
In c++1z, static_assert is not required to have a StringLiteral message, where
previously it was required.  Update the AST Reader to be able to handle a
null StringLiteral.

llvm-svn: 281286
2016-09-13 01:20:40 +00:00
Richard Smith 6561f92b62 [modules] When we merge two definitions of a function, mark the retained
definition as visible in the discarded definition's module, as we do for
other kinds of definition.

llvm-svn: 281258
2016-09-12 21:06:40 +00:00
Manman Ren ec315f1002 Modules: for ObjectiveC try to keep the definition invariant.
When deserializing ObjCInterfaceDecl with definition data, if we already have
a definition, try to keep the definition invariant; also pull in the
categories even if it is not what getDefinition returns (this effectively
combines categories).

rdar://27926200
rdar://26708823

llvm-svn: 281119
2016-09-09 23:48:27 +00:00
Richard Smith 8df390f9eb C++ Modules TS: Add parsing and some semantic analysis support for
export-declarations. These don't yet have an effect on name visibility;
we still export everything by default.

llvm-svn: 280999
2016-09-08 23:14:54 +00:00
Eugene Zelenko e95e7d5d64 Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes.
Differential revision: https://reviews.llvm.org/D24115

llvm-svn: 280870
2016-09-07 21:53:17 +00:00
Yaxun Liu 43712e05ea Do not validate pch when -fno-validate-pch is set
There is a bug causing pch to be validated even though -fno-validate-pch is set. This patch fixes it.

ASTReader relies on ASTReaderListener to initialize SuggestedPredefines, which is required for compilations using PCH. Before this change, PCHValidator is the default ASTReaderListener. After this change, when -fno-validate-pch is set, PCHValidator is disabled, but we need a replacement ASTReaderListener to initialize SuggestedPredefines. Class SimpleASTReaderListener is implemented for this purpose.

This change only affects -fno-validate-pch. There is no functional change if -fno-validate-pch is not set.

If -fno-validate-pch is not set, conflicts in predefined macros between pch and current compiler instance causes error.

If -fno-validate-pch is set, predefine macros in current compiler override those in pch so that compilation can continue.

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

llvm-svn: 280842
2016-09-07 18:40:20 +00:00
Richard Smith 3bd6d7fb78 Clean up handling of reading module files from stdin. Don't bother trying to
look for a corresponding file, since we're not going to read it anyway.

No observable behavior change (though we now avoid pointlessly trying to stat
or open a file named "-").

llvm-svn: 280436
2016-09-02 00:18:05 +00:00
Richard Smith 3b99db5566 Refactor to avoid holding a reference to a container element that could go away
during this function, and to avoid rolling back changes to the module manager's
data structures. Instead, we defer registering the module file until after we
have successfully finished loading it.

llvm-svn: 280434
2016-09-02 00:10:28 +00:00
Richard Smith 3fb1a8554d PR29166: when merging declarations with typedef names for linkage purposes,
don't assume that the anonymous struct will be part of the most recent
declaration of the typedef.

llvm-svn: 280136
2016-08-30 19:13:18 +00:00
Adrian Prantl b3b5a7362c Fix a bug preventing the cause for a module file-not-found from being displayed
llvm-svn: 280010
2016-08-29 20:46:59 +00:00
Adrian Prantl 9a06a882bc Fix a bug preventing the cause of a module-out-of-date error from being printed
llvm-svn: 280009
2016-08-29 20:46:56 +00:00
Richard Smith bbcc9f0462 C++ Modules TS: add frontend support for building pcm files from module
interface files. At the moment, all declarations (and no macros) are exported,
and 'export' declarations are not supported yet.

llvm-svn: 279794
2016-08-26 00:14:38 +00:00
Richard Smith bd97f35339 Refactor to remove the assumption that we know the name of the module we're emitting at the point when we create a PCHGenerator (with the C++ modules TS, we find that out part way through parsing the input).
llvm-svn: 279766
2016-08-25 18:26:30 +00:00
Richard Smith 0bae624934 Lazily load the ContextDecl for a lambda's DefinitionData, to fix a
deserialization cycle caused by the ContextDecl recursively importing members
of the lambda's closure type.

llvm-svn: 279694
2016-08-25 00:34:00 +00:00
Richard Smith 4b054b2665 PR29097: add an update record when we instantiate the default member
initializer of an imported field.

llvm-svn: 279667
2016-08-24 21:25:37 +00:00
Tim Shen f2187ed321 [GraphTraits] Replace all NodeType usage with NodeRef
This should finish the GraphTraits migration.

Differential Revision: http://reviews.llvm.org/D23730

llvm-svn: 279475
2016-08-22 21:09:30 +00:00
Manman Ren 11f2a47772 Module: add -fprebuilt-module-path to support loading prebuilt modules.
In this mode, there is no need to load any module map and the programmer can
simply use "@import" syntax to load the module directly from a prebuilt
module path. When loading from prebuilt module path, we don't support
rebuilding of the module files and we ignore compatible configuration
mismatches.

rdar://27290316
Differential Revision: http://reviews.llvm.org/D23125

llvm-svn: 279096
2016-08-18 17:42:15 +00:00
Diana Picus 8b44bbc077 Revert "[OpenMP] Sema and parsing for 'teams distribute simd’ pragma"
This reverts commit r279003 as it breaks some of our buildbots (e.g.
clang-cmake-aarch64-quick, clang-x86_64-linux-selfhost-modules).

The error is in OpenMP/teams_distribute_simd_ast_print.cpp:
clang: /home/buildslave/buildslave/clang-cmake-aarch64-quick/llvm/include/llvm/ADT/DenseMap.h:527:
bool llvm::DenseMapBase<DerivedT, KeyT, ValueT, KeyInfoT, BucketT>::LookupBucketFor(const LookupKeyT&, const BucketT*&) const
[with LookupKeyT = clang::Stmt*; DerivedT = llvm::DenseMap<clang::Stmt*, long unsigned int>;
      KeyT = clang::Stmt*; ValueT = long unsigned int;
      KeyInfoT = llvm::DenseMapInfo<clang::Stmt*>;
      BucketT = llvm::detail::DenseMapPair<clang::Stmt*, long unsigned int>]:
Assertion `!KeyInfoT::isEqual(Val, EmptyKey) && !KeyInfoT::isEqual(Val, TombstoneKey) &&
"Empty/Tombstone value shouldn't be inserted into map!"' failed.

llvm-svn: 279045
2016-08-18 09:25:07 +00:00
Kelvin Li 0e3bde8216 [OpenMP] Sema and parsing for 'teams distribute simd’ pragma
This patch is to implement sema and parsing for 'teams distribute simd’ pragma.

This patch is originated by Carlo Bertolli.

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

llvm-svn: 279003
2016-08-17 23:13:03 +00:00
Tim Shen 2931d17142 [GraphWriter] Change GraphWriter to use NodeRef in GraphTraits
Summary: Corresponding LLVM patch: D23580

Reviewers: dblaikie

Subscribers: cfe-commits

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

llvm-svn: 278963
2016-08-17 20:02:38 +00:00
Richard Smith 7b76d81bdf P0217R3: serialization/deserialization support for c++17 decomposition declarations.
llvm-svn: 278460
2016-08-12 02:21:25 +00:00
Benjamin Kramer b6aadc1ca5 [ASTReader] Use real move semantics instead of emulating them in the copy ctor.
No functionality change intended.

llvm-svn: 277923
2016-08-06 12:45:16 +00:00
Benjamin Kramer a0a13c3649 Move helpers into anonymous namespaces. NFC.
llvm-svn: 277918
2016-08-06 11:21:04 +00:00
Kelvin Li 0253287633 [OpenMP] Sema and parsing for 'teams distribute' pragma
This patch is to implement sema and parsing for 'teams distribute' pragma.

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

llvm-svn: 277818
2016-08-05 14:37:37 +00:00
Hubert Tong e4a0c0ec78 Reapply r276069 with workaround for MSVC 2013
llvm-svn: 277286
2016-07-30 22:33:34 +00:00
Samuel Antao 6890b09634 [OpenMP] Code generation for the is_device_ptr clause
Summary: This patch adds support for the is_device_ptr clause. It expands SEMA to use the mappable expression logic that can only be tested with code generation in place and check conflicts with other data sharing related clauses using the mappable expressions infrastructure.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev

Subscribers: caomhin, cfe-commits

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

llvm-svn: 276978
2016-07-28 14:25:09 +00:00
Samuel Antao cc10b85789 [OpenMP] Codegen for use_device_ptr clause.
Summary: This patch adds support for the use_device_ptr clause. It includes changes in SEMA that could not be tested without codegen, namely, the use of the first private logic and mappable expressions support.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev

Subscribers: caomhin, cfe-commits

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

llvm-svn: 276977
2016-07-28 14:23:26 +00:00
Manman Ren 47a4445687 Modules: add command line option fmodules-disable-diagnostic-validation
With PCH+Module, sometimes compiler gives a hard error:
Module file ‘<some-file path>.pcm' is out of date and needs to be rebuilt

This happens when we have a pch importing a module and the module gets
overwritten by another compiler instance after we build the pch (one example is
that both compiler instances hash to the same pcm file but use different
diagnostic options). When we try to load the pch later on, the compiler notices
that the imported module is out of date (modification date, size do not match)
but it can't handle this out of date pcm (i.e it does not know how to rebuild
the pch).

This commit introduces a new command line option so for PCH + module, we can
turn on this option and if two compiler instances only differ in diagnostic
options, the latter instance will not invalidate the original pcm.

rdar://26675801
Differential Revision: http://reviews.llvm.org/D22773

llvm-svn: 276769
2016-07-26 17:12:17 +00:00
Richard Smith bdb84f374c P0217R3: Parsing support and framework for AST representation of C++1z
decomposition declarations.

There are a couple of things in the wording that seem strange here:
decomposition declarations are permitted at namespace scope (which we partially
support here) and they are permitted as the declaration in a template (which we
reject).

llvm-svn: 276492
2016-07-22 23:36:59 +00:00
Vassil Vassilev 19765fb68c [modules] Teach the ASTWriter to ignore mutations coming from the ASTReader.
Processing update records (and loading a module, in general) might trigger
unexpected calls to the ASTWriter (being a mutation listener). Now we have a
mechanism to suppress those calls to the ASTWriter but notify other possible
mutation listeners.

Fixes https://llvm.org/bugs/show_bug.cgi?id=28332

Patch by Cristina Cristescu and me.

Reviewed by Richard Smith (D21800).

llvm-svn: 276473
2016-07-22 21:08:24 +00:00
Kelvin Li 986330c190 [OpenMP] Sema and parsing for 'target simd' pragma
This patch is to implement sema and parsing for 'target simd' pragma.

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

llvm-svn: 276203
2016-07-20 22:57:10 +00:00
Richard Smith dc1f042171 [modules] Don't emit initializers for VarDecls within a module eagerly whenever
we first touch any part of that module. Instead, defer them until the first
time that module is (transitively) imported. The initializer step for a module
then recursively initializes modules that its own headers imported.

For example, this avoids running the <iostream> global initializer in programs
that don't actually use iostreams, but do use other parts of the standard
library.

llvm-svn: 276159
2016-07-20 19:10:16 +00:00
Hubert Tong 286547a337 Revert r276069: MSVC bots not happy
llvm-svn: 276074
2016-07-20 01:05:31 +00:00
Hubert Tong 24ee98e4a5 Concepts: Create space for requires-clause in TemplateParameterList; NFC
Summary:
Space for storing the //constraint-expression// of the
//requires-clause// associated with a `TemplateParameterList` is
arranged by taking a bit out of the `NumParams` field for the purpose
of determining whether there is a //requires-clause// or not, and by
adding to the trailing objects tied to the `TemplateParameterList`. An
accessor is provided.

An appropriate argument is supplied to `TemplateParameterList::Create`
at the various call sites.

Serialization changes will addressed as the Concepts implementation
becomes more solid.

Drive-by fix:
This change also replaces the custom
`FixedSizeTemplateParameterListStorage` implementation with one that
follows the interface provided by `llvm::TrailingObjects`.

Reviewers: aaron.ballman, faisalv, rsmith

Subscribers: cfe-commits, nwilson

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

llvm-svn: 276069
2016-07-20 00:30:15 +00:00
Mehdi Amini 9670f847b8 [NFC] Header cleanup
Summary: Removed unused headers, replaced some headers with forward class declarations

Patch by: Eugene <claprix@yandex.ru>

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

llvm-svn: 275882
2016-07-18 19:02:11 +00:00
Erik Pilkington 29099ded0c [ObjC] Implement @available in the Parser and AST
This patch adds a new AST node: ObjCAvailabilityCheckExpr, and teaches the
Parser and Sema to generate it. This node represents an availability check of
the form:

  @available(macos 10.10, *);

Which will eventually compile to a runtime check of the host's OS version. This
is the first patch of the feature I proposed here:
http://lists.llvm.org/pipermail/cfe-dev/2016-July/049851.html

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

llvm-svn: 275654
2016-07-16 00:35:23 +00:00
Richard Smith 13fb860c78 Revert r275481, r275490. This broke modules bootstrap.
llvm-svn: 275624
2016-07-15 21:33:46 +00:00
Argyrios Kyrtzidis d798c05526 [AST] Keep track of the left brace source location of a tag decl.
This is useful for source modification tools. There will be a follow-up commit using it.

llvm-svn: 275590
2016-07-15 18:11:33 +00:00
Richard Smith 6c35b2dea4 [modules] Don't pass interesting decls to the consumer for a module file that's
passed on the command line but never actually used. We consider a (top-level)
module to be used if any part of it is imported, either by the current
translation unit, or by any part of a top-level module that is itself used.

(Put another way, a module is used if an implicit modules build would have
loaded its .pcm file.)

llvm-svn: 275481
2016-07-14 21:50:09 +00:00
Kelvin Li a579b9196c [OpenMP] Sema and parsing for 'target parallel for simd' pragma
This patch is to implement sema and parsing for 'target parallel for simd' pragma.

Differential Revision: http://reviews.llvm.org/D22096

llvm-svn: 275365
2016-07-14 02:54:56 +00:00