]> granicus.if.org Git - clang/commitdiff
Revert "libclang: fix a bug in processing invalid arguments, introduced in r201249,"
authorJuergen Ributzka <juergen@apple.com>
Thu, 13 Feb 2014 23:34:54 +0000 (23:34 +0000)
committerJuergen Ributzka <juergen@apple.com>
Thu, 13 Feb 2014 23:34:54 +0000 (23:34 +0000)
Reverting commit (201346) for now, because it is breaking our internal builds.

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

tools/libclang/CIndex.cpp
unittests/Makefile
unittests/libclang/CMakeLists.txt [deleted file]
unittests/libclang/LibclangTest.cpp [deleted file]
unittests/libclang/Makefile [deleted file]

index e862889f26367c2f565704660e9fc7f517f4540e..a74feabf06f3c42d32c382890e7613c326fbf7d2 100644 (file)
@@ -2686,11 +2686,6 @@ static void clang_parseTranslationUnit_Impl(void *UserData) {
   unsigned options = PTUI->options;
   CXTranslationUnit *out_TU = PTUI->out_TU;
 
-  // Set up the initial return values.
-  if (out_TU)
-    *out_TU = NULL;
-  PTUI->result = CXError_Failure;
-
   // Check arguments.
   if (!CIdx || !out_TU ||
       (unsaved_files == NULL && num_unsaved_files != 0)) {
@@ -2698,6 +2693,10 @@ static void clang_parseTranslationUnit_Impl(void *UserData) {
     return;
   }
 
+  // Set up the initial return values.
+  *out_TU = NULL;
+  PTUI->result = CXError_Failure;
+
   CIndexer *CXXIdx = static_cast<CIndexer *>(CIdx);
 
   if (CXXIdx->isOptEnabled(CXGlobalOpt_ThreadBackgroundPriorityForIndexing))
@@ -2827,8 +2826,12 @@ clang_parseTranslationUnit(CXIndex CIdx,
       CIdx, source_filename, command_line_args, num_command_line_args,
       unsaved_files, num_unsaved_files, options, &TU);
   (void)Result;
-  assert((TU && Result == CXError_Success) ||
-         (!TU && Result != CXError_Success));
+
+  // FIXME: This probably papers over a problem. If the result is not success,
+  // no TU should be set.
+  if (Result != CXError_Success)
+    return 0;
+
   return TU;
 }
 
index 9b95a6eda20e51b918bd49419ff3602aa22ff8f0..e4fbe584da1f0dcb682abe7a34db2262b2a822e1 100644 (file)
@@ -14,7 +14,7 @@ ifndef CLANG_LEVEL
 
 IS_UNITTEST_LEVEL := 1
 CLANG_LEVEL := ..
-PARALLEL_DIRS = Basic Lex Driver libclang
+PARALLEL_DIRS = Basic Lex Driver
 
 include $(CLANG_LEVEL)/../..//Makefile.config
 
diff --git a/unittests/libclang/CMakeLists.txt b/unittests/libclang/CMakeLists.txt
deleted file mode 100644 (file)
index 1cdc45e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-add_clang_unittest(libclangTests
-  LibclangTest.cpp
-  )
-
-target_link_libraries(libclangTests
-  libclang
-  )
diff --git a/unittests/libclang/LibclangTest.cpp b/unittests/libclang/LibclangTest.cpp
deleted file mode 100644 (file)
index 7048af9..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-//===- unittests/libclang/LibclangTest.cpp --- libclang tests -------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang-c/Index.h"
-#include "gtest/gtest.h"
-
-TEST(libclang, TestInvalidArgs) {
-  EXPECT_EQ(CXError_InvalidArguments,
-            clang_parseTranslationUnit2(0, 0, 0, 0, 0, 0, 0, 0));
-}
-
diff --git a/unittests/libclang/Makefile b/unittests/libclang/Makefile
deleted file mode 100644 (file)
index e96c925..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-##===- unittests/libclang/Makefile -------------------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-CLANG_LEVEL = ../..
-TESTNAME = libclang
-include $(CLANG_LEVEL)/../../Makefile.config
-LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option
-
-# Note that 'USEDLIBS' must include all of the core clang libraries
-# when -static is given to linker on cygming.
-USEDLIBS = clang.a \
-          clangIndex.a clangFormat.a clangRewriteCore.a \
-          clangFrontend.a clangDriver.a \
-          clangTooling.a \
-          clangSerialization.a clangParse.a clangSema.a \
-          clangAnalysis.a clangEdit.a clangAST.a clangLex.a \
-          clangBasic.a
-
-include $(CLANG_LEVEL)/unittests/Makefile