| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
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.
|
|
|
|
| |
Fixes: #94
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Only the top-level decays.
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Fixes: #92
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
| |
When an `auto` type is encountered in an interface, desugar it
through to the deduced type.
Issue: #89
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
This was forgotten when the elaborated type specifier changes were made.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
Use explicit input source files for these tests so that we can later
change the original test sources to cover more cases.
|
|
|
|
|
|
|
|
|
| |
Visual Studio 2015 Update 2 (cl 19.00.23918) adds a `__make_integer_seq`
builtin. It also started using the builtin in the `<type_traits>`
header. Clang version 3.8 and above provide this builtin but older
versions do not, so CastXML fails when built against Clang 3.6 or 3.7.
Work around this problem by adding our own implementation of the builtin
when Clang does not provide it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In code like
class foo {
template <typename> class bar {};
typedef bar<char> incomplete;
};
template class foo::bar<int>; // complete
the instantiations of `foo::bar<>` should have the same access as the
original template whether they are fully instantiated or incomplete.
GitHub-Issue: CastXML/CastXML#56
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In code like
class foo {
template <typename> class bar {};
};
the instantiations of `foo::bar<>` should have the same access as the
original template. Clang generates access `AS_none` for member template
instantiations because they have no meaningful access of their own.
Previously we have misinterpreted this as `AS_public` because it is not
`AS_private` or `AS_protected`. Instead we must detect when a class is
a template instantiation and get the access specifier from its original
template.
GitHub-Issue: CastXML/CastXML#56
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A struct like
struct foo {
int const bar;
};
cannot have an implicit default constructor but can be initialized
as an aggregate, e.g.
foo f = {123};
Clang in C++11 mode and above correctly deletes the implicit default
constructor. Add a test case covering this for C++11 and C++14.
Unfortunately Clang in C++98 mode does not mark the implicit default
constructor as invalid even after `Sema::MarkFunctionReferenced` has
been called. Therefore CastXML incorrectly generates the member.
Add a "broken" test case to record this limitation.
GitHub-Issue: CastXML/CastXML#55
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
The gccxml output format may contain only C++98 constructs.
|
|
|
|
| |
The gccxml output format may contain only C++98 constructs.
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
The gccxml output format had this attribute.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Be consistent with gccxml which did not generate the attribute.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Fix the start() function in test/input/Function-template.cxx to
actually return a value from its implementation.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|