summaryrefslogtreecommitdiffstats
path: root/unittests
Commit message (Collapse)AuthorAgeFilesLines
* [clang-format] Indent after breaking Javadoc annotated lineKrasimir Georgiev2018-07-302-31/+146
| | | | | | | | | | | | | | | | Summary: This patch makes clang-format indent the subsequent lines created by breaking a long javadoc annotated line. Reviewers: mprobst Reviewed By: mprobst Subscribers: acoomans, cfe-commits Differential Revision: https://reviews.llvm.org/D49797 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338232 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Introduce a matcher for `ObjCIvarExpr`, support getting it's ↵George Karpenkov2018-07-271-0/+10
| | | | | | | | | | | | | declaration. ObjCIvarExpr is *not* a subclass of MemberExpr, and a separate matcher is required to support it. Adding a hasDeclaration support as well, as it's not very useful without it. Differential Revision: https://reviews.llvm.org/D49701 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338137 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r338057 "[VirtualFileSystem] InMemoryFileSystem::status: Return a ↵Reid Kleckner2018-07-262-50/+11
| | | | | | | | Status with the requested name" This broke clang/test/PCH/case-insensitive-include.c on Windows. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338084 91177308-0d34-0410-b5e6-96231b3b80d8
* [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the ↵Simon Marchi2018-07-262-11/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | requested name Summary: InMemoryFileSystem::status behaves differently than RealFileSystem::status. The Name contained in the Status returned by RealFileSystem::status will be the path as requested by the caller, whereas InMemoryFileSystem::status returns the normalized path. For example, when requested the status for "../src/first.h", RealFileSystem returns a Status with "../src/first.h" as the Name. InMemoryFileSystem returns "/absolute/path/to/src/first.h". The reason for this change is that I want to make a unit test in the clangd testsuite (where we use an InMemoryFileSystem) to reproduce a bug I get with the clangd program (where a RealFileSystem is used). This difference in behavior "hides" the bug in the unit test version. Reviewers: malaperle, ilya-biryukov, bkramer Subscribers: cfe-commits, ioeric, ilya-biryukov, bkramer, hokein, omtcyfz Differential Revision: https://reviews.llvm.org/D48903 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338057 91177308-0d34-0410-b5e6-96231b3b80d8
* [Test commit] Fix a spelling error.Jiading Gai2018-07-241-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337807 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Add an isMain() matcherGeorge Karpenkov2018-07-231-0/+8
| | | | | | Differential Revision: https://reviews.llvm.org/D49615 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337761 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] add matcher for decltypeType and its underlyingTypeJonas Toth2018-07-231-0/+6
| | | | | | | | | | | | | | | | Summary: This patch introduces a new matcher for `DecltypeType` and its underlying type in order to fix a bug in clang-tidy, see https://reviews.llvm.org/D48717 for more. Reviewers: aaron.ballman, alexfh, NoQ, dcoughlin Reviewed By: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48759 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337703 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove superfluous ; to fix -Wpedantic warning from gccNico Weber2018-07-171-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337285 91177308-0d34-0410-b5e6-96231b3b80d8
* [Tooling] Add operator== to CompileCommandSimon Marchi2018-07-171-0/+28
| | | | | | | | | | | | Summary: It does the obvious thing of comparing all fields. This will be needed for a clangd patch I have in the pipeline. Subscribers: dblaikie, ilya-biryukov, ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D49265 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337284 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Fix poisonous structural equivalence cacheGabor Marton2018-07-171-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Implementation functions call into the member functions of ASTStructuralEquivalence, thus they can falsely alter the DeclsToCheck state (they add decls). This results that some leaf declarations can be stated as inequivalent as a side effect of one inequivalent element in the DeclsToCheck list. And since we store the non-equivalencies, any (otherwise independent) decls will be rendered as non-equivalent. Solution: I tried to clearly separate the implementation functions (the static ones) and the public interface. From now on, the implementation functions do not call any public member functions, only other implementation functions. Reviewers: a.sidorin, a_sidorin, r.stahl Subscribers: rnkovacs, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D49300 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337275 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Fix import of unnamed structsGabor Marton2018-07-172-7/+123
| | | | | | | | | | | | | | | Summary: D48773 simplified ASTImporter nicely, but it introduced a new error: Unnamed structs are not imported correctly, if they appear in a recursive context. This patch provides a fix for structural equivalency. Reviewers: a.sidorin, a_sidorin, balazske, gerazo Subscribers: rnkovacs, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D49296 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337267 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Import described template (if any) of function.Balazs Keri2018-07-171-1/+1
| | | | | | | | | | | | | | | | | Summary: When a function is imported, check if it has a described template. The name lookup is corrected to find the templated entity in this case. The described template of the function is imported too. Reviewers: a.sidorin, a_sidorin Reviewed By: a_sidorin Subscribers: a_sidorin, martong, cfe-commits Differential Revision: https://reviews.llvm.org/D49235 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337260 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Quickfix for tests.George Karpenkov2018-07-161-6/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337214 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Introduce Objective-C matchers `hasReceiver` and ↵George Karpenkov2018-07-161-0/+29
| | | | | | | | `isInstanceMessage` for ObjCMessageExpr Differential Revision: https://reviews.llvm.org/D49333 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337209 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Changed constant int to unsigned int in test code.Balazs Keri2018-07-161-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337172 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Import implicit methods of existing class.Balazs Keri2018-07-161-0/+111
| | | | | | | | | | | | | | | | | | | | Summary: When an already existing class is encountered during import, check if it has implicit methods that are missing in the existing one, and import these. The to-be-imported code may use the same class in different way than the existing (before the import) code. This may result in that there are implicit methods that are not generated for the existing code. Reviewers: a.sidorin, a_sidorin Reviewed By: a_sidorin Subscribers: a_sidorin, martong, cfe-commits Differential Revision: https://reviews.llvm.org/D49245 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337162 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Fix infinite recursion on function import with struct ↵Gabor Marton2018-07-121-19/+79
| | | | | | | | | | | | | | | | | | | definition in parameters Summary: Importing a function having a struct definition in the parameter list causes a crash in the importer via infinite recursion. This patch avoids the crash and reports such functions as not supported. Unit tests make sure that normal struct definitions inside function bodies work normally on the other hand and LLDB-like type imports also do. Reviewers: a.sidorin, martong Differential Revision: https://reviews.llvm.org/D47946 Patch by Zoltan Gera! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336898 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Refactor Decl creationGabor Marton2018-07-122-33/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Generalize the creation of Decl nodes during Import. With this patch we do the same things after and before a new AST node is created (::Create) The import logic should be really simple, we create the node, then we mark that as imported, then we recursively import the parts for that node and then set them on that node. However, the AST is actually a graph, so we have to handle circles. If we mark something as imported (`MapImported()`) then we return with the corresponding `To` decl whenever we want to import that node again, this way circles are handled. In order to make this algorithm work we must ensure things, which are handled in the generic CreateDecl<> template: * There are no `Import()` calls in between any node creation (::Create) and the `MapImported()` call. * Before actually creating an AST node (::Create), we must check if the Node had been imported already, if yes then return with that one. One very important case for this is connected to templates: we may start an import both from the templated decl of a template and from the template itself. Now, the virtual `Imported` function is called in `ASTImporter::Impor(Decl *)`, but only once, when the `Decl` is imported. One point of this refactor is to separate responsibilities. The original `Imported()` had 3 responsibilities: - notify subclasses when an import happened - register the decl into `ImportedDecls` - initialise the Decl (set attributes, etc) Now all of these are in separate functions: - `Imported` - `MapImported` - `InitializeImportedDecl` I tried to check all the clients, I executed tests for `ExternalASTMerger.cpp` and some unittests for lldb. Reviewers: a.sidorin, balazske, xazax.hun, r.stahl Subscribers: rnkovacs, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D47632 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336896 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with ↵Eric Liu2018-07-112-33/+2
| | | | | | | | | | the requested name" This reverts commit r336807. This breaks users of ClangTool::mapVirtualFile. Will try to investigate a fix. See also the discussion on https://reviews.llvm.org/D48903 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336831 91177308-0d34-0410-b5e6-96231b3b80d8
* [AST] Fix for structural equivalence tests in rL336776.Balazs Keri2018-07-111-5/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336817 91177308-0d34-0410-b5e6-96231b3b80d8
* [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the ↵Simon Marchi2018-07-112-2/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | requested name Summary: InMemoryFileSystem::status behaves differently than RealFileSystem::status. The Name contained in the Status returned by RealFileSystem::status will be the path as requested by the caller, whereas InMemoryFileSystem::status returns the normalized path. For example, when requested the status for "../src/first.h", RealFileSystem returns a Status with "../src/first.h" as the Name. InMemoryFileSystem returns "/absolute/path/to/src/first.h". The reason for this change is that I want to make a unit test in the clangd testsuite (where we use an InMemoryFileSystem) to reproduce a bug I get with the clangd program (where a RealFileSystem is used). This difference in behavior "hides" the bug in the unit test version. In general, I guess it's good if InMemoryFileSystem works as much as possible like RealFileSystem. Doing so made the FileEntry::RealPathName value (assigned in FileManager::getFile) wrong when using the InMemoryFileSystem. That's because it assumes that vfs::File::getName will always return the real path. I changed to to use FileSystem::getRealPath instead. Subscribers: ilya-biryukov, ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D48903 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336807 91177308-0d34-0410-b5e6-96231b3b80d8
* [AST] Structural equivalence of methodsBalazs Keri2018-07-112-55/+519
| | | | | | | | | | | | | | | | | Summary: Added structural equivalence check for C++ methods. Improved structural equivalence tests. Added related ASTImporter tests. Reviewers: a.sidorin, szepet, xazax.hun, martong, a_sidorin Reviewed By: martong, a_sidorin Subscribers: a_sidorin, rnkovacs, cfe-commits Differential Revision: https://reviews.llvm.org/D48628 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336776 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r336590 "[libclang] evalute compound statement cursors before trying ↵Evgeniy Stepanov2018-07-101-41/+0
| | | | | | | | | to evaluate" New memory leaks in LibclangParseTest_EvaluateChildExpression_Test::TestBody() git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336716 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang] evalute compound statement cursors before trying to evaluateAlex Lorenz2018-07-091-0/+41
| | | | | | | | | | | | | | | the cursor like a declaration This change fixes a bug in libclang in which it tries to evaluate a statement cursor as a declaration cursor, because that statement still has a pointer to the declaration parent. rdar://38888477 Differential Revision: https://reviews.llvm.org/D49051 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336590 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] import FunctionDecl end locationsRafael Stahl2018-07-091-1/+1
| | | | | | | | | | | | | | Summary: On constructors that do not take the end source location, it was not imported. Fixes test from D47698 / rC336269. Reviewers: martong, a.sidorin, balazske, xazax.hun, a_sidorin Reviewed By: martong, a_sidorin Subscribers: a_sidorin, rnkovacs, cfe-commits Differential Revision: https://reviews.llvm.org/D48941 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336523 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format/ObjC] Put ObjC method arguments into one line when they fitJacek Olesiak2018-07-091-0/+42
| | | | | | | | | | | | | | | | | | | | Reapply D47195: Currently BreakBeforeParameter is set to true everytime message receiver spans multiple lines, e.g.: ``` [[object block:^{ return 42; }] aa:42 bb:42]; ``` will be formatted: ``` [[object block:^{ return 42; }] aa:42 bb:42]; ``` even though arguments could fit into one line. This change fixes this behavior. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336521 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format/ObjC] Improve split priorities for ObjC methodsJacek Olesiak2018-07-091-2/+19
| | | | | | | | | | Reduce penalty for aligning ObjC method arguments using the colon alignment as this is the canonical way. Trying to fit a whole expression into one line should not force other line breaks (e.g. when ObjC method expression is a part of other expression). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336520 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] A matcher for Objective-C @autoreleasepoolGeorge Karpenkov2018-07-061-0/+12
| | | | | | Differential Revision: https://reviews.llvm.org/D48910 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336468 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Fix import of objects with anonymous typesGabor Marton2018-07-051-0/+29
| | | | | | | | | | | | | | | | Summary: Currently, anonymous types are merged into the same redecl chain even if they are structurally inequivalent. This results that global objects are not imported, if there are at least two global objects with different anonymous types. This patch provides a fix. Reviewers: a.sidorin, balazske, r.stahl Subscribers: rnkovacs, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D48773 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336332 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] import macro source locationsRafael Stahl2018-07-041-0/+60
| | | | | | | | | | | | | | Summary: Implement full import of macro expansion info with spelling and expansion locations. Reviewers: a.sidorin, klimek, martong, balazske, xazax.hun Reviewed By: martong Subscribers: thakis, xazax.hun, balazske, rnkovacs, cfe-commits Differential Revision: https://reviews.llvm.org/D47698 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336269 91177308-0d34-0410-b5e6-96231b3b80d8
* [SemaCodeComplete] Make sure visited contexts are passed to completion ↵Eric Liu2018-07-041-0/+11
| | | | | | | | | | | | results handler. Reviewers: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48917 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336255 91177308-0d34-0410-b5e6-96231b3b80d8
* Test commit accessBalazs Keri2018-07-021-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336108 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format/ObjC] Fix NS_SWIFT_NAME(foo(bar:baz:)) after ObjC method declBen Hamilton2018-06-291-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In D44638, I partially fixed `NS_SWIFT_NAME(foo(bar:baz:))`-style annotations on C functions, but didn't add a test for Objective-C method declarations. For ObjC method declarations which are annotated with `NS_SWIFT_NAME(...)`, we currently fail to annotate the final component of the selector name as `TT_SelectorName`. Because the token type is left unknown, clang-format will happily cause a compilation error when it changes the following: ``` @interface Foo - (void)doStuffWithFoo:(id)name bar:(id)bar baz:(id)baz NS_SWIFT_NAME(doStuff(withFoo:bar:baz:)); @end ``` to: ``` @interface Foo - (void)doStuffWithFoo:(id)name bar:(id)bar baz:(id)baz NS_SWIFT_NAME(doStuff(withFoo:bar:baz :)); @end ``` (note the linebreak before the final `:`). The logic which decides whether or not to annotate the token before a `:` with `TT_SelectorName` is pretty fragile, and has to handle some pretty odd cases like pair-parameters: ``` [I drawRectOn:surface ofSize:aa:bbb atOrigin:cc:dd]; ``` So, to minimize the effect of this change, I decided to only annotate unknown identifiers before a `:` as `TT_SelectorName` for Objective-C declaration lines. Test Plan: New tests included. Confirmed tests failed before change and passed after change. Ran tests with: % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: djasper, krasimir, jolesiak Reviewed By: krasimir Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48679 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335983 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Eliminated some unittest warnings.Gabor Marton2018-06-291-415/+326
| | | | | | | | | | | | | | | | | | | Summary: When running the ASTTests test, warnings produced by the compiler can be distracting when looking for test errors. A part of the warnings is removed by setting extra compiler options. Reviewers: a.sidorin Reviewed By: a.sidorin Subscribers: a_sidorin, martong, cfe-commits Differential Revision: https://reviews.llvm.org/D47459 Patch by Balazs Keri! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335959 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Do not format raw string literals inside a recognized ↵Krasimir Georgiev2018-06-281-0/+26
| | | | | | | | | | | | | | function with a non-recognized delimiter Summary: This stops clang-format from touching raw string contents with unrecognized delimiters inside recognized functions. Unrecognized delimiters signal that the string might be special. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48728 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335876 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix unittest build with GCC older than 5.Benjamin Kramer2018-06-281-1/+1
| | | | | | | | Old GCCs have an annoying bug where RVO disables the automatic conversion to base for unique_ptr. Add a pessimizing std::move as a workaround. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335854 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Add clangFrontend to target_link_librariesHeejin Ahn2018-06-271-0/+1
| | | | | | | Without this, builds with `-DSHARED_LIB=ON` fail. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335791 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Allow registering custom statically-linked analyzer checkersAlexander Kornienko2018-06-273-2/+85
| | | | | | | | | | | | | | | | | | Summary: Add an extension point to allow registration of statically-linked Clang Static Analyzer checkers that are not a part of the Clang tree. This extension point employs the mechanism used when checkers are registered from dynamically loaded plugins. Reviewers: george.karpenkov, NoQ, xazax.hun, dcoughlin Reviewed By: george.karpenkov Subscribers: mgorny, mikhail.ramalho, rnkovacs, xazax.hun, szepet, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D45718 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335740 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-apply: [ASTImporter] Import the whole redecl chain of functionsGabor Marton2018-06-271-70/+644
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: With this patch when any `FunctionDecl` of a redeclaration chain is imported then we bring in the whole declaration chain. This involves functions and function template specializations. Also friend functions are affected. The chain is imported as it is in the "from" tu, the order of the redeclarations are kept. I also changed the lookup logic in order to find friends, but first making them visible in their declaration context. We may have long redeclaration chains if all TU contains the same prototype, but our measurements shows no degradation in time of CTU analysis (Tmux, Xerces, Bitcoin, Protobuf). Also, as further work we could squash redundant prototypes, but first ensure that functionality is working properly; then should we optimize. This may seem like a huge patch, sorry about that. But, most of the changes are new tests, changes in the production code is not that much. I also tried to create a smaller patch which does not affect specializations, but that patch failed to pass some of the `clang-import-test`s because there we import function specializations. Also very importantly, we can't just change the import of `FunctionDecl`s without changing the import of function template specializations because they are handled as `FunctionDecl`s. Reviewers: a.sidorin, r.stahl, xazax.hun, balazske, a_sidorin Reviewed By: a_sidorin Subscribers: labath, aprantl, a_sidorin, rnkovacs, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D47532 Re-apply commit rC335480 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335731 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[ASTImporter] Import the whole redecl chain of functions"Gabor Marton2018-06-251-644/+70
| | | | | | This reverts commit r335480. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335491 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Import the whole redecl chain of functionsGabor Marton2018-06-251-70/+644
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: With this patch when any `FunctionDecl` of a redeclaration chain is imported then we bring in the whole declaration chain. This involves functions and function template specializations. Also friend functions are affected. The chain is imported as it is in the "from" tu, the order of the redeclarations are kept. I also changed the lookup logic in order to find friends, but first making them visible in their declaration context. We may have long redeclaration chains if all TU contains the same prototype, but our measurements shows no degradation in time of CTU analysis (Tmux, Xerces, Bitcoin, Protobuf). Also, as further work we could squash redundant prototypes, but first ensure that functionality is working properly; then should we optimize. This may seem like a huge patch, sorry about that. But, most of the changes are new tests, changes in the production code is not that much. I also tried to create a smaller patch which does not affect specializations, but that patch failed to pass some of the `clang-import-test`s because there we import function specializations. Also very importantly, we can't just change the import of `FunctionDecl`s without changing the import of function template specializations because they are handled as `FunctionDecl`s. Reviewers: a.sidorin, r.stahl, xazax.hun, balazske Subscribers: rnkovacs, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D47532 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335480 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Add ms compatibility to tests which use the TestBaseGabor Marton2018-06-253-296/+283
| | | | | | | | | | | | | | | | | | Summary: In order to avoid build failures on MS, we use -fms-compatibility too in the tests which use the TestBase. Moved the family of `testImport` functions under a test fixture class, so we can use parameterized tests. Refactored `testImport` and `testImportSequence`, because `for` loops over the different compiler options is no longer needed, that is handeld by the test framework via parameters from now on. Reviewers: a.sidorin, r.stahl, xazax.hun Subscribers: rnkovacs, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D47367 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335464 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Keep @message together in text protosKrasimir Georgiev2018-06-251-0/+18
| | | | | | | | | | | | Summary: In C++ code snippets of the form `@field` are common. This makes clang-format keep them together in text protos, whereas before it would break them. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48543 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335459 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Add new tests about templated-described swingGabor Marton2018-06-251-0/+60
| | | | | | | | | | | | | | | Summary: Add a new test about importing a partial specialization (of a class). Also, this patch adds new tests about the templated-described swing, some of these fail ATM, but subsequent patches will fix them. Reviewers: a.sidorin, r.stahl, xazax.hun Subscribers: rnkovacs, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D47534 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335455 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Fix end-of-file comments text proto formattingKrasimir Georgiev2018-06-251-0/+17
| | | | | | | | | | | | | | | | | | | | Summary: The case of end-of-file comments was formatted badly: ``` key: value # end-of-file comment ``` This patch fixes that formatting: ``` key: value # end-of-file comment ``` Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48539 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335449 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Add AlwaysBreakBeforeMultilineString testsJacek Olesiak2018-06-221-0/+9
| | | | | | | | | | | | | | Summary: Followup to D47393. Reviewers: stephanemoore Reviewed By: stephanemoore Subscribers: benhamilton, cfe-commits Differential Revision: https://reviews.llvm.org/D48432 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335338 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Add support for matching the type of a friend decl.David L. Jones2018-06-181-0/+10
| | | | | | | | | | | | | | | | | | This allows matchers like: friendDecl(hasType(cxxRecordDecl(...))) friendDecl(hasType(asString(...))) It seems that hasType is probably the most reasonable narrowing matcher to overload, since it is already used to narrow to other declaration kinds. Differential Revision: https://reviews.llvm.org/D48242 Reviewers: klimek, aaron.ballman Subscribers: cfe-commits git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334930 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Don't assert-fail in specifiesTypeLoc().David L. Jones2018-06-181-0/+4
| | | | | | | | The specifiesTypeLoc() matcher narrows a nestedNameSpecifier matcher based on a typeloc within the NNS. However, the matcher does not guard against NNS which are a namespace, and cause getTypeLoc to assert-fail. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334929 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Corrected diagnostic client handling in tests.Adam Balogh2018-06-151-1/+9
| | | | | | | | | | | | | | ASTImporter tests may produce source file related warnings, the diagnostic client should be in correct state to handle it. Added 'beginSourceFile' to set the client state. Patch by: Balázs Kéri Differential Revision: https://reviews.llvm.org/D47445 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334804 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Disable AlwaysBreakBeforeMultilineStrings in Google style for ↵Ben Hamilton2018-06-141-0/+11
| | | | | | | | | | | | | | | | Objective-C 📜 Contributed by @stephanemoore. Reviewers: benhamilton, jolesiak, djasper Reviewed By: benhamilton Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D47393 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334739 91177308-0d34-0410-b5e6-96231b3b80d8