Commit Graph

82 Commits

Author SHA1 Message Date
Aleksei Sidorin 4c05f14271 [ASTImporter] Fix lexical DC for templated decls; support VarTemplatePartialSpecDecl
Also minor refactoring in related functions was done.

Differential Revision: https://reviews.llvm.org/D43012

llvm-svn: 325116
2018-02-14 11:18:00 +00:00
Aleksei Sidorin 8fc8510cb8 [ASTImporter] Support LambdaExprs and improve template support
Also, a number of style and bug fixes was done:

 *  ASTImporterTest: added sanity check for source node
 *  ExternalASTMerger: better lookup for template specializations
 *  ASTImporter: don't add templated declarations into DeclContext
 *  ASTImporter: introduce a helper, ImportTemplateArgumentListInfo getting SourceLocations
 *  ASTImporter: proper set ParmVarDecls for imported FunctionProtoTypeLoc

Differential Revision: https://reviews.llvm.org/D42301

llvm-svn: 323519
2018-01-26 11:36:54 +00:00
Aleksei Sidorin 47dbaf6c8e [ASTImporter] Fix missing SourceLoc import for ObjCMethodDecl selectors
Patch by Nico Rieck, test case by Sean Callanan!

Differential Revision: https://reviews.llvm.org/D6550

llvm-svn: 322079
2018-01-09 14:25:05 +00:00
Aleksei Sidorin 2697f8e4b2 [ASTImporter] Support new AST nodes:
* UnresolvedUsingType
 * EmptyDecl
 * NamespaceAliasDecl
 * UsingDecl
 * UsingShadowDecl
 * UsingDirectiveDecl
 * UnresolvedUsingValueDecl
 * UnresolvedUsingTypenameDecl

Refactor error handling in ImportTemplateArgumentLoc() method.
Add a test for inline namespaces.

llvm-svn: 318776
2017-11-21 16:08:41 +00:00
Gabor Horvath 3b392bb8d8 Revert r299355 "[ASTImporter] Fix for importing unnamed structs"
It breaks windows bots. 

llvm-svn: 299386
2017-04-03 21:06:45 +00:00
Gabor Horvath 3d2c10d941 [ASTImporter] Fix for importing unnamed structs
Patch by Peter Szecsi!

Differential Revision: https://reviews.llvm.org/D30876

llvm-svn: 299355
2017-04-03 11:57:11 +00:00
Gabor Horvath 5558ba2d82 [ASTImporter] Lookup SearchName instead of Name
When the SearchName is already calculated we should use that for the lookup.

Patch by Peter Szecsi!

Differential Revision: https://reviews.llvm.org/D30877

llvm-svn: 299354
2017-04-03 09:30:20 +00:00
Gabor Horvath 27f5ff66cc [ASTImporter] Import fix of GCCAsmStmts w/ missing symbolic operands
Patch by Zoltan Gera!

Differential Revision: https://reviews.llvm.org/D30831

llvm-svn: 297627
2017-03-13 15:32:24 +00:00
Aleksei Sidorin 55a6350613 [ASTImporter] Support default argument initialization of ParmVarDecls
Patch by Peter Szecsi!

Differential Revision: https://reviews.llvm.org/D29612

llvm-svn: 295654
2017-02-20 11:57:12 +00:00
Aleksei Sidorin 079534760c ASTImporter: fix tests on Windows with removing slashed parts of paths
Differential Revision: https://reviews.llvm.org/D26753

llvm-svn: 292781
2017-01-23 10:39:45 +00:00
Aleksei Sidorin 9931f756c1 ASTImporter: quick test fix
Differential Revision: https://reviews.llvm.org/D26753

llvm-svn: 292779
2017-01-23 10:16:30 +00:00
Aleksei Sidorin daf82f675e ASTImporter: add forgotten tests for rL292776
llvm-svn: 292778
2017-01-23 09:45:29 +00:00
Sean Callanan ee6d3fa07e Fixed layout of test/ASTMerge.
As outlined in a previous RFC, the test/ASTMerge/Inputs folder is getting full and the tests are starting to become interdependent. This is undesirable because

- it makes it harder to write new tests
- it makes it harder to figure out at a glance what old tests are doing, and
- it adds the risk of breaking one test while changing a different one, because of the interdependencies.

To fix this, according to the conversation in the RFC, I have changed the layout from

a.c
Inputs/a1.c
Inputs/a2.c

to

a/test.c
a/Inputs/a1.c
a/Inputs/a2.c
for all existing tests. I have also eliminated interdependencies by replicating the input files for each test that uses them.

https://reviews.llvm.org/D26571

llvm-svn: 287129
2016-11-16 18:21:00 +00:00
Sean Callanan e8fee34c62 Updated ASTMerge/macro.m to use _Nullable.
llvm-svn: 286151
2016-11-07 21:10:31 +00:00
Sean Callanan 24c5fe6b34 When the ASTImporter imports a source location, it avoids importing macro
expansions by calling getSpellingLoc(). That's great in most cases, but for
macros defined in the '<built-in>' source file, the source file is invalid
and does not import correctly, causing an assertion failure (the assertion
is Invalid SLocOffset or bad function choice).

A more reliable way to avoid this is to use getFileLoc(), which does not
return built-in locations. This avoids the crash but still preserves valid
source locations.

I've added a testcase that covers the previously crashing scenario.

https://reviews.llvm.org/D26054

llvm-svn: 286144
2016-11-07 20:42:25 +00:00
Aleksei Sidorin 9e447e9726 ASTMerge: explicitly specify arch for GCCAsmStmt test to calm non-x86 buildbots
This should fix r282572.

llvm-svn: 282578
2016-09-28 11:04:42 +00:00
Aleksei Sidorin 2234e0da4c ASTMerge: specify arch for GCCAsmStmt test explicitly to calm non-x86 buildbots
llvm-svn: 282576
2016-09-28 10:57:36 +00:00
Aleksei Sidorin a693b37e14 [ASTImporter] Implement some expression-related AST node import (part 2)
* Some code cleanup
* Add tests not present in http://reviews.llvm.org/D14286
* Integrate a test suite from Serge Pavlov (http://reviews.llvm.org/D14224)
* ArrayTypeTraitExpr: serialize sub-expression to avoid keeping it undefined
* Implement import of some nodes:
  - ArrayTypeTraitExpr
  - ExpressionTraitExpr
  - OpaqueValueExpr
  - ArraySubscriptExpr
  - ExplicitCastExpr
  - ImplicitValueInitExpr
  - OffsetOfExpr
  - CXXThisExpr
  - CXXThrowExpr
  - CXXNoexceptExpr
  - CXXDefaultArgExpr
  - CXXScalarValueInitExpr
  - CXXBindTemporaryExpr
  - CXXTemporaryObjectExpr
  - MaterializeTemporaryExpr
  - ExprWithCleanups

  - StaticAssertDecl
  - FriendDecl

  - DecayedType

Differential Revision: https://reviews.llvm.org/D14326

llvm-svn: 282572
2016-09-28 10:16:56 +00:00
Sean Callanan 488f861b83 When importing classes and structs with anonymous structs, it is critical that
distinct anonymous structs remain distinct despite having similar layout.

This is already ensured by distinguishing based on their placement in the parent
struct, using the function `findAnonymousStructOrUnionIndex`.

The problem is that this function only handles anonymous structs, like
```
class Foo { struct { int a; } }
```
and not untagged structs like
```
class Foo { struct { int a; } var; }
```
Both need to be handled, and this patch fixes that.  The test case ensures that this functionality doesn't regress.

Thanks to Manman Ren for review.

https://reviews.llvm.org/D22270

llvm-svn: 275460
2016-07-14 19:53:44 +00:00
Sean Callanan dd2c174132 Added support to the ASTImporter for C++ constructor initializers.
Also added named casts and propagation of "implicit" to fix the LLDB testsuite.
This is a fixed commit of r269546, which was reverted by r269575.

Thanks to Aleksei Sidorin for review and advice.

llvm-svn: 269693
2016-05-16 20:48:03 +00:00
Oleksiy Vyalov 94854be9e1 Revert r269546 "Added support to the ASTImporter for C++ constructor initializers." as it breaks TestDataFormatterSynthVal.DataFormatterSynthValueTestCase.test_with_run_command_dwarf test - http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/14699
llvm-svn: 269575
2016-05-14 19:07:13 +00:00
Sean Callanan 041cceb019 Handle injected class names in the ASTImporter.
Every class as parsed by Clang has a forward declaration of itself as a member:

class A {
  class A;
  ...
}

but when the parser generates this it ensures that the RecordTypes for the two 
are the same.  This makes (among other things) inheritance work.  This patch
fixes a bug where the ASTImporter generated two separate RecordTypes when
importing the class and the contained forward declaration, and adds a test case.

Thanks to Doug Gregor for advice on this.

llvm-svn: 269551
2016-05-14 05:43:57 +00:00
Sean Callanan 55d486d72a Added support to the ASTImporter for C++ constructor initializers.
Thanks to Aleksei Sidorin for review and advice.

llvm-svn: 269546
2016-05-14 05:20:31 +00:00
Argyrios Kyrtzidis 544ea71cd7 [ASTImporter] Implement missing VisitAccessSpecDecl function in ASTImporter class.
Patch by Elisavet Sakellari!

llvm-svn: 261274
2016-02-18 23:08:36 +00:00
David Majnemer c10b8381f7 Update tests touched by r249656
These test updates almost exclusively around the change in behavior
around enum: enums without a definition are considered incomplete except
when targeting MSVC ABIs.  Since these tests are interested in the
'incomplete-enum' behavior, restrict them to %itanium_abi_triple.

llvm-svn: 249660
2015-10-08 06:31:22 +00:00
Nikola Smiljanic fa00728f58 PR10405 - Desugar FunctionType and TemplateSpecializationType if any type that appears inside needs to be desugared.
llvm-svn: 242371
2015-07-16 01:06:17 +00:00
Colin LeMahieu e4c0d58f62 [Hexagon] Reapply 238773 after fix to LLVM.
llvm-svn: 238948
2015-06-03 17:34:22 +00:00
Rafael Espindola 015455848e Revert "[Hexagon] Test passes for hexagon target now that the backend correctly generates relocations."
This reverts commit r238754.

It depends on r238748, which was reverted.

llvm-svn: 238773
2015-06-01 19:46:36 +00:00
Colin LeMahieu 743d1a7a69 [Hexagon] Test passes for hexagon target now that the backend correctly generates relocations.
llvm-svn: 238754
2015-06-01 15:47:46 +00:00
Rick Foos 2688a49981 XFAIL Hexagon until more codegen in place.
Summary:
Hexagon is being updated, but there is not enough to pass these tests.
These sections are now on top of Colin's list.

Test Plan: Ran changes on hexagon-build-03.

Reviewers: colinl, rfoos

Reviewed By: rfoos

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D9356

llvm-svn: 236173
2015-04-29 22:54:40 +00:00
Sean Callanan 59721b3d3f Implemented ASTImporter support for Stmts and fixed
some bugs in the ASTImporter that this exposed:

- When importing functions, the body (if any) was
  previously ignored.  This patch ensures that the
  body is imported also.

- When a function-local Decl is imported, the first
  thing the ASTImporter does is import its context
  (via ImportDeclParts()).  This can trigger 
  importing the Decl again as part of the body of
  the function (but only once, since the function's
  Decl has been added to ImportedDecls).  This patch
  fixes that problem by extending ImportDeclParts()
  to return the imported Decl if it was imported as
  part of importing its context, and the patch adds
  ASTImporter::GetAlreadyImportedOrNull() to support
  this query.  All callers of ImportDeclParts return
  the imported version of the Decl if ImportDeclParts()
  returns it.

- When creating functions, InnerLocStart of the source
  function was re-used without importing.  This is a
  straight up bug, and this patch makes ASTImporter
  import the InnerLocStart and use the imported version.

- When importing FileIDs, the ASTImporter previously
  always tried to re-load the file for the corresponding
  CacheEntry from disk.  This doesn't work if the 
  CacheEntry corresponds to a named memory buffer.  This
  patch changes the code so that if the UniqueID for the
  cache entry is invalid (i.e., it is not a disk file)
  the whole entry is treated as if it were invalid, which
  forces an in-memory copy of the buffer.

Also added test cases, using the new support committed in
236011.

llvm-svn: 236012
2015-04-28 18:41:46 +00:00
Alp Toker 9c5ae47c94 Ignore test Inputs globally and remove redundant lit.local.cfg files
By adding a default config.excludes pattern we can avoid individual
suppressions in subdirectories.

This matches LLVM's lit.cfg which also excludes a few other common non-test
filenames for consistency.

llvm-svn: 194814
2013-11-15 13:37:49 +00:00
Argyrios Kyrtzidis 8ade08edba Changes so that a few tests do not fail when running under guarded malloc.
Guarded malloc emits some messages at the beginning in stderr when enabled.
These messages caused a few tests to fail.

llvm-svn: 186219
2013-07-12 22:30:03 +00:00
Rafael Espindola 925213b0fa Add 'not' to commands that are expected to fail.
This is at least good documentation, but also opens the possibility of
using pipefail.

llvm-svn: 185652
2013-07-04 16:16:58 +00:00
Andy Gibbs fcc699aee8 Extended VerifyDiagnosticConsumer to also verify source file for diagnostic.
VerifyDiagnosticConsumer previously would not check that the diagnostic and
its matching directive referenced the same source file.  Common practice was
to create directives that referenced other files but only by line number,
and this led to problems such as when the file containing the directive
didn't have enough lines to match the location of the diagnostic in the
other file, leading to bizarre file formatting and other oddities.

This patch causes VerifyDiagnosticConsumer to match source files as well as
line numbers.  Therefore, a new syntax is made available for directives, for
example:

// expected-error@file:line {{diagnostic message}}

This extends the @line feature where "file" is the file where the diagnostic
is generated.  The @line syntax is still available and uses the current file
for the diagnostic.  "file" can be specified either as a relative or absolute
path - although the latter has less usefulness, I think!  The #include search
paths will be used to locate the file and if it is not found an error will be
generated.

The new check is not optional: if the directive is in a different file to the
diagnostic, the file must be specified.  Therefore, a number of test-cases
have been updated with regard to this.

This closes out PR15613.

llvm-svn: 179677
2013-04-17 08:06:46 +00:00
Richard Smith 5bb4cdfaa9 Fix code that attempted to produce a diagnostic with one DiagnosticEngine, then
produce a note for that diagnostic either with a different DiagnosticEngine or
after calling DiagnosticEngine::Reset(). That didn't make any sense, and did the
wrong thing if the original diagnostic was suppressed.

llvm-svn: 170636
2012-12-20 02:22:15 +00:00
Andy Gibbs c6e68daac0 Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive.
llvm-svn: 166280
2012-10-19 12:44:48 +00:00
Jordan Rose b00073db80 Update VerifyDiagnosticConsumer to only get directives during parsing.
The old behavior was to re-scan any files (like modules) where we may have
directives but won't actually be parsing during the -verify invocation.
Now, we keep the old behavior in Debug builds as a sanity check (though
modules are a known entity), and expect all legitimate directives to come
from comments seen by the preprocessor.

This also affects the ARC migration tool, which captures diagnostics in
order to filter some out. This change adds an explicit cleanup to
CaptureDiagnosticsConsumer in order to let its sub-consumer handle the
real end of diagnostics.

This was originally split into four patches, but the tests do not run
cleanly without all four, so I've combined them into one commit.

Patches by Andy Gibbs, with slight modifications from me.

llvm-svn: 161650
2012-08-10 01:06:16 +00:00
Argyrios Kyrtzidis 3b60cffa22 Fix crash at @implementation with a forward reference as base class.
rdar://11020003

llvm-svn: 152596
2012-03-13 01:09:36 +00:00
Argyrios Kyrtzidis 52f53fb303 Improve location fidelity of objc decls.
-Add the location of the class name to all objc container decls, not just ObjCInterfaceDecl.
-Make objc decls consistent with the rest of the NamedDecls and have getLocation() point to the
 class name, not the location of '@'.

llvm-svn: 141061
2011-10-04 04:48:02 +00:00
Chandler Carruth 24284afa2d Flip the default for showing include stacks on notes to false. This
required modifying a few tests that specifically use note include stacks
to check the source manager's view of include stacks. I've simply added
the flag to these tests for now, they may have to be more substantially
changed if we decide to remove support for note include stacks
altogether.

Also, add a test for include stacks on notes that was supposed to go in
with the previous commit.

llvm-svn: 128390
2011-03-27 20:00:08 +00:00
Douglas Gregor 35fd7bc7e0 Fix two thinkos and add a test for importing the AST of a category
implementation.

llvm-svn: 121263
2010-12-08 16:41:55 +00:00
Douglas Gregor 14a49e2fbe Implement AST import for Objective-C property implementations
(@synthesize and @dynamic).

llvm-svn: 121159
2010-12-07 18:32:03 +00:00
Douglas Gregor 4da9d68da0 Implement ASTImporter support for Objective-C category implementations.
llvm-svn: 121139
2010-12-07 15:32:12 +00:00
Douglas Gregor da8025c09e Extern the ASTImporter to import @implementation declarations.
llvm-svn: 121097
2010-12-07 01:26:03 +00:00
Douglas Gregor e2e50d331c Implement AST import support for class template specializations.
llvm-svn: 120523
2010-12-01 01:36:18 +00:00
Douglas Gregor a082a49d9e Implement basic AST importing and merging support for class template
declarations.

llvm-svn: 120448
2010-11-30 19:14:50 +00:00
Argyrios Kyrtzidis 434383d703 Read/write to/from PCH DeclarationNameLocs, DeclarationNameInfos and QualifierInfos (rdar://8513756).
llvm-svn: 116598
2010-10-15 18:21:24 +00:00
Eric Christopher 366c146e79 Try to disable this again.
llvm-svn: 116094
2010-10-08 19:36:36 +00:00
Eric Christopher 2f38b940e3 Disable this test temporarily in an attempt to green the buildbots.
llvm-svn: 116082
2010-10-08 19:18:57 +00:00