Skip to content

Commit

Permalink
Merge pull request #579 from ryuichis/llvm-11
Browse files Browse the repository at this point in the history
LLVM 11.0.0 and Release 20.10
  • Loading branch information
ryuichis committed Oct 18, 2020
2 parents 9eb04ad + 1002169 commit 476b9c3
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 42 deletions.
35 changes: 14 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,56 @@ language: cpp
matrix:
include:
- os: linux
dist: bionic
dist: focal
sudo: required
env: BUILD="test" MODULE="core"
- os: linux
dist: bionic
dist: focal
sudo: required
env: BUILD="test" MODULE="metrics"
- os: linux
dist: bionic
dist: focal
sudo: required
env: BUILD="test" MODULE="rules" DEP="core metrics"
- os: linux
dist: bionic
dist: focal
sudo: required
env: BUILD="test" MODULE="reporters" DEP="core"
- os: linux
dist: bionic
dist: focal
sudo: required
env: BUILD="test" MODULE="driver" DEP="core"
- os: linux
dist: bionic
dist: focal
sudo: required
env: BUILD="build"
- os: linux
dist: bionic
dist: focal
sudo: required
env: BUILD="docgen"
- os: osx
osx_image: xcode11.5
osx_image: xcode12.2
env: BUILD="test" MODULE="core"
- os: osx
osx_image: xcode11.5
osx_image: xcode12.2
env: BUILD="test" MODULE="metrics"
- os: osx
osx_image: xcode11.5
osx_image: xcode12.2
env: BUILD="test" MODULE="rules" DEP="core metrics"
- os: osx
osx_image: xcode11.5
osx_image: xcode12.2
env: BUILD="test" MODULE="reporters" DEP="core"
- os: osx
osx_image: xcode11.5
osx_image: xcode12.2
env: BUILD="test" MODULE="driver" DEP="core"
- os: osx
osx_image: xcode11.5
osx_image: xcode12.2
env: BUILD="build"
- os: osx
osx_image: xcode11.5
osx_image: xcode12.2
env: BUILD="docgen"

before_install:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y;
sudo apt-get update -q;
sudo apt-get install gcc-7 g++-7 -y --allow-unauthenticated;
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 50;
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 50;
fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
HOMEBREW_NO_AUTO_UPDATE=1 brew install pyenv;
eval "$(pyenv init -)";
Expand Down
1 change: 1 addition & 0 deletions oclint-core/cmake/OCLintConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ MESSAGE(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
LLVM_MAP_COMPONENTS_TO_LIBNAMES(REQ_LLVM_LIBRARIES asmparser bitreader instrumentation mcparser option support frontendopenmp)

SET(CLANG_LIBRARIES
clangToolingCore
clangTooling
clangFrontend
clangDriver
Expand Down
1 change: 1 addition & 0 deletions oclint-core/lib/RuleCarrier.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "oclint/RuleCarrier.h"

#include <clang/AST/AST.h>
#include <clang/Basic/SourceManager.h>

using namespace oclint;

Expand Down
2 changes: 1 addition & 1 deletion oclint-core/lib/Version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ using namespace oclint;

std::string Version::identifier()
{
return "0.15";
return "20.10";
}
2 changes: 1 addition & 1 deletion oclint-core/test/VersionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using namespace oclint;

TEST(VersionTest, VersionString)
{
EXPECT_THAT(Version::identifier(), StrEq("0.15"));
EXPECT_THAT(Version::identifier(), StrEq("20.10"));
}

int main(int argc, char **argv)
Expand Down
2 changes: 1 addition & 1 deletion oclint-driver/lib/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static std::string compilationJobsToString(const clang::driver::JobList &jobs)
clang::SmallString<256> errorMsg;
llvm::raw_svector_ostream errorStream(errorMsg);
jobs.Print(errorStream, "; ", true);
return errorStream.str();
return errorStream.str().str();
}

static const llvm::opt::ArgStringList *getCC1Arguments(clang::driver::Compilation *compilation)
Expand Down
2 changes: 1 addition & 1 deletion oclint-driver/lib/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static void processConfigFile(const std::string &path)
oclint::option::ConfigFile config(path);
for (const oclint::option::RuleConfigurationPair &ruleConfig : config.ruleConfigurations())
{
consumeRuleConfiguration(ruleConfig.key(), ruleConfig.value());
consumeRuleConfiguration(ruleConfig.key().str(), ruleConfig.value().str());
}
for (const llvm::StringRef &rulePath : config.rulePaths())
{
Expand Down
1 change: 1 addition & 0 deletions oclint-rules/include/oclint/AbstractASTRuleBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define OCLINT_ABSTRACTASTRULEBASE_H

#include <clang/AST/AST.h>
#include <clang/Basic/SourceManager.h>

#include "oclint/RuleBase.h"

Expand Down
3 changes: 3 additions & 0 deletions oclint-rules/lib/AbstractSourceCodeReaderRule.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "oclint/AbstractSourceCodeReaderRule.h"

#include <clang/AST/AST.h>
#include <clang/Basic/SourceManager.h>

#include "oclint/helper/SuppressHelper.h"

namespace oclint
Expand Down
15 changes: 7 additions & 8 deletions oclint-rules/lib/helper/AttributeHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ bool attributeHasAnnotation(
const std::string& annotation,
const std::string& attributeName,
std::string* comment) {
// Unqualified actions must compare directly e.g. we don't want to return a match for
// Unqualified actions must compare directly e.g. we don't want to return a match for
// for 'oclint:suppress' when the annotation is 'oclint::suppress[foo]'
if(attributeName.find('[') == std::string::npos) {
return attributeName == annotation;
}

// Otherwise, check if the attributeName is a prefix of the annotation
// We need to check prefix and not equality in case there's a comment
if(annotation.length() < attributeName.length() ||
Expand All @@ -25,7 +25,7 @@ bool attributeHasAnnotation(
// Try to pick out a comment if we need to
if(comment != nullptr) {
const auto commentStart = annotation.find('[', attributeName.length());

if(commentStart != std::string::npos && annotation.back() == ']') {
*comment =
annotation.substr(commentStart + 1, annotation.length() - commentStart - 2);
Expand All @@ -52,8 +52,8 @@ bool declHasAttribute(
if (!annotate) {
continue;
}
const std::string annotation = annotate->getAnnotation();

const std::string annotation = annotate->getAnnotation().str();
if(attributeHasAnnotation(annotation, attributeName, comment)) {
return true;
}
Expand Down Expand Up @@ -125,15 +125,15 @@ bool objCMethodDeclHasActionAttributeImpl(
baseDeclHasActionAttributeImpl(decl->findPropertyDecl(), action, rule, comment)) {
return true;
}

// Check if the method comes from a protocol, because then it doesn't have a class
// interface
const auto protocol = clang::dyn_cast<clang::ObjCProtocolDecl>(decl->getDeclContext());
if(protocol) {
const auto method = protocol->lookupMethod(decl->getSelector(), decl->isInstanceMethod());
return baseDeclHasActionAttributeImpl(method, action, rule, comment);
}

return objCMethodDeclHasAttributeFromCategory(decl, action, rule, comment);

}
Expand All @@ -149,4 +149,3 @@ bool declHasActionAttribute(
}
return baseDeclHasActionAttributeImpl(decl, action, rule, comment);
}

8 changes: 5 additions & 3 deletions oclint-rules/lib/helper/SuppressHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#include <unordered_map>
#include <utility>

#include <clang/AST/ParentMapContext.h>
#include <clang/AST/RecursiveASTVisitor.h>
#include <clang/Basic/SourceManager.h>

#include "oclint/RuleCarrier.h"

Expand All @@ -23,13 +25,13 @@ bool markedAsSuppress(const clang::Decl *decl, oclint::RuleBase *rule)
template <typename T>
bool markedParentsAsSuppress(const T &node, clang::ASTContext &context, oclint::RuleBase *rule)
{
const auto &parents = context.getParents(node);
clang::DynTypedNodeList parents = context.getParents(node);
if (parents.empty())
{
return false;
}

const clang::ast_type_traits::DynTypedNode* dynTypedNode = parents.begin();
const clang::DynTypedNode* dynTypedNode = parents.begin();
const clang::Decl *aDecl = dynTypedNode->get<clang::Decl>();
if (aDecl)
{
Expand Down Expand Up @@ -124,7 +126,7 @@ bool lineBasedShouldSuppress(int beginLine, clang::ASTContext &context)
if (commentLinesIt == singleLineMapping.end())
{
auto mainFileID = context.getSourceManager().getMainFileID();
auto commentList = context.getRawCommentList();
auto commentList = context.Comments;
const auto commentMap = commentList.getCommentsInFile(mainFileID);
if (commentMap != nullptr)
{
Expand Down
4 changes: 3 additions & 1 deletion oclint-rules/lib/util/ASTUtil.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "oclint/util/ASTUtil.h"

#include <clang/Basic/SourceManager.h>

bool isObjCMethodDeclaredInSuperClass(clang::ObjCMethodDecl *decl)
{
if (decl && !isObjCMethodDeclLocatedInInterfaceContainer(decl))
Expand All @@ -21,7 +23,7 @@ bool isObjCMethodDeclaredInProtocol(clang::ObjCMethodDecl *decl)
{
return false;
}

clang::Selector selector = decl->getSelector();
clang::ObjCInterfaceDecl *interfaceDecl = decl->getClassInterface();
if (interfaceDecl)
Expand Down
2 changes: 1 addition & 1 deletion oclint-scripts/clang
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def setup_prebuilt_binary():
if environment.is_darwin():
binary_url = path.url.clang_prebuilt_binary_for_macos
else:
binary_url = path.url.clang_prebuilt_binary_for_ubuntu_lts_18
binary_url = path.url.clang_prebuilt_binary_for_ubuntu_lts_20

current_dir = os.getcwd()
path.mkdir_p(build_path)
Expand Down
4 changes: 2 additions & 2 deletions oclint-scripts/oclintscripts/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class url:
json_compilation_database = 'https://github.com/oclint/oclint-json-compilation-database.git'
xcodebuild = 'https://github.com/oclint/oclint-xcodebuild.git'

clang_prebuilt_binary_for_macos = 'https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-apple-darwin.tar.xz'
clang_prebuilt_binary_for_ubuntu_lts_18 = 'https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz'
clang_prebuilt_binary_for_macos = 'https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz'
clang_prebuilt_binary_for_ubuntu_lts_20 = 'https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz'

def cd(dir_path):
os.chdir(dir_path)
Expand Down
4 changes: 2 additions & 2 deletions oclint-scripts/oclintscripts/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ def dev_version():
return "src"

def oclint_version():
return "0.15"
return "20.10"

def oclint_dev_version():
return oclint_version() + '.dev.' + dev_version()

def llvm_version():
return "10.0.0"
return "11.0.0"

0 comments on commit 476b9c3

Please sign in to comment.