summaryrefslogtreecommitdiffstats
path: root/clang/test/Frontend
Commit message (Collapse)AuthorAgeFilesLines
* Frontend: Fix SourceColumnMap assertion failure on non-ascii characters.Logan Chien2015-01-081-0/+37
| | | | | | | | | | | | | | | | | | | | If there are some non-ascii character in the input source code, the column index might be smallar than the byte index. This will result in two possible assertion failures. This CL fixes the computation of the column index and byte index. 1. The assertion in startOfNextColumn() and startOfPreviousColumn() should not be raised when the byte index is greater than the column index since the non-ascii characters may use more than one bytes to store a character in a column. 2. The length of the caret line should be equal to the number of columns of source line, instead of the length of the source line. Otherwise, the assertion in selectInterestingSourceRegion will be raised because the removed columns plus the kept columns are not greater than the max column, which means that we should not remove any column at all. llvm-svn: 225442
* Add driver flags -ftrigraphs, -fno-trigraphs.Nico Weber2014-12-231-2/+2
| | | | | | | | | | | | | | | | | -trigraphs is now an alias for -ftrigraphs. -fno-trigraphs makes it possible to explicitly disable trigraphs, which couldn't be done before. clang -std=c++11 -fno-trigraphs now builds without GNU extensions, but with trigraphs disabled. Previously, trigraphs were only disabled in GNU modes or with -std=c++1z. Make the new -f flags the cc1 interface too. This requires changing -trigraphs to -ftrigraphs in a few cc1 tests. Related to PR21974. llvm-svn: 224790
* Disable trigraphs in microsoft mode by default. Matches cl.exe.Nico Weber2014-12-221-2/+4
| | | | | | | | | | The default value of Opts.Trigraphs now no longer depends solely on the language input kind, so move the code out of setLangDefaults(). Also make sure that Opts.MSVCCompat is set before the Trigraph code runs. Related to PR21974. llvm-svn: 224719
* Add test coverage for cc1's trigraph option handling.Nico Weber2014-12-221-0/+15
| | | | llvm-svn: 224714
* Destroy the diagnostic client first in ~DiagnosticEngineReid Kleckner2014-12-171-0/+6
| | | | | | | | | | | | Add a comment and a test to ~DiagnosticEngine about the ordering requirements on the teardown of DiagnosticConsumer. This could also be accomplished by rearranging the fields of ~DiagnosticEngine, but I felt that this was a better, more explicit solution. This fixes PR21911, an issue that occurred after the unique_ptr migration in r222193. llvm-svn: 224454
* Fix handling of invalid -O options.Rafael Espindola2014-12-161-3/+4
| | | | | | | | We were checking the value after truncating it to a bitfield. Thanks to Yunzhong Gao for noticing it. llvm-svn: 224378
* Don't actually generate code for testing the frontend's target cpu flag,Chandler Carruth2014-12-091-26/+28
| | | | | | | just verify. This should fix the bots where the x86 backend isn't built into Clang. Sorry for the breakage. llvm-svn: 223779
* Re-work the Clang system for classifying Intel x86 CPUs to use theirChandler Carruth2014-12-091-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | basic microarchitecture names, and add support (with tests) for parsing all of the masic microarchitecture names for CPUs documented to be accepted by GCC with -march. I didn't go back through the 32-bit-only old microarchitectures, but this at least brings the recent architecture names up to speed. This is essentially the follow-up to the LLVM commit r223769 which did similar cleanups for the LLVM CPUs. One particular benefit is that you can now use -march=westmere in Clang and get the LLVM westmere processor which is a different ISA variant (!) and so quite significant. Much like with r223769, I would appreciate the Intel folks carefully thinking about the macros defined, names used, etc for the atom chips and newest primary x86 chips. The current patterns seem quite strange to me, especially here in Clang. Note that I haven't replicated the per-microarchitecture macro defines provided by GCC. I'm really opposed to source code using these rather than using ISA feature macros. llvm-svn: 223776
* Extended list of valid frontend options with '-cl-std=CL2.0'.Anastasia Stulova2014-11-201-0/+9
| | | | | | | This option sets language mode for the compilation of a source file to be OpenCL v2.0. Example: clang -cc1 -cl-std=CL2.0 myfile.cl llvm-svn: 222444
* Frontend: Define __EXCEPTIONS if -fexceptions is passedDavid Majnemer2014-10-271-2/+5
| | | | | | | | | GCC defines __EXCEPTIONS, regardless of language mode, if -fexceptions is passed. We should do the same. This fixes PR21358. llvm-svn: 220714
* Support using sample profiles with partial debug info (driver)Diego Novillo2014-10-222-0/+21
| | | | | | | | | | | | | | | | | | | | | | | Summary: When using a profile, we used to require the use -gmlt so that we could get access to the line locations. This is used to match line numbers in the input profile to the line numbers in the function's IR. But this is actually not necessary. The driver can provide source location tracking without the emission of debug information. In these cases, the annotation 'llvm.dbg.cu' is missing from the IR, but the actual line location annotations are still present. This patch tells the driver to only emit source location tracking when -fprofile-sample-use is present in the command line. Reviewers: echristo, dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5888 llvm-svn: 220383
* This test was updated in r216397, but was failing on Windows due to mixed ↵Aaron Ballman2014-08-261-1/+1
| | | | | | | | path separators as well as case sensitivity of the "no" in "no such file or directory." Rather than revert this file back to its original form, I've made some incredibly ugly regexes so that it will pass everywhere. Note, the path this test reports a failure on (for my Windows setup) is: E:\llvm\llvm\tools\clang\test\Frontend/doesnotexist/somename llvm-svn: 216456
* Update for llvm api change.Rafael Espindola2014-08-251-1/+1
| | | | llvm-svn: 216397
* clang/test/Frontend/print-header-includes.c REQUIRES shell due to "cd".NAKAMURA Takumi2014-08-121-0/+2
| | | | llvm-svn: 215434
* Correctly implement -include search logic.Manuel Klimek2014-08-121-0/+1
| | | | | | | | | | | | | | | According to the gcc docs, -include uses the current working directory for the lookup instead of the main source file. This patch gets rid of NormalizeIncludePath (which relied on an implementation detail of FileManager / FileEntry for the include path logic to work), and instead hands the correct lookup information down to LookupFile. This will allow us to change the FileEntry's behavior regarding its Name caching. llvm-svn: 215433
* Change __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ for versions > 10.9.Bob Wilson2014-08-081-0/+2
| | | | | | | | The previous encoding only allowed a single digit for the minor version number. This changes it to use 2 digits for both the minor version and the revision number. llvm-svn: 215245
* Use -Rblah, not -Wblah, to control remark diagnostics. This was always theRichard Smith2014-08-072-1/+18
| | | | | | | | | | | | | | | | | | | | | | intent when we added remark support, but was never implemented in the general case, because the first -R flags didn't need it. (-Rpass= had special handling to accomodate its argument.) -Rno-foo, -Reverything, and -Rno-everything can be used to turn off a remark, or to turn on or off all remarks. Per discussion on cfe-commits, -Weverything does not affect remarks, and -Reverything does not affect warnings or errors. The only "real" -R flag we have right now is -Rmodule-build; that flag is effectively renamed from -Wmodule-build to -Rmodule-build by this change. -Wpass and -Wno-pass (and their friends) are also renamed to -Rpass and -Rno-pass by this change; it's not completely clear whether we intended to have a -Rpass (with no =pattern), but that is unchanged by this commit, other than the flag name. The default pattern is effectively one which matches no passes. In future, we may want to make the default pattern be .*, so that -Reverything works for -Rpass properly. llvm-svn: 215046
* Revert "clang/test/Driver/crash-report.c: This requires rewriter for ↵Alp Toker2014-07-1622-3/+1
| | | | | | | | | | | | | | | | | | | | | -frewrite-includes. [PR20321]" We've decided to make the core rewriter class and PP rewriters mandatory. They're only a few hundred lines of code in total and not worth supporting as a distinct build configuration, especially since doing so disables key compiler features. This reverts commit r213150. Revert "clang/test: Introduce the feature "rewriter" for --enable-clang-rewriter." This reverts commit r213148. Revert "Move clang/test/Frontend/rewrite-*.c to clang/test/Frontend/Rewriter/" This reverts commit r213146. llvm-svn: 213159
* clang/test: Introduce the feature "rewriter" for --enable-clang-rewriter.NAKAMURA Takumi2014-07-161-0/+2
| | | | llvm-svn: 213148
* Move clang/test/Frontend/rewrite-*.c to clang/test/Frontend/Rewriter/NAKAMURA Takumi2014-07-1621-1/+1
| | | | llvm-svn: 213146
* Trailing linefeed.NAKAMURA Takumi2014-07-161-2/+0
| | | | llvm-svn: 213145
* Avoid non-attributive uses of 'unsupported' in diagnosticsAlp Toker2014-07-141-1/+1
| | | | | | | | | | | | | We don't have a style guide for diagnostic messages, but convention strongly favours the forms: 'attribute is not supported', 'unsupported attribute' We generally avoid: 'attribute is unsupported', 'non-supported attribute' llvm-svn: 212972
* Provide -verify support to match "any" line for diagnostics in included files.Andy Gibbs2014-07-103-4/+32
| | | | | | | | Allow diagnostic checks that originate in included files to be matched without necessarily determining the line number that the diagnostic occurs on. The new syntax replaces the line number with '*'. This extension is limited to diagnostics in included files and may be used where the include file is not part of the test-suite itself. Expected uses are for diagnostics originating in system headers, or for users who use -verify in testing 3rd-party library code where the location of diagnostics in header files may change from revision to revision and their precise location is not important to the success of the test-case. llvm-svn: 212735
* clang-cl: /showIncludes output should go to stdout, not stderr. Fixes PR20217.Nico Weber2014-07-061-4/+4
| | | | llvm-svn: 212383
* Account for differences in grep implementationsAlp Toker2014-06-271-3/+3
| | | | llvm-svn: 211856
* Restore test from r211844 skipping '.file' directivesAlp Toker2014-06-271-8/+8
| | | | | | | At least this answers the question of whether .bc/.ll input processed by the frontend produces identical output to the original compilation. llvm-svn: 211853
* Partially disable test from r211844Alp Toker2014-06-271-2/+4
| | | | | | | ELF assembly contains .line directives that differ based on the input filename. Weaken the test while considering options. llvm-svn: 211849
* Add test coverage for .bc input in the frontendAlp Toker2014-06-271-0/+17
| | | | | | | | | | | | | Test that we can consume LLVM bitcode and additionally check that it produces the same output as a direct compilation. The feature is crashy and has gone untested until now, but we might as well provide some coverage as long as it remains in tree. Also test LL source input in the same way because the existing tests for that don't look convincing. llvm-svn: 211844
* Remove .bc from test config.suffixesAlp Toker2014-06-271-1/+1
| | | | | | This was unused. Besides, a binary file can't really contain lit ShTests. llvm-svn: 211843
* Simplify optimization-remark.c test following r211610Alp Toker2014-06-241-12/+7
| | | | | | | | | | With LocTrackingOnly there's no longer a user-facing distinction so the NDEBUG checks can go away. (Except maybe column info, but -verify only checks line numbers anyway.) Also add a RUN line to validate the traditional !LocTrackingOnly case. llvm-svn: 211622
* Fix test added in r211610 so it doesn't race on output file creation.David Blaikie2014-06-241-1/+1
| | | | llvm-svn: 211615
* Add new debug kind LocTrackingOnly.Diego Novillo2014-06-241-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This new debug emission kind supports emitting line location information in all instructions, but stops code generation from emitting debug info to the final output. This mode is useful when the backend wants to track source locations during code generation, but it does not want to produce debug info. This is currently used by optimization remarks (-Rpass, -Rpass-missed and -Rpass-analysis). When one of the -Rpass flags is used, the front end will enable location tracking, only if no other debug option is enabled. To prevent debug information from being generated, a new debug info kind LocTrackingOnly causes DIBuilder::createCompileUnit() to not emit the llvm.dbg.cu annotation. This blocks final code generation from generating debug info in the back end. Depends on D4234. Reviewers: echristo, dblaikie Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4235 llvm-svn: 211610
* Do not predefine __EXCEPTIONS in clang-cl (PR19977)Hans Wennborg2014-06-101-0/+6
| | | | | | | | Patch by Ehsan Akhgari! (Test tweak by me.) Differential Revision: http://reviews.llvm.org/D4065 llvm-svn: 210582
* Make '-Werror=frame-larger-than=' and associated diagnostic pragmas ↵Alp Toker2014-06-091-2/+2
| | | | | | | | | | | GCC-compatible It turns out the trailing '=' really is part of the option name spelling and treating it as such gets us compatible with GCC's -Werror= and pragmas. (GCC doesn't appear to support any -Wno- form for this diagnostic but we do.) llvm-svn: 210503
* Don't generate assembly in backend diagnostic testsAlp Toker2014-06-062-3/+3
| | | | | | | | | | | A leftover -S was generating unwanted output in the source tree overriding -only flags that normally disable output. This reverts commit r210323 and implements the proper fix. Reported by Timur Iskhodzhanov! llvm-svn: 210326
* Add -o /dev/null to one of the tests as it fails when run from a read-only ↵Timur Iskhodzhanov2014-06-061-2/+2
| | | | | | checkout llvm-svn: 210323
* Provide fallback locations for backend remarksAlp Toker2014-06-052-20/+19
| | | | | | | | | | | | Instead of disembodied diagnostics when debug info is disabled it's now possible to identify the associated function's location in order to provide some amount of of context. We use the definition's body right brace location to differentiate the fallback from diagnostics that genuinely relate to the function declaration itself (a convention also used by gcc). llvm-svn: 210294
* Implement -Wframe-larger-than backend diagnosticAlp Toker2014-06-051-6/+3
| | | | | | | | | | | | | | | | | | Add driver and frontend support for the GCC -Wframe-larger-than=bytes warning. This is the first GCC-compatible backend diagnostic built around LLVM's reporting feature. This commit adds infrastructure to perform reverse lookup from mangled names emitted after LLVM IR generation. We use that to resolve precise locations and originating AST functions, lambdas or block declarations to produce seamless codegen-guided diagnostics. An associated change, StringMap now maintains unique mangled name strings instead of allocating copies. This is a net memory saving in C++ and a small hit for C where we no longer reuse IdentifierInfo storage, pending further optimisation. llvm-svn: 210293
* Fix leak from r210059Alp Toker2014-06-031-3/+2
| | | | | | | Also revert r210096 which temporarily disabled the test while this was being investigated. llvm-svn: 210115
* temporary disable part of a test because it causes clang to leak memory ↵Kostya Serebryany2014-06-031-2/+3
| | | | | | (want to have the sanitizer bot green) llvm-svn: 210096
* Fix -emit-codegen-only to not generate binariesAlp Toker2014-06-031-0/+7
| | | | llvm-svn: 210059
* Remove unnecessary test.Diego Novillo2014-05-301-28/+0
| | | | llvm-svn: 209893
* clang/test/Frontend/Weverything-and-remarks.cpp: Add explicit -target.NAKAMURA Takumi2014-05-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | You could see unexpected result (*.tmp.err) with "-target x86_64-win32". Weverything-and-remarks.cpp:11:9: warning: 'char32_t' type specifier is incompatible with C++98 [-Wc++98-compat] typedef __char32_t char32_t; ^ Weverything-and-remarks.cpp:12:27: error: typedef redefinition with different types ('unsigned long' vs 'unsigned long long') typedef long unsigned int size_t; ^ Weverything-and-remarks.cpp:19:62: warning: dynamic exception specifications are deprecated [-Wdeprecated] static void assign(char_type& __c1, const char_type& __c2) throw() { ^~~~~~~ Weverything-and-remarks.cpp:19:62: note: use 'noexcept' instead static void assign(char_type& __c1, const char_type& __c2) throw() { ^~~~~~~ noexcept Weverything-and-remarks.cpp:25:46: warning: unused parameter '__n' [-Wunused-parameter] size_t __n) { ^ 3 warnings and 1 error generated. llvm-svn: 209878
* Add flags -Rpass-missed and -Rpass-analysis.Diego Novillo2014-05-291-6/+17
| | | | | | | | | | | | | | | | | | | | | | Summary: These two flags are in the same family as -Rpass, but are used in different situations. -Rpass-missed is used by optimizers to inform the user when they tried to apply an optimization but couldn't (or wouldn't). -Rpass-analysis is used by optimizers to report analysis results back to the user (e.g., why the transformation could not be applied). Depends on D3682. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3683 llvm-svn: 209839
* Add missing -S to avoid invoking assembler unnecessarily.Diego Novillo2014-05-291-1/+1
| | | | llvm-svn: 209828
* No longer allow the -std options to entirely override the -x language ↵Aaron Ballman2014-05-291-0/+9
| | | | | | option. This allows -x cuda -std=c++11, for instance. llvm-svn: 209824
* Fix spurious remarks when -Weverything is used.Diego Novillo2014-05-291-0/+28
| | | | | | | | | | | With -Weverything, the backend remarks are enabled. This was causing spurious diagnostics for remarks that we don't yet handle (cf http://reviews.llvm.org/D3683). This will stop being a problem once http://reviews.llvm.org/D3683 is committed. llvm-svn: 209823
* Fix segmentation fault when mixing -Rpass with #line.Diego Novillo2014-05-081-0/+15
| | | | | | | | | | | | | | | | | | | Summary: When using #line directives, FileManager::getFile() will return a nil entry. This triggers an assert in translateFileLineCol(). This patch handles nil FileEntry instances by emitting a note that the location could not be translated back to a SourceLocation. I don't really like this solution, but we are translating presumed locations, so some information has already been lost. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3625 llvm-svn: 208315
* -fsyntax-only for a testLubos Lunak2014-05-011-1/+1
| | | | llvm-svn: 207814
* Use %clang_cc1 in rewrite-includes-messages.c test and drop REQUIRES: shellReid Kleckner2014-05-011-4/+3
| | | | | | This test passes on Windows with lit's shell interpreter. llvm-svn: 207810
OpenPOWER on IntegriCloud