aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/ASTMerge.cpp
AgeCommit message (Collapse)AuthorFilesLines
2022-10-31Revert "[clang] ASTImporter: Fix importing of va_list types and declarations"Matheus Izvekov1-0/+6
This reverts commit 5f820c0f55cd9d4f4520cc92eae0a1c4afe05a54. Apparently it breaks aarch64 buildbots. https://lab.llvm.org/buildbot#builders/188/builds/21591
2022-10-31[clang] ASTImporter: Fix importing of va_list types and declarationsMatheus Izvekov1-6/+0
This fixes a problem where __va_list_tag was not correctly imported, possibly leading to multiple definitions with different types. This adds __va_list_tag to it's proper scope, so that the ASTImporter can find it. Signed-off-by: Matheus Izvekov <mizvekov@gmail.com> Differential Revision: https://reviews.llvm.org/D136886
2019-07-01[ASTImporter] Mark erroneous nodes in shared stGabor Marton1-3/+3
Summary: Now we store the errors for the Decls in the "to" context too. For that, however, we have to put these errors in a shared state (among all the ASTImporter objects which handle the same "to" context but different "from" contexts). After a series of imports from different "from" TUs we have a "to" context which may have erroneous nodes in it. (Remember, the AST is immutable so there is no way to delete a node once we had created it and we realized the error later.) All these erroneous nodes are marked in ASTImporterSharedState::ImportErrors. Clients of the ASTImporter may use this as an input. E.g. the static analyzer engine may not try to analyze a function if that is marked as erroneous (it can be queried via ASTImporterSharedState::getImportDeclErrorIfAny()). Reviewers: a_sidorin, a.sidorin, shafik Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62376 llvm-svn: 364785
2019-05-15[ASTImporter] Use llvm::Expected and Error in the importer APIGabor Marton1-1/+1
Summary: This is the final phase of the refactoring towards using llvm::Expected and llvm::Error in the ASTImporter API. This involves the following: - remove old Import functions which returned with a pointer, - use the Import_New functions (which return with Err or Expected) everywhere and handle their return value - rename Import_New functions to Import This affects both Clang and LLDB. Reviewers: shafik, teemperor, aprantl, a_sidorin, balazske, a.sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits, lldb-commits Tags: #clang, #lldb Differential Revision: https://reviews.llvm.org/D61438 llvm-svn: 360760
2019-04-08Changed every use of ASTImporter::Import to Import_NewBalazs Keri1-3/+5
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 llvm-svn: 357913
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth1-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
2018-12-17[ASTImporter] Add importer specific lookupGabor Marton1-5/+6
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 llvm-svn: 349351
2018-07-30Remove trailing spaceFangrui Song1-5/+5
sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338291
2018-04-10Revert r329684 (and follow-ups 329693, 329714). See discussion on ↵Nico Weber1-4/+1
https://reviews.llvm.org/D43578. llvm-svn: 329739
2018-04-10-ftime-report switch support in Clang.Andrew V. Tischenko1-1/+4
The current support of the feature produces only 2 lines in report: -Some general Code Generation Time; -Total time of Backend Consumer actions. This patch extends Clang time report with new lines related to Preprocessor, Include Filea Search, Parsing, etc. Differential Revision: https://reviews.llvm.org/D43578 llvm-svn: 329684
2018-04-06Fix typos in clangAlexander Kornienko1-1/+1
Found via codespell -q 3 -I ../clang-whitelist.txt Where whitelist consists of: archtype cas classs checkk compres definit frome iff inteval ith lod methode nd optin ot pres statics te thru Patch by luzpaz! (This is a subset of D44188 that applies cleanly with a few files that have dubious fixes reverted.) Differential revision: https://reviews.llvm.org/D44188 llvm-svn: 329399
2017-06-29Teach ASTReader how to read only the Preprocessor state from an AST file, ↵Richard Smith1-3/+3
not the ASTContext state. We use this when running a preprocessor-only action on an AST file in order to avoid paying the runtime cost of loading the extra information. llvm-svn: 306760
2017-06-09Remove 'Filename' parameter from BeginSourceFileAction.Richard Smith1-3/+2
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
2016-02-07[Frontend] Make the memory management of FrontendAction pointers explicit by ↵Argyrios Kyrtzidis1-3/+2
using unique_ptr. llvm-svn: 260048
2015-08-18Initialize the AST consumer as soon as we have both an ASTConsumer and anRichard Smith1-1/+0
ASTContext. Fixes some cases where we could previously initialize the AST consumer more than once. llvm-svn: 245346
2015-07-17Make the clang module container format selectable from the command line.Adrian Prantl1-1/+1
- introduces a new cc1 option -fmodule-format=[raw,obj] with 'raw' being the default - supports arbitrary module container formats that libclang is agnostic to - adds the format to the module hash to avoid collisions - splits the old PCHContainerOperations into PCHContainerWriter and a PCHContainerReader. Thanks to Richard Smith for reviewing this patch! llvm-svn: 242499
2015-06-20Introduce a PCHContainerOperations interface (NFC).Adrian Prantl1-2/+4
A PCHContainerOperations abstract interface provides operations for creating and unwrapping containers for serialized ASTs (precompiled headers and clang modules). The default implementation is RawPCHContainerOperations, which uses a flat file for the output. The main application for this interface will be an ObjectFilePCHContainerOperations implementation that uses LLVM to wrap the module in an ELF/Mach-O/COFF container to store debug info alongside the AST. rdar://problem/20091852 llvm-svn: 240225
2015-04-28Implemented support for testing the ASTImporter'sSean Callanan1-1/+7
ability to generate code that CodeGen likes. Test cases can use this functionality by calling // RUN: %clang_cc1 -emit-obj -o /dev/null -ast-merge %t.1.ast -ast-merge %t.2.ast %s llvm-svn: 236011
2014-08-10Recommit 213307: unique_ptr-ify ownership of ASTConsumers (reverted in r213325)David Blaikie1-2/+2
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
2014-08-10std::unique_ptr-ify the result of ASTUnit::LoadFromASTFileDavid Blaikie1-4/+2
llvm-svn: 215320
2014-07-17Revert "unique_ptr-ify ownership of ASTConsumers"David Blaikie1-2/+2
This reverts commit r213307. Reverting to have some on-list discussion/confirmation about the ongoing direction of smart pointer usage in the LLVM project. llvm-svn: 213325
2014-07-17unique_ptr-ify ownership of ASTConsumersDavid Blaikie1-2/+2
(after fixing a bug in MultiplexConsumer I noticed the ownership of the nested consumers was implemented with raw pointers - so this fixes that... and follows the source back to its origin pushing unique_ptr ownership up through there too) llvm-svn: 213307
2014-03-07[C++11] Replacing DeclBase iterators decls_begin() and decls_end() with ↵Aaron Ballman1-5/+3
iterator_range decls(). The same is true for the noload versions of these APIs. Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203278
2013-05-03When building a module, forward diagnostics to the outer diagnostic consumer.Douglas Gregor1-3/+4
Previously, we would clone the current diagnostic consumer to produce a new diagnostic consumer to use when building a module. The problem here is that we end up losing diagnostics for important diagnostic consumers, such as serialized diagnostics (where we'd end up with two diagnostic consumers writing the same output file). With forwarding, the diagnostics from all of the different modules being built get forwarded to the one serialized-diagnostic consumer and are emitted in a sane way. Fixes <rdar://problem/13663996>. llvm-svn: 181067
2012-12-04Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth1-2/+2
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. llvm-svn: 169237
2012-10-23Make DiagnosticOptions intrusively reference-counted, and make sureDouglas Gregor1-2/+3
the various stakeholders bump up the reference count. In particular, the diagnostics engine now keeps the DiagnosticOptions object alive. llvm-svn: 166508
2012-03-11Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie1-1/+1
(Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
2012-02-20Basic: import IntrusiveRefCntPtr<> into clang namespaceDylan Noblesmith1-2/+2
The class name is long enough without the llvm:: added. Also bring in RefCountedBase and RefCountedBaseVPTR. llvm-svn: 150958
2012-02-04Use variable in place of multiple CI.getFrontendOpts() calls and use a bitArgyrios Kyrtzidis1-2/+2
of ArrayRef goodness. No functionality change. llvm-svn: 149739
2012-01-20Extract the (InputKind, std::string) pair used to describe inputs toDouglas Gregor1-2/+1
the front end into its own class, FrontendInputFile, to make it easier to introduce new per-input data. No functionality change. llvm-svn: 148546
2011-09-25Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie1-2/+2
llvm-svn: 140478
2011-08-25Introduce a -cc1 option "-emit-module", that creates a binary moduleDouglas Gregor1-2/+2
from the given source. -emit-module behaves similarly to -emit-pch, except that Sema is somewhat more strict about the contents of -emit-module. In the future, there are likely to be more interesting differences. llvm-svn: 138595
2011-07-23remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner1-2/+2
LLVM.h imports them into the clang namespace. llvm-svn: 135852
2011-01-18Introduce the notion of a "minimal" import of ASTs, to better support LLDB.Douglas Gregor1-1/+2
llvm-svn: 123723
2010-11-23now the FileManager has a FileSystemOpts ivar, stop threadingChris Lattner1-3/+1
FileSystemOpts through a ton of apis, simplifying a lot of code. This also fixes a latent bug in ASTUnit where it would invoke methods on FileManager without creating one in some code paths in cindextext. llvm-svn: 120010
2010-11-18Since multiple diagnostics can share one diagnostic client, have the client ↵Argyrios Kyrtzidis1-9/+0
keeping track of the total number of warnings/errors reported. llvm-svn: 119731
2010-11-18Refactoring of Diagnostic class.Argyrios Kyrtzidis1-9/+15
-Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class. -DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units. -The rest of the state in Diagnostic object is considered related and tied to one translation unit. -Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a SourceLocation instead of a FullSourceLoc. -Reflect the changes to various interfaces. llvm-svn: 119730
2010-11-03Implement -working-directory.Argyrios Kyrtzidis1-2/+5
When -working-directory is passed in command line, file paths are resolved relative to the specified directory. This helps both when using libclang (where we can't require the user to actually change the working directory) and to help reproduce test cases when the reproduction work comes along. --FileSystemOptions is introduced which controls how file system operations are performed (currently it just contains the working directory value if set). --FileSystemOptions are passed around to various interfaces that perform file operations. --Opening & reading the content of files should be done only through FileManager. This is useful in general since file operations will be abstracted in the future for the reproduction mechanism. FileSystemOptions is independent of FileManager so that we can have multiple translation units sharing the same FileManager but with different FileSystemOptions. Addresses rdar://8583824. llvm-svn: 118203
2010-08-18More PCH -> AST renaming.Sebastian Redl1-2/+2
llvm-svn: 111472
2010-08-13Teach ASTUnit to hold on to the Sema object and ASTConsumer that areDouglas Gregor1-0/+6
used when parsing (or re-parsing) a file. Also, when loading a precompiled header into ASTUnit, create a Sema object that holds onto semantic-analysis information. llvm-svn: 111003
2010-06-07FrontendAction: Track active file kind.Daniel Dunbar1-1/+2
llvm-svn: 105581
2010-06-07Frontend: Rename hasASTSupport to hasASTFileSupport, which is more accurate.Daniel Dunbar1-2/+2
llvm-svn: 105580
2010-04-05Make Diagnostic reference-counted, which is simpler than jugglingDouglas Gregor1-3/+3
maybe-ownership vs. ownership. llvm-svn: 100498
2010-04-05Clarify the ownership semantics of the Diagnostic object used byDouglas Gregor1-1/+2
ASTUnit. Previously, we would end up with use-after-free errors because the Diagnostic object would be creating in one place (say, CIndex) and its ownership would not be transferred into the ASTUnit. Fixes <rdar://problem/7818608>. llvm-svn: 100464
2010-02-16ASTUnit: Constant fold UseBumpAllocator to true, we don't care to support ↵Daniel Dunbar1-1/+1
this as an argument. llvm-svn: 96316
2010-02-16Don't import __va_list_tag or __builtin_va_list when mergingDouglas Gregor1-0/+6
llvm-svn: 96299
2010-02-15Tell ASTMerge to merge every declaration it sees, rather than cherry-picking ↵Douglas Gregor1-15/+1
those declarations that we know will work. llvm-svn: 96280
2010-02-11When AST merging for record declarations fails, warn about theDouglas Gregor1-9/+4
incompatibility and show where the structural differences are. For example: struct1.c:36:8: warning: type 'struct S7' has incompatible definitions in different translation units struct S7 { int i : 8; unsigned j : 8; } x7; ^ struct1.c:36:33: note: bit-field 'j' with type 'unsigned int' and length 8 here struct S7 { int i : 8; unsigned j : 8; } x7; ^ struct2.c:33:33: note: bit-field 'j' with type 'unsigned int' and length 16 here struct S7 { int i : 8; unsigned j : 16; } x7; ^ There are a few changes to make this work: - ASTImporter now has only a single Diagnostic object, not multiple diagnostic objects. Otherwise, having a warning/error printed via one Diagnostic and its note printed on the other Diagnostic could cause the note to be suppressed. - Implemented import functionality for IntegerLiteral (along with general support for statements and expressions) llvm-svn: 95900
2010-02-10Implement basic support for merging function declarations acrossDouglas Gregor1-3/+10
translation units. llvm-svn: 95794
2010-02-10Teach AST merging that variables with incomplete array types can beDouglas Gregor1-2/+4
merged with variables of constant array types. Also, make sure that we call DiagnosticClient's BeginSourceFile/EndSourceFile, so that it has a LangOptions to work with. llvm-svn: 95782