r201373 - Revert "libclang: fix a bug in processing invalid arguments, introduced in r201249, "

Juergen Ributzka juergen at apple.com
Thu Feb 13 15:34:54 PST 2014


Author: ributzka
Date: Thu Feb 13 17:34:54 2014
New Revision: 201373

URL: http://llvm.org/viewvc/llvm-project?rev=201373&view=rev
Log:
Revert "libclang: fix a bug in processing invalid arguments, introduced in r201249,"

Reverting commit (201346) for now, because it is breaking our internal builds.

Removed:
    cfe/trunk/unittests/libclang/CMakeLists.txt
    cfe/trunk/unittests/libclang/LibclangTest.cpp
    cfe/trunk/unittests/libclang/Makefile
Modified:
    cfe/trunk/tools/libclang/CIndex.cpp
    cfe/trunk/unittests/Makefile

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=201373&r1=201372&r2=201373&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Thu Feb 13 17:34:54 2014
@@ -2686,11 +2686,6 @@ static void clang_parseTranslationUnit_I
   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_I
     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;
 }
 

Modified: cfe/trunk/unittests/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Makefile?rev=201373&r1=201372&r2=201373&view=diff
==============================================================================
--- cfe/trunk/unittests/Makefile (original)
+++ cfe/trunk/unittests/Makefile Thu Feb 13 17:34:54 2014
@@ -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
 

Removed: cfe/trunk/unittests/libclang/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/libclang/CMakeLists.txt?rev=201372&view=auto
==============================================================================
--- cfe/trunk/unittests/libclang/CMakeLists.txt (original)
+++ cfe/trunk/unittests/libclang/CMakeLists.txt (removed)
@@ -1,7 +0,0 @@
-add_clang_unittest(libclangTests
-  LibclangTest.cpp
-  )
-
-target_link_libraries(libclangTests
-  libclang
-  )

Removed: cfe/trunk/unittests/libclang/LibclangTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/libclang/LibclangTest.cpp?rev=201372&view=auto
==============================================================================
--- cfe/trunk/unittests/libclang/LibclangTest.cpp (original)
+++ cfe/trunk/unittests/libclang/LibclangTest.cpp (removed)
@@ -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));
-}
-

Removed: cfe/trunk/unittests/libclang/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/libclang/Makefile?rev=201372&view=auto
==============================================================================
--- cfe/trunk/unittests/libclang/Makefile (original)
+++ cfe/trunk/unittests/libclang/Makefile (removed)
@@ -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





More information about the cfe-commits mailing list