aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/MultiplexConsumer.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-08-24PR29097: add an update record when we instantiate the default memberRichard Smith1-0/+6
initializer of an imported field. llvm-svn: 279667
2016-05-09[OpenMP] Parse+Sema for '#pragma omp declare target' syntax version 4.5Dmitry Polukhin1-3/+4
Support OpenMP version 4.5 syntax for #pragma omp declare target. Syntax: #pragma omp declare target (extended-list) new-line or #pragma omp declare target clause[ [,] clause ... ] new-line Where clause is one of the following: to(extended-list) link(list) Differential Revision: http://reviews.llvm.org/D20011 llvm-svn: 268925
2016-04-06[OPENMP] Parsing and Sema support for 'omp declare target' directiveDmitry Polukhin1-0/+6
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-03-30For MS ABI, emit dllexport friend functions defined inline in classStephan Bergmann1-2/+2
...as that is apparently what MSVC does. This is an updated version of r263738, which had to be reverted in r263740 due to test failures. The original version had erroneously emitted functions that are defined in class templates, too (see the updated "Handle friend functions" code in EmitDeferredDecls, lib/CodeGen/ModuleBuilder.cpp). (The updated tests needed to be split out into their own dllexport-ms-friend.cpp because of the CHECK-NOTs which would have interfered with subsequent CHECK-DAGs in dllexport.cpp.) Differential Revision: http://reviews.llvm.org/D18430 llvm-svn: 264841
2016-03-17Revert "For MS ABI, emit dllexport friend functions defined inline in class"Reid Kleckner1-2/+2
This reverts commit r263738. This appears to cause a failure in CXX/temp/temp.decls/temp.friend/p1.cpp llvm-svn: 263740
2016-03-17For MS ABI, emit dllexport friend functions defined inline in classReid Kleckner1-2/+2
Summary: ...as that is apparently what MSVC does Reviewers: rnk Patch by Stephan Bergmann Differential Revision: http://reviews.llvm.org/D15267 llvm-svn: 263738
2016-03-02Serialize `#pragma detect_mismatch`.Nico Weber1-5/+0
This is like r262493, but for pragma detect_mismatch instead of pragma comment. The two pragmas have similar behavior, so use the same approach for both. llvm-svn: 262506
2016-03-02Serialize `#pragma comment`.Nico Weber1-10/+0
`#pragma comment` was handled by Sema calling a function on ASTConsumer, and CodeGen then implementing this function and writing things to its output. Instead, introduce a PragmaCommentDecl AST node and hang one off the TranslationUnitDecl for every `#pragma comment` line, and then use the regular serialization machinery. (Since PragmaCommentDecl has codegen relevance, it's eagerly deserialized.) http://reviews.llvm.org/D17799 llvm-svn: 262493
2016-02-09[Frontend] Handle ASTConsumer::shouldSkipFunctionBody via the MultiplexConsumer.Argyrios Kyrtzidis1-0/+7
llvm-svn: 260252
2016-01-26[MS ABI] Allow a member pointers' converted type to changeDavid Majnemer1-0/+5
Member pointers in the MS ABI are tricky for a variety of reasons. The size of a member pointer is indeterminate until the program reaches a point where the representation is required to be known. However, *pointers* to member pointers may exist without knowing the pointee type's representation. In these cases, we synthesize an opaque LLVM type for the pointee type. However, we can be in a situation where the underlying member pointer's representation became known mid-way through the program. To account for this, we attempted to manicure CodeGen's type-cache so that we can replace the opaque member pointer type with the real deal while leaving the pointer types unperturbed. This, unfortunately, is a problematic approach to take as we will violate CodeGen's invariants. These violations are mostly harmless but let's do the right thing instead: invalidate the type-cache if a member pointer's LLVM representation changes. This fixes PR26313. llvm-svn: 258839
2016-01-16Introduce -fsanitize-stats flag.Peter Collingbourne1-2/+2
This is part of a new statistics gathering feature for the sanitizers. See clang/docs/SanitizerStats.rst for further info and docs. Differential Revision: http://reviews.llvm.org/D16175 llvm-svn: 257971
2016-01-06Only instantiate a default argument once.John McCall1-0/+6
By storing the instantiated expression back in the ParmVarDecl, we remove the last need for separately storing the sub-expression of a CXXDefaultArgExpr. This makes PCH/Modules merging quite simple: CXXDefaultArgExpr records are serialized as references to the ParmVarDecl, and we ignore redundant attempts to overwrite the instantiated expression. This has some extremely marginal impact on user-facing semantics. However, the major effect is that it avoids IRGen errors about conflicting definitions due to lambdas in the argument being instantiated multiple times while sharing the same mangling. It should also slightly improve memory usage and module file size. rdar://23810407 llvm-svn: 256983
2015-11-03Stop back-patching 'readonly' Objective-C properties with 'readwrite' ones.Douglas Gregor1-10/+0
A 'readonly' Objective-C property declared in the primary class can effectively be shadowed by a 'readwrite' property declared within an extension of that class, so long as the types and attributes of the two property declarations are compatible. Previously, this functionality was implemented by back-patching the original 'readonly' property to make it 'readwrite', destroying source information and causing some hideously redundant, incorrect code. Simplify the implementation to express how this should actually be modeled: as a separate property declaration in the extension that shadows (via the name lookup rules) the declaration in the primary class. While here, correct some broken Fix-Its, eliminate a pile of redundant code, clean up the ARC migrator's handling of properties declared in extensions, and fix debug info's naming of methods that come from categories. A wonderous side effect of doing this write is that it eliminates the "AddedObjCPropertyInClassExtension" method from the AST mutation listener, which in turn eliminates the last place where we rewrite entire declarations in a chained PCH file or a module file. This change (which fixes rdar://problem/18475765) will allow us to eliminate the rewritten-decls logic from the serialization library, and fixes a crash (rdar://problem/23247794) illustrated by the test/PCH/chain-categories.m example. llvm-svn: 251874
2015-10-20Roll-back r250822.Angel Garcia Gomez1-1/+1
Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
2015-10-20Apply modernize-use-default to clang.Angel Garcia Gomez1-1/+1
Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
2015-06-26[ObjC] Add NSValue support for objc_boxed_expressionsAlex Denisov1-0/+9
Patch extends ObjCBoxedExpr to accept records (structs and unions): typedef struct __attribute__((objc_boxable)) _Color { int r, g, b; } Color; Color color; NSValue *boxedColor = @(color); // [NSValue valueWithBytes:&color objCType:@encode(Color)]; llvm-svn: 240761
2015-06-18Add missing overrides to MultiplexConsumer. Test coverage will beAdrian Prantl1-0/+26
provided by an upcoming commit. llvm-svn: 240026
2015-05-15Refactor: when exposing a definition in some module, provide listeners with theRichard Smith1-5/+4
module rather than requiring them to work it out themselves. llvm-svn: 237416
2015-05-04Rename MacroDefinition -> MacroDefinitionRecord, ↵Richard Smith1-3/+4
Preprocessor::MacroDefinition -> MacroDefinition. clang::MacroDefinition now models the currently-defined value of a macro. The previous MacroDefinition type, which represented a record of a macro definition directive for a detailed preprocessing record, is now called MacroDefinitionRecord. llvm-svn: 236400
2015-03-26[modules] If we reach a definition of a class for which we already have aRichard Smith1-0/+7
non-visible definition, skip the new definition and make the old one visible instead of trying to parse it again and failing horribly. C++'s ODR allows us to assume that the two definitions are identical. llvm-svn: 233250
2015-03-10[modules] Don't clobber a destructor's operator delete when adding another one;Richard Smith1-0/+7
move the operator delete updating into a separate update record so we can cope with updating another module's destructor's operator delete. llvm-svn: 231735
2015-02-25Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl1-27/+0
llvm-svn: 230454
2015-02-25Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl1-0/+27
This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. This reapplies r230044 with a fixed configure+make build and updated dependencies and testcase requirements. Over the last iteration this version adds - missing target requirements for testcases that specify an x86 triple, - a missing clangCodeGen.a dependency to libClang.a in the make build. rdar://problem/19104245 llvm-svn: 230423
2015-02-24Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl1-27/+0
This reverts commit r230305. Off to fix another round of missing dependencies on various platforms. llvm-svn: 230309
2015-02-24Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl1-0/+27
This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. rdar://problem/19104245 This reapplies r230044 with a fixed configure+make build and updated dependencies. Take 3. llvm-svn: 230305
2015-02-21Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl1-27/+0
This reverts commit 230099. The Linux configure+make build variant still needs some work. llvm-svn: 230103
2015-02-20Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl1-0/+27
This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. rdar://problem/19104245 This reapplies r230044 with a fixed configure+make build and updated dependencies. Take 2. llvm-svn: 230089
2015-02-20Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl1-27/+0
This reverts commit r230067. Investigating another batch of problems found by the bots. llvm-svn: 230073
2015-02-20Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl1-0/+27
This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. rdar://problem/19104245 This reapplies r230044 with a fixed configure+make build and updated dependencies. llvm-svn: 230067
2015-02-20Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl1-27/+0
This reverts commit r230044 while dealing with buildbot breakage. Conflicts: test/Modules/module_container.m llvm-svn: 230052
2015-02-20Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl1-0/+27
This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. rdar://problem/19104245 llvm-svn: 230044
2015-01-15Remove ASTConsumer::HandleVTable()'s bool parameter.Nico Weber1-3/+2
Sema calls HandleVTable() with a bool parameter which is then threaded through three layers. The only effect of this bool is an early return at the last layer. Instead, remove this parameter and call HandleVTable() only if the bool is true. No intended behavior change. llvm-svn: 226096
2014-11-11[OPENMP] Codegen for threadprivate variablesAlexey Bataev1-0/+6
For all threadprivate variables which have constructor/destructor emit call to void __kmpc_threadprivate_register(ident_t * <Current Location>, void *<Original Global Addr>, kmpc_ctor <Constructor>, kmpc_cctor NULL, kmpc_dtor <Destructor>); In expressions all references to such variables are replaced by calls to void *__kmpc_threadprivate_cached(ident_t *<Current Location>, kmp_int32 <Current Thread Id>, void *<Original Global Addr>, size_t <Size of Data>, void ***<Pointer to autogenerated cache – array of private copies of threadprivate variable>); Test test/OpenMP/threadprivate_codegen.cpp checks that codegen is correct. Also it checks that codegen is correct after serialization/deserialization and one of passes verifies debug info. Differential Revision: http://reviews.llvm.org/D4002 llvm-svn: 221663
2014-08-10Recommit 213307: unique_ptr-ify ownership of ASTConsumers (reverted in r213325)David Blaikie1-58/+53
After post-commit review and community discussion, this seems like a reasonable direction to continue, making ownership semantics explicit in the source using the type system. llvm-svn: 215323
2014-07-17Revert "unique_ptr-ify ownership of ASTConsumers"David Blaikie1-53/+58
This reverts commit r213307. Reverting to have some on-list discussion/confirmation about the ongoing direction of smart pointer usage in the LLVM project. llvm-svn: 213325
2014-07-17unique_ptr-ify ownership of ASTConsumersDavid Blaikie1-58/+53
(after fixing a bug in MultiplexConsumer I noticed the ownership of the nested consumers was implemented with raw pointers - so this fixes that... and follows the source back to its origin pushing unique_ptr ownership up through there too) llvm-svn: 213307
2014-07-16DebugInfo: Forward HandleTagDeclRequiredDefinition through MultiplexConsumer ↵David Blaikie1-0/+25
to fix debug info emission in the presence of plugins. When plugins are used the Multiplex(AST)Consumer is employed to dispatch to both the plugin ASTConsumers and the IRGen ASTConsumer. It wasn't dispatching a critical call for debug info, resulting in plugin users having a negative debugging experience. While I'm here, forward a bunch of other missing calls through the consumer that seem like they should be there. To test this, use the example plugin (requires plugins and examples) and split the test case up so that the plugin testing can be done under that requirement while the non-plugin testing will execute even in builds that don't include plugin support or examples. llvm-svn: 213213
2014-05-23Emit used/dllexport inline method definitions in nested classes (PR19743, ↵Hans Wennborg1-0/+5
PR11170) The previous code that was supposed to handle this didn't work since parsing of inline method definitions is delayed to the end of the outer class definition. Thus, when HandleTagDeclDefinition() got called for the inner class, the inline functions in that class had not been parsed yet. Richard suggested that the way to do this is by handling inline method definitions through a new ASTConsumer callback. I really wanted to call ASTContext::DeclMustBeEmitted() instead of checking for attributes, but doing that causes us to compute linkage, and then we fail with "error: unsupported: typedef changes linkage of anonymous type, but linkage was already computed" on tests like this: (from SemaCXX/undefined-internal.cpp) :-/ namespace test7 { typedef struct { void bar(); void foo() { bar(); } } A; } Differential Revision: http://reviews.llvm.org/D3809 llvm-svn: 209549
2014-03-13[C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper1-26/+25
class. llvm-svn: 203758
2014-03-07Replace OwningPtr with std::unique_ptr.Ahmed Charles1-4/+3
This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
2014-03-02Switch all uses of LLVM_OVERRIDE to just use 'override' directly.Craig Topper1-1/+1
llvm-svn: 202625
2013-09-05Note when a decl is used in AST files.Eli Friedman1-0/+6
When an AST file is built based on another AST file, it can use a decl from the fist file, and therefore mark the "isUsed" bit. We need to note this in the AST file so that the bit is set correctly when the second AST file is loaded. This patch introduces the distinction between setIsUsed() and markUsed() so that we don't call into the ASTMutationListener callback when it wouldn't be appropriate. Fixes PR16635. llvm-svn: 190016
2013-08-06Started implementing variable templates. Top level declarations should be ↵Larisse Voufo1-0/+8
fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention... llvm-svn: 187762
2013-05-11C++1y deduced return types: when we deduce a return type for a function whichRichard Smith1-0/+6
we loaded from PCH, if we're building another PCH, create an update record to patch the return type of the earlier declaration. llvm-svn: 181659
2012-12-04Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth1-1/+0
uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
2012-03-08Replace MarkVarRequired with a more genericRafael Espindola1-2/+2
HandleCXXStaticMemberVarInstantiation. Suggested by Argyrios. llvm-svn: 152320
2012-03-05Fix a small difference in sema and codegen views of what needs to be output.Rafael Espindola1-0/+5
In the included testcase, soma thinks that we already have a definition after we see the out of line decl. Codegen puts it in a deferred list, to be output if a use is seen. This would break when we saw an explicit template instantiation definition, since codegen would not be notified. This patch adds a method to the consumer interface so that soma can notify codegen that this decl is now required. llvm-svn: 152024
2012-02-10[libclang] Indexing API: Fully index implict template instantiations.Argyrios Kyrtzidis1-0/+5
llvm-svn: 150267
2012-02-10Add ArrayRef goodness in MultiplexASTMutationListener.Argyrios Kyrtzidis1-3/+3
llvm-svn: 150266
2012-02-10Update MultiplexASTMutationListener with the missing methods from ↵Argyrios Kyrtzidis1-0/+18
ASTMutationListener. llvm-svn: 150265