summaryrefslogtreecommitdiffstats
path: root/lib/CrossTU/CrossTranslationUnit.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [analyzer][CrossTU] Extend CTU to VarDecls with initializerRafael Stahl2019-04-231-41/+92
| | | | | | | | | | | | | | | | | | | | | | Summary: The existing CTU mechanism imports `FunctionDecl`s where the definition is available in another TU. This patch extends that to VarDecls, to bind more constants. - Add VarDecl importing functionality to CrossTranslationUnitContext - Import Decls while traversing them in AnalysisConsumer - Add VarDecls to CTU external mappings generator - Name changes from "external function map" to "external definition map" Reviewers: NoQ, dcoughlin, xazax.hun, george.karpenkov, martong Reviewed By: xazax.hun Subscribers: Charusso, baloghadamsoftware, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, george.karpenkov, mgorny, whisperity, szepet, rnkovacs, a.sidorin, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D46421 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358968 91177308-0d34-0410-b5e6-96231b3b80d8
* Changed every use of ASTImporter::Import to Import_NewBalazs Keri2019-04-081-5/+20
| | | | | | | | | | | | | | Reviewers: a.sidorin, shafik, martong, a_sidorin Reviewed By: a_sidorin Subscribers: rnkovacs, dkrupp, martong, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D55049 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357913 91177308-0d34-0410-b5e6-96231b3b80d8
* [CTU] Do not allow different CPP dialects in CTUGabor Marton2019-02-281-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: If CPP dialects are different then return with error. Consider this STL code: template<typename _Alloc> struct __alloc_traits #if __cplusplus >= 201103L : std::allocator_traits<_Alloc> #endif { // ... }; This class template would create ODR errors during merging the two units, since in one translation unit the class template has a base class, however in the other unit it has none. Reviewers: xazax.hun, a_sidorin, r.stahl Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57906 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355096 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer][CrossTU][NFC] Generalize to external definitions instead of ↵Rafael Stahl2019-01-101-7/+7
| | | | | | | | | | | | | | | | external functions Summary: This is just changing naming and documentation to be general about external definitions that can be imported for cross translation unit analysis. There is at least a plan to add VarDecls: D46421 Reviewers: NoQ, xazax.hun, martong, a.sidorin, george.karpenkov, serge-sans-paille Reviewed By: xazax.hun, martong Subscribers: mgorny, whisperity, baloghadamsoftware, szepet, rnkovacs, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D56441 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350852 91177308-0d34-0410-b5e6-96231b3b80d8
* [CTU] Make loadExternalAST return with non nullptr on successGabor Marton2019-01-071-3/+3
| | | | | | | | | | | | | | | Summary: In loadExternalAST we return with either an error or with a valid ASTUnit pointer which should not be a nullptr. This prevents in the call site any superfluous check for being a nullptr. Reviewers: xazax.hun, a_sidorin, Szelethus, balazske Subscribers: rnkovacs, dkrupp, gamesh411, cfe-commits Differential Revision: https://reviews.llvm.org/D55280 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350521 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Add importer specific lookupGabor Marton2018-12-171-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: There are certain cases when normal C/C++ lookup (localUncachedLookup) does not find AST nodes. E.g.: Example 1: template <class T> struct X { friend void foo(); // this is never found in the DC of the TU. }; Example 2: // The fwd decl to Foo is not found in the lookupPtr of the DC of the // translation unit decl. struct A { struct Foo *p; }; In these cases we create a new node instead of returning with the old one. To fix it we create a new lookup table which holds every node and we are not interested in any C++ specific visibility considerations. Simply, we must know if there is an existing Decl in a given DC. Reviewers: a_sidorin, a.sidorin Subscribers: mgorny, rnkovacs, dkrupp, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D53708 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349351 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix up diagnostics.Richard Trieu2018-12-141-3/+2
| | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349125 91177308-0d34-0410-b5e6-96231b3b80d8
* [CTU] Add triple/lang mismatch handlingGabor Marton2018-12-071-0/+65
| | | | | | | | | | | | | | | | | | Summary: We introduce a strict policy for C++ CTU. It can work across TUs only if the C++ dialects are the same. We neither allow C vs C++ CTU. We do this because the same constructs might be represented with different properties in the corresponding AST nodes or even the nodes might be completely different (a struct will be RecordDecl in C, but it will be a CXXRectordDecl in C++, thus it may cause certain assertions during cast operations). Reviewers: xazax.hun, a_sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Differential Revision: https://reviews.llvm.org/D55134 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348610 91177308-0d34-0410-b5e6-96231b3b80d8
* [CTU] Add more lit tests and better error handlingGabor Marton2018-12-071-1/+3
| | | | | | | | | | | | | | | Summary: Adding some more CTU list tests. E.g. to check if a construct is unsupported. We also slightly modify the handling of the return value of the `Import` function from ASTImporter. Reviewers: xazax.hun, balazske, a_sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Differential Revision: https://reviews.llvm.org/D55131 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348605 91177308-0d34-0410-b5e6-96231b3b80d8
* [CTU] Add DisplayCTUProgress analyzer switchGabor Marton2018-12-071-3/+9
| | | | | | | | | | | | | | | | Summary: With a new switch we may be able to print to stderr if a new TU is being loaded during CTU. This is very important for higher level scripts (like CodeChecker) to be able to parse this output so they can create e.g. a zip file in case of a Clang crash which contains all the related TU files. Reviewers: xazax.hun, Szelethus, a_sidorin, george.karpenkov Subscribers: whisperity, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, Differential Revision: https://reviews.llvm.org/D55135 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348594 91177308-0d34-0410-b5e6-96231b3b80d8
* [CTU] Add asserts to protect invariantsGabor Marton2018-12-071-0/+3
| | | | | | | | | | Reviewers: xazax.hun, a_sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Differential Revision: https://reviews.llvm.org/D55132 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348586 91177308-0d34-0410-b5e6-96231b3b80d8
* [CTU] Add statisticsGabor Marton2018-12-071-1/+15
| | | | | | | | | | Reviewers: xazax.hun, a_sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Differential Revision: https://reviews.llvm.org/D55133 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348584 91177308-0d34-0410-b5e6-96231b3b80d8
* [CrossTU] Fix handling of Cross Translation Unit directory pathGabor Horvath2017-10-271-4/+1
| | | | | | | Differential Revision: https://reviews.llvm.org/D38842 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316764 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix implicit-fallthrough warning by adding missing breakSimon Pilgrim2017-09-241-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314079 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix unused variable warning in non-debug builds.Richard Trieu2017-09-221-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314035 91177308-0d34-0410-b5e6-96231b3b80d8
* Add Cross Translation Unit support libraryGabor Horvath2017-09-221-0/+271
This patch introduces a class that can help to build tools that require cross translation unit facilities. This class allows function definitions to be loaded from external AST files based on an index. In order to use this functionality an index is required. The index format is a flat text file but it might be replaced with a different solution in the near future. USRs are used as names to look up the functions definitions. This class also does caching to avoid redundant loading of AST files. Right now only function defnitions can be loaded using this API because this is what the in progress cross translation unit feature of the Static Analyzer requires. In to future this might be extended to classes, types etc. Differential Revision: https://reviews.llvm.org/D34512 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313975 91177308-0d34-0410-b5e6-96231b3b80d8