summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/Rewrite
Commit message (Collapse)AuthorAgeFilesLines
...
* Attempt to fix shared library build: RewriteFrontend depends on ↵Richard Smith2017-06-091-0/+1
| | | | | | Serialization after r305116. llvm-svn: 305121
* Add -frewrite-imports flag.Richard Smith2017-06-091-14/+104
| | | | | | | | If specified, when preprocessing, the contents of imported .pcm files will be included in preprocessed output. The resulting preprocessed file can then be compiled standalone without the module sources or .pcm files. llvm-svn: 305116
* Remove 'Filename' parameter from BeginSourceFileAction.Richard Smith2017-06-091-2/+1
| | | | | | | | | No-one was using this, and it's not meaningful in general -- FrontendActions can be run on inputs that don't have a corresponding source file. The current frontend input can be obtained by asking the FrontendAction if any future action actually needs it. llvm-svn: 305045
* PR32848: There isn't necessarily a FileChanged or FileSkipped for every ↵Richard Smith2017-06-021-4/+3
| | | | | | | | | 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
* Escape filenames in module map line marker directives, to unbreak Windows ↵Richard Smith2017-06-011-2/+5
| | | | | | build bots. llvm-svn: 304464
* Add support for building modules from preprocessed source.Richard Smith2017-05-051-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To support this, an optional marker "#pragma clang module contents" is recognized in module map files, and the rest of the module map file from that point onwards is treated as the source of the module. Preprocessing a module map produces the input module followed by the marker and then the preprocessed contents of the module. Ignoring line markers, a preprocessed module might look like this: module A { header "a.h" } #pragma clang module contents #pragma clang module begin A // ... a.h ... #pragma clang module end The preprocessed output generates line markers, which are not accepted by the module map parser, so -x c++-module-map-cpp-output should be used to compile such outputs. A couple of major parts do not work yet: 1) The files that are listed in the module map must exist on disk, in order to build the on-disk header -> module lookup table in the PCM file. To fix this, we need the preprocessed output to track the file size and other stat information we might use to build the lookup table. 2) Declaration ownership semantics don't work properly yet, since mapping from a source location to a module relies on mapping from FileIDs to modules, which we can't do if module transitions can occur in the middle of a file. llvm-svn: 302309
* Add #pragma clang module begin/end pragmas and generate them when ↵Richard Smith2017-05-041-0/+30
| | | | | | | | | | | | | | preprocessing a module. These pragmas are intended to simulate the effect of entering or leaving a file with an associated module. This is not completely implemented yet: declarations between the pragmas will not be attributed to the correct module, but macro visibility is already functional. Modules named by #pragma clang module begin must already be known to clang (in some module map that's either loaded or on the search path). llvm-svn: 302098
* PR26771: don't forget the " 2" (returning from #included file) linemarker ↵Richard Smith2017-04-291-14/+9
| | | | | | 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-4/+2
| | | | | | | | | | | | | | | | | | | | | 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
* Preprocessor: Suppress -Wnonportable-include-path for header mapsDuncan P. N. Exon Smith2017-04-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a file search involves a header map, suppress -Wnonportable-include-path. It's firing lots of false positives for framework authors internally, and it's not trivial to fix. Consider a framework called "Foo" with a main (installed) framework header "Foo/Foo.h". It's atypical for "Foo.h" to actually live inside a directory called "Foo" in the source repository. Instead, the build system generates a header map while building the framework. If Foo.h lives at the top-level of the source repository (common), and the git repo is called ssh://some.url/foo.git, then the header map will have something like: Foo/Foo.h -> /Users/myname/code/foo/Foo.h where "/Users/myname/code/foo" is the clone of ssh://some.url/foo.git. After #import <Foo/Foo.h>, the current implementation of -Wnonportable-include-path will falsely assume that Foo.h was found in a nonportable way, because of the name of the git clone (.../foo/Foo.h). However, that directory name was not involved in the header search at all. This commit adds an extra parameter to Preprocessor::LookupFile and HeaderSearch::LookupFile to track if the search used a header map, making it easy to suppress the warning. Longer term, once we find a way to avoid the false positive, we should turn the warning back on. rdar://problem/28863903 llvm-svn: 301592
* Spelling mistakes in comments. NFCI. (PR27635)Simon Pilgrim2017-03-303-3/+3
| | | | llvm-svn: 299083
* Encapsulate FPOptions and use it consistentlyAdam Nemet2017-03-272-2/+2
| | | | | | | | | | | | | | | | | | Sema holds the current FPOptions which is adjusted by 'pragma STDC FP_CONTRACT'. This then gets propagated into expression nodes as they are built. This encapsulates FPOptions so that this propagation happens opaquely rather than directly with the fp_contractable on/off bit. This allows controlled transitioning of fp_contractable to a ternary value (off, on, fast). It will also allow adding more fast-math flags later. This is toward moving fp-contraction=fast from an LLVM TargetOption to a FastMathFlag in order to fix PR25721. Differential Revision: https://reviews.llvm.org/D31166 llvm-svn: 298877
* Pass a char instead of a string to the find function. clang-tidy: ↵Sylvestre Ledru2017-01-282-2/+2
| | | | | | performance-faster-string-find llvm-svn: 293379
* getObjCEncodingForMethodDecl cannot fail. Simplify. NFC.John McCall2016-11-292-14/+13
| | | | llvm-svn: 288203
* Fix Clang-tidy readability-redundant-string-cstr warningsMalcolm Parsons2016-11-022-24/+18
| | | | | | | | | | Reviewers: aaron.ballman, mehdi_amini, dblaikie Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26206 llvm-svn: 285799
* Use StringRef for MemoryBuffer identifier API (NFC)Mehdi Amini2016-10-012-4/+4
| | | | llvm-svn: 283043
* [NFC] Header cleanupMehdi Amini2016-07-183-6/+4
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 llvm-svn: 275882
* Frontend: Simplify ownership model for clang's output streams.Peter Collingbourne2016-07-154-47/+54
| | | | | | | | | | | | | | This changes the CompilerInstance::createOutputFile function to return a std::unique_ptr<llvm::raw_ostream>, rather than an llvm::raw_ostream implicitly owned by the CompilerInstance. This in most cases required that I move ownership of the output stream to the relevant ASTConsumer. The motivation for this change is to allow BackendConsumer to be a client of interfaces such as D20268 which take ownership of the output stream. Differential Revision: http://reviews.llvm.org/D21537 llvm-svn: 275507
* Use more ArrayRefsDavid Majnemer2016-06-242-6/+6
| | | | | | No functional change is intended, just a small refactoring. llvm-svn: 273647
* Delete dead code.Rafael Espindola2016-06-211-96/+0
| | | | | | Found by gcc 6. llvm-svn: 273327
* Apply clang-tidy's misc-move-constructor-init throughout Clang.Benjamin Kramer2016-05-271-2/+3
| | | | | | No functionality change intended, maybe a tiny performance improvement. llvm-svn: 270996
* Fix a couple assertions that can never fire because the condition ANDed with ↵Craig Topper2016-04-242-2/+2
| | | | | | the string is just true or 1. llvm-svn: 267313
* [modules] Don't write @import in -E output if the current language mode doesn'tRichard Smith2016-04-081-1/+3
| | | | | | support @import; use the form as written instead. llvm-svn: 265756
* [Objective-c] Stop attaching section "datacoal_nt" to global variables.Akira Hatanaka2016-02-111-1/+1
| | | | | | | | | | | | | The current macho linker just copies symbols in section datacoal_nt to section data, so it doesn't really matter whether or not section "datacoal_nt" is attached to the global variable. This is a follow-up to r250370, which made changes in llvm to stop putting functions and data in the *coal* sections. rdar://problem/24528611 llvm-svn: 260496
* Fix some Clang-tidy readability-redundant-control-flow warnings; other minor ↵Eugene Zelenko2016-02-102-88/+35
| | | | | | | | fixes. Differential revision: http://reviews.llvm.org/D17060 llvm-svn: 260414
* Move DebugInfoKind into its own header to cut the cyclic dependency edge ↵Benjamin Kramer2016-02-021-5/+4
| | | | | | from Driver to Frontend. llvm-svn: 259489
* Remove autoconf supportChris Bieneman2016-01-261-22/+0
| | | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "This is the way [autoconf] ends Not with a bang but a whimper." -T.S. Eliot Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D16472 llvm-svn: 258862
* Use instance_properties instead of properties. NFC.Manman Ren2016-01-262-9/+12
| | | | | | | | | | | All current properties are instance properties. This is the second patch in a series of patches to support class properties in addition to instance properties in objective-c. rdar://23891898 llvm-svn: 258824
* Fix a couple places where InsertText was being called with a pointer and ↵Craig Topper2015-10-222-5/+5
| | | | | | | | size when it really expects a StringRef and a normally optional bool argument. The pointer was being implicitly converted to a StringRef and the size was being passed into the bool. Since the bool has a default value normally, no one noticed that the wrong number of arguments was given. llvm-svn: 250977
* Pass an ArrayRef instead of pointer and size. NFCCraig Topper2015-10-222-68/+38
| | | | llvm-svn: 250976
* Roll-back r250822.Angel Garcia Gomez2015-10-204-5/+5
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-204-5/+5
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
* Refactor module lookup when looking up a header file, and wire through the ↵Richard Smith2015-10-161-1/+2
| | | | | | requesting module. No functionality change. llvm-svn: 250554
* Replace double-negated !SourceLocation.isInvalid() with ↵Yaron Keren2015-10-031-1/+1
| | | | | | SourceLocation.isValid(). llvm-svn: 249228
* Fix a small bug in clang where generating some temporary files would have an ↵Argyrios Kyrtzidis2015-09-091-1/+1
| | | | | | | | extra period before the extension. Patch by Cameron Esfahani! llvm-svn: 247160
* Switch users of the 'for (StmtRange range = stmt->children(); range; ↵Benjamin Kramer2015-07-022-45/+37
| | | | | | | | | ++range)‘ pattern to range for loops. The pattern was born out of the lack of range-based for loops in C++98 and is somewhat obscure. No functionality change intended. llvm-svn: 241300
* Fix a couple of unused variables in no-assertsJustin Bogner2015-07-011-0/+2
| | | | llvm-svn: 241144
* -frewrite-includes: Prefer insert to emplaceJustin Bogner2015-07-011-3/+4
| | | | | | Some bots didn't like r241140. llvm-svn: 241141
* -frewrite-includes: Rework how includes and modules are differentiatedJustin Bogner2015-07-011-39/+50
| | | | | | | | | | | | | | | | | | | | The map of FileChange structs here was storing two disjoint types of information: 1. A pointer to the Module that an #include directive implicitly imported 2. A FileID and FileType for an included file. These would be left uninitialized in the Module case. This change splits these two kinds of information into their own maps, which both simplifies how we access either and avoids the undefined behaviour we were hitting due to the uninitialized fields in the included file case. Mostly NFC, but fixes some errors found by self-host with ubsan. llvm-svn: 241140
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-224-4/+4
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-224-4/+4
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* [fixit] Use overwriteChangedFiles() to deal with Windows mapped filesReid Kleckner2015-06-172-2/+10
| | | | | | Fixes one instance of PR17960. llvm-svn: 239920
* Fix misleading parameter name for PPCallbacks::FileSkipped.Nikola Smiljanic2015-05-121-2/+2
| | | | | | Patch thanks to Vladimir Voskresensky. llvm-svn: 237115
* Fix a few line endings. NFC.Yunzhong Gao2015-05-011-38/+38
| | | | llvm-svn: 236301
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-112-5/+5
| | | | | | | | | | | | | | | | | | | | Summary: The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix Reviewers: dblaikie Reviewed By: dblaikie Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D8926 llvm-svn: 234678
* [Objective-C modern translation]. Patch to fix type ofFariborz Jahanian2015-04-091-97/+97
| | | | | | | objc_msgSend's first argument to "Class" because objc_getClass is passed. rdar://20477025 llvm-svn: 234520
* Track the source location of the dot or arrow operator in a MemberExpr.Aaron Ballman2015-03-242-145/+132
| | | | | | Patch by Joe Ranieri! llvm-svn: 233085
* Fix a [-Werror,-Wreorder] initialization ordering error.Eric Christopher2015-02-261-2/+2
| | | | llvm-svn: 230589
* Add -fuse-line-directive flag to control usage of #line with -EReid Kleckner2015-02-261-10/+10
| | | | | | | | | | | | | | | | | | Currently -fms-extensions controls this behavior, which doesn't make much sense. It means we can't identify what is and isn't a system header when compiling our own preprocessed output, because #line doesn't represent this information. If someone is feeding Clang's preprocessed output to another compiler, they can use this flag. Fixes PR20553. Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D5217 llvm-svn: 230587
* Rename RefersToCapturedVariable to RefersToEnclosingVariableOrCapture, NFCAlexey Bataev2015-01-122-6/+6
| | | | llvm-svn: 225624
OpenPOWER on IntegriCloud