Add .travis.yml

This commit is contained in:
Jonathan Müller 2017-04-20 12:17:00 +02:00
commit 1420abc81b
14 changed files with 82 additions and 13 deletions

62
.travis.yml Normal file
View file

@ -0,0 +1,62 @@
language: cpp
matrix:
include:
- os: linux
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5']
env: TOOLSET=g++-5 LLVM_DOWNLOAD_OS_NAME=x86_64-linux-gnu-ubuntu-14.04 LLVM_VERSION=3.9.1
- os: linux
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5']
env: TOOLSET=g++-5 LLVM_DOWNLOAD_OS_NAME=x86_64-linux-gnu-ubuntu-14.04 LLVM_VERSION=4.0.0
- os: linux
compiler: clang
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.9']
packages: ['g++-4.9', 'g++-5', 'clang-3.9']
env: TOOLSET=clang++-3.9 LLVM_DOWNLOAD_OS_NAME=x86_64-linux-gnu-ubuntu-14.04 LLVM_VERSION=3.9.1
- os: linux
compiler: clang
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.9']
packages: ['g++-4.9', 'g++-5', 'clang-3.9']
env: TOOLSET=clang++-3.9 LLVM_DOWNLOAD_OS_NAME=x86_64-linux-gnu-ubuntu-14.04 LLVM_VERSION=4.0.0
- os: osx
compiler: clang
env: TOOLSET=clang++ LLVM_DOWNLOAD_OS_NAME=x86_64-apple-darwin LLVM_VERSION=4.0.0
install:
- cd ../
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget --no-check-certificate https://www.cmake.org/files/v3.3/cmake-3.3.1-Linux-x86_64.tar.gz; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar -xzf cmake-3.3.1-Linux-x86_64.tar.gz; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CMAKE=$TRAVIS_BUILD_DIR/../cmake-3.3.1-Linux-x86_64/bin/cmake; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then wget --no-check-certificate https://cmake.org/files/v3.3/cmake-3.3.0-Darwin-x86_64.tar.gz; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tar -xzf cmake-3.3.0-Darwin-x86_64.tar.gz && ls && ls cmake-3.3.0-Darwin-x86_64; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CMAKE=$TRAVIS_BUILD_DIR/../cmake-3.3.0-Darwin-x86_64/CMake.app/Contents/bin/cmake; fi
- export CXX=$TOOLSET
- $CXX --version
- $CMAKE --version
- cd cppast/
script:
- mkdir build/ && cd build/
- $CMAKE -DCMAKE_CXX_FLAGS="-pedantic -Wall -Wextra -Wconversion -Wsign-conversion -Wno-parentheses" -DLLVM_DOWNLOAD_OS_NAME=$LLVM_DOWNLOAD_OS_NAME -DLLVM_PREFERRED_VERSION=$LLVM_VERSION ../
- $CMAKE --build .
- ./test/cppast_test

View file

@ -54,7 +54,7 @@ Else you need to set the CMake variable `LLVM_CONFIG_BINARY` to the proper path.
If you don't have a proper clang version installed, it can also be downloaded. If you don't have a proper clang version installed, it can also be downloaded.
For that you need to set `LLVM_DOWNLOAD_OS_NAME`. For that you need to set `LLVM_DOWNLOAD_OS_NAME`.
This is the name of the operating system used on the [LLVM pre-built binary archive](http://releases.llvm.org/download.html#4.0.0), e.g. `linux-gnu-ubuntu-16.10` for Ubuntu 16.10. This is the name of the operating system used on the [LLVM pre-built binary archive](http://releases.llvm.org/download.html#4.0.0), e.g. `x86_64-linux-gnu-ubuntu-16.10` for Ubuntu 16.10.
The other dependencies like [type_safe](http://type_safe.foonathan.net) are installed automatically with git submodules, if they're not installed already. The other dependencies like [type_safe](http://type_safe.foonathan.net) are installed automatically with git submodules, if they're not installed already.

View file

@ -5,6 +5,8 @@
#ifndef CPPAST_CPP_ENTITY_HPP_INCLUDED #ifndef CPPAST_CPP_ENTITY_HPP_INCLUDED
#define CPPAST_CPP_ENTITY_HPP_INCLUDED #define CPPAST_CPP_ENTITY_HPP_INCLUDED
#include <string>
#include <type_safe/optional_ref.hpp> #include <type_safe/optional_ref.hpp>
#include <cppast/detail/intrusive_list.hpp> #include <cppast/detail/intrusive_list.hpp>

View file

@ -28,7 +28,7 @@ namespace cppast
// FNV-1a 64 bit hash // FNV-1a 64 bit hash
constexpr std::size_t id_hash(const char* str, std::size_t hash = fnv_basis) constexpr std::size_t id_hash(const char* str, std::size_t hash = fnv_basis)
{ {
return *str ? id_hash(str + 1, (hash ^ *str) * fnv_prime) : hash; return *str ? id_hash(str + 1, (hash ^ std::size_t(*str)) * fnv_prime) : hash;
} }
} // namespace detail } // namespace detail
@ -50,7 +50,7 @@ namespace cppast
inline namespace literals inline namespace literals
{ {
/// \returns A new [cppast::cpp_entity_id]() created from the given string. /// \returns A new [cppast::cpp_entity_id]() created from the given string.
inline cpp_entity_id operator""_id(const char* str, std::size_t) inline cpp_entity_id operator"" _id(const char* str, std::size_t)
{ {
return cpp_entity_id(str); return cpp_entity_id(str);
} }

View file

@ -96,6 +96,7 @@ std::unique_ptr<cpp_entity> detail::parse_cpp_class(const detail::parse_context&
#if CPPAST_CINDEX_HAS_FRIEND #if CPPAST_CINDEX_HAS_FRIEND
auto is_friend = clang_getCursorKind(parent_cur) == CXCursor_FriendDecl; auto is_friend = clang_getCursorKind(parent_cur) == CXCursor_FriendDecl;
#else #else
(void)parent_cur;
auto is_friend = false; auto is_friend = false;
#endif #endif

View file

@ -5,6 +5,8 @@
#ifndef CPPAST_DEBUG_HELPER_HPP_INCLUDED #ifndef CPPAST_DEBUG_HELPER_HPP_INCLUDED
#define CPPAST_DEBUG_HELPER_HPP_INCLUDED #define CPPAST_DEBUG_HELPER_HPP_INCLUDED
#include <string>
#include "raii_wrapper.hpp" #include "raii_wrapper.hpp"
namespace cppast namespace cppast

View file

@ -58,7 +58,8 @@ namespace
for (auto i = 0; i != no; ++i) for (auto i = 0; i != no; ++i)
try try
{ {
auto parameter = parse_parameter(context, clang_Cursor_getArgument(cur, i)); auto parameter =
parse_parameter(context, clang_Cursor_getArgument(cur, unsigned(i)));
builder.add_parameter(std::move(parameter)); builder.add_parameter(std::move(parameter));
} }
catch (detail::parse_error& ex) catch (detail::parse_error& ex)

View file

@ -98,7 +98,7 @@ std::unique_ptr<cpp_entity> detail::parse_cpp_namespace_alias(const detail::pars
auto result = cpp_namespace_alias::build(*context.idx, get_entity_id(cur), std::move(name), auto result = cpp_namespace_alias::build(*context.idx, get_entity_id(cur), std::move(name),
std::move(target)); std::move(target));
context.comments.match(*result, cur); context.comments.match(*result, cur);
return result; return std::move(result);
} }
std::unique_ptr<cpp_entity> detail::parse_cpp_using_directive(const detail::parse_context& context, std::unique_ptr<cpp_entity> detail::parse_cpp_using_directive(const detail::parse_context& context,
@ -121,7 +121,7 @@ std::unique_ptr<cpp_entity> detail::parse_cpp_using_directive(const detail::pars
auto target = cpp_namespace_ref(parse_ns_target_cursor(cur), std::move(target_name)); auto target = cpp_namespace_ref(parse_ns_target_cursor(cur), std::move(target_name));
auto result = cpp_using_directive::build(target); auto result = cpp_using_directive::build(target);
context.comments.match(*result, cur); context.comments.match(*result, cur);
return result; return std::move(result);
} }
namespace namespace
@ -189,5 +189,5 @@ std::unique_ptr<cpp_entity> detail::parse_cpp_using_declaration(
auto target = cpp_entity_ref(parse_entity_target_cursor(cur), std::move(target_name)); auto target = cpp_entity_ref(parse_entity_target_cursor(cur), std::move(target_name));
auto result = cpp_using_declaration::build(std::move(target)); auto result = cpp_using_declaration::build(std::move(target));
context.comments.match(*result, cur); context.comments.match(*result, cur);
return result; return std::move(result);
} }

View file

@ -227,5 +227,5 @@ std::unique_ptr<cpp_entity> detail::parse_cpp_static_assert(const detail::parse_
auto result = cpp_static_assert::build(std::move(expr), std::move(msg)); auto result = cpp_static_assert::build(std::move(expr), std::move(msg));
context.comments.match(*result, cur); context.comments.match(*result, cur);
return result; return std::move(result);
} }

View file

@ -84,7 +84,7 @@ namespace
str.push_back(*ptr++); str.push_back(*ptr++);
++ptr; ++ptr;
line = std::stoi(str); line = unsigned(std::stoi(str));
} }
DEBUG_ASSERT(*ptr == ':', detail::assert_handler{}); DEBUG_ASSERT(*ptr == ':', detail::assert_handler{});

View file

@ -5,6 +5,7 @@
#ifndef CPPAST_TOKENIZER_HPP_INCLUDED #ifndef CPPAST_TOKENIZER_HPP_INCLUDED
#define CPPAST_TOKENIZER_HPP_INCLUDED #define CPPAST_TOKENIZER_HPP_INCLUDED
#include <string>
#include <vector> #include <vector>
#include "raii_wrapper.hpp" #include "raii_wrapper.hpp"

View file

@ -674,6 +674,6 @@ std::unique_ptr<cpp_entity> detail::parse_cpp_type_alias(const detail::parse_con
auto result = auto result =
cpp_type_alias::build(*context.idx, get_entity_id(cur), name.c_str(), std::move(type)); cpp_type_alias::build(*context.idx, get_entity_id(cur), name.c_str(), std::move(type));
context.comments.match(*result, cur); context.comments.match(*result, cur);
return result; return std::move(result);
} }
} }

View file

@ -78,7 +78,7 @@ std::unique_ptr<cpp_entity> detail::parse_cpp_variable(const detail::parse_conte
result = cpp_variable::build_declaration(get_entity_id(cur), name.c_str(), std::move(type), result = cpp_variable::build_declaration(get_entity_id(cur), name.c_str(), std::move(type),
storage_class, is_constexpr); storage_class, is_constexpr);
context.comments.match(*result, cur); context.comments.match(*result, cur);
return result; return std::move(result);
} }
std::unique_ptr<cpp_entity> detail::parse_cpp_member_variable(const detail::parse_context& context, std::unique_ptr<cpp_entity> detail::parse_cpp_member_variable(const detail::parse_context& context,
@ -108,5 +108,5 @@ std::unique_ptr<cpp_entity> detail::parse_cpp_member_variable(const detail::pars
std::move(type), std::move(default_value), is_mutable); std::move(type), std::move(default_value), is_mutable);
} }
context.comments.match(*result, cur); context.comments.match(*result, cur);
return result; return std::move(result);
} }

View file

@ -138,7 +138,7 @@ unsigned test_visit(const cppast::cpp_file& file, Func f, bool check_code = true
template <class Entity> template <class Entity>
unsigned count_children(const Entity& cont) unsigned count_children(const Entity& cont)
{ {
return std::distance(cont.begin(), cont.end()); return unsigned(std::distance(cont.begin(), cont.end()));
} }
// ignores templated scopes // ignores templated scopes