Re: r335081 - Recommit r335063: [Darwin] Add a warning for missing include path for libstdc++

2018-12-06 Thread Alex L via cfe-commits
On Fri, 7 Sep 2018 at 12:02, Alex L  wrote:

>
> On Fri, 7 Sep 2018 at 05:41, Nico Weber  wrote:
>
>> On Wed, Sep 5, 2018 at 9:25 PM Alex L  wrote:
>>
>>> Sorry for the late response,
>>>
>>> On Sat, 18 Aug 2018 at 20:10, Nico Weber  wrote:
>>>
 Also, the diag text should probably say "pass '-stdlib=libc++' " not
 "pass '-std=libc++' "?

>>>
>>> Good catch, thanks! I'll commit a fixup for it.
>>>
>>
> Fixed in r341697.
>
>
>>
>>>

 On Sat, Aug 18, 2018 at 11:06 PM Nico Weber 
 wrote:

> Should this maybe not be emitted when compiling e.g. .ii files
> (preprocessed output)? I just got this when I built a standalone .ii file
> with some bug repro after I deleted all -I and -isysroot flags and 
> whatnot,
> since they aren't needed for preprocessed files.
>

>>> That would make sense, but I'm not sure how easy it is to determine if a
>>> file is already preprocessed. I'll try to create a patch for this fixup.
>>>
>>
>> Probably you'd want something like
>> http://llvm-cs.pcc.me.uk/tools/clang/lib/Driver/Types.cpp#123 that
>> returns true for all (or most) of the TY_PP_ types, and then just rely
>> on lookupTypeForExtension.
>>
>
> Good idea, I'll try it out.
>

Apologies for the delay, I fixed the issue with preprocessed inputs in
r348540.

Cheers,
Alex


>
>
>>
>>
>>>
>>>
>>>

> On Tue, Jun 19, 2018 at 6:52 PM Alex Lorenz via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: arphaman
>> Date: Tue Jun 19 15:47:53 2018
>> New Revision: 335081
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=335081=rev
>> Log:
>> Recommit r335063: [Darwin] Add a warning for missing include path for
>> libstdc++
>>
>> The recommit ensures that the tests that failed on bots don't trigger
>> the warning.
>>
>> Xcode 10 removes support for libstdc++, but the users just get a
>> confusing
>> include not file warning when including an STL header (when building
>> for iOS6
>> which uses libstdc++ by default for example).
>> This patch adds a new warning that lets the user know that the
>> libstdc++ include
>> path was not found to ensure that the user is more aware of why the
>> error occurs.
>>
>> rdar://40830462
>>
>> Differential Revision: https://reviews.llvm.org/D48297
>>
>> Added:
>> cfe/trunk/test/Frontend/warning-stdlibcxx-darwin.cpp
>> Modified:
>> cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
>> cfe/trunk/include/clang/Lex/HeaderSearch.h
>> cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
>> cfe/trunk/test/CodeGenCXX/apple-kext-guard-variable.cpp
>> cfe/trunk/test/Misc/backend-stack-frame-diagnostics.cpp
>>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=335081=335080=335081=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
>> (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Tue Jun
>> 19 15:47:53 2018
>> @@ -236,4 +236,9 @@ def err_invalid_vfs_overlay : Error<
>>
>>  def warn_option_invalid_ocl_version : Warning<
>>"OpenCL version %0 does not support the option '%1'">,
>> InGroup;
>> +
>> +def warn_stdlibcxx_not_found : Warning<
>> +  "include path for stdlibc++ headers not found; pass '-std=libc++'
>> on the "
>> +  "command line to use the libc++ standard library instead">,
>> +  InGroup>;
>>  }
>>
>> Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=335081=335080=335081=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Lex/HeaderSearch.h (original)
>> +++ cfe/trunk/include/clang/Lex/HeaderSearch.h Tue Jun 19 15:47:53
>> 2018
>> @@ -272,6 +272,8 @@ public:
>>
>>FileManager () const { return FileMgr; }
>>
>> +  DiagnosticsEngine () const { return Diags; }
>> +
>>/// Interface for setting the file search paths.
>>void SetSearchPaths(const std::vector ,
>>unsigned angledDirIdx, unsigned systemDirIdx,
>>
>> Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=335081=335080=335081=diff
>>
>> ==
>> --- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
>> +++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Tue Jun 19 15:47:53
>> 2018
>> @@ -14,6 +14,7 @@

Re: r335081 - Recommit r335063: [Darwin] Add a warning for missing include path for libstdc++

2018-09-07 Thread Alex L via cfe-commits
On Fri, 7 Sep 2018 at 05:41, Nico Weber  wrote:

> On Wed, Sep 5, 2018 at 9:25 PM Alex L  wrote:
>
>> Sorry for the late response,
>>
>> On Sat, 18 Aug 2018 at 20:10, Nico Weber  wrote:
>>
>>> Also, the diag text should probably say "pass '-stdlib=libc++' " not
>>> "pass '-std=libc++' "?
>>>
>>
>> Good catch, thanks! I'll commit a fixup for it.
>>
>
Fixed in r341697.


>
>>
>>>
>>> On Sat, Aug 18, 2018 at 11:06 PM Nico Weber  wrote:
>>>
 Should this maybe not be emitted when compiling e.g. .ii files
 (preprocessed output)? I just got this when I built a standalone .ii file
 with some bug repro after I deleted all -I and -isysroot flags and whatnot,
 since they aren't needed for preprocessed files.

>>>
>> That would make sense, but I'm not sure how easy it is to determine if a
>> file is already preprocessed. I'll try to create a patch for this fixup.
>>
>
> Probably you'd want something like
> http://llvm-cs.pcc.me.uk/tools/clang/lib/Driver/Types.cpp#123 that
> returns true for all (or most) of the TY_PP_ types, and then just rely
> on lookupTypeForExtension.
>

Good idea, I'll try it out.


>
>
>>
>>
>>
>>>
 On Tue, Jun 19, 2018 at 6:52 PM Alex Lorenz via cfe-commits <
 cfe-commits@lists.llvm.org> wrote:

> Author: arphaman
> Date: Tue Jun 19 15:47:53 2018
> New Revision: 335081
>
> URL: http://llvm.org/viewvc/llvm-project?rev=335081=rev
> Log:
> Recommit r335063: [Darwin] Add a warning for missing include path for
> libstdc++
>
> The recommit ensures that the tests that failed on bots don't trigger
> the warning.
>
> Xcode 10 removes support for libstdc++, but the users just get a
> confusing
> include not file warning when including an STL header (when building
> for iOS6
> which uses libstdc++ by default for example).
> This patch adds a new warning that lets the user know that the
> libstdc++ include
> path was not found to ensure that the user is more aware of why the
> error occurs.
>
> rdar://40830462
>
> Differential Revision: https://reviews.llvm.org/D48297
>
> Added:
> cfe/trunk/test/Frontend/warning-stdlibcxx-darwin.cpp
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
> cfe/trunk/include/clang/Lex/HeaderSearch.h
> cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
> cfe/trunk/test/CodeGenCXX/apple-kext-guard-variable.cpp
> cfe/trunk/test/Misc/backend-stack-frame-diagnostics.cpp
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=335081=335080=335081=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Tue Jun
> 19 15:47:53 2018
> @@ -236,4 +236,9 @@ def err_invalid_vfs_overlay : Error<
>
>  def warn_option_invalid_ocl_version : Warning<
>"OpenCL version %0 does not support the option '%1'">,
> InGroup;
> +
> +def warn_stdlibcxx_not_found : Warning<
> +  "include path for stdlibc++ headers not found; pass '-std=libc++'
> on the "
> +  "command line to use the libc++ standard library instead">,
> +  InGroup>;
>  }
>
> Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=335081=335080=335081=diff
>
> ==
> --- cfe/trunk/include/clang/Lex/HeaderSearch.h (original)
> +++ cfe/trunk/include/clang/Lex/HeaderSearch.h Tue Jun 19 15:47:53 2018
> @@ -272,6 +272,8 @@ public:
>
>FileManager () const { return FileMgr; }
>
> +  DiagnosticsEngine () const { return Diags; }
> +
>/// Interface for setting the file search paths.
>void SetSearchPaths(const std::vector ,
>unsigned angledDirIdx, unsigned systemDirIdx,
>
> Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=335081=335080=335081=diff
>
> ==
> --- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
> +++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Tue Jun 19 15:47:53
> 2018
> @@ -14,6 +14,7 @@
>  #include "clang/Basic/FileManager.h"
>  #include "clang/Basic/LangOptions.h"
>  #include "clang/Config/config.h" // C_INCLUDE_DIRS
> +#include "clang/Frontend/FrontendDiagnostic.h"
>  #include "clang/Frontend/Utils.h"
>  #include "clang/Lex/HeaderMap.h"
>  #include 

Re: r335081 - Recommit r335063: [Darwin] Add a warning for missing include path for libstdc++

2018-09-07 Thread Nico Weber via cfe-commits
On Wed, Sep 5, 2018 at 9:25 PM Alex L  wrote:

> Sorry for the late response,
>
> On Sat, 18 Aug 2018 at 20:10, Nico Weber  wrote:
>
>> Also, the diag text should probably say "pass '-stdlib=libc++' " not
>> "pass '-std=libc++' "?
>>
>
> Good catch, thanks! I'll commit a fixup for it.
>
>
>>
>> On Sat, Aug 18, 2018 at 11:06 PM Nico Weber  wrote:
>>
>>> Should this maybe not be emitted when compiling e.g. .ii files
>>> (preprocessed output)? I just got this when I built a standalone .ii file
>>> with some bug repro after I deleted all -I and -isysroot flags and whatnot,
>>> since they aren't needed for preprocessed files.
>>>
>>
> That would make sense, but I'm not sure how easy it is to determine if a
> file is already preprocessed. I'll try to create a patch for this fixup.
>

Probably you'd want something like
http://llvm-cs.pcc.me.uk/tools/clang/lib/Driver/Types.cpp#123 that returns
true for all (or most) of the TY_PP_ types, and then just rely
on lookupTypeForExtension.


>
>
>
>>
>>> On Tue, Jun 19, 2018 at 6:52 PM Alex Lorenz via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Author: arphaman
 Date: Tue Jun 19 15:47:53 2018
 New Revision: 335081

 URL: http://llvm.org/viewvc/llvm-project?rev=335081=rev
 Log:
 Recommit r335063: [Darwin] Add a warning for missing include path for
 libstdc++

 The recommit ensures that the tests that failed on bots don't trigger
 the warning.

 Xcode 10 removes support for libstdc++, but the users just get a
 confusing
 include not file warning when including an STL header (when building
 for iOS6
 which uses libstdc++ by default for example).
 This patch adds a new warning that lets the user know that the
 libstdc++ include
 path was not found to ensure that the user is more aware of why the
 error occurs.

 rdar://40830462

 Differential Revision: https://reviews.llvm.org/D48297

 Added:
 cfe/trunk/test/Frontend/warning-stdlibcxx-darwin.cpp
 Modified:
 cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
 cfe/trunk/include/clang/Lex/HeaderSearch.h
 cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
 cfe/trunk/test/CodeGenCXX/apple-kext-guard-variable.cpp
 cfe/trunk/test/Misc/backend-stack-frame-diagnostics.cpp

 Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=335081=335080=335081=diff

 ==
 --- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
 +++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Tue Jun 19
 15:47:53 2018
 @@ -236,4 +236,9 @@ def err_invalid_vfs_overlay : Error<

  def warn_option_invalid_ocl_version : Warning<
"OpenCL version %0 does not support the option '%1'">,
 InGroup;
 +
 +def warn_stdlibcxx_not_found : Warning<
 +  "include path for stdlibc++ headers not found; pass '-std=libc++' on
 the "
 +  "command line to use the libc++ standard library instead">,
 +  InGroup>;
  }

 Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=335081=335080=335081=diff

 ==
 --- cfe/trunk/include/clang/Lex/HeaderSearch.h (original)
 +++ cfe/trunk/include/clang/Lex/HeaderSearch.h Tue Jun 19 15:47:53 2018
 @@ -272,6 +272,8 @@ public:

FileManager () const { return FileMgr; }

 +  DiagnosticsEngine () const { return Diags; }
 +
/// Interface for setting the file search paths.
void SetSearchPaths(const std::vector ,
unsigned angledDirIdx, unsigned systemDirIdx,

 Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=335081=335080=335081=diff

 ==
 --- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
 +++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Tue Jun 19 15:47:53 2018
 @@ -14,6 +14,7 @@
  #include "clang/Basic/FileManager.h"
  #include "clang/Basic/LangOptions.h"
  #include "clang/Config/config.h" // C_INCLUDE_DIRS
 +#include "clang/Frontend/FrontendDiagnostic.h"
  #include "clang/Frontend/Utils.h"
  #include "clang/Lex/HeaderMap.h"
  #include "clang/Lex/HeaderSearch.h"
 @@ -55,11 +56,13 @@ public:

/// AddPath - Add the specified path to the specified group list,
 prefixing
/// the sysroot if used.
 -  void AddPath(const Twine , IncludeDirGroup Group, bool
 

Re: r335081 - Recommit r335063: [Darwin] Add a warning for missing include path for libstdc++

2018-09-05 Thread Alex L via cfe-commits
Sorry for the late response,

On Sat, 18 Aug 2018 at 20:10, Nico Weber  wrote:

> Also, the diag text should probably say "pass '-stdlib=libc++' " not "pass
> '-std=libc++' "?
>

Good catch, thanks! I'll commit a fixup for it.


>
> On Sat, Aug 18, 2018 at 11:06 PM Nico Weber  wrote:
>
>> Should this maybe not be emitted when compiling e.g. .ii files
>> (preprocessed output)? I just got this when I built a standalone .ii file
>> with some bug repro after I deleted all -I and -isysroot flags and whatnot,
>> since they aren't needed for preprocessed files.
>>
>
That would make sense, but I'm not sure how easy it is to determine if a
file is already preprocessed. I'll try to create a patch for this fixup.



>
>> On Tue, Jun 19, 2018 at 6:52 PM Alex Lorenz via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: arphaman
>>> Date: Tue Jun 19 15:47:53 2018
>>> New Revision: 335081
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=335081=rev
>>> Log:
>>> Recommit r335063: [Darwin] Add a warning for missing include path for
>>> libstdc++
>>>
>>> The recommit ensures that the tests that failed on bots don't trigger
>>> the warning.
>>>
>>> Xcode 10 removes support for libstdc++, but the users just get a
>>> confusing
>>> include not file warning when including an STL header (when building for
>>> iOS6
>>> which uses libstdc++ by default for example).
>>> This patch adds a new warning that lets the user know that the libstdc++
>>> include
>>> path was not found to ensure that the user is more aware of why the
>>> error occurs.
>>>
>>> rdar://40830462
>>>
>>> Differential Revision: https://reviews.llvm.org/D48297
>>>
>>> Added:
>>> cfe/trunk/test/Frontend/warning-stdlibcxx-darwin.cpp
>>> Modified:
>>> cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
>>> cfe/trunk/include/clang/Lex/HeaderSearch.h
>>> cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
>>> cfe/trunk/test/CodeGenCXX/apple-kext-guard-variable.cpp
>>> cfe/trunk/test/Misc/backend-stack-frame-diagnostics.cpp
>>>
>>> Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=335081=335080=335081=diff
>>>
>>> ==
>>> --- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
>>> +++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Tue Jun 19
>>> 15:47:53 2018
>>> @@ -236,4 +236,9 @@ def err_invalid_vfs_overlay : Error<
>>>
>>>  def warn_option_invalid_ocl_version : Warning<
>>>"OpenCL version %0 does not support the option '%1'">,
>>> InGroup;
>>> +
>>> +def warn_stdlibcxx_not_found : Warning<
>>> +  "include path for stdlibc++ headers not found; pass '-std=libc++' on
>>> the "
>>> +  "command line to use the libc++ standard library instead">,
>>> +  InGroup>;
>>>  }
>>>
>>> Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=335081=335080=335081=diff
>>>
>>> ==
>>> --- cfe/trunk/include/clang/Lex/HeaderSearch.h (original)
>>> +++ cfe/trunk/include/clang/Lex/HeaderSearch.h Tue Jun 19 15:47:53 2018
>>> @@ -272,6 +272,8 @@ public:
>>>
>>>FileManager () const { return FileMgr; }
>>>
>>> +  DiagnosticsEngine () const { return Diags; }
>>> +
>>>/// Interface for setting the file search paths.
>>>void SetSearchPaths(const std::vector ,
>>>unsigned angledDirIdx, unsigned systemDirIdx,
>>>
>>> Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=335081=335080=335081=diff
>>>
>>> ==
>>> --- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
>>> +++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Tue Jun 19 15:47:53 2018
>>> @@ -14,6 +14,7 @@
>>>  #include "clang/Basic/FileManager.h"
>>>  #include "clang/Basic/LangOptions.h"
>>>  #include "clang/Config/config.h" // C_INCLUDE_DIRS
>>> +#include "clang/Frontend/FrontendDiagnostic.h"
>>>  #include "clang/Frontend/Utils.h"
>>>  #include "clang/Lex/HeaderMap.h"
>>>  #include "clang/Lex/HeaderSearch.h"
>>> @@ -55,11 +56,13 @@ public:
>>>
>>>/// AddPath - Add the specified path to the specified group list,
>>> prefixing
>>>/// the sysroot if used.
>>> -  void AddPath(const Twine , IncludeDirGroup Group, bool
>>> isFramework);
>>> +  /// Returns true if the path exists, false if it was ignored.
>>> +  bool AddPath(const Twine , IncludeDirGroup Group, bool
>>> isFramework);
>>>
>>>/// AddUnmappedPath - Add the specified path to the specified group
>>> list,
>>>/// without performing any sysroot remapping.
>>> -  void AddUnmappedPath(const Twine , IncludeDirGroup Group,
>>> +  /// 

Re: r335081 - Recommit r335063: [Darwin] Add a warning for missing include path for libstdc++

2018-08-18 Thread Nico Weber via cfe-commits
Also, the diag text should probably say "pass '-stdlib=libc++' " not "pass
'-std=libc++' "?

On Sat, Aug 18, 2018 at 11:06 PM Nico Weber  wrote:

> Should this maybe not be emitted when compiling e.g. .ii files
> (preprocessed output)? I just got this when I built a standalone .ii file
> with some bug repro after I deleted all -I and -isysroot flags and whatnot,
> since they aren't needed for preprocessed files.
>
> On Tue, Jun 19, 2018 at 6:52 PM Alex Lorenz via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: arphaman
>> Date: Tue Jun 19 15:47:53 2018
>> New Revision: 335081
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=335081=rev
>> Log:
>> Recommit r335063: [Darwin] Add a warning for missing include path for
>> libstdc++
>>
>> The recommit ensures that the tests that failed on bots don't trigger the
>> warning.
>>
>> Xcode 10 removes support for libstdc++, but the users just get a confusing
>> include not file warning when including an STL header (when building for
>> iOS6
>> which uses libstdc++ by default for example).
>> This patch adds a new warning that lets the user know that the libstdc++
>> include
>> path was not found to ensure that the user is more aware of why the error
>> occurs.
>>
>> rdar://40830462
>>
>> Differential Revision: https://reviews.llvm.org/D48297
>>
>> Added:
>> cfe/trunk/test/Frontend/warning-stdlibcxx-darwin.cpp
>> Modified:
>> cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
>> cfe/trunk/include/clang/Lex/HeaderSearch.h
>> cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
>> cfe/trunk/test/CodeGenCXX/apple-kext-guard-variable.cpp
>> cfe/trunk/test/Misc/backend-stack-frame-diagnostics.cpp
>>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=335081=335080=335081=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Tue Jun 19
>> 15:47:53 2018
>> @@ -236,4 +236,9 @@ def err_invalid_vfs_overlay : Error<
>>
>>  def warn_option_invalid_ocl_version : Warning<
>>"OpenCL version %0 does not support the option '%1'">,
>> InGroup;
>> +
>> +def warn_stdlibcxx_not_found : Warning<
>> +  "include path for stdlibc++ headers not found; pass '-std=libc++' on
>> the "
>> +  "command line to use the libc++ standard library instead">,
>> +  InGroup>;
>>  }
>>
>> Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=335081=335080=335081=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Lex/HeaderSearch.h (original)
>> +++ cfe/trunk/include/clang/Lex/HeaderSearch.h Tue Jun 19 15:47:53 2018
>> @@ -272,6 +272,8 @@ public:
>>
>>FileManager () const { return FileMgr; }
>>
>> +  DiagnosticsEngine () const { return Diags; }
>> +
>>/// Interface for setting the file search paths.
>>void SetSearchPaths(const std::vector ,
>>unsigned angledDirIdx, unsigned systemDirIdx,
>>
>> Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=335081=335080=335081=diff
>>
>> ==
>> --- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
>> +++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Tue Jun 19 15:47:53 2018
>> @@ -14,6 +14,7 @@
>>  #include "clang/Basic/FileManager.h"
>>  #include "clang/Basic/LangOptions.h"
>>  #include "clang/Config/config.h" // C_INCLUDE_DIRS
>> +#include "clang/Frontend/FrontendDiagnostic.h"
>>  #include "clang/Frontend/Utils.h"
>>  #include "clang/Lex/HeaderMap.h"
>>  #include "clang/Lex/HeaderSearch.h"
>> @@ -55,11 +56,13 @@ public:
>>
>>/// AddPath - Add the specified path to the specified group list,
>> prefixing
>>/// the sysroot if used.
>> -  void AddPath(const Twine , IncludeDirGroup Group, bool
>> isFramework);
>> +  /// Returns true if the path exists, false if it was ignored.
>> +  bool AddPath(const Twine , IncludeDirGroup Group, bool
>> isFramework);
>>
>>/// AddUnmappedPath - Add the specified path to the specified group
>> list,
>>/// without performing any sysroot remapping.
>> -  void AddUnmappedPath(const Twine , IncludeDirGroup Group,
>> +  /// Returns true if the path exists, false if it was ignored.
>> +  bool AddUnmappedPath(const Twine , IncludeDirGroup Group,
>> bool isFramework);
>>
>>/// AddSystemHeaderPrefix - Add the specified prefix to the system
>> header
>> @@ -70,10 +73,9 @@ public:
>>
>>/// AddGnuCPlusPlusIncludePaths - Add the necessary paths to support a
>> gnu
>>///  libstdc++.
>> -  void 

Re: r335081 - Recommit r335063: [Darwin] Add a warning for missing include path for libstdc++

2018-08-18 Thread Nico Weber via cfe-commits
Should this maybe not be emitted when compiling e.g. .ii files
(preprocessed output)? I just got this when I built a standalone .ii file
with some bug repro after I deleted all -I and -isysroot flags and whatnot,
since they aren't needed for preprocessed files.

On Tue, Jun 19, 2018 at 6:52 PM Alex Lorenz via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: arphaman
> Date: Tue Jun 19 15:47:53 2018
> New Revision: 335081
>
> URL: http://llvm.org/viewvc/llvm-project?rev=335081=rev
> Log:
> Recommit r335063: [Darwin] Add a warning for missing include path for
> libstdc++
>
> The recommit ensures that the tests that failed on bots don't trigger the
> warning.
>
> Xcode 10 removes support for libstdc++, but the users just get a confusing
> include not file warning when including an STL header (when building for
> iOS6
> which uses libstdc++ by default for example).
> This patch adds a new warning that lets the user know that the libstdc++
> include
> path was not found to ensure that the user is more aware of why the error
> occurs.
>
> rdar://40830462
>
> Differential Revision: https://reviews.llvm.org/D48297
>
> Added:
> cfe/trunk/test/Frontend/warning-stdlibcxx-darwin.cpp
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
> cfe/trunk/include/clang/Lex/HeaderSearch.h
> cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
> cfe/trunk/test/CodeGenCXX/apple-kext-guard-variable.cpp
> cfe/trunk/test/Misc/backend-stack-frame-diagnostics.cpp
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=335081=335080=335081=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Tue Jun 19
> 15:47:53 2018
> @@ -236,4 +236,9 @@ def err_invalid_vfs_overlay : Error<
>
>  def warn_option_invalid_ocl_version : Warning<
>"OpenCL version %0 does not support the option '%1'">,
> InGroup;
> +
> +def warn_stdlibcxx_not_found : Warning<
> +  "include path for stdlibc++ headers not found; pass '-std=libc++' on
> the "
> +  "command line to use the libc++ standard library instead">,
> +  InGroup>;
>  }
>
> Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=335081=335080=335081=diff
>
> ==
> --- cfe/trunk/include/clang/Lex/HeaderSearch.h (original)
> +++ cfe/trunk/include/clang/Lex/HeaderSearch.h Tue Jun 19 15:47:53 2018
> @@ -272,6 +272,8 @@ public:
>
>FileManager () const { return FileMgr; }
>
> +  DiagnosticsEngine () const { return Diags; }
> +
>/// Interface for setting the file search paths.
>void SetSearchPaths(const std::vector ,
>unsigned angledDirIdx, unsigned systemDirIdx,
>
> Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=335081=335080=335081=diff
>
> ==
> --- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
> +++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Tue Jun 19 15:47:53 2018
> @@ -14,6 +14,7 @@
>  #include "clang/Basic/FileManager.h"
>  #include "clang/Basic/LangOptions.h"
>  #include "clang/Config/config.h" // C_INCLUDE_DIRS
> +#include "clang/Frontend/FrontendDiagnostic.h"
>  #include "clang/Frontend/Utils.h"
>  #include "clang/Lex/HeaderMap.h"
>  #include "clang/Lex/HeaderSearch.h"
> @@ -55,11 +56,13 @@ public:
>
>/// AddPath - Add the specified path to the specified group list,
> prefixing
>/// the sysroot if used.
> -  void AddPath(const Twine , IncludeDirGroup Group, bool
> isFramework);
> +  /// Returns true if the path exists, false if it was ignored.
> +  bool AddPath(const Twine , IncludeDirGroup Group, bool
> isFramework);
>
>/// AddUnmappedPath - Add the specified path to the specified group
> list,
>/// without performing any sysroot remapping.
> -  void AddUnmappedPath(const Twine , IncludeDirGroup Group,
> +  /// Returns true if the path exists, false if it was ignored.
> +  bool AddUnmappedPath(const Twine , IncludeDirGroup Group,
> bool isFramework);
>
>/// AddSystemHeaderPrefix - Add the specified prefix to the system
> header
> @@ -70,10 +73,9 @@ public:
>
>/// AddGnuCPlusPlusIncludePaths - Add the necessary paths to support a
> gnu
>///  libstdc++.
> -  void AddGnuCPlusPlusIncludePaths(StringRef Base,
> -   StringRef ArchDir,
> -   StringRef Dir32,
> -   StringRef Dir64,
> +  /// Returns true if the \p Base path was found, false if it 

r335081 - Recommit r335063: [Darwin] Add a warning for missing include path for libstdc++

2018-06-19 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Tue Jun 19 15:47:53 2018
New Revision: 335081

URL: http://llvm.org/viewvc/llvm-project?rev=335081=rev
Log:
Recommit r335063: [Darwin] Add a warning for missing include path for libstdc++

The recommit ensures that the tests that failed on bots don't trigger the 
warning.

Xcode 10 removes support for libstdc++, but the users just get a confusing
include not file warning when including an STL header (when building for iOS6
which uses libstdc++ by default for example).
This patch adds a new warning that lets the user know that the libstdc++ include
path was not found to ensure that the user is more aware of why the error 
occurs.

rdar://40830462

Differential Revision: https://reviews.llvm.org/D48297

Added:
cfe/trunk/test/Frontend/warning-stdlibcxx-darwin.cpp
Modified:
cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
cfe/trunk/include/clang/Lex/HeaderSearch.h
cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
cfe/trunk/test/CodeGenCXX/apple-kext-guard-variable.cpp
cfe/trunk/test/Misc/backend-stack-frame-diagnostics.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=335081=335080=335081=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Tue Jun 19 
15:47:53 2018
@@ -236,4 +236,9 @@ def err_invalid_vfs_overlay : Error<
 
 def warn_option_invalid_ocl_version : Warning<
   "OpenCL version %0 does not support the option '%1'">, InGroup;
+
+def warn_stdlibcxx_not_found : Warning<
+  "include path for stdlibc++ headers not found; pass '-std=libc++' on the "
+  "command line to use the libc++ standard library instead">,
+  InGroup>;
 }

Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=335081=335080=335081=diff
==
--- cfe/trunk/include/clang/Lex/HeaderSearch.h (original)
+++ cfe/trunk/include/clang/Lex/HeaderSearch.h Tue Jun 19 15:47:53 2018
@@ -272,6 +272,8 @@ public:
   
   FileManager () const { return FileMgr; }
 
+  DiagnosticsEngine () const { return Diags; }
+
   /// Interface for setting the file search paths.
   void SetSearchPaths(const std::vector ,
   unsigned angledDirIdx, unsigned systemDirIdx,

Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=335081=335080=335081=diff
==
--- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
+++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Tue Jun 19 15:47:53 2018
@@ -14,6 +14,7 @@
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Config/config.h" // C_INCLUDE_DIRS
+#include "clang/Frontend/FrontendDiagnostic.h"
 #include "clang/Frontend/Utils.h"
 #include "clang/Lex/HeaderMap.h"
 #include "clang/Lex/HeaderSearch.h"
@@ -55,11 +56,13 @@ public:
 
   /// AddPath - Add the specified path to the specified group list, prefixing
   /// the sysroot if used.
-  void AddPath(const Twine , IncludeDirGroup Group, bool isFramework);
+  /// Returns true if the path exists, false if it was ignored.
+  bool AddPath(const Twine , IncludeDirGroup Group, bool isFramework);
 
   /// AddUnmappedPath - Add the specified path to the specified group list,
   /// without performing any sysroot remapping.
-  void AddUnmappedPath(const Twine , IncludeDirGroup Group,
+  /// Returns true if the path exists, false if it was ignored.
+  bool AddUnmappedPath(const Twine , IncludeDirGroup Group,
bool isFramework);
 
   /// AddSystemHeaderPrefix - Add the specified prefix to the system header
@@ -70,10 +73,9 @@ public:
 
   /// AddGnuCPlusPlusIncludePaths - Add the necessary paths to support a gnu
   ///  libstdc++.
-  void AddGnuCPlusPlusIncludePaths(StringRef Base,
-   StringRef ArchDir,
-   StringRef Dir32,
-   StringRef Dir64,
+  /// Returns true if the \p Base path was found, false if it does not exist.
+  bool AddGnuCPlusPlusIncludePaths(StringRef Base, StringRef ArchDir,
+   StringRef Dir32, StringRef Dir64,
const llvm::Triple );
 
   /// AddMinGWCPlusPlusIncludePaths - Add the necessary paths to support a 
MinGW
@@ -88,7 +90,8 @@ public:
 
   // AddDefaultCPlusPlusIncludePaths -  Add paths that should be searched when
   //  compiling c++.
-  void AddDefaultCPlusPlusIncludePaths(const llvm::Triple ,
+  void AddDefaultCPlusPlusIncludePaths(const LangOptions ,
+