[cfe-commits] r158772 - in /cfe/trunk: include/clang/Basic/DiagnosticSerializationKinds.td lib/Serialization/ASTReader.cpp test/PCH/badpch-dir.h.gch/ test/PCH/badpch-dir.h.gch/.keep test/PCH/badpch-empty.h.gch test/PCH/badpch.c

Kaelyn Uhrain rikka at google.com
Wed Jun 20 13:24:23 PDT 2012


This should be fixed in r158841

On Wed, Jun 20, 2012 at 11:25 AM, Kaelyn Uhrain <rikka at google.com> wrote:

> This looks like a difference in how the calls clang uses to open and read
> pch files behave under FreeBSD vs Linux when operating on a directory
> instead of a normal file. I'm looking deeper into it now...
>
>
> On Wed, Jun 20, 2012 at 10:58 AM, Galina Kistanova <gkistanova at gmail.com>wrote:
>
>> Hi Kaelyn,
>> The test cfe/trunk/test/PCH/badpch.c fails on builder
>> http://lab.llvm.org:8011/builders/clang-X86_64-freebsd/builds/3155
>> Please have a look at this?
>>
>> Thanks
>>
>> Galina
>>
>> On Tue, Jun 19, 2012 at 5:36 PM, Kaelyn Uhrain <rikka at google.com> wrote:
>>
>>> Author: rikka
>>> Date: Tue Jun 19 19:36:03 2012
>>> New Revision: 158772
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=158772&view=rev
>>> Log:
>>> Add the PCH file name to the message about not being able to read the
>>> PCH.
>>>
>>> Also add a couple of unit tests to check the invalid-PCH error messages
>>> to satisfy PR4568 and for the assertion (introduced in r149918 and fixed
>>> in r158769) that would cause clang to crash when given an empty PCH.
>>>
>>> Added:
>>>    cfe/trunk/test/PCH/badpch-dir.h.gch/
>>>    cfe/trunk/test/PCH/badpch-dir.h.gch/.keep
>>>    cfe/trunk/test/PCH/badpch-empty.h.gch
>>>    cfe/trunk/test/PCH/badpch.c
>>> Modified:
>>>    cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
>>>    cfe/trunk/lib/Serialization/ASTReader.cpp
>>>
>>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td?rev=158772&r1=158771&r2=158772&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
>>> (original)
>>> +++ cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td Tue
>>> Jun 19 19:36:03 2012
>>> @@ -10,7 +10,7 @@
>>>  let Component = "Serialization" in {
>>>
>>>  def err_fe_unable_to_read_pch_file : Error<
>>> -    "unable to read PCH file: '%0'">;
>>> +    "unable to read PCH file %0: '%1'">;
>>>  def err_fe_not_a_pch_file : Error<
>>>     "input is not a PCH file: '%0'">;
>>>  def err_fe_pch_malformed : Error<
>>>
>>> Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=158772&r1=158771&r2=158772&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
>>> +++ cfe/trunk/lib/Serialization/ASTReader.cpp Tue Jun 19 19:36:03 2012
>>> @@ -3001,7 +3001,7 @@
>>>   OwningPtr<llvm::MemoryBuffer> Buffer;
>>>   Buffer.reset(FileMgr.getBufferForFile(ASTFileName, &ErrStr));
>>>   if (!Buffer) {
>>> -    Diags.Report(diag::err_fe_unable_to_read_pch_file) << ErrStr;
>>> +    Diags.Report(diag::err_fe_unable_to_read_pch_file) << ASTFileName
>>> << ErrStr;
>>>     return std::string();
>>>   }
>>>
>>>
>>> Added: cfe/trunk/test/PCH/badpch-dir.h.gch/.keep
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/badpch-dir.h.gch/.keep?rev=158772&view=auto
>>>
>>> ==============================================================================
>>>    (empty)
>>>
>>> Added: cfe/trunk/test/PCH/badpch-empty.h.gch
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/badpch-empty.h.gch?rev=158772&view=auto
>>>
>>> ==============================================================================
>>>    (empty)
>>>
>>> Added: cfe/trunk/test/PCH/badpch.c
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/badpch.c?rev=158772&view=auto
>>>
>>> ==============================================================================
>>> --- cfe/trunk/test/PCH/badpch.c (added)
>>> +++ cfe/trunk/test/PCH/badpch.c Tue Jun 19 19:36:03 2012
>>> @@ -0,0 +1,13 @@
>>> +// RUN: %clang_cc1 -fsyntax-only -include-pch %S/badpch-empty.h.gch %s
>>> 2>&1 | FileCheck -check-prefix=CHECK-EMPTY %s
>>> +// RUN: %clang_cc1 -fsyntax-only -include-pch %S/badpch-dir.h.gch %s
>>> 2>&1 | FileCheck -check-prefix=CHECK-DIR %s
>>> +
>>> +// The purpose of this test is to verify that various invalid PCH files
>>> are
>>> +// reported as such.
>>> +
>>> +// PR4568: The messages were much improved since the bug was filed on
>>> +// 2009-07-16, though in the case of the PCH being a directory, the
>>> error
>>> +// message still did not contain the name of the PCH. Also, r149918
>>> which was
>>> +// submitted on 2012-02-06 introduced a segfault in the case where the
>>> PCH is
>>> +// an empty file and clang was built with assertions.
>>> +// CHECK-EMPTY: error: input is not a PCH file:
>>> '{{.*[/\\]}}badpch-empty.h.gch'
>>> +// CHECK-DIR: error: unable to read PCH file
>>> {{.*[/\\]}}badpch-dir.h.gch:
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120620/5d19ba6e/attachment.html>


More information about the cfe-commits mailing list