summaryrefslogtreecommitdiffstats
path: root/clang/test/Frontend/rewrite-includes.c
Commit message (Collapse)AuthorAgeFilesLines
* fix build, adjust test also for Windows path separatorLubos Lunak2019-09-181-1/+1
| | | | | | Introduced in 1e9c1d2b7bfc. llvm-svn: 372263
* actually also compile output in tests for -frewrite-includesLubos Lunak2019-09-181-38/+45
| | | | | | | | | 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
* make -frewrite-includes also rewrite conditions in #if/#elifLubos Lunak2019-09-181-8/+45
| | | | | | | | | | | | | | | Those conditions may use __has_include, which needs to be rewritten. The existing code has already tried to rewrite just __has_include, but it didn't work with macro expansion, so e.g. Qt's "#define QT_HAS_INCLUDE(x) __has_include(x)" didn't get handled properly. Since the preprocessor run knows what each condition evaluates to, just rewrite the entire condition. This of course requires that the -frewrite-include pass has the same setup as the following compilation, but that has always been the requirement. Differential Revision: https://reviews.llvm.org/D63508 llvm-svn: 372248
* Fix evaluation of `__has_include_next` during -frewrite-includes.Volodymyr Sapsai2018-04-131-4/+30
| | | | | | | | | | | | | | | | | | | | | | | `__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
* Revert "clang/test/Driver/crash-report.c: This requires rewriter for ↵Alp Toker2014-07-161-0/+184
| | | | | | | | | | | | | | | | | | | | | -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-161-184/+0
| | | | llvm-svn: 213146
* write a line marker right before adding included fileLubos Lunak2014-05-011-0/+10
| | | | | | | | 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
* do not use "1" for line marker for the main fileLubos Lunak2014-05-011-0/+1
| | | | | | | | | | "1" means entering a new file (from a different one), but the main file is not included from anything (and this would e.g. confuse -Wunused-macros to not report unused macros in the main file, see pr15610, or also see pr18948). The line marker is still useful e.g. if the resulting file is renamed or used via a pipe. llvm-svn: 207764
* revert r207756Lubos Lunak2014-05-011-10/+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/+10
| | | | | | | | 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
* clang/test/Frontend/rewrite-includes.c: Tweak expressions for r'\\', not ↵NAKAMURA Takumi2013-08-291-14/+14
| | | | | | r'\', on win32. llvm-svn: 189591
* fix sometimes incorrect line numbers in -frewrite-includes mode (pr#14795)Lubos Lunak2013-07-201-6/+15
| | | | | | | | Every #include is surrounded by #if 0 in order to comment it out, which adds lines. That is fixed up right after, but that all can be inside #if part that is not processed, so fix up also after every end of a conditional part. llvm-svn: 186763
* Add 'not' to commands that are expected to fail.Rafael Espindola2013-07-041-2/+2
| | | | | | | This is at least good documentation, but also opens the possibility of using pipefail. llvm-svn: 185652
* rewrite-includes: Rewrite __has_include(_next) to get rid of a host dependency.Benjamin Kramer2013-04-161-0/+19
| | | | | | | | | | | | | | 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
* Rename -rewrite-includes to -frewrite-includes.David Blaikie2012-06-141-46/+46
| | | | llvm-svn: 158458
* test/Frontend/rewrite-includes.c: Tweak for win32's pathsep.NAKAMURA Takumi2012-06-071-9/+9
| | | | llvm-svn: 158149
* Add a -rewrite-includes option, which is similar to -rewrite-macros, but ↵David Blaikie2012-06-061-0/+145
only expands #include directives. Patch contributed by Lubos Lunak (l.lunax@suse.cz). Review by Matt Beaumont-Gay (matthewbg@google.com). llvm-svn: 158093
OpenPOWER on IntegriCloud