Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
clang-tidy modernizations & clang-format reformat (#2012)
Browse files Browse the repository at this point in the history
- Reformats according to tools/fix-format.sh:
Google style. Headers sorted -- except for a handful where
that resulted in errors. That part needs to be automated, and
isn't contained yet in `tools/fix-format.sh`
- adds a script to tools/ to generate compile_commands.json
  for clang_tidy.
- Ran some auto-fixes from clang-tidy-10:
```
    modernize-deprecated-headers
    modernize-make-shared
    modernize-make-unique
    modernize-use-default
    modernize-use-emplace
    modernize-use-nullptr
    modernize-use-override
    modernize-use-using
```

Should be a functional no-op, but not everything could be automated.

Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
  • Loading branch information
oschaaf committed Jul 27, 2020
1 parent 6dcad7d commit d8d13e8
Show file tree
Hide file tree
Showing 1,397 changed files with 42,659 additions and 50,094 deletions.
17 changes: 10 additions & 7 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
---
Language: Cpp
AccessModifierOffset: -2
ColumnLimit: 100
# Use the Google style in this project.
BasedOnStyle: Google
Language: Cpp
AccessModifierOffset: -1
ColumnLimit: 80
DerivePointerAlignment: false
PointerAlignment: Left
SortIncludes: true
...

SortIncludes: false
# This excludes multi-line comments, and with that
# we leave license banners as-is
CommentPragmas: "."
ReflowComments: false
---
Language: Proto
ColumnLimit: 100
SpacesInContainerLiterals: false
AllowShortFunctionsOnASingleLine: false
...
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ bazel-*
.vscode/ipch
.vscode/.vs_code_bazel_build/vs_code_aspect.bzl
external/
compile_commands.json
53 changes: 27 additions & 26 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
{
"configurations": [
{
"name": "WSL",
"intelliSenseMode": "clang-x64",
"compilerPath": "/usr/bin/clang-8",
"includePath": [
"configurations": [
{
"name": "WSL",
"intelliSenseMode": "clang-x64",
"compilerPath": "/usr/lib/llvm-10/bin/clang-10",
"includePath": [
"${workspaceFolder}",
"${workspaceFolder}//bazel-incubator-pagespeed-mod/**",
"/usr/include/x86_64-linux-gnu/5/include",
"/usr/local/include",
"/usr/include/x86_64-linux-gnu/5/include-fixed",
"/usr/include/x86_64-linux-gnu",
"/usr/include"
],
"defines": [],
"browse": {
"path": [
"${workspaceFolder}",
"${workspaceFolder}//bazel-incubator-pagespeed-mod/**",
"/usr/include/x86_64-linux-gnu/5/include",
Expand All @@ -13,23 +24,13 @@
"/usr/include/x86_64-linux-gnu",
"/usr/include"
],
"defines": [],
"browse": {
"path": [
"${workspaceFolder}",
"${workspaceFolder}//bazel-incubator-pagespeed-mod/**",
"/usr/include/x86_64-linux-gnu/5/include",
"/usr/local/include",
"/usr/include/x86_64-linux-gnu/5/include-fixed",
"/usr/include/x86_64-linux-gnu",
"/usr/include"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"cStandard": "c11",
"cppStandard": "c++14"
}
],
"version": 4
}
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": "compile_commands.json"
},
"cStandard": "c11",
"cppStandard": "c++17",
"compileCommands": "${workspaceFolder}/compile_commands.json"
}
],
"version": 4
}
16 changes: 7 additions & 9 deletions base/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@
#include "glog/logging.h"

namespace logging {
constexpr int LOG_INFO = google::GLOG_INFO;
constexpr int LOG_ERROR = google::GLOG_ERROR;
constexpr int LOG_WARNING = google::GLOG_WARNING;
constexpr int LOG_FATAL = google::GLOG_FATAL;
}
constexpr int LOG_INFO = google::GLOG_INFO;
constexpr int LOG_ERROR = google::GLOG_ERROR;
constexpr int LOG_WARNING = google::GLOG_WARNING;
constexpr int LOG_FATAL = google::GLOG_FATAL;
} // namespace logging

// TODO(oschaaf): move this out of here.
#ifndef DISALLOW_COPY_AND_ASSIGN
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
#endif
TypeName(const TypeName&); \
void operator=(const TypeName&)
5 changes: 4 additions & 1 deletion mod_pagespeed.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@
"regex": "cpp",
"set": "cpp",
"bit": "cpp"
}
},
"C_Cpp.clang_format_fallbackStyle": "Google",
"C_Cpp.clang_format_sortIncludes": true,
"editor.formatOnSave": true
}
}
Loading

0 comments on commit d8d13e8

Please sign in to comment.