summaryrefslogtreecommitdiffstats
path: root/clang/test/Frontend/Inputs
Commit message (Collapse)AuthorAgeFilesLines
* [clang][test][NFC] Use more widely supported sanitizer for file dependency testsJan Korous2020-01-141-0/+0
| | | | | | | | The tests aren't concerned at all by the actual sanitizer - only by blacklist being reported as a dependency. We're unfortunately limited by platform support for any particular sanitizer but we can at least use one that is widely supported. Post-commit review: https://reviews.llvm.org/D72729
* actually also compile output in tests for -frewrite-includesLubos Lunak2019-09-188-8/+8
| | | | | | | | | Checking that the created output matches something is nice, but this should also check whether the output makes sense. Differential Revision: https://reviews.llvm.org/D63979 llvm-svn: 372250
* Reland r371785: Add -Wpoison-system-directories warningManoj Gupta2019-09-135-0/+0
| | | | | | | | | | | | | | | | | | | | When using clang as a cross-compiler, we should not use system headers to do the compilation. This CL adds support of a new warning flag -Wpoison-system-directories which emits warnings if --sysroot is set and headers from common host system location are used. By default the warning is disabled. The intention of the warning is to catch bad includes which are usually generated by third party build system not targeting cross-compilation. Such cases happen in Chrome OS when someone imports a new package or upgrade one to a newer version from upstream. This is reland of r371785 with a fix to test file. Patch by: denik (Denis Nikitin) llvm-svn: 371878
* Revert r371785.Manoj Gupta2019-09-135-0/+0
| | | | | | r371785 is causing fails on clang-hexagon-elf buildbots. llvm-svn: 371799
* Add -Wpoison-system-directories warningManoj Gupta2019-09-125-0/+0
| | | | | | | | | | | | | | | | | | When using clang as a cross-compiler, we should not use system headers to do the compilation. This CL adds support of a new warning flag -Wpoison-system-directories which emits warnings if --sysroot is set and headers from common host system location are used. By default the warning is disabled. The intention of the warning is to catch bad includes which are usually generated by third party build system not targeting cross-compilation. Such cases happen in Chrome OS when someone imports a new package or upgrade one to a newer version from upstream. Patch by: denik (Denis Nikitin) llvm-svn: 371785
* Move test input file into same directory as test. NFCRichard Trieu2018-05-081-0/+0
| | | | llvm-svn: 331706
* Track skipped files in dependency scanning.Volodymyr Sapsai2018-05-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | It's possible for a header to be a symlink to another header. In this case both will be represented by clang::FileEntry with the same UID and they'll use the same clang::HeaderFileInfo. If you include both headers and use some single-inclusion mechanism like a header guard or #import, one header will get a FileChanged callback, and another FileSkipped. So that we get an accurate dependency file, we therefore need to also implement the FileSkipped callback in dependency scanning. Patch by Pete Cooper. Reviewers: bruno, pete Reviewed By: bruno Subscribers: cfe-commits, jkorous, vsapsai Differential Revision: https://reviews.llvm.org/D30881 llvm-svn: 331319
* Fix evaluation of `__has_include_next` during -frewrite-includes.Volodymyr Sapsai2018-04-132-0/+4
| | | | | | | | | | | | | | | | | | | | | | | `__has_include_next` requires correct DirectoryLookup for being evaluated correctly. We were using Preprocessor::GetCurDirLookup() but we were calling it after the preprocessor finished its work. And in this case CurDirLookup is always nullptr which makes `__has_include_next` behave as `__has_include`. Fix by storing and using CurDirLookup when preprocessor enters a file, not when we rewrite the includes. rdar://problem/36305026 Reviewers: bkramer Reviewed By: bkramer Subscribers: jkorous-apple, cfe-commits Differential Revision: https://reviews.llvm.org/D45603 llvm-svn: 330041
* Fix opt-remark with hotness testcase for sample-based PGOAdam Nemet2017-12-011-5/+5
| | | | | | | | | | | | 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
* [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
* Un-revert "[Driver] Add -fdiagnostics-hotness-threshold"Brian Gesiak2017-07-011-1/+1
| | | | | | | | 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-011-1/+1
| | | | | | | Summary: The commit caused a documentation breakage. llvm-svn: 306946
* [Driver] Add -fdiagnostics-hotness-thresholdBrian Gesiak2017-07-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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-231-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Add test coverage for recent behavior change in GNU line marker pre-processingReid Kleckner2017-05-232-0/+2
| | | | llvm-svn: 303642
* Give files from #line the characteristics of the current fileReid Kleckner2017-05-222-0/+3
| | | | | | | | | | 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-291-0/+0
| | | | | | after including an empty file with -frewrite-includes. llvm-svn: 301727
* Reapply r281276 with passing -emit-llvm in one of the testsAdam Nemet2016-09-131-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original commit message: Add -fdiagnostics-show-hotness Summary: I've recently added the ability for optimization remarks to include the hotness of the corresponding code region. This uses PGO and allows filtering of the optimization remarks by relevance. The idea was first discussed here: http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334 The general goal is to produce a YAML file with the remarks. Then, an external tool could dynamically filter these by hotness and perhaps by other things. That said it makes sense to also expose this at the more basic level where we just include the hotness info with each optimization remark. For example, in D22694, the clang flag was pretty useful to measure the overhead of the additional analyses required to include hotness. (Without the flag we don't even run the analyses.) For the record, Hal has already expressed support for the idea of this patch on IRC. Differential Revision: https://reviews.llvm.org/D23284 llvm-svn: 281293
* Revert "Add -fdiagnostics-show-hotness"Adam Nemet2016-09-131-25/+0
| | | | | | | | This reverts commit r281276. Many bots are failing. llvm-svn: 281279
* Add -fdiagnostics-show-hotnessAdam Nemet2016-09-121-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: I've recently added the ability for optimization remarks to include the hotness of the corresponding code region. This uses PGO and allows filtering of the optimization remarks by relevance. The idea was first discussed here: http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334 The general goal is to produce a YAML file with the remarks. Then, an external tool could dynamically filter these by hotness and perhaps by other things. That said it makes sense to also expose this at the more basic level where we just include the hotness info with each optimization remark. For example, in D22694, the clang flag was pretty useful to measure the overhead of the additional analyses required to include hotness. (Without the flag we don't even run the analyses.) For the record, Hal has already expressed support for the idea of this patch on IRC. Differential Revision: https://reviews.llvm.org/D23284 llvm-svn: 281276
* Add support for -fdiagnostics-absolute-paths: printing absolute paths in ↵Hans Wennborg2016-08-261-0/+3
| | | | | | | | diagnostics Differential Revision: https://reviews.llvm.org/D23816 llvm-svn: 279827
* Fix the sample profile format that breaks in test ↵Dehao Chen2015-09-301-1/+1
| | | | | | | | http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/505 http://reviews.llvm.org/D13145 llvm-svn: 248869
* Support using sample profiles with partial debug info (driver)Diego Novillo2014-10-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | 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
* Revert "clang/test/Driver/crash-report.c: This requires rewriter for ↵Alp Toker2014-07-1610-0/+23
| | | | | | | | | | | | | | | | | | | | | -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
* Move clang/test/Frontend/rewrite-*.c to clang/test/Frontend/Rewriter/NAKAMURA Takumi2014-07-1610-23/+0
| | | | llvm-svn: 213146
* write a line marker right before adding included fileLubos Lunak2014-05-011-0/+4
| | | | | | | | Enclosing the original #include directive inside #if 0 adds lines, so warning/errors messages would have the line number off in "In file included from <file>:<line>:", so add line marker to fix this. llvm-svn: 207795
* revert r207756Lubos Lunak2014-05-011-4/+0
| | | | | | | | There's nothing wrong with the change itself, but test/Frontend/rewrite-includes-messages.c fails without another not-yet-committed fix. llvm-svn: 207762
* write a line marker right before adding included fileLubos Lunak2014-05-011-0/+4
| | | | | | | | Enclosing the original #include directive inside #if 0 adds lines, so warning/errors messages would have the line number off in "In file included from <file>:<line>:", so add line marker to fix this. llvm-svn: 207756
* strip UTF-8 BOM in -frewrite-includes (PR#15664)Lubos Lunak2013-11-271-0/+1
| | | | llvm-svn: 195877
* Ignore test Inputs globally and remove redundant lit.local.cfg filesAlp Toker2013-11-151-1/+0
| | | | | | | | | | By adding a default config.excludes pattern we can avoid individual suppressions in subdirectories. This matches LLVM's lit.cfg which also excludes a few other common non-test filenames for consistency. llvm-svn: 194814
* rewrite-includes: Rewrite __has_include(_next) to get rid of a host dependency.Benjamin Kramer2013-04-161-0/+5
| | | | | | | | | | | | | | This broke e.g. compiling a crash report from a glibc system on Darwin. Sadly, the implementation had to game the lexer a lot as we're not using a real preprocessor here. It also doesn't handle special cases like arbitrary macros in __has_include, but since this macro isn't common outside of clang's headers we can get away with that. Fixes PR14422. Differential Revision: http://llvm-reviews.chandlerc.com/D594 llvm-svn: 179616
* Add -isystem-prefix and -ino-system-prefix arguments, which can be used toRichard Smith2012-06-136-0/+14
| | | | | | | | | | override whether headers are system headers by checking for prefixes of the header name specified in the #include directive. This allows warnings to be disabled for third-party code which is found in specific subdirectories of include paths. llvm-svn: 158418
* Add a -rewrite-includes option, which is similar to -rewrite-macros, but ↵David Blaikie2012-06-067-0/+13
| | | | | | | | | only expands #include directives. Patch contributed by Lubos Lunak (l.lunax@suse.cz). Review by Matt Beaumont-Gay (matthewbg@google.com). llvm-svn: 158093
* Frontend: Support -iframework.Daniel Dunbar2011-10-181-0/+1
| | | | llvm-svn: 142418
* Frontend: Add basic -H support.Daniel Dunbar2010-08-244-0/+4
- I didn't implement the GCC "multiple include guard" detection parts, because it doesn't seem useful or obvious. llvm-svn: 111983
OpenPOWER on IntegriCloud