summaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
...
* Output: Fix unnamed enum value references in default argumentsBrad King2016-03-212-8/+13
| | | | | | | | | | | | | | | | In code like namespace ns { enum { E = 0 }; void f(int = E); } we use `clang::NamedDecl::printQualifiedName` to print the fully qualified name of the enum constant `E`. However, the method produces `ns::::E` when the enumeration type itself is not named. Work around this problem by removing one of the `::` from the result. GitHub-Issue: CastXML/CastXML#52
* Output: Print fully qualified names in variable initializersBrad King2016-03-165-0/+31
| | | | | | | | | | | | | | | | | | | In code like namespace ns { static int const C = 123; int v1 = C; typedef int Int; Int v2 = (Int)123; } we previously generated `init="C"` and `init="(Int)123"` for the variable initializers. Produce a value more useful to tools reading the output by using fully qualified names and/or canonical types. This is the same approach we already use for function default argument expressions. GitHub-Issue: CastXML/CastXML#51
* Output: Print canonical form of types named in default argumentsBrad King2016-03-165-0/+98
| | | | | | | | | | | | | | | | | | | | | In code like namespace ns { typedef unsigned int UI; void f(UI = (UI)0); } we previously generated `default="(UI)0"` for the default argument of `f` because Clang prints the expression as it was written in the source. GCC-XML would generate the canonical typed value `default="0u"`. Ideally we should generate `default="(ns::UI)0"` but Clang does not offer hooks into its type printing API. Instead we can produce a value which is useful to tools reading the output by printing the cast with a canonical type like `default="(unsigned int)0"`. In the case that the type names a struct or class the canonical type will be printed as the fully qualified name. GitHub-Issue: CastXML/CastXML#51
* test: Fix test output conversion for `*`Brad King2016-03-161-1/+1
| | | | | | When using `TEST_UPDATE` to convert the actual test output to the expected test output we must convert `*` to `\*` to ensure it matches the actual content.
* Output: Print fully qualified declarations named in default argumentsBrad King2016-03-165-0/+46
| | | | | | | | | | | | | | | | | | In code like namespace ns { static int const C = 0; void f(int = C); } we previously generated `default="C"` for the default argument of `f` because Clang prints the expression as it was written in the source. GCC-XML would generate the fully qualified name `default="ns::C"` which is more useful to tools reading the output. Update our default argument printing to do this by hooking in to Clang's pretty printer and providing a custom implementation for `DeclRefExpr`. GitHub-Issue: CastXML/CastXML#51
* RunClang: Avoid infinite class template implicit member recursionBrad King2016-03-103-0/+30
| | | | | | | | | | | | | | | | | We force declaration of class implicit members in order to generate a full description of valid members. In the case that a class is a template instantiation the definition of the implicit member bodies may recursively create new template instantiations. We queue them and continue. However, it is possible that this process will produce an unbounded depth of template instantiations that is not diagnosed by Clang's template instantiation depth limit because that does not force implicit member definition. Avoid infinite class template recursion by enforcing an artificial limit on the depth through which we force definition of class implicit members. GitHub-Issue: CastXML/CastXML#50
* RunClang: Avoid GNU extensions in glibc math headers on i386Brad King2016-02-093-0/+25
| | | | | | | | On i386 with optimizations enabled, the `bits/mathinline.h` header may use a GNU extension not implemented by Clang. Avoid parsing this code by defining `__NO_MATH_INLINES` so it will be preprocessed out. GitHub-Issue: #47
* RunClang: Tolerate __builtin_va_arg_pack during parsingBrad King2016-02-017-0/+38
| | | | | | | | | When simulating preprocessing by a GNU compiler code (in the standard library) may try to use this builtin, but Clang does not support it. Provide a fake instance of the builtin using a preprocessor macro good enough to get through parsing references to it in function bodies. GitHub-Issue: #46
* test: Add tests for `-std={gnu89,gnu++98,gnu++11,gnu++14}`Brad King2016-01-261-1/+41
| | | | | Run the tests corresponding to `-std={c89,c++98,c++11,c++14}` but with GNU extensions enabled.
* test: Run GNU-float128 test without an external compilerBrad King2016-01-261-67/+16
| | | | | Use our own `cc-gnu` test tool to activate the detection logic for `__float128` support.
* Output: Fix `__float128` mangled name suppression with MSVC manglingBrad King2016-01-261-1/+1
| | | | | | | Suppress mangled name output for any name containing `__float128` so it works for both GNU and MSVC mangling conventions. Rename the struct `__castxml_float128` to `__castxml__float128` so that the full name of the type always appears.
* Output: Fix references to types whose declaration is invalidBrad King2015-12-143-0/+40
| | | | | | | | | | | | We skip generating declarations that Clang has deemed invalid. Most callers of AddDeclDumpNode can check the return value and handle the lack of a valid decl. However, callers of AddDeclDumpNodeForType are generating references to types and expect to get a valid element to reference. We can get an invalid RecordDecl when it is a template instantation that fails (but does not otherwise produce a compilation error in Clang). References to types corresponding to the invalid RecordDecl must remain valid, so generate a Class/Struct/Union element anyway and simply leave out class members and bases.
* Output: Skip C++11 type alias declarationsBrad King2015-12-107-0/+21
| | | | The gccxml output format may contain only C++98 constructs.
* Output: Skip Typedef elements that refer to rvalue referencesBrad King2015-12-102-5/+5
| | | | The gccxml output format may contain only C++98 constructs.
* Output: Generate Base element offset="" attributeBrad King2015-12-0316-18/+37
| | | | | | | | The gccxml output format had this attribute, defined by GCC as "The offset where this basetype appears in its containing type". This is well-defined only for non-virtual base classes. GitHub-Issue: 34
* Add predefined macros for versions of CastXML and internal ClangBrad King2015-12-036-2/+35
| | | | | | | Some translation units may need to know the real tool that is performing the preprocessing even when --castxml-cc-<id> switches predefined macros to those from another compiler. Provide dedicated version macros for both CastXML and the internal Clang against which it is built.
* test: Support absolute paths to expected result filesBrad King2015-12-032-4/+10
| | | | | | Teach test/run.cmake to accept absolute paths to files containing expected results. This will allow tests to compute the expected values at configuration time.
* test: Tolerate warnings about unknown float abiMattias Ellert2015-09-241-0/+1
| | | | | | | | When running with an 'arm' target architecture, Clang warns: warning: unknown platform, assuming -mfloat-abi=soft Tolerate this warning in test output by removing it before matching.
* RunClang: Detect C and C++ std level from --castxml-cc-<id>Brad King2015-09-1829-13/+57
| | | | | | | | If no -std= option is explicitly given then parse the __cplusplus or __STDC_VERSION__ preprocessor definition from the compiler output and add the corresponding -std= flag. For MSVC we need to map _MSC_VER to -std= ourselves because the compiler does not define __cplusplus to standard values and each version hard-codes its C++ standard level.
* 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.