summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* Move LangStandard*, InputKind::Language to BasicRainer Orth2019-08-0523-223/+222
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is a prerequisite for using LangStandard from Driver in https://reviews.llvm.org/D64793. It moves LangStandard* and InputKind::Language to Basic. It is mostly mechanical, with only a few changes of note: - enum Language has been changed into enum class Language : uint8_t to avoid a clash between OpenCL in enum Language and OpenCL in enum LangFeatures and not to increase the size of class InputKind. - Now that getLangStandardForName, which is currently unused, also checks both canonical and alias names, I've introduced a helper getLangKind which factors out a code pattern already used 3 times. The patch has been tested on x86_64-pc-solaris2.11, sparcv9-sun-solaris2.11, and x86_64-pc-linux-gnu. There's a companion patch for lldb which uses LangStandard.h (https://reviews.llvm.org/D65717). While polly includes isl which in turn uses InputKind::C, that part of the code isn't even built inside the llvm tree. I've posted a patch to allow for both InputKind::C and Language::C upstream (https://groups.google.com/forum/#!topic/isl-development/6oEvNWOSQFE). Differential Revision: https://reviews.llvm.org/D65562 llvm-svn: 367864
* [clang][NFC] Remove unused private variable 'CI' in CrossTranslationUnit.hRaphael Isemann2019-08-052-2/+1
| | | | | | | | | | | | | | It seems because of the recent refactorings this variable has become unused and now we get this warning in the build logs: In file included from llvm/clang/lib/CrossTU/CrossTranslationUnit.cpp:12: llvm/clang/include/clang/CrossTU/CrossTranslationUnit.h:200:21: warning: private field 'CI' is not used [-Wunused-private-field] CompilerInstance &CI; ^ I'll remove them for now to get the builds back to green. llvm-svn: 367840
* [AST] Fix RecursiveASTVisitor visiting implicit constructor initializers.Johan Vikstrom2019-08-053-1/+60
| | | | | | | | | | | | | | Summary: RecursiveASTVisitor was visiting implcit constructor initializers. This caused semantic highlighting in clangd to emit error logs. Fixes this by checking if the constructor is written or if the visitor should visit implicit decls. Reviewers: hokein, ilya-biryukov Subscribers: kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65735 llvm-svn: 367839
* [CrossTU][NFCI] Refactor loadExternalAST functionEndre Fulop2019-08-052-58/+242
| | | | | | | | | | | | | | | | Summary: Refactor loadExternalAST method of CrossTranslationUnitContext in order to reduce maintenance burden and so that features are easier to add in the future. Reviewers: martong Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64753 llvm-svn: 367829
* Sidestep false positive due to a matching git repository nameRoger Ferrer Ibanez2019-08-051-1/+1
| | | | | | | | | | | | | | | I have failures in this test because the grep @b gets confused by the clang version including a repository name like this !1 = !{!"clang version 10.0.0 (git@build-machine:llvm/llvm-monorepo.git fe958c0e8c89ec663c8e551936778e2cbb460154)"} I considered something like grep -w but my understanding of the manpages was that that isn't super portable. So I think it is easier to make clang not to output that metadata using -fno-ident. Differential Revision: https://reviews.llvm.org/D65635 llvm-svn: 367826
* [OpenCL] Fix vector literal test broken in rL367675.Anastasia Stulova2019-08-051-2/+2
| | | | | | | Avoid checking alignment unnecessary that is not portable among targets. llvm-svn: 367823
* Adds a warning when an inline Doxygen comment has no argumentDmitri Gribenko2019-08-053-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | Summary: It warns for for comments like /** \pre \em */ where \em has no argument This warning is enabled with the -Wdocumentation option. Reviewers: gribozavr, rsmith Reviewed By: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64696 Patch by Mark de Wever. llvm-svn: 367809
* [Analyzer] Iterator Checkers - Fix for Crash on Iterator DifferencesAdam Balogh2019-08-054-5/+17
| | | | | | | Iterators differences were mistakenly handled as random decrements which causes an assertion. This patch fixes this. llvm-svn: 367802
* Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFCFangrui Song2019-08-0522-32/+34
| | | | | | F_{None,Text,Append} are kept for compatibility since r334221. llvm-svn: 367800
* [Driver] Don't disable -fsanitizer-coverage for safe-stack or shadow-call-stackPetr Hosek2019-08-052-2/+15
| | | | | | | | | These "sanitizers" are hardened ABIs that are wholly orthogonal to the SanitizerCoverage instrumentation. Differential Revision: https://reviews.llvm.org/D65715 llvm-svn: 367799
* [Driver] Derive Fuchsia Linker directly from ToolPetr Hosek2019-08-051-2/+2
| | | | | | Fuchsia Linker tool doesn't need any of the GnuTool behavior. llvm-svn: 367797
* [Driver] Always use -z separate-code with lld on FuchsiaPetr Hosek2019-08-052-1/+3
| | | | | | | Previously -z separate-code was the default lld behavior, but now it has to be explicitly requested by specifying the flag. llvm-svn: 367796
* [Driver] Support for disabling sanitizer runtime linkingPetr Hosek2019-08-045-23/+79
| | | | | | | | | | | This change introduces a pair of -fsanitize-link-runtime and -fno-sanitize-link-runtime flags which can be used to control linking of sanitizer runtimes. This is useful in certain environments like kernels where existing runtime libraries cannot be used. Differential Revision: https://reviews.llvm.org/D65029 llvm-svn: 367794
* [Parser] Emit descriptive diagnostic for misplaced pragmaSerge Pavlov2019-08-046-2/+63
| | | | | | | | | | | If a class or struct or union declaration contains a pragma that is not valid in this context, compiler issues generic error like "expected member name or ';' after declaration specifiers". With this change the error tells that this pragma cannot appear in this declaration. Differential Revision: https://reviews.llvm.org/D64932 llvm-svn: 367779
* Revert "[OpenMP 5.0] Codegen support for user-defined mappers."Michael Kruse2019-08-047-887/+87
| | | | | | | This reverts commit r367773. The test case OpenMP/declare_mapper_codegen.cpp is failing. llvm-svn: 367774
* [OpenMP 5.0] Codegen support for user-defined mappers.Michael Kruse2019-08-047-87/+887
| | | | | | | | | | | | | | | | This patch implements the code generation for OpenMP 5.0 declare mapper (user-defined mapper) constructs. For each declare mapper, a mapper function is generated. These mapper functions will be called by the runtime and/or other mapper functions to achieve user defined mapping. The design slides can be found at https://github.com/lingda-li/public-sharing/blob/master/mapper_runtime_design.pptx Patch by Lingda Li <lildmh@gmail.com> Differential Revision: https://reviews.llvm.org/D59474 llvm-svn: 367773
* Use switch instead of series of comparisonsSerge Pavlov2019-08-032-7/+11
| | | | | | | | This is style correction, no functional changes. Differential Revision: https://reviews.llvm.org/D65670 llvm-svn: 367759
* IR: print value numbers for unnamed function argumentsTim Northover2019-08-03135-864/+864
| | | | | | | | | | For consistency with normal instructions and clarity when reading IR, it's best to print the %0, %1, ... names of function arguments in definitions. Also modifies the parser to accept IR in that form for obvious reasons. llvm-svn: 367755
* The MinGW linker supports response filesReid Kleckner2019-08-021-1/+2
| | | | | | | | | | This affects both LLD and ld.bfd. This isn't testable with a normal driver test with -### because those command lines are printed before response file setup. I tested manually and confirmed it seems to do the right thing. llvm-svn: 367733
* [BPF] annotate DIType metadata for builtin preseve_array_access_index()Yonghong Song2019-08-023-14/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, debuginfo types are annotated to IR builtin preserve_struct_access_index() and preserve_union_access_index(), but not preserve_array_access_index(). The debug info is useful to identify the root type name which later will be used for type comparison. For user access without explicit type conversions, the previous scheme works as we can ignore intermediate compiler generated type conversions (e.g., from union types to union members) and still generate correct access index string. The issue comes with user explicit type conversions, e.g., converting an array to a structure like below: struct t { int a; char b[40]; }; struct p { int c; int d; }; struct t *var = ...; ... __builtin_preserve_access_index(&(((struct p *)&(var->b[0]))->d)) ... Although BPF backend can derive the type of &(var->b[0]), explicit type annotation make checking more consistent and less error prone. Another benefit is for multiple dimension array handling. For example, struct p { int c; int d; } g[8][9][10]; ... __builtin_preserve_access_index(&g[2][3][4].d) ... It would be possible to calculate the number of "struct p"'s before accessing its member "d" if array debug info is available as it contains each dimension range. This patch enables to annotate IR builtin preserve_array_access_index() with proper debuginfo type. The unit test case and language reference is updated as well. Signed-off-by: Yonghong Song <yhs@fb.com> Differential Revision: https://reviews.llvm.org/D65664 llvm-svn: 367724
* [Driver][test] Avoid undefined grep in darwin-ld.cHubert Tong2019-08-021-2/+2
| | | | | | | | | | | | | | | | | | | | Summary: question-mark is not a BRE special character. POSIX.1-2017 XBD Section 9.3.2 indicates that the interpretation of `\?` as used by rC366282 is undefined. This patch uses an ERE instead. Reviewers: rnk, daltenty, xingxue, jasonliu Reviewed By: rnk Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65668 llvm-svn: 367709
* Remove a dead diagnostic, NFCErik Pilkington2019-08-022-6/+0
| | | | | | | This was issued in Objective-C 1 mode, but we not longer support that, so this is just unreachable. llvm-svn: 367708
* [Sema] Disable -Wbitwise-op-parentheses and -Wlogical-op-parentheses by defaultFangrui Song2019-08-025-55/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The -Wparentheses warnings are enabled by default in clang but they are under -Wall in gcc (gcc/c-family/c.opt). Some of the operator precedence warnings are oftentimes criticized as noise (clang: default; gcc: -Wall). If a warning is very controversial, it is probably not a good idea to enable it by default. This patch disables the rather annoying ones: -Wbitwise-op-parentheses, e.g. i & i | i -Wlogical-op-parentheses, e.g. i && i || i After this change: ``` * = enabled by default -Wall -Wparentheses -Wlogical-op-parentheses -Wlogical-not-parentheses* -Wbitwise-op-parentheses -Wshift-op-parentheses* -Woverloaded-shift-op-parentheses* -Wparentheses-equality* -Wdangling-else* ``` -Woverloaded-shift-op-parentheses is typically followed by overload resolution failure. We can instead improve the error message, and probably delete -Woverloaded-shift-op-parentheses in the future. Keep it for now because it gives some diagnostics. Reviewers: akyrtzi, jyknight, rtrieu, rsmith, aaron.ballman Reviewed By: aaron.ballman Subscribers: dexonsmith, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65192 llvm-svn: 367690
* [OpenCL] Allow OpenCL C style vector initialization in C++Anastasia Stulova2019-08-025-69/+78
| | | | | | | | | | | Allow creating vector literals from other vectors. float4 a = (float4)(1.0f, 2.0f, 3.0f, 4.0f); float4 v = (float4)(a.s23, a.s01); Differential revision: https://reviews.llvm.org/D65286 llvm-svn: 367675
* Don't try emitting dllexported explicitly defaulted non-trivial ctors twice ↵Hans Wennborg2019-08-022-1/+14
| | | | | | | | | | during explicit template instantiation definition (PR42857) Trying to emit the definition twice triggers an assert. Differential revision: https://reviews.llvm.org/D65579 llvm-svn: 367661
* Revert r367649: Improve raw_ostream so that you can "write" colors using ↵Rui Ueyama2019-08-025-30/+53
| | | | | | | | operator<< This reverts commit r367649 in an attempt to unbreak Windows bots. llvm-svn: 367658
* [PGO] Fix bolt failures from r367628Rong Xu2019-08-021-2/+2
| | | | | | | Relaxed the check in a test because the windows bolt generates different profile variables. llvm-svn: 367657
* Improve raw_ostream so that you can "write" colors using operator<<Rui Ueyama2019-08-025-53/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. raw_ostream supports ANSI colors so that you can write messages to the termina with colors. Previously, in order to change and reset color, you had to call `changeColor` and `resetColor` functions, respectively. So, if you print out "error: " in red, for example, you had to do something like this: OS.changeColor(raw_ostream::RED); OS << "error: "; OS.resetColor(); With this patch, you can write the same code as follows: OS << raw_ostream::RED << "error: " << raw_ostream::RESET; 2. Add a boolean flag to raw_ostream so that you can disable colored output. If you disable colors, changeColor, operator<<(Color), resetColor and other color-related functions have no effect. Most LLVM tools automatically prints out messages using colors, and you can disable it by passing a flag such as `--disable-colors`. This new flag makes it easy to write code that works that way. Differential Revision: https://reviews.llvm.org/D65564 llvm-svn: 367649
* [clang-format] Fix a bug that doesn't break braces before unions for AllmanOwen Pan2019-08-022-0/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D65631 llvm-svn: 367648
* [DirectoryWatcher] Relax assumption to prevent test flakinessJan Korous2019-08-012-1/+19
| | | | llvm-svn: 367632
* [PGO] Add PGO support at -O0 in the experimental new pass managerRong Xu2019-08-013-7/+52
| | | | | | | | | | | | | | Add PGO support at -O0 in the experimental new pass manager to sync the behavior of the legacy pass manager. Also change the test of gcc-flag-compatibility.c for more complete test: (1) change the match string to "profc" and "profd" to ensure the instrumentation is happening. (2) add IR format proftext so that PGO use compilation is tested. Differential Revision: https://reviews.llvm.org/D64029 llvm-svn: 367628
* Fix Windows branch of FileManagerTest changesHarlan Haskins2019-08-011-1/+1
| | | | llvm-svn: 367622
* Fix use-after-move in ClangBasicTestsHarlan Haskins2019-08-011-1/+1
| | | | llvm-svn: 367620
* [clang] Adopt new FileManager error-returning APIsHarlan Haskins2019-08-0135-215/+298
| | | | | | | Update the callers of FileManager::getFile and FileManager::getDirectory to handle the new llvm::ErrorOr-returning methods. Signed-off-by: Harlan Haskins <harlan@apple.com> llvm-svn: 367616
* [clang] Adopt llvm::ErrorOr in FileManager methodsHarlan Haskins2019-08-013-103/+144
| | | | | | | Previously, the FileManager would use NULL returns to signify whether a file existed, but that doesn’t cover permissions issues or anything else that might occur while trying to stat or read a file. Instead, convert getFile and getDirectory into returning llvm::ErrorOr Signed-off-by: Harlan Haskins <harlan@apple.com> llvm-svn: 367615
* [OpenMP] Fix declare target link implementationGheorghe-Teodor Bercea2019-08-014-64/+84
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch fixes the case where variables in different compilation units or the same compilation unit are under the declare target link clause AND have the same name. This also fixes the name clash error that occurs when unified memory is activated. The changes in this patch include: - Pointers to internal variables are given unique names. - Externally visible variables are given the same name as before. - All pointer variables (external or internal) are weakly linked. Reviewers: ABataev, jdoerfert, caomhin Reviewed By: ABataev Subscribers: lebedev.ri, guansong, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64592 llvm-svn: 367613
* [analyzer] StackFrameContext: Add NodeBuilderContext::blockCount() to its ↵Csaba Dabis2019-08-019-51/+95
| | | | | | | | | | | | | | | | | | profile Summary: It allows discriminating between stack frames of the same call that is called multiple times in a loop. Thanks to Artem Dergachev for the great idea! Reviewed By: NoQ Tags: #clang Differential Revision: https://reviews.llvm.org/D65587 llvm-svn: 367608
* Test linux only for absolute paths in the -fuse-ld optionYuanfang Chen2019-08-011-0/+1
| | | | | | | Some target do not use this option and may emit a error message for using it. llvm-svn: 367602
* [Parser] Use special definition for pragma annotationsSerge Pavlov2019-08-013-22/+39
| | | | | | | | | | | Previously pragma annotation tokens were described as any other annotations in TokenKinds.def. This change introduces special macro PRAGMA_ANNOTATION for the pragma descriptions. It allows implementing checks that deal with pragma annotations only. Differential Revision: https://reviews.llvm.org/D65405 llvm-svn: 367575
* Rename two clang tests from .cc to .cpp.Nico Weber2019-08-012-2/+1
| | | | | | | | | | clang/test/lit.cfg.py doesn't list .cc as test extension, so these tests never ran. Tweak one of the two tests to actually pass, now that it runs. (The other one was already passing.) llvm-svn: 367574
* Add support for openSUSE RISC-V tripleSam Elliott2019-08-017-1/+22
| | | | | | | | | | | | | | | | Reviewers: asb Reviewed By: asb Subscribers: lenary, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, lebedev.ri, kito-cheng, shiva0217, rogfer01, dexonsmith, rkruppe, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D63497 Patch by Andreas Schwab (schwab) llvm-svn: 367565
* [RISCV] Add FreeBSD targetsSam Elliott2019-08-013-6/+34
| | | | | | | | | | | | | | | | Reviewers: asb Reviewed By: asb Subscribers: simoncook, s.egerton, lenary, psnobl, benna, mhorne, emaste, kito-cheng, shiva0217, rogfer01, rkruppe, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57795 Patch by James Clarke (jrtc27) llvm-svn: 367557
* [Parser] Change parameter type from int to enumSerge Pavlov2019-08-014-6/+6
| | | | | | | | | Some parser functions accept argument of type unsigned while it is actually of type DeclSpec::TST. No functional changes. Differential Revision: https://reviews.llvm.org/D65406 llvm-svn: 367545
* [Preprocessor] Always discard body of #define if we failed to parse itIlya Biryukov2019-08-013-5/+29
| | | | | | | | | | | | | | | | | | | | Summary: Preivously we would only discard it if we failed to parse parameter lists. If we do not consume the body, parser sees tokens inside directive. In turn, this leads to spurious diagnostics and a crash in TokenBuffer, see the added tests. Reviewers: sammccall Reviewed By: sammccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65517 llvm-svn: 367530
* Delay emitting dllexport explicitly defaulted members until the class is ↵Hans Wennborg2019-08-014-2/+22
| | | | | | | | | | | | | | | | | | | | fully parsed (PR40006) This is similar to r245139, but that only addressed dllexported classes. It was still possible to run into the same problem with dllexported members in an otherwise normal class (see bug). This uses the same strategy to fix: delay defining the method until the whole class has been parsed. (The easiest way to see the ordering problem is in Parser::ParseCXXMemberSpecification(): it calls ParseLexedMemberInitializers() *after* ActOnFinishCXXMemberDecls(), which was trying to define the dllexport method. Now we delay it to ActOnFinishCXXNonNestedClass() which is called after both of those.) Differential revision: https://reviews.llvm.org/D65511 llvm-svn: 367520
* [Sema] Enable -Wimplicit-float-conversion for integral to floating point ↵Ziang Wan2019-08-011-17/+4
| | | | | | | | precision loss Fix one test case for it to be system-independent. llvm-svn: 367502
* [Sema] Enable -Wimplicit-float-conversion for integral to floating point ↵Ziang Wan2019-08-017-21/+149
| | | | | | | | | | | | | | | | precision loss Issue an warning when the code tries to do an implicit int -> float conversion, where the float type ha a narrower significant than the float type. The new warning is controlled by flag -Wimplicit-int-float-conversion, under -Wimplicit-float-conversion and -Wconversion. It is also silenced when c++11 narrowing warning is issued. Differential Revision: https://reviews.llvm.org/D64666 llvm-svn: 367497
* [clang][ARM] Fix msvc arm{64} builtins to use int on LP64 systems.Michael J. Spencer2019-07-314-49/+275
| | | | | | | | | | | | The `InterlockedX_{acq,nf,rel}` functions deal with 32 bits which is long on MSVC, but int on most other systems. This also checks that `ReadStatusRegister` and `WriteStatusRegister` have the correct type on aarch64-darwin. Differential Revision: https://reviews.llvm.org/D64164 llvm-svn: 367479
* [NFC][clang] Refactor getCompilationPhases()+Types.def step 3.Puyan Lotfi2019-07-313-64/+68
| | | | | | | | | | | | | Second landing attempt: Changed TY_ObjCXXHeader to TY_PP_ObjCXXHeader to fix -xobjective-c++-header. This time I verified against preprocessor output. Dropping the 'u' entry and the entire Flags table from Types.def. Now it'll be a bit easier to tablegenify this. Differential Revision: https://reviews.llvm.org/D65308 llvm-svn: 367478
* [InstCombine] canonicalize fneg before fmul/fdivSanjay Patel2019-07-311-12/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reverse the canonicalization of fneg relative to fmul/fdiv. That makes it easier to implement the transforms (and possibly other fneg transforms) in 1 place because we can always start the pattern match from fneg (either the legacy binop or the new unop). There's a secondary practical benefit seen in PR21914 and PR42681: https://bugs.llvm.org/show_bug.cgi?id=21914 https://bugs.llvm.org/show_bug.cgi?id=42681 ...hoisting fneg rather than sinking seems to play nicer with LICM in IR (although this change may expose analysis holes in the other direction). 1. The instcombine test changes show the expected neutral IR diffs from reversing the order. 2. The reassociation tests show that we were missing an optimization opportunity to fold away fneg-of-fneg. My reading of IEEE-754 says that all of these transforms are allowed (regardless of binop/unop fneg version) because: "For all other operations [besides copy/abs/negate/copysign], this standard does not specify the sign bit of a NaN result." In all of these transforms, we always have some other binop (fadd/fsub/fmul/fdiv), so we are free to flip the sign bit of a potential intermediate NaN operand. (If that interpretation is wrong, then we must already have a bug in the existing transforms?) 3. The clang tests shouldn't exist as-is, but that's effectively a revert of rL367149 (the test broke with an extension of the pre-existing fneg canonicalization in rL367146). Differential Revision: https://reviews.llvm.org/D65399 llvm-svn: 367447
OpenPOWER on IntegriCloud