]> granicus.if.org Git - clang/commitdiff
[libclang] Pass in the -fallow-editor-placeholders option
authorAlex Lorenz <arphaman@gmail.com>
Thu, 27 Apr 2017 13:47:03 +0000 (13:47 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Thu, 27 Apr 2017 13:47:03 +0000 (13:47 +0000)
This will suppress any live diagnostics caused by editor placeholders in Xcode.

rdar://31833579

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301542 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/LangOptions.def
test/Index/allow-editor-placeholders.cpp [new file with mode: 0644]
tools/libclang/CIndex.cpp

index 6ae34a89fe2853cf1fb087e2193399a5840d8bf7..60c8a68cd2e9246b1a147c0b993cd3fc4520d693 100644 (file)
@@ -266,7 +266,8 @@ LANGOPT(SanitizeAddressFieldPadding, 2, 0, "controls how aggressive is ASan "
 
 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
diff --git a/test/Index/allow-editor-placeholders.cpp b/test/Index/allow-editor-placeholders.cpp
new file mode 100644 (file)
index 0000000..5a7207d
--- /dev/null
@@ -0,0 +1,5 @@
+// RUN: c-index-test -test-load-source all %s 2>&1 | FileCheck %s
+
+<#placeholder#>;
+
+// CHECK-NOT: error
index 216322b9f9369dc3b1d4bc6c344f4670139134c5..c7fdb5ad1aa5c010edfdef01d5ae61a5fdb1b8f5 100644 (file)
@@ -3371,7 +3371,10 @@ clang_parseTranslationUnit_Impl(CXIndex CIdx, const char *source_filename,
     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