llvm-project/clang/unittests
Sam McCall e503256790 [ClangFormat] Future-proof Standard option, allow floating or pinning to arbitrary lang version
Summary:
The historical context:
- clang-format was written when C++11 was current,
  and the main language-version concern was >> vs > > template-closers.
  An option was added to allow selection of the 03/11 behavior, or auto-detection.
- there was no option to choose simply "latest standard" so anyone who didn't
  ever want 03 behavior or auto-detection specified Cpp11.
- In r185149 this option started to affect lexer mode.
- no options were added to cover c++14, as parsing/formatting
  didn't change that much. The usage of Cpp11 to mean "latest" became
  codified e.g. in r206263
- c++17 added some new constructs. These were mostly backwards-compatible and so
  not used in old programs, so having no way to turn them off was OK.
- c++20 added some new constructs and keywords (e.g. co_*) that changed the
  meaning of existing programs, and people started to complain that
  the c++20 parsing couldn't be turned off.

New plan:
 - Default ('Auto') behavior remains unchanged: parse as latest, format
   template-closers based on input.
 - Add new 'Latest' option that more clearly expresses the intent "use
   modern features" that many projects have chosen for their .clang-format files.
 - Allow pinning to *any* language version, using the same name as clang -std:
   c++03, c++11, c++14 etc. These set precise lexer options, and any
   clang-format code depending on these can use a >= check.
 - For backwards compatibility, `Cpp11` is an alias for `Latest`, not `c++11`.
   This matches the historical documented semantics of this option.
   This spelling (and `Cpp03`) are deprecated.

Reviewers: klimek, modocache

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67541

llvm-svn: 373439
2019-10-02 09:50:40 +00:00
..
AST Fix memory leak in DeclTest. 2019-09-25 22:38:20 +00:00
ASTMatchers Fix the nullPointerConstant() test to get bots back to green. 2019-08-22 18:56:18 +00:00
Analysis [CFG] Introduce CFGElementRef, a wrapper that knows it's position in a CFGBlock 2019-08-14 17:05:55 +00:00
Basic ASTReader: Bypass overridden files when reading PCHs 2019-08-30 22:59:25 +00:00
CodeGen Added 'inline' to functions defined in headers to avoid ODR violations 2019-08-29 16:58:13 +00:00
CrossTU [Tooling] Migrated APIs that take ownership of objects to unique_ptr 2019-08-30 09:29:34 +00:00
DirectoryWatcher Use ASSERT_THAT_ERROR instead of logAllUnhandledErrors/exit 2019-08-09 06:14:54 +00:00
Driver Driver tests: set `--sysroot=""` to support clang with `DEFAULT_SYSROOT` 2019-09-28 12:21:06 +00:00
Format [ClangFormat] Future-proof Standard option, allow floating or pinning to arbitrary lang version 2019-10-02 09:50:40 +00:00
Frontend [Clang] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:04:18 +00:00
Index [Tooling] Migrated APIs that take ownership of objects to unique_ptr 2019-08-30 09:29:34 +00:00
Lex [clang-scan-deps] Allow continuation line backslashes followed by whitespace 2019-09-26 19:28:51 +00:00
Rename cmake: Add CLANG_LINK_CLANG_DYLIB option 2019-07-03 22:45:55 +00:00
Rewrite [Rewrite][NFC] Add FIXMEs and tests for RemoveLineIfEmpty bug 2019-08-15 21:17:48 +00:00
Sema [LifetimeAnalysis] don't use raw string literals in macros 2019-09-06 19:15:02 +00:00
Serialization cmake: Add CLANG_LINK_CLANG_DYLIB option 2019-07-03 22:45:55 +00:00
StaticAnalyzer [analyzer][NFC] Fix inconsistent references to checkers as "checks" 2019-09-12 19:09:24 +00:00
Tooling [libTooling] Transformer: refine `SourceLocation` specified as anchor of changes. 2019-09-27 15:26:04 +00:00
libclang [libclang] Fix UninstallAbortingLLVMFatalErrorHandler test 2019-09-12 23:51:48 +00:00
CMakeLists.txt [clang] [unittest] Import LLVMTestingSupport if necessary 2019-09-12 13:06:12 +00:00