]> granicus.if.org Git - clang/commit
Add support for editor placeholders to Clang
authorAlex Lorenz <arphaman@gmail.com>
Wed, 19 Apr 2017 08:58:56 +0000 (08:58 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Wed, 19 Apr 2017 08:58:56 +0000 (08:58 +0000)
commitaac41bcdb19f21fb20a2efdc19494b622ba29171
tree345ec850b0f432a0708b5559ca86da3e1c25cdbc
parentad25f8b712f1ef99020fcb7b5e31dd95b39c6112
Add support for editor placeholders to Clang

This commit teaches Clang to recognize editor placeholders that are produced
when an IDE like Xcode inserts a code-completion result that includes a
placeholder. Now when the lexer sees a placeholder token, it emits an
'editor placeholder in source file' error and creates an identifier token
that represents the placeholder. The parser/sema can now recognize the
placeholders and can suppress the diagnostics related to the placeholders. This
ensures that live issues in an IDE like Xcode won't get spurious diagnostics
related to placeholders.

This commit also adds a new compiler option named '-fallow-editor-placeholders'
that silences the 'editor placeholder in source file' error. This is useful
for an IDE like Xcode as we don't want to display those errors in live issues.

rdar://31581400

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300667 91177308-0d34-0410-b5e6-96231b3b80d8
16 files changed:
include/clang/Basic/DiagnosticLexKinds.td
include/clang/Basic/IdentifierTable.h
include/clang/Basic/LangOptions.def
include/clang/Driver/Options.td
include/clang/Lex/Lexer.h
include/clang/Lex/Token.h
lib/Driver/ToolChains/Clang.cpp
lib/Frontend/CompilerInvocation.cpp
lib/Lex/Lexer.cpp
lib/Parse/Parser.cpp
lib/Sema/SemaCXXScopeSpec.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaExpr.cpp
test/Driver/clang_f_opts.c
test/Parser/editor-placeholder-recovery.cpp [new file with mode: 0644]
test/Parser/placeholder-recovery.m