summaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* test: Run cc-msvc-builtin-1923 test with suitable target tripleBrad King2020-04-271-1/+3
| | | | | | | | | | The test added by commit 4ef8cb85 (test: Add case for __builtin_assume_aligned declaration in MSVC header, 2020-04-03, v0.3.3~2^2) uses the MSVC `__cdecl` calling convention specifier. That is not supported by all target ABIs, so update the test to run CastXML using the `x86_64-pc-windows-msvc` target triple. Fixes: #165
* Detect: Add MSVC target triple componentBrad King2020-04-274-4/+7
| | | | When `_MSC_VER` is among compiler predefines, the target ABI is MSVC.
* test: Fix cc-gnu predefined macros on WindowsBrad King2020-04-035-8/+20
| | | | | | | | | For Windows targets, GNU compilers predefine `_WIN32` and `__MINGW32__`. CastXML uses those to set the target triple correctly when using `--castxml-cc-gnu`. Teach our fake GNU compiler in the test suite to define these too. Otherwise CastXML does not add `gnu` to the target triple. This causes the Windows-hosted Clang to choose `msvc` in the default triple and enable MS compatibility, which is incorrect.
* test: Add case for __builtin_assume_aligned declaration in MSVC headerBrad King2020-04-032-0/+9
| | | | | | In commit f9a05da6 (RunClang: Tolerate __builtin_assume_aligned declaration in MSVC header, 2020-03-31, v0.3.2~1^2) we left out a test case. Add one now.
* Update documentation and comments to use https links where possibleBrad King2020-02-132-2/+2
|
* Output: Add decltype supportLucas Gandel2020-02-111-2/+1
| | | | | Extend the `--castxml-output=1` format to support decltype. Create a dump node for the underlying type.
* cmake: bump minimum required version to 3.3Brad King2019-08-291-1/+1
| | | | | Adapt our `target_link_libraries` call based on the version of LLVM to account for policy `CMP0023` NEW behavior.
* test: Update expected XML output for LLVM/Clang 9.0Brad King2019-08-292-2/+2
| | | | The format of a lambda initializer changed slightly. Update our regex.
* Output: Indicate whether an Enumeration is scopedBrad King2019-08-194-0/+21
| | | | Fixes: #94
* Merge branch 'ppc64'Brad King2019-07-151-0/+4
|\ | | | | | | | | | | * ppc64: Detect: Drop detected predefined macros conflicting with Clang's Detect: Fix GNU builtin include directory detection on ppc64
| * Detect: Drop detected predefined macros conflicting with Clang'sBrad King2019-07-151-0/+4
| | | | | | | | | | | | Extend the filtering added by commit 1cf66488 (Detect: Drop detected predefined macros starting in '__has', 2015-02-04, v0.2.0~199) to cover more Clang builtin macros. In particular, cover builtins on ppc64.
* | test: Allow string before clang versionKyle Edwards2019-04-291-1/+2
|/ | | | | Some Debian builds have a "Debian" or "Ubuntu" string before the clang version. Relax the test to allow for this.
* RunClang: Improve predefined macros identifying castxmlBrad King2019-04-1114-14/+105
| | | | | | | | Provide `__castxml_{major,minor,patch}__`. Re-purpose `__castxml__` to be for comparison with a `__castxml_check()` helper. Leave the actual encoding of the components unspecified. Ensure the integer version value of the encoding is larger than the only value of `1000` that `__castxml__` had previously.
* Output: Add the type of nullptr as a FundamentalTypeBrad King2019-04-094-0/+25
| | | | | | | | | Extend the `--castxml-output=1` format to support the nullptr type. The name of the type is `decltype(nullptr)`. Recognize types named exactly this way (as a literal) and treat them as a FundamentalType. This gives the `std::nullptr_t` typedef a meaningful representation even without full decltype support. Leave deeper nullptr-typed expressions like `decltype((nullptr))` unchanged.
* Revise C++ coding style using clang-format-6.0Kitware Robot2019-04-0814-64/+72
| | | | | | | | | | | | Run the `clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`. Use `clang-format` version 6.0. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
* Detect: Add __STDCPP_DEFAULT_NEW_ALIGNMENT__ predefined VS macroBrad King2018-08-063-1/+21
| | | | | | | | | | | This macro is missing from the main MSVC predefined macro list but is documented by [1] and [2]. Also add `__STDCPP_STRICT_POINTER_SAFETY__` as documented by [2] in case MSVC ever starts defining it. [1] https://docs.microsoft.com/en-us/cpp/build/reference/zc-alignednew [2] https://en.cppreference.com/w/cpp/preprocessor/replace Fixes: #125
* Output: Add original types to decayed function parametersBrad King2018-03-222-24/+30
| | | | | | | | | Some types decay when used in function parameters (e.g. arrays become pointers). When this occurs, add an `original_type` attribute to reference the original type without decay. Issue: #96 Inspired-by: Todd Martin (todoooo on github)
* test: Add case covering multi-dimensional arrays in function argumentsBrad King2018-03-213-13/+19
| | | | Only the top-level decays.
* RunClang: Tolerate use of GNU builtin __has_unique_object_representationsBrad King2017-12-052-0/+4
| | | | | | | | | | | The builtin is used by the GNU type_traits header in modes aware of C++17, so we need to provide it in CastXML. LLVM/Clang SVN r316518 (implement __has_unique_object_representations, 2017-10-24), in development of Clang 6, added this GNU builtin. For older versions of LLVM/Clang, provide a minimum implementation that at least allows `type_traits` to parse. Fixes: #98
* test: Add tests for C++17 modesBrad King2017-12-055-2/+256
|
* RunClang: Detect -std=c++17 from --castxml-cc-gnuBrad King2017-12-055-0/+13
|
* RunClang: Detect -std=c++17 from --castxml-cc-msvcBrad King2017-12-053-0/+10
| | | | | | | Updates to VS 2015 and VS 2017 added support for `-std:` flags specifying the language standard level for MSVC. The level is reported in the `_MSVC_LANG` preprocessor definition instead of `__cplusplus`. Detect MSVC standard C++ level from `_MSVC_LANG`.
* test: Fix Class-implicit-member-bad-base on WindowsBrad King2017-11-062-4/+12
| | | | | | | | LLVM/Clang somehow produces a different order of two implicit constructors on Windows hosts than on other platforms. Update the expected test results to accept either order. Fixes: #95
* Output: Add deprecated attributeBrad King2017-10-1343-0/+481
| | | | Fixes: #92
* Output: Always print name= attribute for function-like elementsBrad King2017-10-036-18/+18
| | | | | | | | Anonymous struct and union types may have constructors and destructors that are also anonymous. Generate `name=""` in such cases because clients expect these function-like elements to have names as gccxml did. Issue: #89
* test: Add cases for anonymous struct and union typesBrad King2017-10-0313-0/+196
|
* Output: Treat lambda classes as anonymous and memberlessBrad King2017-09-297-0/+56
| | | | | | | | | | In C++11 the compiler synthesizes class types to represent lambda function objects. These types cannot be named directly, so treat them as anonymous. Leave out all their members for now too because they cannot be treated as normal C++98 classes represented by gccxml's format. Issue: #89
* test: Fix test output conversion for `[` and `]`Brad King2017-09-291-1/+1
| | | | | | When using `TEST_UPDATE` to convert the actual test output to the expected test output we must convert `[` and `]` to `\[` and `\]` to ensure it matches the actual content.
* Output: Add dllexport/dllimport attributesMark A Russell2017-09-2861-0/+758
|
* Output: Add size and align attributes to ReferenceTypeBrad King2017-09-28118-322/+322
| | | | | | | | These were included by gccxml, and they make sense for a reference type because its ABI is like a pointer type. Suggested-by: todoooo@users.noreply.github.com Issue: #89
* Output: Desugar 'auto' typesBrad King2017-09-284-0/+24
| | | | | | | When an `auto` type is encountered in an interface, desugar it through to the deduced type. Issue: #89
* Output: Present TypeAlias as TypedefBrad King2017-09-272-2/+8
| | | | | | | Treat `using Alias = Original` as `typedef Original Alias` to support such constructs while still generating a gccxml-compatible format. Issue: #89
* test: Stabilize order of derived class implicitsBrad King2017-09-063-38/+42
| | | | | | | In the `Function-Argument-default-cast` case, spell out the special members explicitly so that the resulting order does not depend on the order that Clang adds them. The special methods are not the purpose of this test case.
* test: Update expected output for LLVM/Clang 5.0Brad King2017-09-064-4/+4
| | | | | LLVM/Clang 5.0 no longer mentions `/ObjC` or `/ObjC++` in `not allowed with {C,C++}` error messages.
* castxml: Use real `__float128` type with LLVM/Clang 3.9+Brad King2017-08-234-8/+8
| | | | | | | | Since Clang 3.9 a real `__float128` type is available for some targets. Use it instead of our simulation struct. This is needed to work with the GCC 7 standard library which uses `__float128` types in expressions. Fixes: #87
* Run clang-format on sourcesBrad King2017-08-233-134/+139
| | | | This was forgotten when the elaborated type specifier changes were made.
* Output: Add support for elaborated type specifiersMichka Popoff2017-03-017-3/+244
| | | | | | | | | | | | Elaborated type specifiers refer to a class, struct, union, or enum name preceded by the corresponding keyword (e.g. `struct foo`). These type specifiers are important for C code, but are also sometimes relevant in the context of C++ code. Add an `ElaboratedType` XML element to the castxml output format to represent elaborated type specifiers. Increment the format *major* version number to indicate the addition of an element that will require clients to be updated.
* Output: Add size and align attributes to EnumerationBrad King2017-01-1312-12/+12
| | | | | | The GCC-XML output included these attributes, so CastXML should too. Closes: #80
* Output: Add size and align attributes to PointerTypeBrad King2017-01-1218-36/+36
| | | | | | The GCC-XML output included these attributes, so CastXML should too. Closes: #80
* test: Fix test output conversion for CastXML-format resultsBrad King2017-01-121-0/+2
| | | | | | When using `TEST_UPDATE` to convert the actual test output to the expected test output we must convert the `CastXML` element as we already do for `GCC_XML`.
* test: Run all gccxml-format test cases as castxml-format cases tooMichka Popoff2016-12-09148-1/+2217
| | | | | | | | | | | | | | Run all `gccxml.*` test cases as `castxml1.*` test cases covering output format with `--castxml-output=1`. Produce the expected test output files as follows: (cd test/expect && rename 's/^gccxml/castxml1/' gccxml.*) && git checkout test/expect && sed -i 's/GCC_XML/CastXML/' test/expect/castxml1.* This covers the current behavior of having both formats identical except for the root element. Later the new format outputs can be adapted as the format is changed.
* castxml: Add flag --castxml-output=<v> to activate a new output formatMichka Popoff2016-12-0914-1/+52
| | | | | | | | | | | | | This will allow us to move the format forward away from gccxml compatibility in order to add information about new C++ structures. The new format will work with all C and C++ language modes but still not for Objective C/C++. Retain the `--castxml-gccxml` flag to produce XML files as similar as possible as the ones produced by gccxml, but do not allow both formats to be specified at the same time. For now use the same output for both formats except for the name of the root element. Later the new format can be adapted to add new features.
* test: Rename 'castxml_test_{gccxml => output}' to be less-specificBrad King2016-12-091-220/+220
| | | | | These test cover the output, but the test infrastructure does not care which format.
* Revise C++ coding style using clang-formatKitware Robot2016-11-10176-666/+860
| | | | | | | | | | | | | Run the `src/clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. Fix expected test output for new line numbers. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
* Protect hand-formatted blocks from clang-formatBrad King2016-11-102-1/+3
|
* Output: Exclude C++11 user defined literal operators from gccxml formatBrad King2016-10-061-2/+1
| | | | | | | CastXML documents that the `--castxml-gccxml` output format excludes non-c++98 constructs. Closes: #76
* Output: Avoid assertion failure on a FunctionDecl with no identifierBrad King2016-10-066-0/+13
| | | | | | | | | | All C++98 function declarations have identifiers as names. Some C++11 function declarations, such as user defined literal operators, do not have identifiers. While we may implement support for these in a future non-gccxml output format, for now simply avoid an assertion failure by outputting such declarations as Unimplemented nodes. Issue: #76
* Output: Desugar typedefs whose context is a templateBrad King2016-08-163-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the code template <typename> struct A { struct B { typedef int intermediate_type; typedef intermediate_type type; }; }; Clang represents `A<int>::B::type` as a typedef whose type is sugared to `A<>::B::intermediate_type` where `A<>::B` is a non-template whose context is an uninstantiated template `A<>` even though the original typedef's context `A<int>::B` is a non-template whose context is an instaniated template `A<int>`. Since CastXML's gccxml output format does not support uninstantiated templates we cannot represent the context of `intermediate_type` so we must desugar it instead. Otherwise we end up with an `Unimplemented` node or even a crash in Clang because we perform operations meant for non-templates on the template context. We previously did this for typedefs that appear directly in template contexts, but not for those whose contexts are nominally non-template but contained in a template context. Fix the logic to loop through all nested contexts to perform this check. Closes: #70
* Output: Fix assertion failure on translation-unit-level operatorsBrad King2016-06-173-0/+16
| | | | | | | | | | Refactoring in commit 917c646e (Output: Generalize exclusion of internal `__castxml` builtins, 2016-04-18) introduced an unconditional call to `clang::NamedDecl::getName`, but that method asserts that the name is a valid identifier. Instead call `getIdentifier` ourselves and check the name only if it is a valid identifier. GitHub-Issue: #62
* castxml: Fix `__float128` simulation with `-std=gnu++{11,14}` againBrad King2016-05-105-5/+18
| | | | | | | | | | | | | | | The approach used in commit 1414278259 (castxml: Fix `__float128` simulation with `-std=gnu++{11,14}`, 2016-01-25) allowed Clang to use its own builtin `__float128` type when it is available. However, Clang does not really implement this builtin and issues diagnostics when it is used in some contexts (e.g. as a data member). Instead we need to provide our own approximation of the builtin in all cases. Avoid a conflict with the Clang builtin by using the preprocessor to rename the type to `__castxml__float128`. Then replace this name with `__float128` during output. GitHub-Issue: CastXML/CastXML#59