r301542 - [libclang] Pass in the -fallow-editor-placeholders option

Alex Lorenz via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 27 06:47:04 PDT 2017


Author: arphaman
Date: Thu Apr 27 08:47:03 2017
New Revision: 301542

URL: http://llvm.org/viewvc/llvm-project?rev=301542&view=rev
Log:
[libclang] Pass in the -fallow-editor-placeholders option

This will suppress any live diagnostics caused by editor placeholders in Xcode.

rdar://31833579

Added:
    cfe/trunk/test/Index/allow-editor-placeholders.cpp
Modified:
    cfe/trunk/include/clang/Basic/LangOptions.def
    cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=301542&r1=301541&r2=301542&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Thu Apr 27 08:47:03 2017
@@ -266,7 +266,8 @@ LANGOPT(SanitizeAddressFieldPadding, 2,
 
 LANGOPT(XRayInstrument, 1, 0, "controls whether to do XRay instrumentation")
 
-LANGOPT(AllowEditorPlaceholders, 1, 0, "allow editor placeholders in source")
+BENIGN_LANGOPT(AllowEditorPlaceholders, 1, 0,
+               "allow editor placeholders in source")
 
 #undef LANGOPT
 #undef COMPATIBLE_LANGOPT

Added: cfe/trunk/test/Index/allow-editor-placeholders.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/allow-editor-placeholders.cpp?rev=301542&view=auto
==============================================================================
--- cfe/trunk/test/Index/allow-editor-placeholders.cpp (added)
+++ cfe/trunk/test/Index/allow-editor-placeholders.cpp Thu Apr 27 08:47:03 2017
@@ -0,0 +1,5 @@
+// RUN: c-index-test -test-load-source all %s 2>&1 | FileCheck %s
+
+<#placeholder#>;
+
+// CHECK-NOT: error

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=301542&r1=301541&r2=301542&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Thu Apr 27 08:47:03 2017
@@ -3371,7 +3371,10 @@ clang_parseTranslationUnit_Impl(CXIndex
     Args->push_back("-Xclang");
     Args->push_back("-detailed-preprocessing-record");
   }
-  
+
+  // Suppress any editor placeholder diagnostics.
+  Args->push_back("-fallow-editor-placeholders");
+
   unsigned NumErrors = Diags->getClient()->getNumErrors();
   std::unique_ptr<ASTUnit> ErrUnit;
   // Unless the user specified that they want the preamble on the first parse




More information about the cfe-commits mailing list