Age | Commit message (Collapse) | Author | Files | Lines |
|
Require all files to use Unix line endings, formalizing an already
followed convention.
|
|
See RFC:
https://discourse.llvm.org/t/policy-on-supporting-newer-c-standard-in-llvm-codebase/88114
|
|
|
|
No change of meaning, just formatting and an extra example to make it
easier to comprehend:
* Split separate, important points into their own paragraphs.
* Remove a contraction.
* Finally, show to to use "static" on a function. As before we just
showed why namespaces were bad, but not what you should do instead.
|
|
|
|
Use llvm::fill instead of std::fill
|
|
asserts (#142850)
Require using attribute `[[maybe_unused]` for assert-only variables that
may be unused in non-assert enabled builds to suppress unused variable
warnings.
---------
Co-authored-by: James Henderson <James.Henderson@sony.com>
Co-authored-by: Nikita Popov <github@npopov.com>
|
|
Fix C++ keywords in Restrict Visibility section to use `` (inline
literal) markup to be consistent with the rest of the doc.
|
|
broadly (#126775)
- Rename anonymous namespace section and rework it to
cover visibility more broadly.
- Add language suggesting restricting visibility as much as
possible, using various C++ facilities.
---------
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
|
|
- Simplify file header to not require file name and C++ Emacs tag.
See
https://discourse.llvm.org/t/is-c-in-header-files-still-relevant/83124/1
|
|
Extend example to document that single statement `else if` needs a brace
as well if the associated `if` needs a brace.
|
|
Add example to document that single statement `else` needs a brace if
the associated `if` needs a brace.
|
|
(#81587)
|
|
Differential Revision: https://reviews.llvm.org/D151187
|
|
Do not attempt to format deleted files.
|
|
Describe the darker utility. Make it clear that black/darker's default
rules should be used. Add some examples.
See ongoing discussion at
<https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style/68257>.
|
|
|
|
It was previously present in the inline code block and did not work as a
hyperlink.
Reviewed By: yassingh
Differential Revision: https://reviews.llvm.org/D153061
|
|
|
|
As discussed on the forums:
https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style/
Reviewed By: jhenderson, JDevlieghere
Differential Revision: https://reviews.llvm.org/D143852
|
|
llvm/clang/clang-tools-extra/polly/bolt"
This reverts commit ee9ccb11036ac46ff9b9f3fa2d459d9d2bce5509.
See https://reviews.llvm.org/D140585#4019417 and following.
Multiple people requested a revert of this change pending further
discussion.
|
|
We removed the Go bindings in https://reviews.llvm.org/D135436 but
missed documentation that talks about the bindings.
|
|
llvm/clang/clang-tools-extra/polly/bolt
See https://discourse.llvm.org/t/top-level-clang-tidy-options-and-variablename-suggestion-on-codingstandards/58783 ,
the CamelCase variable names guideline does not reflect the truth:
flang, libc, libclc, libcxx, libcxxabi, libunwind, lld, mlir, openmp,
and pstl use camelCase. lldb uses snake_case.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D140585
|
|
We currently suggest that users not use an else clause after a return
statement in a prior if branch. e.g.,
if (foo)
return 1;
else // Should remove this else clause
return 10;
however, this suggestion is incorrect for a constexpr if statement
because one of the two branches will be a discarded statement and thus
can impact template instantiation behavior. This updates the coding
standard to make it clear that it's okay to have a return after an else
in a constexpr if statement.
I think this is an NFC change to the intent of the rule, which is why
I've not started an RFC for the changes.
Differential Revision: https://reviews.llvm.org/D132232
|
|
Also make the soft toolchain requirements hard. This allows
us to use C++17 features in LLVM now.
If we find patterns with C++17 that improve readability
it should be recommended in the coding standards.
Reviewed By: jhenderson, cor3ntin, MaskRay
Differential Revision: https://reviews.llvm.org/D130689
|
|
While working on a clang-format option RemoveBracesLLVM that removes
braces following the guideline, we were unsure about what to do with
the braces of do-while loops. The ratio of using to omitting the
braces is about 4:1 in the llvm-project source, so it will help to
add an example to the guideline.
Also cleans up the original examples including making the nested if
example more targeted on avoiding potential dangling else situations.
Differential Revision: https://reviews.llvm.org/D126512
|
|
There are many more instances of this pattern, but I chose to limit this change to .rst files (docs), anything in libcxx/include, and string literals. These have the highest chance of being seen by end users.
Reviewed By: #libc, Mordante, martong, ldionne
Differential Revision: https://reviews.llvm.org/D124708
|
|
The Coding Guidelines specify that the ending brace of a
namespace shall have a comment like:
} // end namespace clang
However the majority of the code uses a different style:
} // namespace clang
Indeed:
$ git grep '// end' | wc -l
6724
$ git grep '// namespace' | wc -l
14348
Besides, this is the style enforced automatically by clang-format,
via the FixNamespaceComments option.
Having inconsistencies between the Coding Guidelines and the
code/tooling creates confusion, can lead to bikeshedding during
reviews and overall delays merging code. Therefore, update the
guidelines to reflect current usage. Updating legacy code to the
new standard should be done in a separate patch, if wanted.
Reviewed By: jyknight
Differential Revision: https://reviews.llvm.org/D115115
|
|
|
|
|
|
This commit replace 'master' with 'main' in llvm/docs.
Reviewed By: sammccall, kristof.beyls
Differential Revision: https://reviews.llvm.org/D92831
|
|
No longer rely on an external tool to build the llvm component layout.
Instead, leverage the existing `add_llvm_componentlibrary` cmake function and
introduce `add_llvm_component_group` to accurately describe component behavior.
These function store extra properties in the created targets. These properties
are processed once all components are defined to resolve library dependencies
and produce the header expected by llvm-config.
Differential Revision: https://reviews.llvm.org/D90848
|
|
clang-tidy's llvm-header-guard rule references the LLVM style - where it's
missing.
Differential Revision: https://reviews.llvm.org/D84989
|
|
Like most readability rules, it isn't absolute and there is a matter of taste
to it. I think more recent part of the project may be more consistent in the
current application of the guideline. I suspect sources like
mlir/lib/Dialect/StandardOps/IR/Ops.cpp may be examples of this at the moment.
Differential Revision: https://reviews.llvm.org/D82594
|
|
Summary:
As per disscussion in D83351, using `for_each` is potentially confusing,
at least in regards to inconsistent style (there's less than 100 `for_each`
usages in LLVM, but ~100.000 `for` range-based loops
Therefore, it should be avoided.
Reviewers: dblaikie, nickdesaulniers
Reviewed By: dblaikie, nickdesaulniers
Subscribers: hubert.reinterpretcast, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D83431
|
|
|
|
This is a rule that seems to have been enforced for the better part of
the decade, so we should document it for new contributors.
Differential Revision: https://reviews.llvm.org/D80947
|
|
Just two paragraphs above it says:
"If the compiler does not support this [skipping code generation for a particular branch], it will fall back
to the "abort" implementation."
And that actually correctly describes llvm_unreachable implementation.
Differential Revision: https://reviews.llvm.org/D81130
|
|
In particular, these messages should start with a lower-case letter and
should have no trailing period at the end of the last sentence.
See http://lists.llvm.org/pipermail/llvm-dev/2020-March/140178.html for
context.
Reviewed by: aaron.ballman, hubert.reinterpretcast, rnk, dblaikie
Differential Revision: https://reviews.llvm.org/D76833
|
|
There has been some ongoing confusion regarding when to use `llvm_unreachable`
which this patch attempts to address. Specifically, the confusion has been
around whether `llvm_unreachable` is intended to mark only unreachable code
paths that the compiler cannot determine itself or to mark a code path which is
unconditionally a bug to reach. Based on email and IRC discussions, it sounds
like "unconditional bug to reach" is the consensus.
|
|
There is prior art for this in the code base itself, and a recent
example of this here: c45f8d49897f
This came up in discussion on this review where @maskray was going the
opposite direction:
https://reviews.llvm.org/D68772
Given that there is disagreement, we should make a choice and document
it.
Thanks to John McCall for the precise wording.
Reviewed By: MaskRay, rjmccall
Differential Revision: https://reviews.llvm.org/D74515
|
|
See https://reviews.llvm.org/D74340
|
|
The existing wording leaves it unclear if C++ standard library data
structures should be preferred over custom LLVM ones, e.g., SmallVector,
even though common practice seems clear on the issue. This change makes
the wording more explicit and aligns it better with the code base.
Some motivating statistics:
```
ag SmallVector llvm/lib/ | wc
8846 40306 901421
ag 'std::vector' llvm/lib/ | wc
2123 8990 214482
ag SmallVector clang/lib/ | wc
3023 13824 281691
ag 'std::vector' clang/lib/ | wc
719 2914 72817
```
Differential Revision: https://reviews.llvm.org/D74340
|
|
Reviewers: hans, Jim
Reviewed By: Jim
Subscribers: jvesely, nhaehnle, mgorny, arphaman, bmahjour, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73017
|
|
Summary: Patch by Doug Gregor, Tres Popp, and Dmitri Gribenko.
Reviewers: chandlerc
Subscribers: hfinkel, bmcreusillet, arsenm, doug.gregor, mgrang, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69354
|
|
(And test my commit access. We're working on larger changes here.)
|
|
Summary:
I just bumped the minimum compiler versions to support C++14 in D66188.
Following [our process](http://llvm.org/docs/DeveloperPolicy.html#toolchain) and [our previous agreement](http://lists.llvm.org/pipermail/llvm-dev/2019-January/129452.html), I'm now officially bumping the C++ version to 14 and updating the documentation.
Subscribers: mgorny, jkorous, dexonsmith, llvm-commits, chandlerc, thakis, EricWF, jyknight, lhames, JDevlieghere
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66195
llvm-svn: 368887
|
|
llvm-svn: 351652
|
|
Differential Revision: https://reviews.llvm.org/D54446
llvm-svn: 346861
|
|
This is a bit awkward in a handful of places where we didn't even have
an instruction and now we have to see if we can build one. But on the
whole, this seems like a win and at worst a reasonable cost for removing
`TerminatorInst`.
All of this is part of the removal of `TerminatorInst` from the
`Instruction` type hierarchy.
llvm-svn: 340701
|