summaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* castxml: Allow --castxml-cc-<id> to detect C language settingsBrad King2015-09-1811-2/+38
| | | | | | If the "<id>" is "gnu-c" or "msvc-c" then run the given compiler command line on a C source file instead of C++. This allows C language settings of the given compiler to be detected.
* RunClang: Exit with error if compiler invocation argument parsing failsBrad King2015-09-185-0/+6
| | | | | If an error occurs during CompilerInvocation::CreateFromArgs then exit with an error code immediately.
* test: Use more realistic macros in --castxml-cc-<id> casesBrad King2015-09-186-12/+18
| | | | | Define some of the compiler-identifying macros actually defined by GNU and MSVC compilers.
* test: Cover --castxml-cc-<id> with a bad commandBrad King2015-09-185-0/+10
|
* test: Rename cc detection tests for source file languageBrad King2015-09-179-8/+8
| | | | | | Add "-src" to the test names to indicate that they cover handling of an input source file of each language rather than detection of compiler settings for each language.
* castxml: Support -std=c++14 with --castxml-gccxmlBrad King2015-09-025-2/+111
| | | | | | | | Drop the rejection of -std=c++14 and --castxml-gccxml together. Extend the test suite to run all gccxml output format tests in -std=c++14 mode to verify the behavior of the mode is as close as possible to other modes. For the few tests that have c++11-specific expected output, use it for c++14 expected output too.
* Output: Add overrides="" attribute to methodsJörg Wollenschläger2015-08-253-0/+45
| | | | The gccxml output format had this attribute.
* Output: Add annotate() to more declaration attributes=""Jörg Wollenschläger2015-08-2412-0/+73
| | | | | | | Extend the change from commit e73fba54 (Output: Add annotate() to function declaration attributes="", 2015-08-18) to support record, enum, field, variable, and typedef since gccxml also supported attributes in these.
* Output: Add annotate() to function argument attributes=""Michka Popoff2015-08-203-0/+12
| | | | | | Extend the change from commit e73fba54 (Output: Add annotate() to function declaration attributes="", 2015-08-18) to function arguments since gccxml also supported attributes there.
* Output: Add annotate() to function declaration attributes=""Brad King2015-08-1818-0/+177
| | | | | | | | | While CastXML cannot support the `gccxml()` attribute because Clang does not define it, we can support the `annotate()` attribute that Clang provides for arbitrary string annotations. This should fill the same use case as the `gccxml()` attribute did for clients. GitHub-Issue: 25
* test: Add tests for Constructor, Destructor, and Converter elementsBrad King2015-08-187-0/+65
|
* test: Fix message about GNU CXX compiler that we find for testingBrad King2015-08-181-2/+1
| | | | | Remove a stray line and fix a typo introduced by commit 5c8a1e73 (test: Add infrastructure to run tests against real GNU compilers, 2015-02-24).
* RunClang: Exit with error if compilation jobs fail to buildBrad King2015-08-074-0/+5
| | | | | | | | If an error occurs during Driver::BuildCompilation then exit with an error code immediately. This is important when an input file is missing, for example. GitHub-Issue: 23
* test: Run __float128 tests only if GNU compiler supports itBrad King2015-07-201-12/+34
| | | | | | | | | CastXML conditionally supports __float128 when asked to simulate a GNU compiler that supports it. The type is available only on certain architectures, so do not run the tests for __float128 if the GNU compiler does not support it for the current architecture. GitHub-Issue: 22
* Output: Further hide our __float128 struct from generated xmlBrad King2015-06-246-2/+26
| | | | | | | | | | | | | | | Give the our __float128 struct an internal '__castxml' name so that it can be identified during traversal of member lists. Do not report the struct as a member of the translation unit since the typedef will be generated as a FundamentalType directly. Also generate empty mangled="" attributes for mangled names involving our __float128 struct since the mangled names will not use the "g" that GCC would for the builtin type. Add test cases that do not use --castxml-start. Verify that no test case produces '__castxml' in its output to ensure we always hide such internal details from the generated output. GitHub-Issue: 18
* test: Add infrastructure to test without --castxml-start optionBrad King2015-06-231-1/+1
|
* Output: Generate a FundamentalType for our __float128 typedefBrad King2015-06-232-22/+2
| | | | | | | | | | | | GNU compilers have a builtin __float128 type but Clang does not. Since commit fe1bb977ee (Detect: Provide __float128 when simulating GNU compilers, 2015-02-24) we define __float128 as a typedef in the preamble referencing a struct with the proper size and alignment. Avoid exposing this implementation detail to clients by generating a FundamentalType element as a special case when our typedef is encountered. This matches gccxml behavior when __float128 is encountered. GitHub-Issue: 18
* castxml: Teach --castxml-start to support a comma-separated listMichka Popoff2015-06-083-0/+31
| | | | | | | In gccxml one could input a comma-separated list for the starting declarations to parse. Add support for this with tests for cases were a comma-separated list is used, and for the case where --castxml-start is used multiple times.
* test: Add infrastructure for custom test input and start optionsBrad King2015-06-081-2/+13
|
* test: Add case for nested namespacesBrad King2015-06-083-0/+25
|
* castxml: Allow -target option to override --castxml-cc-<id> detectionBrad King2015-05-283-0/+6
| | | | | | | If the command line contains an explicit '-target' option then do not consider the target platform detected from any --castxml-cc-<id> option. Instead simply honor the explicitly requested target. This will be particularly helpful for targets that CastXML has not learned to detect.
* test: Add cases covering --castxml-cc-<id> target triple detectionBrad King2015-05-2812-2/+54
| | | | | Add test cases for the changes in commit 3c777ef360 (Detect: Improve target triple selection, 2015-04-16).
* test: Fix xml output matching on i386-pc-windows-msvc targetsBrad King2015-05-271-0/+2
| | | | | | | | Class methods have an extra attributes="__thiscall__" xml attribute on this architecture that does not appear in our test expectation files. We already have an explicit test that this function type attribute is generated, so simply filter it out from test output before matching.
* Output: Move function type attributes to end of element attribute listBrad King2015-05-271-3/+3
| | | | | | | Function type attributes like attributes="__thiscall__" are specific to the architecture and so may need to be filtered during testing. Move them to be the last xml attribute in their element to make filtering easier.
* Output: Generate throw="..." instead of throws="..."Michka Popoff2015-05-2134-149/+149
| | | | | | Original gccxml output used the singular name, so we should too for compatibility. Fix this typo left from commit defc576826 (Output: Generate Function and related elements, 2014-02-12).
* Output: Place inline namespace members in containing namespaceBrad King2015-05-157-0/+42
| | | | | | | | | | | | | | | | | | An inline namespace affects the linkage of its members but for APIs the members are effectively in the containing namespace. Generate output as if they were really in the containing namespace and do not generate a Namespace element for an inline namespace. If --castxml-start names an inline namespace simply ignore it to avoid dumping a Namespace element for it. One can argue this is valid since the inline namespace should not normally be named in API usage. Set our printing policy to avoid showing the inline namespace component automatically. Note that expressions in the source code that hard-code the inline namespace name will still be preserved and show the inline namespace when printed (e.g. Variable init="" attribute expressions). Suggested-by: Michka Popoff <michkapopoff@gmail.com>
* Output: Do not generate name="" attribute on anonymous namespacesBrad King2015-05-153-0/+14
| | | | Be consistent with gccxml which did not generate the attribute.
* Output: Add mangled="" attributes to function and variable declsBrad King2015-05-1251-95/+96
| | | | | | The gccxml output format includes mangled="" attributes on almost all elements. Clang only defines mangling for function and variable declarations. Add mangled attributes to castxml output where possible.
* Output: Drop unused index previously consumed by CvQualifiedType elementsBrad King2015-04-2815-97/+97
| | | | | | | | Refactoring in the parent commit removed the need to consume a node index when creating a CvQualifiedType element. That commit preserved the behavior artificially in order to minimize differences in expected test output. Now remove this behavior and update the expected test output to account for the now-contiguous indexes.
* Output: Refactor generation of CvQualifiedType elementsBrad King2015-04-2842-78/+131
| | | | | | | | | | | | | | | | | | | | | Previously our handling of cv-qualified types did not account for multiple locally cv-qualified types encountered through multiple levels of desugaring. This could lead to CvQualifiedType elements that reference elements that are generated with a different id. Refactor our internal representation of dump nodes to keep cv-qualifiers in the node ids. Teach AddTypeDumpNode to collect cv-qualifiers from each level of desugaring and compute their union. Once the desugared unqualified type is found, generate one CvQualifiedType element for the qualified type, if any. Update the expected test output to account for the new ordering of nodes. Mark the Class-template-constructor-template test case as no longer broken because this approach fixes it. Add test cases covering cv-qualifiers added at different layers of desugaring (via "T const" where T is already a "const" type in a template instantiation). GitHub-Issue: 10
* test: Add option to transform actual xml to expected xmlBrad King2015-04-281-0/+12
| | | | | | | If TEST_UPDATE is set in the environment and a test fails, transform the actual xml output into the expected xml and overwrite the .xml.txt file containing the latter. This will help make sweeping updates to the expected test output when sweeping output format changes are made.
* Output: Add "size" and "align" attributes on builtin types and structsMichka Popoff2015-04-0871-140/+140
| | | | | | This information is produced by gccxml, so add it to our output too. Since we don't know the architecture that will be targeted during testing, match any size and align values with "[0-9]+".
* Output: Generate an "offset" attribute on Field elementsMichka Popoff2015-04-088-10/+10
| | | | This information is produced by gccxml, so add it to our output too.
* Output: Handle function types with no prototypeBrad King2015-03-313-0/+9
| | | | | | | | | | | A FunctionType may be either FunctionProtoType or FunctionNoProtoType. Check that runtime downcasts to FunctionProtoType succeed before using them. For FunctionNoProtoType we will simply output the type "int()", which is compatible with gccxml format (gccxml never lacked prototypes because it always operates in C++ mode). In CastXML we can encounter functions with no prototype in C++ modes when traversing Clang buildins. GitHub-Issue: 1
* test: Print command line string when a test failsBrad King2015-03-311-0/+2
| | | | This will make it easy to re-run the command by hand for debugging.
* Port to LLVM/Clang SVN r232962 (trunk)Brad King2015-03-232-7/+7
| | | | | | | | Clang renamed clang::DeclContext::{lookup_const_result => lookup_result}. Use "auto" to automatically match either of these. Update test expected output to match the lack of throws="" on destructors in C++98 mode.
* Output: Traverse namespace redeclarationsBrad King2015-03-235-0/+35
| | | | | | | | | | | | | | | A namespace may be redeclared to add more members: namespace ns { void f1(); } namespace ns { void f2(); } Fix our AST traversal to consider members from all redeclarations of each namespace instead of only the canonical (first) one. Previously we generated members from later redeclarations only if they were referenced from other declarations we happened to encounter. Reported-by: Michka Popoff <michkapopoff@gmail.com>
* Detect: Provide __float128 when simulating GNU compilersBrad King2015-02-255-0/+42
| | | | | | | GNU compilers provide a __float128 builtin type on Intel architectures. When simulating such GNU compiler preprocessing, define a __float128 type with the expected size and alignment in case the translation unit references it.
* test: Add infrastructure to run tests against real GNU compilersBrad King2015-02-251-0/+36
| | | | | Find gcc and g++ tools on the local system to use for running tests for simulating real compilers with --castxml-cc-gnu.
* test: Default to requiring empty stdout and stderrBrad King2015-02-2532-31/+2
|
* test: Fix Function-template source to return from startBrad King2015-02-251-1/+1
| | | | | Fix the start() function in test/input/Function-template.cxx to actually return a value from its implementation.
* Detect: Do not use Clang builtin include dir with --castxml-cc-msvcBrad King2015-02-112-2/+2
| | | | | | | | | In commit 8d8aacd6 (Detect: Use Clang builtin include dir even with --castxml-cc-<id>, 2015-02-04) we added the Clang builtin include dir to the beginning of the include path detected by --castxml-cc-msvc. However, since we use only the detected predefined macros and not those builtin to Clang, the Clang builtin headers cannot be included safely. Revert that part of the commit for now.
* Detect: Drop detected predefined macros starting in '__has'Brad King2015-02-046-4/+16
| | | | | These macros are builtin to Clang so we should not try to use any such definitions detected from the compiler.
* Detect: Use Clang builtin include dir even with --castxml-cc-<id>Brad King2015-02-047-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | We need implementation-provided headers to come from Clang to match what is really built in to the parser. When not using --castxml-cc-<id>, the Clang driver adds its builtin include directory in methods like Linux::AddClangSystemIncludeArgs MSVCToolChain::AddClangSystemIncludeArgs CrossWindowsToolChain::AddClangSystemIncludeArgs (see lib/Driver/*ToolChain*.cpp). When using --castxml-cc-<id>, we must add the Clang builtin include dir in the appropriate place. GNU-like compilers should have a builtin include directory too, providing files like <emmintrin.h>. The Clang driver does not add this directory from GCC toolchains and instead adds its own builtin include directory. In this case, replace the detected compiler builtin include directory with ours. MSVC-like compilers have no separate builtin include directory. The Clang driver simply places its own builtin include direcory before the system include directory read from the INCLUDE environment variable. In this case, do the same.
* test: Add a case to test that -c is ignoredGaëtan Lehmann2015-02-033-0/+3
| | | | | | | The '-c' option is required to use castxml with ccache to tell ccache that we are compiling rather than linking. In castxml we already ignore the option when used with --castxml-gccxml, so add a test case to ensure the behavior is preserved in the future.
* castxml: Allow -E to suppress --castxml-gccxml when used togetherGaëtan Lehmann2015-01-286-4/+6
| | | | | | | | | | | This helps make castxml usable with ccache. In its first pass, ccache drops the -o and the output file from the command line and add the -E option to get the preprocessed output. It does not now about --castxml-gccxml, so castxml must not produce an error when the options are used together. Instead make -E suppress --castxml-gccxml, much like compilers do for -E and -c together. Co-Author: Brad King <brad.king@kitware.com>
* castxml: Add creditsBrad King2014-12-171-0/+3
|
* Output: Fix references to cv-qualified types encountered indirectlyBrad King2014-12-114-5/+35
| | | | | | | | | | | | Teach AddDumpNode to optionally report back the actual QualType that it selects after possibly unwrapping some layers of indirection in the Clang AST. Use this in GetTypeIdRef so that we check this actual QualType's cv qualifiers instead of the original QualType. Otherwise we may generate a dangling reference to the id number that is replaced by a CvQualifiedType id. Fix the expected output of existing test cases that exhibit this problem and add a new test case designed to cover the behavior explicitly.
* test: Improve class template member typedef test casesBrad King2014-12-114-6/+6
| | | | Reference the template parameter type as the typedef'd type.
* RunClang: Refactor definition of implicit membersBrad King2014-12-086-7/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use clang::Sema::PerformPendingInstantiations before we attempt to add implicit member definitions so any real errors show up first. Then set SuppressAllDiagnostics to suppress errors caused by the following. Iterate over all members of one class at a time in order of completion of class definition (bases before derived classes). Force definition of each member using clang::Sema::MarkFunctionReferenced followed by another call to clang::Sema::PerformPendingInstantiations to ensure that members formed by implicitly instantiated templates are completed. Clang will mark any failed declaration as invalid, allowing us to exclude it from the output. This works both for implicit and explicit members. Update the test suite to mark test cases that are no longer 'broken'. According to discussion on the Clang cfe-commits mailing list: [PATCH] Add DiagnosticSuppressionScope RAII class http://thread.gmane.org/gmane.comp.compilers.clang.scm/110832/focus=111112 this approach may depend on non-guaranteed behavior. By iterating over members in order of class definition, we mark any bad special members invalid in base classes so that when Clang processes those in derived classes the invalid members are only one "step" away. Hopefully this behavior will be easier to preserve if Clang changes in the future.