summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement codegen for MSVC unions with reference members.Aaron Ballman2019-08-272-14/+50
| | | | | | | | Currently, clang accepts a union with a reference member when given the -fms-extensions flag. This change fixes the codegen for this case. Patch by Dominic Ferreira. llvm-svn: 370052
* Testing commit access; NFCJoe Ranieri2019-08-271-1/+0
| | | | llvm-svn: 370051
* [ASTImporter] Fix name conflict handling with different strategiesGabor Marton2019-08-276-113/+447
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are numorous flaws about the name conflict handling, this patch attempts fixes them. Changes in details: * HandleNameConflict return with a false DeclarationName Hitherto we effectively never returned with a NameConflict error, even if the preceding StructuralMatch indicated a conflict. Because we just simply returned with the parameter `Name` in HandleNameConflict and that name is almost always `true` when converted to `bool`. * Add tests which indicate wrong NameConflict handling * Add to ConflictingDecls only if decl kind is different Note, we might not indicate an ODR error when there is an existing record decl and a enum is imported with same name. But there are other cases. E.g. think about the case when we import a FunctionTemplateDecl with name f and we found a simple FunctionDecl with name f. They overload. Or in case of a ClassTemplateDecl and CXXRecordDecl, the CXXRecordDecl could be the 'templated' class, so it would be false to report error. So I think we should report a name conflict error only when we are 100% sure of that. That is why I think it should be a general pattern to report the error only if the kind is the same. * Fix failing ctu test with EnumConstandDecl In ctu-main.c we have the enum class 'A' which brings in the enum constant 'x' with value 0 into the global namespace. In ctu-other.c we had the enum class 'B' which brought in the same name ('x') as an enum constant but with a different enum value (42). This is clearly an ODR violation in the global namespace. The solution was to rename the second enum constant. * Introduce ODR handling strategies Reviewers: a_sidorin, shafik Differential Revision: https://reviews.llvm.org/D59692 llvm-svn: 370045
* [clang] Ensure that statements, expressions and types are trivially destructibleBruno Ricci2019-08-272-0/+24
| | | | | | | | | | | | | | | Since statements, expressions and types are allocated with the BumpPtrAllocator from ASTContext their destructor is not executed. Two classes are currently exempted from the check : InitListExpr due to its ASTVector and ConstantArrayType due to its APInt. No functional changes. Differential Revision: https://reviews.llvm.org/D66646 Reviewed By: lebedev.ri, gribozavr llvm-svn: 370044
* [clang] Ensure that comment classes are trivially destructibleBruno Ricci2019-08-271-0/+15
| | | | | | | | | | | As in D66646, these classes are also allocated with a BumpPtrAllocator, and therefore should be trivially destructible. Differential Revision: https://reviews.llvm.org/D66722 Reviewed By: Mordante, gribozavr llvm-svn: 370041
* [ReleaseNotes] MemorySanitizer support of ASLR on FreeBSDDavid Carlier2019-08-271-0/+3
| | | | | | | | | | Reviewers: sylvestre.ledru, kcc Reviewed By: sylvestre.ledru Differential Revision: https://reviews.llvm.org/D66792 llvm-svn: 370035
* [Driver] Add an option for createInvocationFromCommandLine to recover on errorsIlya Biryukov2019-08-273-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, it would always return nullptr on any error. This change adds a parameter, controlling whether the function should attempt to return a non-null result even if unknown arguments (or other errors were encountered). The new behavior is only used in clangd. Considered an alternative of changing the return value instead of adding a new parameter, but that would require updating all callsites. Settled with the parameter to minimize the code changes. Reviewers: gribozavr Reviewed By: gribozavr Subscribers: nridge, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66731 llvm-svn: 370033
* Revert "[clang-scan-deps] Minimizer: Correctly handle multi-line content ↵Richard Smith2019-08-272-51/+14
| | | | | | | | | | | | with CR+LF line endings" This reverts commit r369986. This change added a dependency on the 'dos2unix' tool, which is not one of our accepted test dependencies and may not exist on all machines that build Clang. llvm-svn: 370000
* Don't lose the FoundDecl and template arguments for a DeclRefExpr inRichard Smith2019-08-271-5/+12
| | | | | | TreeTransform. llvm-svn: 369999
* Use FileEntryRef for PPCallbacks::FileSkippedAlex Lorenz2019-08-275-11/+49
| | | | | | | | This fixes the issue where a filename dependendency was missing if the file that was skipped was included through a symlink in an earlier run, if the file manager was reused between runs. llvm-svn: 369998
* [clang-scan-deps] Skip UTF-8 BOM in source minimizerAlexandre Ganea2019-08-272-0/+17
| | | | | | Differential Revision: https://reviews.llvm.org/D66511 llvm-svn: 369993
* NFC: Make test work with or without assertionsVitaly Buka2019-08-271-7/+10
| | | | llvm-svn: 369992
* [clang-scan-deps] Minimizer: Correctly skip over double slashes in angle ↵Alexandre Ganea2019-08-262-3/+12
| | | | | | | | | | bracket #include Previously, double slashes (//) occurring in angle brackets #include were incorrectly interpreted as comments. eg. #include <dir//file.h> Differential Revision: https://reviews.llvm.org/D66550 llvm-svn: 369988
* [clang-scan-deps] Minimizer: Correctly handle multi-line content with CR+LF ↵Alexandre Ganea2019-08-262-14/+51
| | | | | | | | | | line endings Previously, an #error directive with quoted, multi-line content, along with CR+LF line endings wasn't handled correctly. Differential Revision: https://reviews.llvm.org/D66556 llvm-svn: 369986
* PR42587: diagnose unexpanded uses of a pack parameter of a genericRichard Smith2019-08-269-34/+111
| | | | | | | | | | | | | | | | | lambda from within the lambda-declarator. Instead of trying to reconstruct whether a parameter pack was declared inside a lambda (which we can't do correctly in general because we might not have attached parameters to their declaration contexts yet), track the set of parameter packs introduced in each live lambda scope, and require only those parameters to be immediately expanded when they appear inside that lambda. In passing, fix incorrect disambiguation of a lambda-expression starting with an init-capture pack in a braced-init-list. We previously incorrectly parsed that as a designated initializer. llvm-svn: 369985
* hwasan, codegen: Keep more lifetime markers used for hwasanVitaly Buka2019-08-264-0/+8
| | | | | | | | | | | | Reviewers: eugenis Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66697 llvm-svn: 369980
* msan, codegen, instcombine: Keep more lifetime markers used for msanVitaly Buka2019-08-264-11/+12
| | | | | | | | | | | | Reviewers: eugenis Subscribers: hiraditya, cfe-commits, #sanitizers, llvm-commits Tags: #clang, #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D66695 llvm-svn: 369979
* Revert r369843 "[Testing] Unbreak r369830"Vitaly Buka2019-08-261-1/+0
| | | | | | | | That was not the fix. This reverts commit 8bcf690ae03db85608b2ea22eac7a91c84df4dc. llvm-svn: 369971
* Updating a test case that was missed in r369957.Aaron Ballman2019-08-261-1/+1
| | | | llvm-svn: 369968
* Remove unused variables.Benjamin Kramer2019-08-261-2/+0
| | | | llvm-svn: 369965
* [DebugInfo] Add debug-entry-values test coverage, NFCVedant Kumar2019-08-261-0/+7
| | | | | | | Check that call site descriptions are emitted in dwarf4 + lldb + debug-entry-values mode. llvm-svn: 369964
* Fixing a weird copy-pasta to get bots back to green.Aaron Ballman2019-08-261-1/+1
| | | | llvm-svn: 369960
* ContentCache: Drop getBuffer's dependency on SourceManagerDuncan P. N. Exon Smith2019-08-264-33/+31
| | | | | | | | | | | | | Refactor ContentCache::IsSystemFile to IsFileVolatile, checking SourceManager::userFilesAreVolatile at construction time. This is a step toward lowering ContentCache down from SourceManager to FileManager. No functionality change intended. https://reviews.llvm.org/D66713 llvm-svn: 369958
* Reword the C11 extension diagnostic.Aaron Ballman2019-08-263-30/+30
| | | | | | This makes it more consistent with other language extension diagnostics. llvm-svn: 369957
* Fix gen-cdb-fragment test for WindowsAlex Lorenz2019-08-261-2/+2
| | | | | | Windows bots didn't seem to like the empty argument, so I rewrote the test. llvm-svn: 369956
* [Clang][Bundler] Use llvm-objcopy for creating fat object filesSergey Dmitriev2019-08-264-125/+29
| | | | | | | | clang-offload-bundler currently uses partial linking for creating fat object files, but such technique cannot be used on Windows due to the absence of partial linking support in the linker. This patch changes implementation to use llvm-objcopy for merging device and host objects instead of doing partial linking. This is one step forward towards enabling OpenMP offload on Windows. Differential Revision: https://reviews.llvm.org/D66485 llvm-svn: 369955
* Diagnose use of _Thread_local as an extension when not in C11 mode.Aaron Ballman2019-08-266-38/+55
| | | | llvm-svn: 369954
* [OPENMP][NVPTX]Fix critical region codegen.Alexey Bataev2019-08-262-3/+26
| | | | | | | | | | | | | | | | | Summary: Previously critical regions were emitted with the barrier making it a worksharing construct though it is not. Also, it leads to incorrect behavior in Cuda9+. Patch fixes this problem. Reviewers: ABataev, jdoerfert Subscribers: jholewinski, guansong, cfe-commits, grokos Tags: #clang Differential Revision: https://reviews.llvm.org/D66673 llvm-svn: 369946
* [msvc] Add necessary #include to make compiler intrinsics available.Richard Smith2019-08-261-0/+4
| | | | llvm-svn: 369944
* FileManager: Use llvm::Expected in new getFileRef APIDuncan P. N. Exon Smith2019-08-265-28/+36
| | | | | | | | | | | | | | | | | | | | | `FileManager::getFileRef` is a modern API which we expect to convert to over time. We should modernize the error handling as well, using `llvm::Expected` instead of `llvm::ErrorOr`, to help clients that care about errors to ensure nothing is missed. However, not all clients care. I've also added another path for those that don't: - `FileEntryRef` is now copy- and move-assignable (using a pointer instead of a reference). - `FileManager::getOptionalFileRef` returns an `llvm::Optional` instead of `llvm::Expected`. - Added an `llvm::expectedToOptional` utility in case this is useful elsewhere. https://reviews.llvm.org/D66705 llvm-svn: 369943
* Fix file header.Richard Smith2019-08-261-1/+1
| | | | llvm-svn: 369941
* Improve behavior in the case of stack exhaustion.Richard Smith2019-08-2621-123/+348
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Clang performs various recursive operations (such as template instantiation), and may use non-trivial amounts of stack space in each recursive step (for instance, due to recursive AST walks). While we try to keep the stack space used by such steps to a minimum and we have explicit limits on the number of such steps we perform, it's impractical to guarantee that we won't blow out the stack on deeply recursive template instantiations on complex ASTs, even with only a moderately high instantiation depth limit. The user experience in these cases is generally terrible: we crash with no hint of what went wrong. Under this patch, we attempt to do better: * Detect when the stack is nearly exhausted, and produce a warning with a nice template instantiation backtrace, telling the user that we might run slowly or crash. * For cases where we're forced to trigger recursive template instantiation in arbitrarily-deeply-nested contexts, check whether we're nearly out of stack space and allocate a new stack (by spawning a new thread) after producing the warning. Reviewers: rnk, aaron.ballman Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66361 llvm-svn: 369940
* [driver] add a new option `-gen-cdb-fragment-path` to emitAlex Lorenz2019-08-264-4/+89
| | | | | | | | | | | | | | a fragment of a compilation database for each compilation This patch adds a new option called -gen-cdb-fragment-path to the driver, which can be used to specify a directory path to which clang can emit a fragment of a CDB for each compilation it needs to invoke. This option emits the same CDB contents as -MJ, and will be ignored if -MJ is specified. Differential Revision: https://reviews.llvm.org/D66555 llvm-svn: 369938
* Fix use of invalidated iterator introduced by r369680.Richard Smith2019-08-261-4/+4
| | | | llvm-svn: 369932
* [libclang][index][NFCi] Refactor machinery for skipping function bodiesJan Korous2019-08-261-41/+65
| | | | | | | | | | | Refactor machinery for skipping inline function bodies that have already been parsed in other frontend actions. Preparations for moving this code to libIndex. Differential Revision: https://reviews.llvm.org/D66694 llvm-svn: 369931
* [NFC] Add comments to some bool arguments for better readabilityGabor Horvath2019-08-261-4/+8
| | | | llvm-svn: 369928
* Fix -dA flag, it is not a preprocessor flag.Erich Keane2019-08-263-6/+3
| | | | | | | | | -dA was in the d_group, which is a preprocessor state dumping group. However -dA is a debug flag to cause a verbose asm. It was already implemented to do the same thing as -fverbose-asm, so make it just be an alias. llvm-svn: 369926
* clang-format: [JS] handle `as const`.Martin Probst2019-08-262-0/+7
| | | | | | | | | | | | | | | | | | | | Summary: TypeScript 3.4 supports casting into a const type using `as const`: const x = {x: 1} as const; Previously, clang-format would insert a space after the `const`. With this patch, no space is inserted after the sequence `as const`. Reviewers: krasimir Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66736 llvm-svn: 369916
* [Wdocumentation] improve wording of a warning messageDmitri Gribenko2019-08-252-7/+7
| | | | | | | | | | | Based on @davezarzycki remarks in D64696 improved the wording of the warning message. Differential Revision: https://reviews.llvm.org/D66700 Patch by Mark de Wever. llvm-svn: 369873
* FileManager: Factor duplicated code in getBufferForFile, NFCDuncan P. N. Exon Smith2019-08-252-12/+14
| | | | | | | Incidentally, this also unifies the two versions (removing an unnecessary call to `SmallString::c_str`). llvm-svn: 369861
* [OpenCL] Microoptimize OCL2Qual a bitBenjamin Kramer2019-08-242-20/+21
| | | | | | Still not optimal, but makes clang 25k smaller. llvm-svn: 369846
* [analyzer] Analysis: Fix checker silencingCsaba Dabis2019-08-242-29/+35
| | | | llvm-svn: 369845
* [Testing] Unbreak r369830David Zarzycki2019-08-241-0/+1
| | | | llvm-svn: 369843
* PR42513: Enter the proper DeclContext before substituting into anRichard Smith2019-08-243-3/+24
| | | | | | | | | | | | default template argument expression. We already did this for type template parameters and template template parameters, but apparently forgot to do so for non-type template parameters. This causes the substituted default argument expression to be substituted in the proper context, and in particular to properly mark its subexpressions as odr-used. llvm-svn: 369834
* Re-enable DependencyScannerTest on windows with the right fixesAlex Lorenz2019-08-241-13/+16
| | | | | | It should now pass. llvm-svn: 369832
* NFC: Rename some sanitizer related lifetime checksVitaly Buka2019-08-243-47/+55
| | | | llvm-svn: 369830
* PR40674: fix assertion failure if a structured binding declaration has aRichard Smith2019-08-242-2/+9
| | | | | | | tuple-like decomposition that produces value-dependent reference bindings. llvm-svn: 369829
* [libclang][index][NFC] Fix test for skipping already parsed function bodiesJan Korous2019-08-231-1/+1
| | | | llvm-svn: 369822
* Fix a test to test what the name suggest.Gabor Horvath2019-08-231-1/+1
| | | | llvm-svn: 369820
* [LifetimeAnalysis] Make it possible to disable the new warningsGabor Horvath2019-08-234-40/+97
| | | | llvm-svn: 369817
OpenPOWER on IntegriCloud