Files
android_development/vndk/tools/header-checker/src/utils/string_utils.h
Logan Chien e527e061b8 header-checker: Downgrade to C++ 14
This commit switches the option to `-std=c++14` to avoid potential ODR
violations and fix the Mac build.

This commit downgrades from `-std=c++17` to `-std=c++14` because
"llvm/Support/RWMutex.h" from clang-r370808 will use `std::shared_mutex`
when `-std=c++17` is specified but LLVM/Clang prebuilts are built with a
different implementation.

Furthermore, Mac OS X 10.8 (or 10.9) does not support
`std::shared_mutex`.  Thus, there are availability errors when we are
building header-checker for Mac OS X:

    clang-r370808/include/llvm/Support/RWMutex.h:98:8:
    error: 'shared_mutex' is unavailable: introduced in macOS 10.12

Bug: 139945549
Test: OUT_DIR=out && \
      development/vndk/tools/header-checker/android/build-prebuilts.sh

Change-Id: Ic23fbdb67f7cd0700a3001c644485f7d8d0ee3e2
2019-12-09 17:33:21 -08:00

49 lines
1.3 KiB
C++

// Copyright (C) 2019 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef STRING_UTILS_H_
#define STRING_UTILS_H_
#include <llvm/ADT/Optional.h>
#include <string>
#include <vector>
namespace header_checker {
namespace utils {
std::string_view Trim(std::string_view s);
bool StartsWith(std::string_view s, std::string_view prefix);
bool EndsWith(std::string_view s, std::string_view suffix);
std::vector<std::string_view> Split(std::string_view s,
std::string_view delim_chars);
llvm::Optional<int> ParseInt(const std::string &s);
bool ParseBool(const std::string &s);
bool IsGlobPattern(std::string_view s);
} // namespace utils
} // namespace header_checker
#endif // STRING_UTILS_H_