summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
Commit message (Collapse)AuthorAgeFilesLines
...
* ASTUnit: Replace out parameter with return value, we have NRVO for this.Benjamin Kramer2014-10-031-22/+22
| | | | | | And elide the copy when pushing the return value into a vector. NFC. llvm-svn: 219001
* Driver: Use pointee_iterator rather than iterating over unique_ptrsJustin Bogner2014-10-031-2/+2
| | | | | | | | There's probably never a good reason to iterate over unique_ptrs. This lets us use range-for and say Job.foo instead of (*it)->foo in a few places. llvm-svn: 218938
* Ensure that all module build failures get diagnosedBen Langmuir2014-09-261-2/+11
| | | | | | | | Otherwise we can end up silently skipping an import. If we happen to be building another module at the time, we may build a mysteriously broken module and not know why it seems to be missing symbols. llvm-svn: 218552
* unique_ptrify ChainedDiagnosticConsumer's ctor parametersDavid Blaikie2014-09-152-9/+14
| | | | llvm-svn: 217793
* Fix memory leak of raw_ostreams in LogDiagnosticPrinter handling.David Blaikie2014-09-152-18/+12
| | | | | | | | | | | | | | | This is another case of conditional ownership (in this case a raw reference, plus a boolean to indicate whether the referenced object should be deleted). While it's not ideal, I prefer to make the ownership explicit with a unique_ptr than using a boolean flag (though it does make the reference and the unique_ptr redundant in the sense that they both refer to the same memory). At some point we might write a reusable conditional ownership pointer (a stateful custom deleter for a unique_ptr may be appropriate). Based on a patch from a patch by Anton Yartsev. llvm-svn: 217791
* Add -fseh-exceptions for MinGW-w64Reid Kleckner2014-09-152-0/+3
| | | | | | | | | | | | | | This adds a flag called -fseh-exceptions that uses the native Windows .pdata and .xdata unwind mechanism to throw exceptions. The other EH possibilities are DWARF and SJLJ exceptions. Patch by Martell Malone! Reviewed By: asl, rnk Differential Revision: http://reviews.llvm.org/D3419 llvm-svn: 217790
* Avoid a couple of assertions when preprocessing with modulesBen Langmuir2014-09-101-0/+3
| | | | | | | | | | | | | | | | 1. We were hitting the NextIsPrevious assertion because we were trying to merge decl chains that were independent of each other because we had no Sema object to allow them to find existing decls. This is fixed by delaying loading the "preloaded" decls until Sema is available. 2. We were trying to get identifier info from an annotation token, which asserts. The fix is to special-case the module annotations in the preprocessed output printer. Fixed in a single commit because when you hit 1 you almost invariably hit 2 as well. llvm-svn: 217550
* Unique_ptrify PPCallbacks ownership.Craig Topper2014-09-107-14/+22
| | | | | | Unique_ptr creation stil needs to be moved earlier at some of the call sites. llvm-svn: 217474
* -frewrite-includes: Normalize line endings to match the main source fileReid Kleckner2014-09-051-52/+90
| | | | | | | | | | | | | | | | | | | | | | It is very common to include headers with DOS-style line endings, such as windows.h, from source files with Unix-style line endings. Previously, we would end up with mixed line endings and #endifs that appeared to be on the same line: #if 0 /* expanded by -frewrite-includes */ #include <windows.h>^M#endif /* expanded by -frewrite-includes */ Clang treats either of \r or \n as a line ending character, so this is purely a cosmetic issue. This has no automated test because most Unix tools on Windows will implictly convert CRLF to LF when reading files, making it very hard to detect line ending mismatches. FileCheck doesn't understand {{\r}} either. Fixes PR20552. llvm-svn: 217259
* unique_ptrify JobList::JobsDavid Blaikie2014-09-041-4/+4
| | | | llvm-svn: 217168
* Frontend: Reindent Opts.CoverageFileDavid Majnemer2014-09-011-1/+1
| | | | | | No functional change intended. llvm-svn: 216888
* unique_ptrify the raw_ostream argument to clang::serialized_diags::createDavid Blaikie2014-08-292-12/+12
| | | | llvm-svn: 216767
* Add an option to silence all analyzer warnings.Anna Zaks2014-08-291-0/+2
| | | | | | | | | | | | People have been incorrectly using "-analyzer-disable-checker" to silence analyzer warnings on a file, when analyzing a project. Add the "-analyzer-disable-all-checks" option, which would allow the suppression and suggest it as part of the error message for "-analyzer-disable-checker". The idea here is to compose this with "--analyze" so that users can selectively opt out specific files from static analysis. llvm-svn: 216763
* Provide a BuryPointer for unique_ptrs.David Blaikie2014-08-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In theory, it'd be nice if we could move to a case where all buried pointers were buried via unique_ptr to demonstrate that the program had finished with the value (that we could really have cleanly deallocated it) but instead chose to bury it. I think the main reason that's not possible right now is the various IntrusiveRefCntPtrs in the Frontend, sharing ownership for a variety of compiler bits (see the various similar "CompilerInstance::releaseAndLeak*" functions). I have yet to figure out their correct ownership semantics - but perhaps, even if the intrusiveness can be removed, the shared ownership may yet remain and that would lead to a non-unique burying as is there today. (though we could model that a little better - by passing in a shared_ptr, etc - rather than needing the two step that's currently used in those other releaseAndLeak* functions) This might be a bit more robust if BuryPointer took the boolean: BuryPointer(bool, unique_ptr<T>) and the choice to bury was made internally - that way, even when DisableFree was not set, the unique_ptr would still be null in the caller and there'd be no chance of accidentally having a different codepath where the value is used after burial in !DisableFree, but it becomes null only in DisableFree, etc... llvm-svn: 216742
* unique_ptrify Directives in VerifyDiagnosticConsumerDavid Blaikie2014-08-291-19/+21
| | | | llvm-svn: 216740
* unique_ptrify SourceManager::createFileIDDavid Blaikie2014-08-291-1/+2
| | | | llvm-svn: 216715
* Improve unique_ptr-y ownership in ASTUnit::ComputePreambleDavid Blaikie2014-08-292-50/+31
| | | | | | | | | | | | | | Rather than having a pair of pairs and a reference out parameter, build a structure with everything together and named. A raw pointer and a unique_ptr, rather than a raw pointer and a boolean, are used to communicate ownership transfer. It's possible one day we'll end up with a conditional pointer (probably represented by a raw pointer and a boolean) abstraction to use in places like this. Conditional ownership seems to be coming up more often than I'd hoped... llvm-svn: 216712
* Don't create a null reference in ASTUnit::LoadFromCommandLine.Alexey Samsonov2014-08-281-2/+3
| | | | | | | | | This change is the last in the pack of five commits (also see r216691, r216694, r216695, and r216696) that reduces the number of test failures in "check-clang" invocation in UBSan bootstrap from 2443 down to 5. llvm-svn: 216697
* Overload SourceManager::overrideFileContents so that unconditionally passing ↵David Blaikie2014-08-271-3/+3
| | | | | | | | | | ownership is explicitly done using unique_ptr. Only those callers who are dynamically passing ownership should need the 3 argument form. Those accepting the default ("do pass ownership") should do so explicitly with a unique_ptr now. llvm-svn: 216614
* Update for LLVM api change.Rafael Espindola2014-08-274-17/+12
| | | | llvm-svn: 216585
* Allow __fp16 as a function arg or return type for AArch64Oliver Stannard2014-08-271-0/+2
| | | | | | | | | | | ACLE 2.0 allows __fp16 to be used as a function argument or return type. This enables this for AArch64. This also fixes an existing bug that causes clang to not allow homogeneous floating-point aggregates with a base type of __fp16. This is valid for AAPCS64, but not for AAPCS-VFP. llvm-svn: 216558
* Add support for the static analyzer to synthesize function implementations ↵Ted Kremenek2014-08-272-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | from external model files. Currently the analyzer lazily models some functions using 'BodyFarm', which constructs a fake function implementation that the analyzer can simulate that approximates the semantics of the function when it is called. BodyFarm does this by constructing the AST for such definitions on-the-fly. One strength of BodyFarm is that all symbols and types referenced by synthesized function bodies are contextual adapted to the containing translation unit. The downside is that these ASTs are hardcoded in Clang's own source code. A more scalable model is to allow these models to be defined as source code in separate "model" files and have the analyzer use those definitions lazily when a function body is needed. Among other things, it will allow more customization of the analyzer for specific APIs and platforms. This patch provides the initial infrastructure for this feature. It extends BodyFarm to use an abstract API 'CodeInjector' that can be used to synthesize function bodies. That 'CodeInjector' is implemented using a new 'ModelInjector' in libFrontend, which lazily parses a model file and injects the ASTs into the current translation unit. Models are currently found by specifying a 'model-path' as an analyzer option; if no path is specified the CodeInjector is not used, thus defaulting to the current behavior in the analyzer. Models currently contain a single function definition, and can be found by finding the file <function name>.model. This is an initial starting point for something more rich, but it bootstraps this feature for future evolution. This patch was contributed by Gábor Horváth as part of his Google Summer of Code project. Some notes: - This introduces the notion of a "model file" into FrontendAction and the Preprocessor. This nomenclature is specific to the static analyzer, but possibly could be generalized. Essentially these are sources pulled in exogenously from the principal translation. Preprocessor gets a 'InitializeForModelFile' and 'FinalizeForModelFile' which could possibly be hoisted out of Preprocessor if Preprocessor exposed a new API to change the PragmaHandlers and some other internal pieces. This can be revisited. FrontendAction gets a 'isModelParsingAction()' predicate function used to allow a new FrontendAction to recycle the Preprocessor and ASTContext. This name could probably be made something more general (i.e., not tied to 'model files') at the expense of losing the intent of why it exists. This can be revisited. - This is a moderate sized patch; it has gone through some amount of offline code review. Most of the changes to the non-analyzer parts are fairly small, and would make little sense without the analyzer changes. - Most of the analyzer changes are plumbing, with the interesting behavior being introduced by ModelInjector.cpp and ModelConsumer.cpp. - The new functionality introduced by this change is off-by-default. It requires an analyzer config option to enable. llvm-svn: 216550
* Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or ↵Craig Topper2014-08-271-1/+1
| | | | | | just letting them be implicitly created. llvm-svn: 216528
* Return a std::unique_ptr from getBufferForFile. NFC.Rafael Espindola2014-08-261-5/+5
| | | | llvm-svn: 216478
* Return a std::unique_ptr from getBufferForFile. NFC.Rafael Espindola2014-08-263-6/+5
| | | | llvm-svn: 216476
* Convert MC command line flag for fatal assembler warnings into a properJoerg Sonnenberger2014-08-261-0/+1
| | | | | | flag. llvm-svn: 216472
* Update for llvm api change.Rafael Espindola2014-08-257-64/+52
| | | | llvm-svn: 216397
* Use range based for loops to avoid needing to re-mention SmallPtrSet size.Craig Topper2014-08-252-36/+23
| | | | llvm-svn: 216370
* Frontend: unique_ptr-ifyDylan Noblesmith2014-08-241-4/+4
| | | | | | NFC. llvm-svn: 216347
* C++1y is now C++14!Aaron Ballman2014-08-192-6/+6
| | | | | | Changes diagnostic options, language standard options, diagnostic identifiers, diagnostic wording to use c++14 instead of c++1y. It also modifies related test cases to use the updated diagnostic wording. llvm-svn: 215982
* Store std::unique_ptr in InMemoryBuffers. NFC.Rafael Espindola2014-08-181-12/+15
| | | | llvm-svn: 215928
* return a std::unique_ptr from getMainBufferWithPrecompiledPreamble. NFC.Rafael Espindola2014-08-181-19/+22
| | | | llvm-svn: 215927
* Simplify ASTUnit::Parse a bit by passing a std::unique_ptr to it.Rafael Espindola2014-08-181-28/+19
| | | | llvm-svn: 215900
* Add the break in the switch case (even if there is llvm_unreachable. It will ↵Sylvestre Ledru2014-08-181-1/+1
| | | | | | silent coverity warning CID 1231654 llvm-svn: 215897
* Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid ↵Craig Topper2014-08-172-4/+4
| | | | | | needing to mention the size. llvm-svn: 215869
* Convert a few ownership comments with std::unique_ptr.Rafael Espindola2014-08-171-1/+1
| | | | llvm-svn: 215853
* Delete support for AuroraUX.Rafael Espindola2014-08-141-5/+0
| | | | | | auroraux.org is not resolving. llvm-svn: 215644
* Small cleanup: Don't duplicate default behavior.Rafael Espindola2014-08-131-2/+2
| | | | | | | | std::unique_ptr is null initialized and reset default to null. Thanks to David Blaikie for noticing. llvm-svn: 215560
* Use std::unique_ptr to simplify memory management a bit.Rafael Espindola2014-08-131-12/+6
| | | | llvm-svn: 215559
* Use StringRef instead of MemoryBuffer&.Rafael Espindola2014-08-122-3/+4
| | | | | | | This code doesn't care where the data it is processing comes from, so a StringRef is probably the most natural interface. llvm-svn: 215448
* Correctly implement -include search logic.Manuel Klimek2014-08-122-17/+16
| | | | | | | | | | | | | | | According to the gcc docs, -include uses the current working directory for the lookup instead of the main source file. This patch gets rid of NormalizeIncludePath (which relied on an implementation detail of FileManager / FileEntry for the include path logic to work), and instead hands the correct lookup information down to LookupFile. This will allow us to change the FileEntry's behavior regarding its Name caching. llvm-svn: 215433
* Modify behavior of -ast-dump-lookups: if -ast-dump is not also provided, dumpRichard Smith2014-08-113-5/+15
| | | | | | | | anyway. If -ast-dump *is* also provided, then dump the AST declarations as well as the lookup results. This is invaluable for cross-correlating the lookup information with the declarations actually found. llvm-svn: 215393
* Change MemoryBuffer* to MemoryBuffer& parameter to Lexer::ComputePreambleDavid Blaikie2014-08-112-5/+5
| | | | | | | | | | | | | (dropping const from the reference as MemoryBuffer is immutable already, so const is just redundant - and while I'd personally put const everywhere, that's not the LLVM Way (see llvm::Type for another example of an immutable type where "const" is omitted for brevity)) Changing the pointer argument to a reference parameter makes call sites identical between callers with unique_ptrs or raw pointers, minimizing the churn in a pending unique_ptr migrations. llvm-svn: 215391
* unique_ptr-ify FileSystemStatCache::setNextStatCacheDavid Blaikie2014-08-111-2/+4
| | | | | | | | | | And in the process, discover that FileManager::removeStatCache had a double-delete when removing an element from the middle of the list (at the beginning or the end of the list, there was no problem) and add a unit test to exercise the code path (which successfully crashed when run (with modifications to match the old API) without this patch applied) llvm-svn: 215388
* Revert r215331, "unique_ptrify CompilerInstance::OutputFile(s) and remove a ↵NAKAMURA Takumi2014-08-111-16/+14
| | | | | | | | | | | | | | | | | | | | | unique_ptr around a non-owning raw_ostream in CodeGenAction::CreateASTConsumer" It cannot be compiled on Visual Studio 2012. clang\include\clang/Frontend/CompilerInstance.h(153): error C2248: 'std::unique_ptr<_Ty>::unique_ptr' : cannot access private member declared in class 'std::unique_ptr<_Ty>' with [ _Ty=llvm::raw_ostream ] D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\memory(1447) : see declaration of 'std::unique_ptr<_Ty>::unique_ptr' with [ _Ty=llvm::raw_ostream ] This diagnostic occurred in the compiler generated function 'clang::CompilerInstance::OutputFile::OutputFile(const clang::CompilerInstance::OutputFile &)' llvm-svn: 215346
* unique_ptrify CompilerInstance::OutputFile(s) and remove a unique_ptr around ↵David Blaikie2014-08-101-14/+16
| | | | | | a non-owning raw_ostream in CodeGenAction::CreateASTConsumer llvm-svn: 215331
* Out-of-line CompilerInstance::takeSema to avoid a header dependence from ↵David Blaikie2014-08-101-1/+5
| | | | | | | | | CompilerInstance.h on Sema.h Hopefully this fixes the libstdc++ build on some of the buildbots after r215321. llvm-svn: 215325
* Recommit 213307: unique_ptr-ify ownership of ASTConsumers (reverted in r213325)David Blaikie2014-08-1012-166/+169
| | | | | | | | After post-commit review and community discussion, this seems like a reasonable direction to continue, making ownership semantics explicit in the source using the type system. llvm-svn: 215323
* unique_ptr-ify CompilerInstance::takeSemaDavid Blaikie2014-08-101-1/+1
| | | | llvm-svn: 215321
* std::unique_ptr-ify the result of ASTUnit::LoadFromASTFileDavid Blaikie2014-08-103-16/+11
| | | | llvm-svn: 215320
OpenPOWER on IntegriCloud