| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
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.
|
|
|
|
| |
Reference the template parameter type as the typedef'd type.
|
|
|
|
|
| |
Add to Function-like and FunctionType elements an attributes=""
attribute for the calling convention as gccxml does.
|
|
|
|
|
|
| |
Report a file id "f0" named "<builtin>" for declarations that are
generated by the compiler and have no reference location in the source.
Add a test case covering the MSVC builtin "size_t" typedef.
|
|
|
|
| |
Teach AddDeclContextMembers to recurse on LinkageSpecDecl members.
|
|
|
|
|
|
|
| |
Since gccxml format does not support uninstantiated templates we must
not output any partial specializations either. Skip class template
partial specializations when traversing context members. Desugar
non-dependent typedef members of class template partial specializations.
|
|
|
|
|
|
|
|
|
|
|
| |
Improve support for -std=c++11 with --castxml-gccxml by dropping all
functions and class methods whose signature contains a rvalue reference.
This subsumes the previous check for implicit move constructors and
implicit move assignment operators and extends it to explicitly written
declarations too.
Add test cases to verify that such declarations are excluded from the
output.
|
|
|
|
|
| |
We need as parsers to support Visual Studio system header files
that contain inline assembly.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Parsing standard library headers in Visual Studio 11 and above requires
Clang to use -std=c++11 because the headers use C++11 constructs. While
gccxml output format does not support these constructs, it is still
useful to be able to output interfaces from C++98 project code while
tolerating C++11 constructs in system headers.
Drop the rejection of -std=c++11 and --castxml-gccxml together. Teach
our ASTVisitor::AddDumpNode method to skip deleted member functions,
implicit move constructors, and implicit move assignment operators.
This should avoid encountering any C++11 constructs that are not written
explicitly in the translation unit.
Extend the test suite to run all gccxml output format tests in both
-std=c++98 and -std=c++11 mode to verify the behavior of the two modes
is as close as possible. Tweak the Class-implicit-members expected
output to tolerate the empty throw specification missing in C++11 mode.
Add a RValueReferenceType test to verify that the gccxml-format output
contains an Unimplemented element for the rvalue-reference type.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a function template (or member of a class template) is instantiated
by an implicit class member definition, Clang delays the instantiation
for later handling by clang::Sema::PerformPendingInstantiations during
clang::Sema::ActOnEndOfTranslationUnit. If the instantiation causes
errors they are not suppressed because our clang::Sema::SFINAETrap has
gone out of scope.
Even if we could keep a clang::Sema::SFINAETrap in scope, the
clang::Sema::InstantiatingTemplate::Initialize method sets
sema.InNonInstantiationSFINAEContext to false and adds an entry to
sema.ActiveTemplateInstantiations. This prevents the
clang::Sema::EmitCurrentDiagnostic call to isSFINAEContext from
returning a valid SFINAE context, so errors are still not suppressed.
Add a test case demonstrating this known failure, and mark it as
"broken". This will require changes to Clang to fix.
|
|
|
|
| |
Clang creates an "EmptyDecl" for a stray semicolon. Ignore it.
|
|
|
|
|
| |
The gccxml output format has no representation for extern "C"
declaration contexts, so simply report the enclosing namespace.
|
|
|
|
|
| |
The gccxml output format does not support uninstantiated templates
so we need to skip friend declarations referencing them.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clang generates a distinct TemplateSpecializationType for each
appearance of A<T> for some template A<>. They are all sugar for an
underlying RecordType. While they all share the same canonical type,
LValueReferenceType instances that refer to them are also distinct and
do not share the same canonical type because each has a different
pointee type.
Add tests demonstrating cases where this causes duplicate ReferenceType
elements to be generated. Mark them as "broken" and add a note in the
expected output that matches nothing but documents the problem.
|
|
|
|
|
|
| |
Since gccxml does not output uninstantiated templates we must desugar
typedef types that would refer to declarations whose context is a
template. This is consistent with gccxml behavior.
|
|
|
|
|
|
| |
Clang presents non-inline class members in the list of declarations in
a namespace. Teach PrintMembersAttribute to skip declarations whose
actual context is not the context that listed them.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement the HandleTagDeclDefinition method in our ASTConsumer. Clang
calls this method during parsing on completion of each class definition.
This gives us a chance to modify class definitions.
Teach HandleTagDeclDefinition to add the implicit member declarations.
For each implicit member, ask Clang to try instantiating its definition
to see if a call to the member will actually work. Suppress errors
during this check using a clang::Sema::SFINAETrap and simply mark
the declaration as invalid if there were errors.
Add test cases for:
* implicit members that cannot be used due to access, const data members,
or reference data members.
* a POD array data member since Clang uses special logic when creating
implicit members that copy the data.
* a mutable data member since Clang adds implicit member declarations
itself (via clang::Sema::AddImplicitlyDeclaredMembersToClass),
but we still need to try defining them.
* a class that uses its implicit members so they are already defined.
|
|
|
|
|
| |
When a typedef is "moded" the underlying type may be different from the
named type. Report the real type.
|
|
|
|
|
| |
Report the actual function argument type even if it decayed from the
type originally specified.
|
|
|
|
| |
When an enum has no name but does have a typedef, use the typedef name.
|
| |
|
| |
|
|
|
|
|
| |
Report the canonical base type instead of a typedef type in order to
match gccxml behavior.
|
| |
|
|
|
|
|
|
|
| |
When adding a dump node for a class, use the class definition, if
available, instead of the canonical declaration. They may not be the
same when a class is forward-declared before it is defined. We need to
use the definition to get all members.
|
| |
|
|
|
|
|
|
| |
Add support for @args.rsp file references on the command line.
Add test cases covering missing response files, empty response files,
and response files that actually provide arguments.
|
|
|
|
|
|
| |
The gccxml FundamentalType names used different variants for integer
type names than Clang uses. Hard-code the names for these types.
Add a test case to cover these names.
|
|
|
|
|
|
|
| |
Although gccxml did not support C, it was occasionally requested. The
gccxml output format supports C and Clang can easily handle parsing it.
Add test cases that verify Clang can parse sources as C code and not
C++.
|
|
|
|
|
| |
Cover a class that brings overloads from a base through a using
declaration.
|
|
|
|
| |
Cover member templates of both classes and class templates.
|
|
|
|
|
|
| |
Report in Class elements a befriending="" attribute listing the class
friends. Queue the friends for output, but not necessarily as complete
types.
|
|
|
|
|
| |
Inside Class elements generate Base elements reporting the type="",
access="", and virtual="" information about base classes, if any.
|
| |
|
|
|
|
|
|
|
|
|
| |
Implement the OutputEnumDecl method to generate the Enumeration element.
Report the name="", context="", and location="" of the declaration.
Inside the Enumeration element generate EnumValue elements describing
the enumeration names and initializers.
Also map enum types to the corresponding declarations.
|
| |
|
|
|
|
|
|
|
|
| |
Honor both for purposes of the start node lookup. Walk through using
declarations (Clang UsingShadowDecl) to output the referenced
declarations in their original context. Do not include names brought
into a context by a using declaration or directive in the members of
that context.
|