summaryrefslogtreecommitdiff
path: root/lib/Rewrite/Frontend/InclusionRewriter.cpp
Commit message (Collapse)AuthorAge
* [C++11] Use 'nullptr'.Craig Topper2014-05-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208163 91177308-0d34-0410-b5e6-96231b3b80d8
* write a line marker right before adding included fileLubos Lunak2014-05-01
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207795 91177308-0d34-0410-b5e6-96231b3b80d8
* do not use "1" for line marker for the predefines "file" eitherLubos Lunak2014-05-01
| | | | | | | | Similar to r207764. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207794 91177308-0d34-0410-b5e6-96231b3b80d8
* do not use "1" for line marker for the main fileLubos Lunak2014-05-01
| | | | | | | | | | | | "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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207764 91177308-0d34-0410-b5e6-96231b3b80d8
* revert r207756Lubos Lunak2014-05-01
| | | | | | | | | | There's nothing wrong with the change itself, but test/Frontend/rewrite-includes-messages.c fails without another not-yet-committed fix. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207762 91177308-0d34-0410-b5e6-96231b3b80d8
* do not warn about unknown pragmas in modes that do not handle them (pr9537)Lubos Lunak2014-05-01
| | | | | | | | | And refactor to have just one place in code that sets up the empty pragma handlers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207758 91177308-0d34-0410-b5e6-96231b3b80d8
* write a line marker right before adding included fileLubos Lunak2014-05-01
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207756 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-15
| | | | | | class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203999 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement MSVC header search algorithm in MicrosoftMode.Will Wilson2013-12-27
| | | | | | Follows algorithm described here: http://msdn.microsoft.com/en-us/library/36k2cdd4.aspx git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198082 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix raw lex crash and -frewrite-includes noeol-at-eof failureAlp Toker2013-12-13
| | | | | | Raw lexers don't have a preprocessor so we need to null check. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197245 91177308-0d34-0410-b5e6-96231b3b80d8
* Check the initial line number without going through PresumedLocAlp Toker2013-12-05
| | | | | | | No practical difference in this case and would return 1 either way, but this is more self-explanatory. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196511 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an assert to make it clear we're on the first lineAlp Toker2013-12-05
| | | | | | A raw lexer in its initial state is guaranteed to be on line number one. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196461 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r196372, "do not warn about unknown pragmas in modes that do not ↵NAKAMURA Takumi2013-12-04
| | | | | | | | handle them (pr9537)" It broke clang tests on some hosts with +Asserts. Seems "STDC" clashes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196376 91177308-0d34-0410-b5e6-96231b3b80d8
* do not warn about unknown pragmas in modes that do not handle them (pr9537)Lubos Lunak2013-12-04
| | | | | | | | | And refactor to have just one place in code that sets up the empty pragma handlers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196372 91177308-0d34-0410-b5e6-96231b3b80d8
* InclusionRewriter: Avoid duplicated BOM checkAlp Toker2013-11-28
| | | | | | | The lexer already knows its position in the file, so use that instead of guessing it might be 3. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195910 91177308-0d34-0410-b5e6-96231b3b80d8
* strip UTF-8 BOM in -frewrite-includes (PR#15664)Lubos Lunak2013-11-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195877 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typo: inccrementallyBenjamin Kramer2013-10-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192551 91177308-0d34-0410-b5e6-96231b3b80d8
* Address review comment on r189557.Eli Friedman2013-09-17
| | | | | | | | | We need to escape filenames the same way in InclusionRewriter whether UseLineDirective is true or false. Review comment from http://llvm.org/bugs/show_bug.cgi?id=17018#c2 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190834 91177308-0d34-0410-b5e6-96231b3b80d8
* Properly escape filenames in line directives.Eli Friedman2013-08-29
| | | | | | | Fixes PR17018. Only partial test coverage because I don't want to try to write a test which generates a file whose name contains a newline. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189557 91177308-0d34-0410-b5e6-96231b3b80d8
* [frontend] '-frewrite-includes' should not ignore headers included from ↵Argyrios Kyrtzidis2013-07-26
| | | | | | | | command-line. rdar://14556182 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187207 91177308-0d34-0410-b5e6-96231b3b80d8
* avoid bogus warnings about "unknown" pragmas with -frewrite-includes (pr#14831)Lubos Lunak2013-07-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186764 91177308-0d34-0410-b5e6-96231b3b80d8
* fix sometimes incorrect line numbers in -frewrite-includes mode (pr#14795)Lubos Lunak2013-07-20
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186763 91177308-0d34-0410-b5e6-96231b3b80d8
* Have SourceManager::getLocForEndOfFile() point at the "EOF" location of the ↵Argyrios Kyrtzidis2013-05-07
| | | | | | | | | | | FileID. This fixes a crash due to SourceManager::getLocForEndOfFile() returning an off-by-one location when the the FileID is for an empty file. rdar://13803893 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181285 91177308-0d34-0410-b5e6-96231b3b80d8
* rewrite-includes: Rewrite __has_include(_next) to get rid of a host dependency.Benjamin Kramer2013-04-16
| | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179616 91177308-0d34-0410-b5e6-96231b3b80d8
* [frontend] -frewrite-includes: turn implicit module imports into @imports.Argyrios Kyrtzidis2013-04-10
| | | | | | rdar://13610250 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179145 91177308-0d34-0410-b5e6-96231b3b80d8
* [frontend] -frewrite-includes: if there was no inclusion, don't add lineinfo ↵Argyrios Kyrtzidis2013-04-10
| | | | | | that indicates return from another file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179143 91177308-0d34-0410-b5e6-96231b3b80d8
* Use trailing documentation comments properlyDmitri Gribenko2013-02-16
| | | | | | | Patch by Alexander Zinenko. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175376 91177308-0d34-0410-b5e6-96231b3b80d8
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-04
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
* Silencing an MSVC warning about */ being found outside of a comment.Aaron Ballman2012-10-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165007 91177308-0d34-0410-b5e6-96231b3b80d8
* For PPCallbacks::InclusionDirective() add a parameter for the module, wheneverArgyrios Kyrtzidis2012-09-29
| | | | | | | an inclusion directive was automatically turned into a module import, and PPCallbacks::moduleImport() for an explicit module import. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164874 91177308-0d34-0410-b5e6-96231b3b80d8
* Per discussion in ↵Argyrios Kyrtzidis2012-09-27
| | | | | | | | | | http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120917/064551.html have PPCallbacks::InclusionDirective pass the character range for the filename quotes or brackets. rdar://11113134 & http://llvm.org/PR13880 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164743 91177308-0d34-0410-b5e6-96231b3b80d8
* Split library clangRewrite into clangRewriteCore and clangRewriteFrontend.Ted Kremenek2012-09-01
This is similar to how we divide up the StaticAnalyzer libraries to separate core functionality to what is clearly associated with Frontend actions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163050 91177308-0d34-0410-b5e6-96231b3b80d8