aboutsummaryrefslogtreecommitdiff
path: root/test/ASTMerge
AgeCommit message (Collapse)Author
2013-04-17Extended VerifyDiagnosticConsumer to also verify source file for diagnostic.Andy Gibbs
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179677 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-20Fix code that attempted to produce a diagnostic with one DiagnosticEngine, thenRichard Smith
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170636 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-19Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs
VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166280 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10Update VerifyDiagnosticConsumer to only get directives during parsing.Jordan Rose
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161650 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13Fix crash at @implementation with a forward reference as base class.Argyrios Kyrtzidis
rdar://11020003 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152596 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-04Improve location fidelity of objc decls.Argyrios Kyrtzidis
-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 '@'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141061 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-27Flip the default for showing include stacks on notes to false. ThisChandler Carruth
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128390 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08Fix two thinkos and add a test for importing the AST of a categoryDouglas Gregor
implementation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121263 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07Implement AST import for Objective-C property implementationsDouglas Gregor
(@synthesize and @dynamic). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121159 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07Implement ASTImporter support for Objective-C category implementations.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121139 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07Extern the ASTImporter to import @implementation declarations.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121097 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01Implement AST import support for class template specializations.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120523 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30Implement basic AST importing and merging support for class templateDouglas Gregor
declarations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120448 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-15Read/write to/from PCH DeclarationNameLocs, DeclarationNameInfos and ↵Argyrios Kyrtzidis
QualifierInfos (rdar://8513756). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116598 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-08Try to disable this again.Eric Christopher
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116094 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-08Disable this test temporarily in an attempt to green the buildbots.Eric Christopher
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116082 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-01Don't add an imported function into its lexical context until *after*Douglas Gregor
we've set all of its parameters. Fixes <rdar://problem/8499598>; thanks to Sean for the diagnosis. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115387 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-03Hack in some really terrible C++ record PCH support that I need right now.John McCall
This is required in order to test: The ASTImporter should set base classes after formally entering the definition. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105401 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07Instead of counting totally diagnostics, split the count into a countChris Lattner
of errors and warnings. This allows us to emit something like this: 2 warnings and 1 error generated. instead of: 3 diagnostics generated. This also stops counting 'notes' because they are just follow-on information about the previous diag, not a diagnostic in themselves. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100675 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-24Add test for AST importing of C++ namespaces, missing from a prior commitDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97062 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19AST import for CStyleCastExpr. With this, we can import Cocoa.h into an ↵Douglas Gregor
empty context git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96648 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19AST import for sizeof and alignof expressionsDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96647 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19AST import for DeclRefExprsDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96646 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19AST import of parenthesized expressions, unary operators, binaryDouglas Gregor
operators, and compound assignment operators. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96643 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18AST import for character literalsDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96557 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18AST import for forward declarations of Objective-C protocolsDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96555 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18Implement import of forward declarations of Objective-C classesDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96554 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18AST import of Objective-C categories.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96551 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17Implement AST merging for Objective-C properties.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96483 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17AST import for Objective-C protocolsDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96478 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17Implement AST importing and checking for Objective-C method declarations.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96442 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17Implement AST importing of Objective-C instance variables. Douglas Gregor
Check superclasses when merging two Objective-C @interfaces. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96420 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16Skeleton for importing Objective-C classesDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96306 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-15Cope with anonymous tags defined within declarators by structurallyDouglas Gregor
comparing their types under the assumption that they are equivalent, rather than importing the types and then checking for compatibility. A few minor tweaks here: - Teach structural matching to handle compatibility between function types with prototypes and those without prototypes. - Teach structural matching that an incomplete record decl is the same as any other record decl with the same name. - Keep track of pairs of declarations that we have already checked (but failed to find as structurally matching), so we don't emit diagnostics repeatedly. - When importing a typedef of an anonymous tag, be sure to link the imported tag type to its typedef. With these changes, we survive a repeated import of <stdlib.h> and <stdio.h>. Alas, the ASTNodeImporter is getting a little grotty. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-15Reimplement the structural-equality checks used to determine whetherDouglas Gregor
two types in different AST contexts are equivalent. Rather than transforming the type from one context into the other context, we perform a deep structural comparison of the types. This change addresses a serious problem with recursive data types like struct ListNode { int value; struct ListNode *Next; } xList; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96278 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12Funnel changes to the ImportedDecls list in the ASTImporter through aDouglas Gregor
single Imported function, in preparation for fixing a serious design flaw. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96044 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12Implement AST importing and merging for enumeration types andDouglas Gregor
enumerators, along with ImplicitCastExprs to make it work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96024 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12Handle AST merges of incomplete class types. Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95941 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11When AST merging for record declarations fails, warn about theDouglas Gregor
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) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95900 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11Add missing test cases for AST merging of structures.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95886 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10Implement basic support for merging function declarations acrossDouglas Gregor
translation units. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95794 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10Implement AST importing and merging for typedefs. As part of this, provide a ↵Douglas Gregor
lame implementation for importing TypeSourceInfos. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95783 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10Teach AST merging that variables with incomplete array types can beDouglas Gregor
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95782 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10Add missing header fileDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95751 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10Implement basic support for importing source locations from one ASTDouglas Gregor
into another AST, including their include history. Here's an example error that involves a conflict merging a variable with different types in two translation units (diagnosed in the third AST context into which everything is merged). /Volumes/Data/dgregor/Projects/llvm/tools/clang/test/ASTMerge/Inputs/var2.c:3:5: error: external variable 'x2' declared with incompatible types in different translation units ('int' vs. 'double') int x2; ^ In file included from /Volumes/Data/dgregor/Projects/llvm/tools/clang/test/ASTMerge/Inputs/var1.c:3: /Volumes/Data/dgregor/Projects/llvm/tools/clang/test/ASTMerge/Inputs/var1.h:1:8: note: declared here with type 'double' double x2; ^ Although we maintain include history, we do not maintain macro instantiation history across a merge. Instead, we map down to the spelling location (for now!). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95732 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-09Add in the LIT magic to avoid running AST merge test inputs asDouglas Gregor
separate tests. Thanks, Daniel! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95705 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-09Hook up the diagnostics-argument printer when merging AST files, soDouglas Gregor
that we get readable diagnostics such as: error: external variable 'x1' declared with incompatible types in different translation units ('double *' vs. 'float **') However, there is no translation of source locations, yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95704 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-09Introduce a testbed for merging multiple ASTs into a single ASTDouglas Gregor
context with the AST importer. WIP, still useless but at least it has a test. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95683 91177308-0d34-0410-b5e6-96231b3b80d8