aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Serialization/ASTWriterDecl.cpp
AgeCommit message (Collapse)AuthorFilesLines
2017-07-06[modules ts] Do not emit strong function definitions from the module ↵Richard Smith1-2/+12
interface unit in every user. llvm-svn: 307232
2017-06-09[DebugInfo] Add kind of ImplicitParamDecl for emission of FlagObjectPointer.Alexey Bataev1-0/+5
Summary: If the first parameter of the function is the ImplicitParamDecl, codegen automatically marks it as an implicit argument with `this` or `self` pointer. Added internal kind of the ImplicitParamDecl to separate 'this', 'self', 'vtt' and other implicit parameters from other kind of parameters. Reviewers: rjmccall, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33735 llvm-svn: 305075
2017-05-18[modules] Switch from inferring owning modules based on source location toRichard Smith1-1/+1
inferring based on the current module at the point of creation. This should result in no functional change except when building a preprocessed module (or more generally when using #pragma clang module begin/end to switch module in the middle of a file), in which case it allows us to correctly track the owning module for declarations. We can't map from FileID to module in the preprocessed module case, since all modules would have the same FileID. There are still a couple of remaining places that try to infer a module from a source location; I'll clean those up in follow-up changes. llvm-svn: 303322
2017-04-12Modular Codegen: Separate flags for function and debug info supportDavid Blaikie1-3/+3
This allows using and testing these two features separately. (noteably, debug info is, so far as I know, always a win (basically). But function modular codegen is currently a loss for highly optimized code - where most of the linkonce_odr definitions are optimized away, so providing weak_odr definitions is only overhead) llvm-svn: 300104
2017-04-11Modular Codegen: Add/use a bit in serialized function definitions to track ↵David Blaikie1-6/+8
whether they are the subject of modular codegen Some decls are created not where they are written, but in other module files/users (implicit special members and function template implicit specializations). To correctly identify them, use a bit next to the definition to track the modular codegen property. Discussed whether the module file bit could be omitted in favor of reconstituting from the modular codegen decls list - best guess today is that the efficiency improvement of not having to deserialize the whole list whenever any function is queried by a module user is worth it for the small size increase of this redundant (list + bit-on-def) representation. Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D29901 llvm-svn: 299982
2017-03-16[index/AST] Add references for ObjC getter=/setter= property attributes and ↵Argyrios Kyrtzidis1-0/+2
related property getter/setter role fixes This enhances the AST to keep track of locations of the names in those ObjC property attributes, and reports them for indexing. Patch by Nathan Hawes! https://reviews.llvm.org/D30907 llvm-svn: 297972
2017-03-07[AST/ObjC] Make ObjCCategoryImplDecl consistent with ObjCCategoryDecl and ↵Argyrios Kyrtzidis1-1/+0
use the category name as its DeclName This also addresses the badness in ObjCCategoryImplDecl's API, which was hiding NamedDecl's APIs with different meaning. llvm-svn: 297131
2017-02-17Add an explicit derived class of FunctionDecl to model deduction guides ratherRichard Smith1-0/+6
than just treating them as FunctionDecls with a funny name. No functionality change intended. llvm-svn: 295491
2017-02-10Sink IsExplicitSpecified flag from CXXConstructorDecl and CXXConversionDeclRichard Smith1-3/+2
into FunctionDecl. Makes CXXConversionDecl 8 bytes smaller. No functionality change intended. llvm-svn: 294684
2017-01-30Prototype of modules codegenDavid Blaikie1-3/+6
First pass at generating weak definitions of inline functions from module files (& skipping (-O0) or emitting available_externally (optimizations) definitions where those modules are used). External functions defined in modules are emitted into the modular object file as well (this may turn an existing ODR violation (if that module were imported into multiple translations) into valid/linkable code). Internal symbols (static functions, for example) are not correctly supported yet. The symbol will be produced, internal, in the modular object - unreferenceable from the users. Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D28845 llvm-svn: 293456
2017-01-26[modules] When reading / writing a typedef that is a name for linkage forRichard Smith1-0/+1
another declaration, ensure we actually serialize / deserialize that declaration. Before this patch, if another copy of the typedef were merged with the parsed version, we would emit type information referring to the merged version and consequently emit nothing about the parsed anonymous struct. This resulted in us losing information, particularly the visible merged module set for the parsed definition. Force that information to be emitted and to be loaded when the typedef is used. llvm-svn: 293219
2017-01-10Serialize the UsesSEH bit on FunctionDeclReid Kleckner1-0/+2
Fixes PR31539 llvm-svn: 291600
2017-01-04Fix for LLVM Bitcode API change (to use std::shared_ptr)David Blaikie1-29/+29
llvm-svn: 291018
2016-12-20[c++1z] P0195R2: Support pack-expansion of using-declarations.Richard Smith1-0/+12
This change introduces UsingPackDecl as a marker for the set of UsingDecls produced by pack expansion of a single (unresolved) using declaration. This is not strictly necessary (we just need to be able to map from the original using declaration to its expansions somehow), but it's useful to maintain the invariant that each declaration reference instantiates to refer to one declaration. This is a re-commit of r290080 (reverted in r290092) with a fix for a use-after-lifetime bug. llvm-svn: 290203
2016-12-19Revert "[c++1z] P0195R2: Support pack-expansion of using-declarations."Daniel Jasper1-12/+0
This reverts commit r290080 as it leads to many Clang crashes, e.g.: http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/1814 llvm-svn: 290092
2016-12-19[c++1z] P0195R2: Support pack-expansion of using-declarations.Richard Smith1-0/+12
This change introduces UsingPackDecl as a marker for the set of UsingDecls produced by pack expansion of a single (unresolved) using declaration. This is not strictly necessary (we just need to be able to map from the original using declaration to its expansions somehow), but it's useful to maintain the invariant that each declaration reference instantiates to refer to one declaration. llvm-svn: 290080
2016-10-14Reinstate r284008 reverted in r284081, with two fixes:Richard Smith1-0/+4
1) Merge and demote variable definitions when we find a redefinition in MergeVarDecls, not only when we find one in AddInitializerToDecl (we only reach the second case if it's the addition of the initializer itself that converts an existing declaration into a definition). 2) When rebuilding a redeclaration chain for a variable, if we merge two definitions together, mark the definitions as merged so the retained definition is made visible whenever the demoted definition would have been. Original commit message (from r283882): [modules] PR28752: Do not instantiate variable declarations which are not visible. Original patch by Vassil Vassilev! Changes listed above are mine. llvm-svn: 284284
2016-10-12Revert r284008. This is us to fail to instantiate static data members in someRichard Smith1-4/+0
cases. I'm working on reducing a testcase. llvm-svn: 284081
2016-10-12Reinstate r283887 and r283882.Vassil Vassilev1-0/+4
Original message: "[modules] PR28752: Do not instantiate variable declarations which are not visible. https://reviews.llvm.org/D24508 Patch developed in collaboration with Richard Smith!" llvm-svn: 284008
2016-10-11Revert r283887 and r283882, until the issue is understood and fixed.Vassil Vassilev1-4/+0
llvm-svn: 283890
2016-10-11[modules] PR28752: Do not instantiate variable declarations which are not ↵Vassil Vassilev1-0/+4
visible. https://reviews.llvm.org/D24508 Patch developed in collaboration with Richard Smith! llvm-svn: 283882
2016-10-06[modules] Allow VarDecls with initializers to use special var abbrev.Vassil Vassilev1-10/+8
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-09-08C++ Modules TS: Add parsing and some semantic analysis support forRichard Smith1-0/+7
export-declarations. These don't yet have an effect on name visibility; we still export everything by default. llvm-svn: 280999
2016-08-12P0217R3: serialization/deserialization support for c++17 decomposition ↵Richard Smith1-2/+19
declarations. llvm-svn: 278460
2016-07-20[modules] Don't emit initializers for VarDecls within a module eagerly wheneverRichard Smith1-5/+5
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-18[NFC] Header cleanupMehdi Amini1-2/+1
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-15Revert r275481, r275490. This broke modules bootstrap.Richard Smith1-1/+1
llvm-svn: 275624
2016-07-15[AST] Keep track of the left brace source location of a tag decl.Argyrios Kyrtzidis1-1/+3
This is useful for source modification tools. There will be a follow-up commit using it. llvm-svn: 275590
2016-07-14[modules] Don't pass interesting decls to the consumer for a module file that'sRichard Smith1-1/+1
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-06-28P0136R1, DR1573, DR1645, DR1715, DR1736, DR1903, DR1941, DR1959, DR1991:Richard Smith1-2/+21
Replace inheriting constructors implementation with new approach, voted into C++ last year as a DR against C++11. Instead of synthesizing a set of derived class constructors for each inherited base class constructor, we make the constructors of the base class visible to constructor lookup in the derived class, using the normal rules for using-declarations. For constructors, UsingShadowDecl now has a ConstructorUsingShadowDecl derived class that tracks the requisite additional information. We create shadow constructors (not found by name lookup) in the derived class to model the actual initialization, and have a new expression node, CXXInheritedCtorInitExpr, to model the initialization of a base class from such a constructor. (This initialization is special because it performs real perfect forwarding of arguments.) In cases where argument forwarding is not possible (for inalloca calls, variadic calls, and calls with callee parameter cleanup), the shadow inheriting constructor is not emitted and instead we directly emit the initialization code into the caller of the inherited constructor. Note that this new model is not perfectly compatible with the old model in some corner cases. In particular: * if B inherits a private constructor from A, and C uses that constructor to construct a B, then we previously required that A befriends B and B befriends C, but the new rules require A to befriend C directly, and * if a derived class has its own constructors (and so its implicit default constructor is suppressed), it may still inherit a default constructor from a base class llvm-svn: 274049
2016-06-25Implement C++17 P0386R2, inline variables. (The 'inline' specifier gives aRichard Smith1-0/+5
variable weak discardable linkage and partially-ordered initialization, and is implied for constexpr static data members.) llvm-svn: 273754
2016-06-24Use even more ArrayRefsDavid Majnemer1-3/+2
No functional change is intended, just a small refactoring. llvm-svn: 273650
2016-06-24Use more ArrayRefsDavid Majnemer1-2/+2
No functional change is intended, just a small refactoring. llvm-svn: 273647
2016-04-28Reland r267691 fixing PR27535.Vassil Vassilev1-10/+0
llvm-svn: 267882
2016-04-27Revert r267691, it caused PR27535.Nico Weber1-0/+10
llvm-svn: 267744
2016-04-27[modules] Fix Decl's Used invariant.Vassil Vassilev1-10/+0
The Decl::isUsed has a value for every decl. In non-module builds it is very difficult (but possible) to break this invariant but when we walk up the redecl chain we find the neccessary information. When deserializing the decls from a module it is much more difficult to update correctly this invariant. The patch centralizes the information whether a decl is used in the canonical decl marking the entire entity as being used. Fixes https://llvm.org/bugs/show_bug.cgi?id=27401 Patch by Cristina Cristescu and me. Thanks to Richard Smith who helped to debug and understand the issue! Reviewed by Richard Smith. llvm-svn: 267691
2016-04-14[modules] Remove CXX_BASE_SPECIFIERS_OFFSETS table. Instead of storing an ID ofRichard Smith1-8/+1
a table entry in the corresponding decl, store an offset from the current record to the relevant CXX_BASE_SPECIFIERS record. This results in fewer indirections and a minor .pcm file size reduction. llvm-svn: 266266
2016-04-13[modules] Remove CXX_CTOR_INITIALIZERS_OFFSETS table. Instead of storing an IDRichard Smith1-2/+2
of a table entry in the corresponding decl, store an offset from the current record to the relevant CXX_CTOR_INITIALIZERS record. This results in fewer indirections and a minor .pcm file size reduction. llvm-svn: 266254
2016-04-13ASTWriterDecl.cpp: Prune a couple of \param(s), corresponding to r266160. ↵NAKAMURA Takumi1-10/+0
[-Wdocumentation] llvm-svn: 266177
2016-04-13[modules] Refactor handling of cases where we write an offset to a prior ↵Richard Smith1-29/+12
record into the bitstream and simplify a little, in preparation for doing this in more cases. llvm-svn: 266160
2016-04-06Minor simplifications.Richard Smith1-1/+1
llvm-svn: 265594
2016-04-06Re-commit r265518 ("[modules] Continue factoring encoding of AST records out ofRichard Smith1-36/+28
ASTWriter."), reverted in r265526, with a fix for an iterator invalidation bug (thanks, MSan!). llvm-svn: 265564
2016-04-06[OPENMP] Parsing and Sema support for 'omp declare target' directiveDmitry Polukhin1-2/+4
Add parsing, sema analysis for 'declare target' construct for OpenMP 4.0 (4.5 support will be added in separate patch). The declare target directive specifies that variables, functions (C, C++ and Fortran), and subroutines (Fortran) are mapped to a device. The declare target directive is a declarative directive. In Clang declare target is implemented as implicit attribute for the declaration. The syntax of the declare target directive is as follows: #pragma omp declare target declarations-definition-seq #pragma omp end declare target Based on patch from Michael Wong http://reviews.llvm.org/D15321 llvm-svn: 265530
2016-04-06Revert "[modules] Continue factoring encoding of AST records out of ASTWriter."Dmitry Polukhin1-28/+36
This reverts commit r265518. llvm-svn: 265526
2016-04-06[modules] Continue factoring encoding of AST records out of ASTWriter.Richard Smith1-36/+28
llvm-svn: 265518
2016-04-01[modules] Start moving the code for encoding AST records out of ASTWriter intoRichard Smith1-240/+237
a separate class. The goal is for this class to have a separate lifetime from the AST writer so that it can meaningfully track pending statement nodes and context for more compact encoding of various types. llvm-svn: 265195
2016-03-27Remove unused support for replacing declarations from chained AST files.Richard Smith1-28/+14
llvm-svn: 264533
2016-03-25[modules] Store a local offset to DeclContext lexical and visible contents. ↵Richard Smith1-3/+9
Saves a few bytes for each primary DeclContext. llvm-svn: 264377
2016-03-24[modules] Store offset to LOCAL_REDECLARATIONS record relative to the currentRichard Smith1-1/+2
record rather than relative to the start of the bitcode file. Saves a couple of bytes per LOCAL_REDECLARATIONS record (also makes diffs of llvm-bcanalyzer output more useful when tracking down nondeterminism...). llvm-svn: 264359
2016-03-04[OPENMP 4.0] Codegen for 'declare reduction' construct.Alexey Bataev1-2/+1
Emit function for 'combiner' part of 'declare reduction' construct and 'initialilzer' part, if any. llvm-svn: 262699