| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| |
|
|
| |
Be consistent with gccxml which did not generate the attribute.
|
| |
|
|
|
|
| |
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.
|
| |
|
|
| |
This will allow use of non-const methods on it.
|
| |
|
|
|
| |
The NamedDecl overload of this method has only one caller. Just
inline the method overload there so that only one overload remains.
|
| |
|
|
|
| |
VS 2012 does not support 'explicit' conversion operators or
initialization of fields at their declaration.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
| |
No code needs the compiler to select an overload. We can simply
spell it out explicitly to make manual searching for calls of each
easier.
|
| |
|
|
|
|
|
| |
Also make the --help output more consistent with the wording
in the castxml(1) manual.
GitHub-Issue: 7
|
| |
|
|
|
|
|
| |
Use llvm::Triple to compute the triple string for us. Start with
the builtin default triple and modify its components based on what
we find in the detected preprocessor definitions. Then recompose
the final target triple.
|
| |
|
|
|
|
| |
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]+".
|
| |
|
|
| |
This information is produced by gccxml, so add it to our output too.
|
| |
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
Use a range-based for loop instead of explicit iterators.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
| |
Separate collection of the members of a given context from printing
of the attribute. This will allow the attribute to be printed with
members collected by other means.
|
| |
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
These macros are builtin to Clang so we should not try to use any such
definitions detected from the compiler.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
| |
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>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
Only special members may be implicit, and only implicit members may
be left undeclared. Avoid spending the time to mark other members
referenced.
|
| |
|
|
|
|
| |
When adding implicit members more classes may be completed. Use a
queue to follow this cleanly instead of allowing a vector to be
reallocated during range interation.
|
| |
|
|
|
|
| |
If there are errors in the actual input translation unit, do not bother
trying to extend it with implicit members because we will not generate
output anyway.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Tell Clang to enable incremental processing so that it does not tear
down the parser when EOF is reached. In HandleTagDeclDefinition, queue
completed classes for later processing instead of adding class implicit
members immediately. Then add implicit members at the end and finally
call clang::Sema::ActOnEndOfTranslationUnit to tear down the parser when
we are done. This approach allows Clang to finish parsing the
translation unit without interference from our custom implicit member
behavior.
Fix the expected output of the Class-bases test in c++11 mode to match
the new order of the implicit members.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Traversal of the clang::driver::JobList entries must now use
a range-based for loop.
Update expected test output to add throws="" to implicit class members
in c++98 mode (which Clang previously missed). First run
sed -i 's/artificial="1"/&( throws="")?/' test/expect/*.xml.txt
Then split the c++98 and c++11 outputs that have too many throws=""
instances for the CMake regex paren limit into separate files. For
c++98 we expect throws="" on implicit members. For c++11 we do not.
|
| |
|
|
|
| |
Traversal of the clang::driver::JobList entries now must use 'const'
clang::driver::Command instances.
|
| | |
|
| |
|
|
| |
Rename 'c++1y' to 'c++14'.
|
| |
|
|
|
|
| |
The clang::FrontendAction::CreateASTConsumer method now returns
std::unique_ptr<clang::ASTConsumer>, so update our override to return
the same type. While at it, mark our declaration with 'override'.
|
| |
|
|
|
|
| |
Use std::error_code instead of llvm::error_code. Use std::unique_ptr
instead of llvm::OwningPtr. Use llvm_map_components_to_libnames instead
of llvm_map_components_to_libraries.
|
| |
|
|
|
| |
The clang::driver::Driver constructor no longer takes a default image
name.
|
| |
|
|
|
|
|
|
| |
Tell Clang not to add its own standard library include directories when
we are simulating another compiler. Pass -nobuiltininc and -nostdlibinc
to suppress all directories that Clang might add. Do not pass -nostdinc
because that may prevent Clang code from ever checking for -nostdlibinc
and then it would warn that the argument is not used.
|
| |
|
|
|
|
|
|
| |
Some OS X compilers report their framework include directories with an
explicit suffix in "-v" output. Others report without an explicit
suffix but the paths imply they are for frameworks by ending in
"/Frameworks". Recognize either suffix and remove the explicit suffix.
Add framework directories with "-iframework" instead of "-isystem".
|
| |
|
|
|
| |
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.
|
| |
|
|
|
| |
Factor new method AddDeclContextMembers out of PrintMembersAttribute.
It will need to become recursive to support 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.
|
| |
|
|
|
|
|
|
|
|
| |
Use a set<> instead of a queue<> to represent the output node queue.
Order nodes by the dump node index. The index is the same as the order
of encounter so for complete nodes this should normally be the same
order as before. However, QueueIncompleteDumpNodes previously ordered
based on memory position which is not deterministic. Use the node index
to get a consistent order across runs. Fix the expected output for test
cases that changed the order of incomplete nodes.
|
| |
|
|
|
| |
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.
|
| |
|
|
|
| |
Pass the full structure instead of just the StartNames field.
We may need information about other options later.
|