summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/DependencyFile.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [clang][DependencyFileGenerator] Fix missing -MT option handlingJan Korous2019-09-071-5/+0
| | | | | | | | Targets in DependencyFileGenerator don't necessarily come from -MT option. Differential Revision: https://reviews.llvm.org/D67308 llvm-svn: 371279
* Use FileEntryRef for PPCallbacks::HasIncludeAlex Lorenz2019-08-271-1/+1
| | | | | | | | This fixes the issue where a filename dependendency was missing if the file that was referenced with __has_include() was accessed through a symlink in an earlier run, if the file manager was reused between runs. llvm-svn: 370081
* Use FileEntryRef for PPCallbacks::FileSkippedAlex Lorenz2019-08-271-1/+1
| | | | | | | | This fixes the issue where a filename dependendency was missing if the file that was skipped was included through a symlink in an earlier run, if the file manager was reused between runs. llvm-svn: 369998
* Introduce FileEntryRef and use it when handling includes to report correct ↵Alex Lorenz2019-08-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | | dependencies when the FileManager is reused across invocations This commit introduces a parallel API to FileManager's getFile: getFileEntryRef, which returns a reference to the FileEntry, and the name that was used to access the file. In the case of a VFS with 'use-external-names', the FileEntyRef contains the external name of the file, not the filename that was used to access it. The new API is adopted only in the HeaderSearch and Preprocessor for include file lookup, so that the accessed path can be propagated to SourceManager's FileInfo. SourceManager's FileInfo now can report this accessed path, using the new getName method. This API is then adopted in the dependency collector, which now correctly reports dependencies when a file is included both using a symlink and a real path in the case when the FileManager is reused across multiple Preprocessor invocations. Note that this patch does not fix all dependency collector issues, as the same problem is still present in other cases when dependencies are obtained using FileSkipped, InclusionDirective, and HasInclude. This will be fixed in follow-up commits. Differential Revision: https://reviews.llvm.org/D65907 llvm-svn: 369680
* [Clang] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-141-3/+3
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368942
* Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFCFangrui Song2019-08-051-1/+1
| | | | | | F_{None,Text,Append} are kept for compatibility since r334221. llvm-svn: 367800
* [clang-scan-deps] print the dependencies to stdoutAlex Lorenz2019-06-211-0/+4
| | | | | | | | and remove the need to use -MD options in the CDB Differential Revision: https://reviews.llvm.org/D63579 llvm-svn: 364088
* Unify DependencyFileGenerator class and DependencyCollector interface (NFCI)Alex Lorenz2019-06-191-205/+69
| | | | | | | | | | | | | | Make DependencyFileGenerator a DependencyCollector as it was intended when DependencyCollector was introduced. The missing PPCallbacks overrides are added to the DependencyCollector as well. This change will allow clang-scan-deps to access the produced dependencies without writing them out to .d files to disk, so that it will be able collate them and report them to the user. Differential Revision: https://reviews.llvm.org/D63290 llvm-svn: 363840
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Fix up diagnostics.Richard Trieu2018-12-141-1/+0
| | | | | | | | | | | Move some diagnostics around between Diagnostic*Kinds.td files. Diagnostics used in multiple places were moved to DiagnosticCommonKinds.td. Diagnostics listed in the wrong place (ie, Sema diagnostics listed in DiagnosticsParseKinds.td) were moved to the correct places. One diagnostic split into two so that the diagnostic string is in the .td file instead of in code. Cleaned up the diagnostic includes after all the changes. llvm-svn: 349125
* Add a callback for `__has_include` and use it for dependency scanning.Volodymyr Sapsai2018-09-181-0/+15
| | | | | | | | | | | | | | | | This adds a preprocessor callback for the `__has_include` and `__has_include_next` directives. Successful checking for the presence of a header should add it to the list of header dependencies so this overrides the callback in the dependency scanner. Patch by Pete Cooper with some additions by me. rdar://problem/39545636 Differential Revision: https://reviews.llvm.org/D30882 llvm-svn: 342517
* Print correctly dependency paths on WindowsDavid Bolvansky2018-09-131-9/+13
| | | | | | | | | | | | | | | | | | | Summary: Before: main.o: main.c ../include/lib\test.h After: main.o: main.c ../include/lib/test.h Fixes PR38877 Reviewers: zturner Subscribers: xbolva00, cfe-commits Differential Revision: https://reviews.llvm.org/D51847 llvm-svn: 342139
* Remove trailing spaceFangrui Song2018-07-301-1/+1
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338291
* Fix emission of phony dependency targets when adding extra depsDavid Stenberg2018-05-291-7/+15
| | | | | | | | | | | | | | | | | | | | | | | Summary: This commit fixes a bug where passing extra dependency entries (using -fdepfile-entry) would result in -MP incorrectly emitting a phony target for the input file, and no phony target for the first extra dependency. The extra dependencies are added first to the filename vector in DFGImpl. That clashed with the emission of the phony targets, as the code assumed that the first index always correspond to the input file. Reviewers: rsmith, pcc, krasin, bruno, vsapsai Reviewed By: vsapsai Subscribers: vsapsai, bruno, cfe-commits Differential Revision: https://reviews.llvm.org/D44568 llvm-svn: 333413
* Reland '[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective'Julie Hockett2018-05-101-3/+6
| | | | | | | | | | | | | | This commit relands r331904. Adding a SrcMgr::CharacteristicKind parameter to the InclusionDirective in PPCallbacks, and updating calls to that function. This will be useful in https://reviews.llvm.org/D43778 to determine which includes are system headers. Differential Revision: https://reviews.llvm.org/D46614 llvm-svn: 332021
* Revert "[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective"Julie Hockett2018-05-091-6/+3
| | | | | | This reverts commit r331904 because of a memory leak. llvm-svn: 331932
* [clang] Adding CharacteristicKind to PPCallbacks::InclusionDirectiveJulie Hockett2018-05-091-3/+6
| | | | | | | | | | | Adding a SrcMgr::CharacteristicKind parameter to the InclusionDirective in PPCallbacks, and updating calls to that function. This will be useful in https://reviews.llvm.org/D43778 to determine which includes are system headers. Differential Revision: https://reviews.llvm.org/D46614 llvm-svn: 331904
* Track skipped files in dependency scanning.Volodymyr Sapsai2018-05-011-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert r316193.Richard Smith2017-10-201-11/+0
| | | | | | | This patch breaks users using -fno-canonical-prefixes, for whom resolving symlinks is not acceptable. llvm-svn: 316195
* Try to shorten system header paths when using -MD depfilesPeter Wu2017-10-191-0/+11
| | | | | | | | | | | | | | | | | | | | | GCC tries to shorten system headers in depfiles using its real path (resolving components like ".." and following symlinks). Mimic this feature to ensure that the Ninja build tool detects the correct dependencies when a symlink changes directory levels, see https://github.com/ninja-build/ninja/issues/1330 An option to disable this feature is added in case "these changed header paths may conflict with some compilation environments", see https://gcc.gnu.org/ml/gcc-patches/2012-09/msg00287.html Note that the original feature request for GCC (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52974) also included paths preprocessed output (-E) and diagnostics. That is not implemented now since I am not sure if it breaks something else. Differential Revision: https://reviews.llvm.org/D37954 llvm-svn: 316193
* Track the set of module maps read while building a .pcm file and reload ↵Richard Smith2017-06-291-3/+3
| | | | | | those when preprocessing from that .pcm file. llvm-svn: 306628
* Fix PR31644 introduced by r287138 and add a regression test.Yaron Keren2017-01-141-2/+2
| | | | | | Thanks Dimitry Andric for the report and fix! llvm-svn: 292032
* Rangify for loops, NFC.Yaron Keren2016-11-161-11/+8
| | | | llvm-svn: 287138
* Turn copies into references as suggested by clang-tidy's ↵Benjamin Kramer2016-05-271-1/+1
| | | | | | performance-unnecessary-copy-initialization. llvm-svn: 270994
* Roll-back r250822.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | 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-201-1/+1
| | | | | | | | | | | | 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
* Use new utility function to clean leading junk from pathnames. NFCDouglas Katzman2015-09-021-18/+3
| | | | llvm-svn: 246714
* [modules] For explicit module file dependencies, only list direct dependency ↵Richard Smith2015-08-131-1/+1
| | | | | | module files. llvm-svn: 244931
* Try to fix the build after r244923Reid Kleckner2015-08-131-1/+1
| | | | llvm-svn: 244926
* [modules] Change the way we deal with .d output for explicitly-specified moduleRichard Smith2015-08-131-9/+13
| | | | | | | | | | | | | files: include the .pcm file itself in the .d output, rather than including its own input files. Other forms of module file continue to be transparent for .d output. Arguably, the input files for the .pcm file are still inputs to the compilation, but that's unnecessary for make-like build systems (where the mtime of the .pcm file is sufficient) and harmful for smarter build systems that know about module files and want to track only the local dependencies. llvm-svn: 244923
* Add sanitizer blacklists to the rules generated with -M/-MM/-MD/-MMD.Ivan Krasin2015-08-131-1/+5
| | | | | | | | | | | | | | | | | | | Summary: Clang sanitizers, such as AddressSanitizer, ThreadSanitizer, MemorySanitizer, Control Flow Integrity and others, use blacklists to specify which types / functions should not be instrumented to avoid false positives or suppress known failures. This change adds the blacklist filenames to the list of dependencies of the rules, generated with -M/-MM/-MD/-MMD. This lets CMake/Ninja recognize that certain C/C++/ObjC files need to be recompiled (if a blacklist is updated). Reviewers: pcc Subscribers: rsmith, honggyu.kim, pcc, cfe-commits Differential Revision: http://reviews.llvm.org/D11968 llvm-svn: 244867
* [modules] When building a dependency file, include module maps parsed in theRichard Smith2015-08-091-0/+30
| | | | | | current compilation, not just those from imported modules. llvm-svn: 244413
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-1/+1
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-1/+1
| | | | | | | | | | | | 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
* Break \# in a depfile the same way as gcc.Paul Robinson2015-05-131-22/+18
| | | | | | | | Backslash followed by # in a filename should have both characters escaped, if you do it the way GNU Make wants. GCC doesn't, so we do it the way GCC does rather than the way GNU Make wants. llvm-svn: 237304
* Fix dependency file escaping.Paul Robinson2015-05-131-5/+57
| | | | | | | | | | | | | | When writing a dependency (.d) file, if space or # is immediately preceded by one or more backslashes, escape the backslashes as well as the space or # character. Otherwise leave backslash alone. This straddles the fence between BSD Make (which does no escaping at all, and does not support space or # in filespecs) and GNU Make (which does support escaping, but will fall back to the filespec as-written if the escaping doesn't match an existing file). Differential Revision: http://reviews.llvm.org/D9208 llvm-svn: 237296
* Support generating NMake/Jom-style depfiles.Paul Robinson2015-04-271-5/+23
| | | | | | | | | | | | | | | NMake is a Make-like builder that comes with Microsoft Visual Studio. Jom (https://wiki.qt.io/Jom) is an NMake-compatible build tool. Dependency files for NMake/Jom need to use double-quotes to wrap filespecs containing special characters, instead of the backslash escapes that GNU Make wants. Adds the -MV option, which specifies to use double-quotes as needed instead of backslash escapes when writing the dependency file. Differential Revision: http://reviews.llvm.org/D9260 llvm-svn: 235903
* Update for LLVM API changeDavid Blaikie2014-11-191-2/+2
| | | | llvm-svn: 222303
* Frontend: Don't include stdin in the dependency list for an object fileDavid Majnemer2014-10-271-2/+11
| | | | | | | | | GCC doesn't do this and it semes weird to include a file that we can't open. This fixes PR21362. llvm-svn: 220726
* Unique_ptrify PPCallbacks ownership.Craig Topper2014-09-101-2/+3
| | | | | | Unique_ptr creation stil needs to be moved earlier at some of the call sites. llvm-svn: 217474
* Update for llvm api change.Rafael Espindola2014-08-251-5/+5
| | | | llvm-svn: 216397
* unique_ptr-ify ASTReaderListener in the ASTReaderDavid Blaikie2014-08-101-2/+2
| | | | llvm-svn: 215317
* Consider module depedencies when checking a preamble in libclangBen Langmuir2014-06-301-0/+99
| | | | | | | | | | | | | Add module dependencies (header files, module map files) to the list of files to check when deciding whether to rebuild a preamble. That fixes using preambles with module imports so long as they are in non-overridden files. My intent is to use to unify the existing dependency collectors to the new “DependencyCollectory” interface from this commit, starting with the DependencyFileGenerator. llvm-svn: 212060
* [C++11] Use 'nullptr'. Frontend edition.Craig Topper2014-05-221-2/+2
| | | | llvm-svn: 209389
* [Modules] Emit the module file paths as dependencies of the PCH when we are ↵Argyrios Kyrtzidis2014-03-141-1/+9
| | | | | | | | | | | building one. This is because the PCH is tied to the module files, if one of the module files changes or gets removed the build system should re-build the PCH file. rdar://16321245 llvm-svn: 203885
* [Modules] Make sure that the synthesized file "__inferred_module.map" ↵Argyrios Kyrtzidis2014-03-141-2/+6
| | | | | | | | doesn't show up as dependency of a module file. Follow-up for rdar://15459210 llvm-svn: 203882
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-131-17/+13
| | | | | | class. llvm-svn: 203758
* Add dependencies from imported modules with -MDBen Langmuir2014-03-071-25/+59
| | | | | | | | Add module dependencies to the dependency files created by -MD/-MMD/etc. by attaching an ASTReaderListener that will call into the dependency file generator when a module input file is seen in the serialized AST. llvm-svn: 203208
* Update for llvm api change.Rafael Espindola2014-02-241-1/+1
| | | | llvm-svn: 202053
* Don't assume that F_None is the default. It is about to change.Rafael Espindola2014-02-241-1/+1
| | | | llvm-svn: 202040
OpenPOWER on IntegriCloud