summaryrefslogtreecommitdiffstats
path: root/clang/test/Frontend
Commit message (Collapse)AuthorAgeFilesLines
...
* The test was fixed.Andrew V. Tischenko2018-04-101-1/+1
| | | | llvm-svn: 329693
* -ftime-report switch support in Clang.Andrew V. Tischenko2018-04-101-0/+147
| | | | | | | | | | The current support of the feature produces only 2 lines in report: -Some general Code Generation Time; -Total time of Backend Consumer actions. This patch extends Clang time report with new lines related to Preprocessor, Include Filea Search, Parsing, etc. Differential Revision: https://reviews.llvm.org/D43578 llvm-svn: 329684
* [Attr] Merge two dependent tests from different directoriesJoel E. Denny2018-03-131-5/+0
| | | | | | Suggested at: https://reviews.llvm.org/D43248 llvm-svn: 327456
* Reland "[Attr] Fix parameter indexing for several attributes"Joel E. Denny2018-03-131-0/+5
| | | | | | | | | Relands r326602 (reverted in r326862) with new test and fix for PR36620. Differential Revision: https://reviews.llvm.org/D43248 llvm-svn: 327405
* Recommit r324107 again.Rafael Espindola2018-02-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The difference from the previous try is that we no longer directly access function declarations from position independent executables. It should work, but currently doesn't with some linkers. It now includes a fix to not mark available_externally definitions as dso_local. Original message: Start setting dso_local in clang. This starts adding dso_local to clang. The hope is to eventually have TargetMachine::shouldAssumeDsoLocal go away. My objective for now is to move enough of it to clang to remove the need for the TargetMachine one to handle PIE copy relocations and -fno-plt. With that it should then be easy to implement a -fno-copy-reloc in clang. This patch just adds the cases where we assume a symbol to be local based on the file being compiled for an executable or a shared library. llvm-svn: 324535
* Revert "Recommit r324107."Rafael Espindola2018-02-071-2/+2
| | | | | | | | | | | | | | This reverts commit r324500. The bots found two failures: ThreadSanitizer-x86_64 :: Linux/pie_no_aslr.cc ThreadSanitizer-x86_64 :: pie_test.cc when using gold. The issue is a limitation in gold when building pie binaries. I will investigate how to work around it. llvm-svn: 324505
* Recommit r324107.Rafael Espindola2018-02-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | It now includes a fix to not mark available_externally definitions as dso_local. Original message: Start setting dso_local in clang. This starts adding dso_local to clang. The hope is to eventually have TargetMachine::shouldAssumeDsoLocal go away. My objective for now is to move enough of it to clang to remove the need for the TargetMachine one to handle PIE copy relocations and -fno-plt. With that it should then be easy to implement a -fno-copy-reloc in clang. This patch just adds the cases where we assume a symbol to be local based on the file being compiled for an executable or a shared library. llvm-svn: 324500
* Revert "Start setting dso_local in clang."Rafael Espindola2018-02-021-2/+2
| | | | | | | | This reverts commit r324107. I will have to test it on OS X. llvm-svn: 324108
* Start setting dso_local in clang.Rafael Espindola2018-02-021-2/+2
| | | | | | | | | | | | | | | | This starts adding dso_local to clang. The hope is to eventually have TargetMachine::shouldAssumeDsoLocal go away. My objective for now is to move enough of it to clang to remove the need for the TargetMachine one to handle PIE copy relocations and -fno-plt. With that it should then be easy to implement a -fno-copy-reloc in clang. This patch just adds the cases where we assume a symbol to be local based on the file being compiled for an executable or a shared library. llvm-svn: 324107
* Always allow "#pragma region".Matt Davis2018-01-271-0/+5
| | | | | | | | | | | | | | | | | | | | | Summary: Both MS and PS4 targets are capable of recognizing the existence of: #pragma region, #pragma endregion. Since this pragma is only a hint for certain editors, and has no logic, it seems helpful to permit this pragma in all cases, not just MS compatibility mode. Reviewers: rnk, rsmith, majnemer Reviewed By: majnemer Subscribers: Quuxplusone, probinson, majnemer, cfe-commits Differential Revision: https://reviews.llvm.org/D42248 llvm-svn: 323577
* [Driver] Suggest correctly spelled driver optionsBrian Gesiak2018-01-061-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Depends on https://reviews.llvm.org/D41732. Utilities such as `opt`, when invoked with arguments that are very nearly spelled correctly, suggest the correctly spelled options: ``` bin/opt -hel opt: Unknown command line argument '-hel'. Try: 'bin/opt -help' opt: Did you mean '-help'? ``` Clang, on the other hand, prior to this commit, does not: ``` bin/clang -hel clang-6.0: error: unknown argument: '-hel' ``` This commit makes use of the new libLLVMOption API from https://reviews.llvm.org/D41732 in order to provide correct suggestions: ``` bin/clang -hel clang-6.0: error: unknown argument: '-hel', did you mean '-help'? ``` Test Plan: `check-clang` Reviewers: yamaguchi, v.g.vassilev, teemperor, ruiu, bruno Reviewed By: bruno Subscribers: bruno, jroelofs, cfe-commits Differential Revision: https://reviews.llvm.org/D41733 llvm-svn: 321917
* Use POSIX argument syntax in test rewrite-includes-messages.cHubert Tong2018-01-041-1/+1
| | | | | | | Invoke diff such that options precede operands. Not doing so leads to unspecified behaviour under the LSB. llvm-svn: 321830
* Re-commit r321223, which adds a printing policy to the ASTDumper.Aaron Ballman2017-12-211-326/+326
| | | | | | | | This allows you to dump C++ code that spells bool instead of _Bool, leaves off the elaborated type specifiers when printing struct or class names, and other C-isms. Fixes the -Wreorder issue and fixes the ast-dump-color.cpp test. llvm-svn: 321310
* Reverting r321223 and its follow-up commit because of failing bots due to ↵Aaron Ballman2017-12-201-326/+326
| | | | | | Misc/ast-dump-color.cpp. llvm-svn: 321229
* Add a printing policy to the ASTDumper.Aaron Ballman2017-12-201-326/+326
| | | | | | This allows you to dump C++ code that spells bool instead of _Bool, leaves off the elaborated type specifiers when printing struct or class names, and other C-isms. llvm-svn: 321223
* [VerifyDiagnosticConsumer] support -verify=<prefixes>Hal Finkel2017-12-162-2/+122
| | | | | | | | | | | | | | | | | | | | This mimics FileCheck's --check-prefixes option. The default prefix is "expected". That is, "-verify" is equivalent to "-verify=expected". The goal is to permit exercising a single test suite source file with different compiler options producing different sets of diagnostics. While cpp can be combined with the existing -verify to accomplish the same goal, source is often easier to maintain when it's not cluttered with preprocessor directives or duplicate passages of code. For example, this patch also rewrites some existing clang tests to demonstrate the benefit of this feature. Patch by Joel E. Denny, thanks! Differential Revision: https://reviews.llvm.org/D39694 llvm-svn: 320908
* [TextDiagnosticBuffer] Fix diagnostic note emission orderHal Finkel2017-12-161-0/+10
| | | | | | | | | | | | The frontend currently groups diagnostics from the command line according to diagnostic level, but that places all notes last. Fix that by emitting such diagnostics in the order they were generated. Patch by Joel E. Denny, thanks! Differential Revision: https://reviews.llvm.org/D40995 llvm-svn: 320904
* Fix the second part of the broken comment from r306079Adam Nemet2017-12-011-2/+6
| | | | | | | | The driver-based test is still not identical to the front-end line, remove the hotness threshold from there and add a new front-end based test with threshold. llvm-svn: 319578
* Fix opt-remark with hotness testcase for sample-based PGOAdam Nemet2017-12-012-7/+7
| | | | | | | | | | | | 1. Require hotness on all remark lines with -verify. 3. Fix the samplePGO file to actually produce hotness on each line. The second remark has hotness 60 rather 30 which I don't quite understand but testing this is strictly better than before. It also unblocks the commit of D40678. llvm-svn: 319577
* Partially fix comment in test broken in r306079 and r306948Adam Nemet2017-12-011-6/+6
| | | | | | | | | | | A RUN line was referring to the previous RUN line but a new test was added in between them. Just reorder the lines. Note this still does not completely fix this the brokenness of the comment as the driver-based test gained a new hotness-threshold argument in r306948 but I'll fix that is a separate commit. llvm-svn: 319576
* [X86] Make sure 'knm' is accepted by -target-cpuCraig Topper2017-11-191-0/+1
| | | | llvm-svn: 318620
* [X86] Add icelake CPU support for -march.Craig Topper2017-11-191-0/+1
| | | | llvm-svn: 318617
* [PGO] Detect more structural changes with the stable hashVedant Kumar2017-11-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lifting from Bob Wilson's notes: The hash value that we compute and store in PGO profile data to detect out-of-date profiles does not include enough information. This means that many significant changes to the source will not cause compiler warnings about the profile being out of date, and worse, we may continue to use the outdated profile data to make bad optimization decisions. There is some tension here because some source changes won't affect PGO and we don't want to invalidate the profile unnecessarily. This patch adds a new hashing scheme which is more sensitive to loop nesting, conditions, and out-of-order control flow. Here are examples which show snippets which get the same hash under the current scheme, and different hashes under the new scheme: Loop Nesting Example -------------------- // Snippet 1 while (foo()) { while (bar()) {} } // Snippet 2 while (foo()) {} while (bar()) {} Condition Example ----------------- // Snippet 1 if (foo()) bar(); baz(); // Snippet 2 if (foo()) bar(); else baz(); Out-of-order Control Flow Example --------------------------------- // Snippet 1 while (foo()) { if (bar()) {} baz(); } // Snippet 2 while (foo()) { if (bar()) continue; baz(); } In each of these cases, it's useful to differentiate between the snippets because swapping their profiles gives bad optimization hints. The new hashing scheme considers some logical operators in an effort to detect more changes in conditions. This isn't a perfect scheme. E.g, it does not produce the same hash for these equivalent snippets: // Snippet 1 bool c = !a || b; if (d && e) {} // Snippet 2 bool f = d && e; bool c = !a || b; if (f) {} This would require an expensive data flow analysis. Short of that, the new hashing scheme looks reasonably complete, based on a scan over the statements we place counters on. Profiles which use the old version of the PGO hash remain valid and can be used without issue (there are tests in tree which check this). rdar://17068282 Differential Revision: https://reviews.llvm.org/D39446 llvm-svn: 318229
* Switch -mcount and -finstrument-functions to emit EnterExitInstrumenter ↵Hans Wennborg2017-11-141-32/+32
| | | | | | | | | | | | | | | | attributes This updates -mcount to use the new attribute names (LLVM r318195), and switches over -finstrument-functions to also use these attributes rather than inserting instrumentation in the frontend. It also adds a new flag, -finstrument-functions-after-inlining, which makes the cygprofile instrumentation get inserted after inlining rather than before. Differential Revision: https://reviews.llvm.org/D39331 llvm-svn: 318199
* Extend -ast-dump for CXXRecordDecl to dump the flags from the DefinitionData.Richard Smith2017-09-221-2/+2
| | | | llvm-svn: 313943
* Fix ClangDiagnosticHandler::is*RemarkEnabled membersAdam Nemet2017-09-191-0/+11
| | | | | | | Apparently these weren't really working. I added test coverage and fixed the typo in the name and the parameter. llvm-svn: 313653
* Add _Float16 as a C/C++ source language typeSjoerd Meijer2017-09-081-3/+3
| | | | | | | Pacify the windows builder; fixed the new test as on Windows some additional attributes are printed. llvm-svn: 312798
* Recommit "Add _Float16 as a C/C++ source language type"Sjoerd Meijer2017-09-081-0/+326
| | | | | | | | This is a recommit of r312781; in some build configurations variable names are omitted, so changed the new regression test accordingly. llvm-svn: 312794
* Revert "Add _Float16 as a C/C++ source language type"Sjoerd Meijer2017-09-081-326/+0
| | | | | | | The clang-with-lto-ubuntu bot didn't like the new regression test, revert while I investigate the issue. llvm-svn: 312784
* Add _Float16 as a C/C++ source language typeSjoerd Meijer2017-09-081-0/+326
| | | | | | | | | | | This adds _Float16 as a source language type, which is a 16-bit floating point type defined in C11 extension ISO/IEC TS 18661-3. In follow up patches documentation and more tests will be added. Differential Revision: https://reviews.llvm.org/D33719 llvm-svn: 312781
* Add flag to request Clang is ABI-compatible with older versions of itselfRichard Smith2017-08-261-0/+15
| | | | | | | | | | | | | | | | | | This patch adds a flag -fclang-abi-compat that can be used to request that Clang attempts to be ABI-compatible with some older version of itself. This is provided on a best-effort basis; right now, this can be used to undo the ABI change in r310401, reverting Clang to its prior C++ ABI for pass/return by value of class types affected by that change, and to undo the ABI change in r262688, reverting Clang to using integer registers rather than SSE registers for passing <1 x long long> vectors. The intent is that we will maintain this backwards compatibility path as we make ABI-breaking fixes in future. The reversion to the old behavior for r310401 is also applied to the PS4 target since that change is not part of its platform ABI (which is essentially to do whatever Clang 3.2 did). llvm-svn: 311823
* Remove .gitattributes, add comment to lineendings.Erich Keane2017-08-242-3/+1
| | | | llvm-svn: 311732
* [Preprocessor] Correct internal token parsing of newline characters in CRLFErich Keane2017-08-242-0/+23
| | | | | | | | | | | | | | | | | | | | Discovered due to a goofy git setup, the test system-headerline-directive.c (and a few others) failed because the token-consumption will consume only the '\r' in CRLF, making the preprocessor's printed value give the wrong line number when returning from an include. For example: (line 1):#include <noline.h>\r\n The "file exit" code causes the printer to try to print the 'returned to the main file' line. It looks up what the current line number is. However, since the current 'token' is the '\n' (since only the \r was consumed), it will give the line number as '1", not '2'. This results in a few failed tests, but more importantly, results in error messages being incorrect when compiling a previously preprocessed file. Differential Revision: https://reviews.llvm.org/D37079 llvm-svn: 311683
* [clang] Fix tests for Emitting Single Inline RemarkSam Elliott2017-08-212-4/+2
| | | | | | | | | | | | | | Summary: This change depends on https://reviews.llvm.org/D36054 and should be landed at the same time. Reviewers: anemet Reviewed By: anemet Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D36949 llvm-svn: 311347
* [ValueTracking] Enabling ValueTracking patch by default (recommit). Part 1.Nikolai Bozhenov2017-08-101-1/+1
| | | | | | | | | | | | | | | The original patch was an improvement to IR ValueTracking on non-negative integers. It has been checked in to trunk (D18777, r284022). But was disabled by default due to performance regressions. Perf impact has improved. The patch would be enabled by default. Reviewers: reames, hfinkel Differential Revision: https://reviews.llvm.org/D34101 Patch by: Olga Chupina <olga.chupina@intel.com> llvm-svn: 310582
* [Support] Use FILE_SHARE_DELETE to fix RemoveFileOnSignal on WindowsReid Kleckner2017-08-041-0/+7
| | | | | | | | | | | | | | | | | Summary: Tools like clang that use RemoveFileOnSignal on their output files weren't actually able to clean up their outputs before this change. Now the call to llvm::sys::fs::remove succeeds and the temporary file is deleted. This is a stop-gap to fix clang before implementing the solution outlined in PR34070. Reviewers: davide Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D36337 llvm-svn: 310137
* Remove Bitrig: Clang ChangesErich Keane2017-07-211-8/+0
| | | | | | | | Bitrig code has been merged back to OpenBSD, thus the OS has been abandoned. Differential Revision: https://reviews.llvm.org/D35708 llvm-svn: 308797
* Un-revert "[Driver] Add -fdiagnostics-hotness-threshold"Brian Gesiak2017-07-012-5/+17
| | | | | | | | Summary: Un-revert https://reviews.llvm.org/D34868, but with a slight tweak to the documentation to fix an error -- I had used the wrong syntax for a link. llvm-svn: 306948
* Revert "[Driver] Add -fdiagnostics-hotness-threshold"Brian Gesiak2017-07-012-17/+5
| | | | | | | Summary: The commit caused a documentation breakage. llvm-svn: 306946
* [Driver] Add -fdiagnostics-hotness-thresholdBrian Gesiak2017-07-012-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Depends on https://reviews.llvm.org/D34867. Add a Clang frontend option to enable optimization remark hotness thresholds, which were added to LLVM in https://reviews.llvm.org/D34867. This prevents diagnostics that do not meet a minimum hotness threshold from being output. When generating optimization remarks for large codebases with a ton of cold code paths, this option can be used to limit the optimization remark output at a reasonable size. Discussion of this change can be read here: http://lists.llvm.org/pipermail/llvm-dev/2017-June/114377.html Reviewers: anemet, davidxl, hfinkel Reviewed By: anemet Subscribers: fhahn, cfe-commits Differential Revision: https://reviews.llvm.org/D34868 llvm-svn: 306945
* [Frontend] 'Show hotness' can be used with a sampling profileBrian Gesiak2017-06-232-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Prior to this change, using `-fdiagnostics-show-hotness` with a sampling profile specified via `-fprofile-sample-use=` would result in the Clang frontend emitting a warning: "argument '-fdiagnostics-show-hotness' requires profile-guided optimization information". Of course, a sampling profile *is* profile-guided optimization information, so the warning is misleading. Furthermore, despite the warning, hotness was displayed based on the data in the sampling profile. Prevent the warning from being emitted when a sampling profile is used, and add a test that verifies this. Reviewers: anemet, davidxl Reviewed By: davidxl Subscribers: danielcdh, cfe-commits Differential Revision: https://reviews.llvm.org/D34082 llvm-svn: 306079
* [PR33394] Avoid lexing editor placeholders when Clang is used onlyAlex Lorenz2017-06-161-0/+4
| | | | | | | | | | | | | | | | for preprocessing r300667 added support for editor placeholder to Clang. That commit didn’t take into account that users who use Clang for preprocessing only (-E) will get the "editor placeholder in source file" error when preprocessing their source (PR33394). This commit ensures that Clang doesn't lex editor placeholders when running a preprocessor only action. rdar://32718000 Differential Revision: https://reviews.llvm.org/D34256 llvm-svn: 305576
* PR32848: There isn't necessarily a FileChanged or FileSkipped for every ↵Richard Smith2017-06-021-0/+6
| | | | | | | | | InclusionDirective callback. In particular, you don't get one if the inclusion directive encountered an error. Don't assert in that case. llvm-svn: 304506
* Don't defer to the GCC driver for linking arm-baremetalJonathan Roelofs2017-05-251-4/+9
| | | | | | | | | | | | | | | Also comes with a cmake cache for building the runtime bits: $ cmake <normal cmake flags> \ -DBAREMETAL_ARMV6M_SYSROOT=/path/to/sysroot \ -DBAREMETAL_ARMV7M_SYSROOT=/path/to/sysroot \ -DBAREMETAL_ARMV7EM_SYSROOT=/path/to/sysroot \ -C /path/to/clang/cmake/caches/BaremetalARM.cmake \ /path/to/llvm https://reviews.llvm.org/D33259 llvm-svn: 303873
* Add test coverage for recent behavior change in GNU line marker pre-processingReid Kleckner2017-05-233-6/+11
| | | | llvm-svn: 303642
* Give files from #line the characteristics of the current fileReid Kleckner2017-05-223-0/+23
| | | | | | | | | | This allows #line directives to appear in system headers that have code that clang would normally warn on. This is compatible with GCC, which is easy to test by running `gcc -E`. Fixes PR30752 llvm-svn: 303582
* PR26771: don't forget the " 2" (returning from #included file) linemarker ↵Richard Smith2017-04-292-0/+8
| | | | | | after including an empty file with -frewrite-includes. llvm-svn: 301727
* Add pragma to perform module import and use it in -E output.Richard Smith2017-04-291-11/+16
| | | | | | | | | | | | | | | | | | | | | Many of our supported configurations support modules but do not have any first-class syntax to perform a module import. This leaves us with a problem: there is no way to represent the expansion of a #include that imports a module in the -E output for such languages. (We don't want to just leave it as a #include because that requires the consumer of the preprocessed source to have the same file system layout and include paths as the creator.) This patch adds a new pragma: #pragma clang module import MODULE.NAME.HERE that imports a module, and changes -E and -frewrite-includes to use it when rewriting a #include that maps to a module import. We don't make any attempt to use a native language syntax import if one exists, to get more consistent output. (If in the future, @import and #include have different semantics in some way, the pragma will track the #include semantics.) llvm-svn: 301725
* Don't accept -std= values that would switch us to a different source language.Richard Smith2017-04-261-1/+3
| | | | | | | | | | | | | | | | | | | | | We already prohibited this in most cases (in r130710), but had some bugs in our enforcement of this rule. Specifically, this prevents the following combinations: * -x c -std=clN.M, which would previously effectively act as if -x cl were used, despite the input being a C source file. (-x cl -std=cNN continues to be disallowed.) * -x c++ -std=cuda, which would previously select C++98 + CUDA, despite that not being a C++ standard. (-x cuda -std=c++NN is still permitted, and selects CUDA with the given C++ standard as its base language. -x cuda -std=cuda is still supported with the meaning of CUDA + C++98.) * -x renderscript -std=c++NN, which would previously form a hybrid "C++ with RenderScript extensions" language. We could support such a thing, but shouldn't do so by accident. llvm-svn: 301497
* Add -iframeworkwithsysroot compiler optionAlex Lorenz2017-03-131-0/+1
| | | | | | | | | | | | | This commit adds support for a new -iframeworkwithsysroot compiler option which allows the user to specify a framework path that can be prefixed with the sysroot. This option is similar to the -iwithsysroot option that exists to supplement -isystem. rdar://21316352 Differential Revision: https://reviews.llvm.org/D30183 llvm-svn: 297614
OpenPOWER on IntegriCloud