Re: r338385 - [RISCV] Add driver for riscv32-unknown-elf baremetal target

2018-08-17 Thread Nico Weber via cfe-commits
It's two weeks later and I'm still seeing this warning. Any news?

On Fri, Aug 3, 2018 at 9:29 AM Dávid Bolvanský 
wrote:

> Such filename fix could be part of https://reviews.llvm.org/D50246
>
> pi 3. 8. 2018 o 15:17 Nico Weber  napísal(a):
>
>> I'm getting this warning from the mac linker after this commit:
>>
>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool:
>> warning same member name (libclangDriver.RISCV.o) in output file used for
>> input files: obj/clang/lib/Driver/ToolChains/Arch/libclangDriver.RISCV.o
>> and: obj/clang/lib/Driver/ToolChains/libclangDriver.RISCV.o (due to use of
>> basename, truncation, blank padding or duplicate input files)
>>
>> Could we rename the file to fix that warning?
>>
>> On Tue, Jul 31, 2018 at 10:40 AM David Bolvansky via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: xbolva00
>>> Date: Tue Jul 31 07:21:46 2018
>>> New Revision: 338385
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=338385&view=rev
>>> Log:
>>> [RISCV] Add driver for riscv32-unknown-elf baremetal target
>>>
>>> Summary:
>>> This patch adds a driver for the baremetal RISC-V target (i.e.
>>> riscv32-unknown-elf). For reference, D39963 added basic target info and
>>> added support for riscv32-linux-unknown-elf.
>>>
>>> Patch by: asb (Alex Bradbury)
>>>
>>> Reviewers: efriedma, phosek, apazos, espindola, mgrang
>>>
>>> Reviewed By: mgrang
>>>
>>> Subscribers: jrtc27, rogfer01, MartinMosbeck, brucehoult, the_o,
>>> rkruppe, emaste, mgorny, arichardson, rbar, johnrusso, simoncook,
>>> jordy.potman.lists, sabuasal, niosHD, kito-cheng, shiva0217, zzheng,
>>> edward-jones, mgrang, cfe-commits
>>>
>>> Differential Revision: https://reviews.llvm.org/D46822
>>>
>>> Added:
>>> cfe/trunk/lib/Driver/ToolChains/RISCV.cpp
>>> cfe/trunk/lib/Driver/ToolChains/RISCV.h
>>> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/
>>> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/bin/
>>>
>>> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/bin/riscv32-unknown-elf-ld
>>>  (with props)
>>> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/lib/
>>> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/lib/gcc/
>>>
>>> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/
>>>
>>> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/
>>>
>>> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/crtbegin.o
>>>
>>> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/crtend.o
>>> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/riscv32-unknown-elf/
>>>
>>> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/riscv32-unknown-elf/include/
>>>
>>> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/riscv32-unknown-elf/include/c++/
>>>
>>> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/riscv32-unknown-elf/include/c++/8.0.1/
>>>
>>> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/riscv32-unknown-elf/include/c++/8.0.1/.keep
>>>
>>> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/riscv32-unknown-elf/lib/
>>>
>>> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/riscv32-unknown-elf/lib/crt0.o
>>> Modified:
>>> cfe/trunk/lib/Driver/CMakeLists.txt
>>> cfe/trunk/lib/Driver/Driver.cpp
>>> cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
>>> cfe/trunk/test/Driver/riscv32-toolchain.c
>>>
>>> Modified: cfe/trunk/lib/Driver/CMakeLists.txt
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CMakeLists.txt?rev=338385&r1=338384&r2=338385&view=diff
>>>
>>> ==
>>> --- cfe/trunk/lib/Driver/CMakeLists.txt (original)
>>> +++ cfe/trunk/lib/Driver/CMakeLists.txt Tue Jul 31 07:21:46 2018
>>> @@ -57,6 +57,7 @@ add_clang_library(clangDriver
>>>ToolChains/NetBSD.cpp
>>>ToolChains/OpenBSD.cpp
>>>ToolChains/PS4CPU.cpp
>>> +  ToolChains/RISCV.cpp
>>>ToolChains/Solaris.cpp
>>>ToolChains/TCE.cpp
>>>ToolChains/WebAssembly.cpp
>>>
>>> Modified: cfe/trunk/lib/Driver/Driver.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=338385&r1=338384&r2=338385&view=diff
>>>
>>> ==
>>> --- cfe/trunk/lib/Driver/Driver.cpp (original)
>>> +++ cfe/trunk/lib/Driver/Driver.cpp Tue Jul 31 07:21:46 2018
>>> @@ -37,6 +37,7 @@
>>>  #include "ToolChains/NetBSD.h"
>>>  #include "ToolChains/OpenBSD.h"
>>>  #include "ToolChains/PS4CPU.h"
>>> +#include "ToolChains/RISCV.h"
>>>  #include "ToolChains/Solaris.h"
>>>  #include "ToolChains/TCE.h"
>>>  #include "ToolChains/WebAssembly.h"
>>> @@ -4399,6 +4400,10 @@ const ToolChain &Driver::getToolChain(co
>>>case llvm::Triple::avr:
>>>  TC = llvm::make_unique(*this, Target,
>>> Args);
>>>  break;
>>> +  case llvm::Triple::riscv32:
>>> +  case llvm::Triple::riscv64:
>>> +TC = llvm::make_unique(*t

r340048 - Make __shiftleft128 / __shiftright128 real compiler built-ins.

2018-08-17 Thread Nico Weber via cfe-commits
Author: nico
Date: Fri Aug 17 10:19:06 2018
New Revision: 340048

URL: http://llvm.org/viewvc/llvm-project?rev=340048&view=rev
Log:
Make __shiftleft128 / __shiftright128 real compiler built-ins.

r337619 added __shiftleft128 / __shiftright128 as functions in intrin.h.
Microsoft's STL plans on using these functions, and they're using intrin0.h
which just has declarations of built-ins to not pull in the huge intrin.h
header in the standard library headers. That requires that these functions are
real built-ins.

https://reviews.llvm.org/D50907

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86_64.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Headers/intrin.h
cfe/trunk/test/CodeGen/ms-x86-intrinsics.c
cfe/trunk/test/Headers/ms-intrin.cpp

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86_64.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86_64.def?rev=340048&r1=340047&r2=340048&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86_64.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86_64.def Fri Aug 17 10:19:06 2018
@@ -31,6 +31,8 @@ TARGET_HEADER_BUILTIN(_mul128, "LLiLLiLL
 TARGET_HEADER_BUILTIN(_umul128, "ULLiULLiULLiULLi*", "nch",   "intrin.h", 
ALL_MS_LANGUAGES, "")
 
 TARGET_HEADER_BUILTIN(__faststorefence, "v", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(__shiftleft128, "ULLiULLiULLiUc", "nch", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(__shiftright128, "ULLiULLiULLiUc", "nch", "intrin.h", 
ALL_MS_LANGUAGES, "")
 
 TARGET_HEADER_BUILTIN(_InterlockedAnd64, "LLiLLiD*LLi", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_InterlockedDecrement64,   "LLiLLiD*","nh", 
"intrin.h", ALL_MS_LANGUAGES, "")

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=340048&r1=340047&r2=340048&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Fri Aug 17 10:19:06 2018
@@ -10440,6 +10440,27 @@ Value *CodeGenFunction::EmitX86BuiltinEx
 return Builder.CreateFence(llvm::AtomicOrdering::SequentiallyConsistent,
llvm::SyncScope::System);
   }
+  case X86::BI__shiftleft128:
+  case X86::BI__shiftright128: {
+// FIXME: Once fshl/fshr no longer add an unneeded and and cmov, do this:
+// llvm::Function *F = CGM.getIntrinsic(
+//   BuiltinID == X86::BI__shiftleft128 ? Intrinsic::fshl : 
Intrinsic::fshr,
+//   Int64Ty);
+// Ops[2] = Builder.CreateZExt(Ops[2], Int64Ty);
+// return Builder.CreateCall(F, Ops);
+llvm::Type *Int128Ty = Builder.getInt128Ty();
+Value *Val = Builder.CreateOr(
+Builder.CreateShl(Builder.CreateZExt(Ops[1], Int128Ty), 64),
+Builder.CreateZExt(Ops[0], Int128Ty));
+Value *Amt = Builder.CreateAnd(Builder.CreateZExt(Ops[2], Int128Ty),
+   llvm::ConstantInt::get(Int128Ty, 0x3f));
+Value *Res;
+if (BuiltinID == X86::BI__shiftleft128)
+  Res = Builder.CreateLShr(Builder.CreateShl(Val, Amt), 64);
+else
+  Res = Builder.CreateLShr(Val, Amt);
+return Builder.CreateTrunc(Res, Int64Ty);
+  }
   case X86::BI_ReadWriteBarrier:
   case X86::BI_ReadBarrier:
   case X86::BI_WriteBarrier: {

Modified: cfe/trunk/lib/Headers/intrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/intrin.h?rev=340048&r1=340047&r2=340048&view=diff
==
--- cfe/trunk/lib/Headers/intrin.h (original)
+++ cfe/trunk/lib/Headers/intrin.h Fri Aug 17 10:19:06 2018
@@ -863,20 +863,6 @@ __nop(void) {
   __asm__ volatile ("nop");
 }
 #endif
-#if defined(__x86_64__)
-static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
-__shiftleft128(unsigned __int64 __l, unsigned __int64 __h, unsigned char __d) {
-  unsigned __int128 __val = ((unsigned __int128)__h << 64) | __l;
-  unsigned __int128 __res = __val << (__d & 63);
-  return (unsigned __int64)(__res >> 64);
-}
-static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
-__shiftright128(unsigned __int64 __l, unsigned __int64 __h, unsigned char __d) 
{
-  unsigned __int128 __val = ((unsigned __int128)__h << 64) | __l;
-  unsigned __int128 __res = __val >> (__d & 63);
-  return (unsigned __int64)__res;
-}
-#endif
 
 
/**\
 |* Privileged intrinsics

Modified: cfe/trunk/test/CodeGen/ms-x86-intrinsics.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-x86-intrinsics.c?rev=340048&r1=340047&r2=340048&view=diff
==
--- cfe/trunk/test/CodeGen/ms-x86-intrinsics.c (original)
+++ cfe/trunk/test/CodeGen/ms-x86-intrinsi

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&view=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&r1=335080&r2=335081&view=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&r1=335080&r2=335081&view=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 &getFileMgr() const { return FileMgr; }
>
> +  DiagnosticsEngine &getDiags() const { return Diags; }
> +
>/// Interface for setting the file search paths.
>void SetSearchPaths(const std::vector &dirs,
>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&r1=335080&r2=335081&view=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 &Path, IncludeDirGroup Group, bool
> isFramework);
> +  /// Returns true if the path exists, false if it was ignored.
> +  bool AddPath(const Twine &Path, IncludeDirGroup Group, bool
> isFramework);
>
>/// AddUnmappedPath - Add the specified path to the specified group
> list,
>/// without performing any sysroot remapping.
> -  void AddUnmappedPath(const Twine &Path, IncludeDirGroup Group,
> +  /// Returns true if the path exists, false if it was ignored.
> +  bool AddUnmappedPath(const Twine &Path, 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,
> -   St

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&view=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&r1=335080&r2=335081&view=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&r1=335080&r2=335081&view=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 &getFileMgr() const { return FileMgr; }
>>
>> +  DiagnosticsEngine &getDiags() const { return Diags; }
>> +
>>/// Interface for setting the file search paths.
>>void SetSearchPaths(const std::vector &dirs,
>>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&r1=335080&r2=335081&view=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 &Path, IncludeDirGroup Group, bool
>> isFramework);
>> +  /// Returns true if the path exists, false if it was ignored.
>> +  bool AddPath(const Twine &Path, IncludeDirGroup Group, bool
>> isFramework);
>>
>>/// AddUnmappedPath - Add the specified path to the specified group
>> list,
>>/// without performing any sysroot remapping.
>> -  void AddUnmappedPath(const Twine &Path, IncludeDirGroup Group,
>> +  /// Returns true if the path exists, false if it was ignored.
>> +  bool AddUnmappedPath(const Twine &Path, IncludeDirGroup Group,
>> bool isFramework);
>>
>>/// AddSystemHeaderPrefix - Add the specified prefix to the system
>> header
>> @@ -70,10 +73,9 @@ public:
>>
>>/// AddGnuCPlusPlusIncludePaths -

r340348 - Eliminate instances of `EmitScalarExpr(E->getArg(n))` in EmitX86BuiltinExpr().

2018-08-21 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Aug 21 15:19:55 2018
New Revision: 340348

URL: http://llvm.org/viewvc/llvm-project?rev=340348&view=rev
Log:
Eliminate instances of `EmitScalarExpr(E->getArg(n))` in EmitX86BuiltinExpr().

EmitX86BuiltinExpr() emits all args into Ops at the beginning, so don't do that
work again.

This changes behavior: If e.g. ++a was passed as an arg, we incremented a twice
previously. This change fixes that bug.

https://reviews.llvm.org/D50979

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/ms-intrinsics.c
cfe/trunk/test/CodeGen/ms-x86-intrinsics.c

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=340348&r1=340347&r2=340348&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Tue Aug 21 15:19:55 2018
@@ -10528,14 +10528,11 @@ Value *CodeGenFunction::EmitX86BuiltinEx
 llvm::Type *Int128PtrTy = Int128Ty->getPointerTo();
 
 Value *Destination =
-Builder.CreateBitCast(EmitScalarExpr(E->getArg(0)), Int128PtrTy);
-Value *ExchangeHigh128 =
-Builder.CreateZExt(EmitScalarExpr(E->getArg(1)), Int128Ty);
-Value *ExchangeLow128 =
-Builder.CreateZExt(EmitScalarExpr(E->getArg(2)), Int128Ty);
-Address ComparandResult(
-Builder.CreateBitCast(EmitScalarExpr(E->getArg(3)), Int128PtrTy),
-getContext().toCharUnitsFromBits(128));
+Builder.CreateBitCast(Ops[0], Int128PtrTy);
+Value *ExchangeHigh128 = Builder.CreateZExt(Ops[1], Int128Ty);
+Value *ExchangeLow128 = Builder.CreateZExt(Ops[2], Int128Ty);
+Address ComparandResult(Builder.CreateBitCast(Ops[3], Int128PtrTy),
+getContext().toCharUnitsFromBits(128));
 
 Value *Exchange = Builder.CreateOr(
 Builder.CreateShl(ExchangeHigh128, 64, "", false, false),
@@ -10586,8 +10583,8 @@ Value *CodeGenFunction::EmitX86BuiltinEx
   case X86::BI__readfsdword:
   case X86::BI__readfsqword: {
 llvm::Type *IntTy = ConvertType(E->getType());
-Value *Ptr = Builder.CreateIntToPtr(EmitScalarExpr(E->getArg(0)),
-llvm::PointerType::get(IntTy, 257));
+Value *Ptr =
+Builder.CreateIntToPtr(Ops[0], llvm::PointerType::get(IntTy, 257));
 LoadInst *Load = Builder.CreateAlignedLoad(
 IntTy, Ptr, getContext().getTypeAlignInChars(E->getType()));
 Load->setVolatile(true);
@@ -10598,8 +10595,8 @@ Value *CodeGenFunction::EmitX86BuiltinEx
   case X86::BI__readgsdword:
   case X86::BI__readgsqword: {
 llvm::Type *IntTy = ConvertType(E->getType());
-Value *Ptr = Builder.CreateIntToPtr(EmitScalarExpr(E->getArg(0)),
-llvm::PointerType::get(IntTy, 256));
+Value *Ptr =
+Builder.CreateIntToPtr(Ops[0], llvm::PointerType::get(IntTy, 256));
 LoadInst *Load = Builder.CreateAlignedLoad(
 IntTy, Ptr, getContext().getTypeAlignInChars(E->getType()));
 Load->setVolatile(true);

Modified: cfe/trunk/test/CodeGen/ms-intrinsics.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-intrinsics.c?rev=340348&r1=340347&r2=340348&view=diff
==
--- cfe/trunk/test/CodeGen/ms-intrinsics.c (original)
+++ cfe/trunk/test/CodeGen/ms-intrinsics.c Tue Aug 21 15:19:55 2018
@@ -416,14 +416,21 @@ __int64 test_InterlockedCompareExchange6
 // CHECK: }
 
 #if defined(__x86_64__)
-unsigned char test_InterlockedCompareExchange128(__int64 volatile 
*Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64* 
ComparandResult) {
-  return _InterlockedCompareExchange128(Destination, ExchangeHigh, 
ExchangeLow, ComparandResult);
+unsigned char test_InterlockedCompareExchange128(
+__int64 volatile *Destination, __int64 ExchangeHigh,
+__int64 ExchangeLow, __int64 *ComparandResult) {
+  return _InterlockedCompareExchange128(++Destination, ++ExchangeHigh,
+++ExchangeLow, ++ComparandResult);
 }
 // CHECK-X64: define{{.*}}i8 @test_InterlockedCompareExchange128(i64*{{[a-z_ 
]*}}%Destination, i64{{[a-z_ ]*}}%ExchangeHigh, i64{{[a-z_ ]*}}%ExchangeLow, 
i64*{{[a-z_ ]*}}%ComparandResult){{.*}}{
-// CHECK-X64: [[DST:%[0-9]+]] = bitcast i64* %Destination to i128*
-// CHECK-X64: [[EH:%[0-9]+]] = zext i64 %ExchangeHigh to i128
-// CHECK-X64: [[EL:%[0-9]+]] = zext i64 %ExchangeLow to i128
-// CHECK-X64: [[CNR:%[0-9]+]] = bitcast i64* %ComparandResult to i128*
+// CHECK-X64: %incdec.ptr = getelementptr inbounds i64, i64* %Destination, i64 
1
+// CHECK-X64: %inc = add nsw i64 %ExchangeHigh, 1
+// CHECK-X64: %inc1 = add nsw i64 %ExchangeLow, 1
+// CHECK-X64: %incdec.ptr2 = getelementptr inbounds i64, i64* 
%ComparandResult, i64 1
+// CHECK-X64: [[DST:%[0-9]+]] = bitcast i64* %incdec.ptr to i128*
+// CHECK-X64: [[EH:%[0-9]+]] 

r340498 - win: Omit ".exe" from clang and clang-cl driver-level diagnostics.

2018-08-22 Thread Nico Weber via cfe-commits
Author: nico
Date: Wed Aug 22 16:53:39 2018
New Revision: 340498

URL: http://llvm.org/viewvc/llvm-project?rev=340498&view=rev
Log:
win: Omit ".exe" from clang and clang-cl driver-level diagnostics.

Like https://reviews.llvm.org/D51133 but for clang.
https://reviews.llvm.org/D51134

Modified:
cfe/trunk/tools/driver/driver.cpp

Modified: cfe/trunk/tools/driver/driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=340498&r1=340497&r2=340498&view=diff
==
--- cfe/trunk/tools/driver/driver.cpp (original)
+++ cfe/trunk/tools/driver/driver.cpp Wed Aug 22 16:53:39 2018
@@ -260,9 +260,9 @@ static void FixupDiagPrefixExeName(TextD
const std::string &Path) {
   // If the clang binary happens to be named cl.exe for compatibility reasons,
   // use clang-cl.exe as the prefix to avoid confusion between clang and MSVC.
-  StringRef ExeBasename(llvm::sys::path::filename(Path));
-  if (ExeBasename.equals_lower("cl.exe"))
-ExeBasename = "clang-cl.exe";
+  StringRef ExeBasename(llvm::sys::path::stem(Path));
+  if (ExeBasename.equals_lower("cl"))
+ExeBasename = "clang-cl";
   DiagClient->setPrefix(ExeBasename);
 }
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r331871 - Remove unused lit setting, see https://reviews.llvm.org/D46619

2018-05-09 Thread Nico Weber via cfe-commits
Author: nico
Date: Wed May  9 05:38:51 2018
New Revision: 331871

URL: http://llvm.org/viewvc/llvm-project?rev=331871&view=rev
Log:
Remove unused lit setting, see https://reviews.llvm.org/D46619

Modified:
cfe/trunk/test/lit.site.cfg.py.in

Modified: cfe/trunk/test/lit.site.cfg.py.in
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.site.cfg.py.in?rev=331871&r1=331870&r2=331871&view=diff
==
--- cfe/trunk/test/lit.site.cfg.py.in (original)
+++ cfe/trunk/test/lit.site.cfg.py.in Wed May  9 05:38:51 2018
@@ -25,7 +25,6 @@ config.clang_examples = @CLANG_BUILD_EXA
 config.enable_shared = @ENABLE_SHARED@
 config.enable_backtrace = @ENABLE_BACKTRACES@
 config.host_arch = "@HOST_ARCH@"
-config.enable_abi_breaking_checks = "@LLVM_ENABLE_ABI_BREAKING_CHECKS@"
 config.python_executable = "@PYTHON_EXECUTABLE@"
 
 # Support substitution of the tools and libs dirs with user parameters. This is


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r332370 - update two comments as suggested on https://reviews.llvm.org/D46843

2018-05-15 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue May 15 09:37:00 2018
New Revision: 332370

URL: http://llvm.org/viewvc/llvm-project?rev=332370&view=rev
Log:
update two comments as suggested on https://reviews.llvm.org/D46843

Modified:
cfe/trunk/tools/clang-fuzzer/CMakeLists.txt
cfe/trunk/tools/clang-fuzzer/proto-to-cxx/CMakeLists.txt

Modified: cfe/trunk/tools/clang-fuzzer/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-fuzzer/CMakeLists.txt?rev=332370&r1=332369&r2=332370&view=diff
==
--- cfe/trunk/tools/clang-fuzzer/CMakeLists.txt (original)
+++ cfe/trunk/tools/clang-fuzzer/CMakeLists.txt Tue May 15 09:37:00 2018
@@ -9,8 +9,7 @@ elseif(LLVM_USE_SANITIZE_COVERAGE)
   unset(DUMMY_MAIN)
 endif()
 
-# Hack to bypass LLVM's cmake sources check and allow multiple libraries and
-# executables from this directory.
+# Needed by LLVM's CMake checks because this file defines multiple targets.
 set(LLVM_OPTIONAL_SOURCES
   ClangFuzzer.cpp
   DummyClangFuzzer.cpp

Modified: cfe/trunk/tools/clang-fuzzer/proto-to-cxx/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-fuzzer/proto-to-cxx/CMakeLists.txt?rev=332370&r1=332369&r2=332370&view=diff
==
--- cfe/trunk/tools/clang-fuzzer/proto-to-cxx/CMakeLists.txt (original)
+++ cfe/trunk/tools/clang-fuzzer/proto-to-cxx/CMakeLists.txt Tue May 15 
09:37:00 2018
@@ -1,8 +1,7 @@
 set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD})
 set(CMAKE_CXX_FLAGS ${CXX_FLAGS_NOFUZZ})
 
-# Hack to bypass LLVM's CMake source checks so we can have both a library and
-# an executable built from this directory.
+# Needed by LLVM's CMake checks because this file defines multiple targets.
 set(LLVM_OPTIONAL_SOURCES proto_to_cxx.cpp proto_to_cxx_main.cpp)
 
 add_clang_library(clangProtoToCXX proto_to_cxx.cpp


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r332614 - Fix __uuidof handling on non-type template parameter in C++17

2018-05-17 Thread Nico Weber via cfe-commits
Author: nico
Date: Thu May 17 08:26:37 2018
New Revision: 332614

URL: http://llvm.org/viewvc/llvm-project?rev=332614&view=rev
Log:
Fix __uuidof handling on non-type template parameter in C++17

Clang used to pass the base lvalue of a non-type template parameter
to the template instantiation phase when the base part is __uuidof
and it's running in C++17 mode.
However, that drops its LValuePath, and unintentionally transforms
&__uuidof(...) to __uuidof(...).

This CL fixes that by passing whole expr. Fixes PR24986.

https://reviews.llvm.org/D46820?id=146557
Patch from Taiju Tsuiki !

Modified:
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/SemaCXX/ms-uuid.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=332614&r1=332613&r2=332614&view=diff
==
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Thu May 17 08:26:37 2018
@@ -6245,7 +6245,7 @@ ExprResult Sema::CheckTemplateArgument(N
   // -- a predefined __func__ variable
   if (auto *E = Value.getLValueBase().dyn_cast()) {
 if (isa(E)) {
-  Converted = TemplateArgument(const_cast(E));
+  Converted = TemplateArgument(ArgResult.get());
   break;
 }
 Diag(Arg->getLocStart(), diag::err_template_arg_not_decl_ref)

Modified: cfe/trunk/test/SemaCXX/ms-uuid.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ms-uuid.cpp?rev=332614&r1=332613&r2=332614&view=diff
==
--- cfe/trunk/test/SemaCXX/ms-uuid.cpp (original)
+++ cfe/trunk/test/SemaCXX/ms-uuid.cpp Thu May 17 08:26:37 2018
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s 
-Wno-deprecated-declarations
+// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify -fms-extensions %s 
-Wno-deprecated-declarations
 
 typedef struct _GUID {
   unsigned long Data1;
@@ -92,4 +93,16 @@ class __declspec(uuid("00A0--000
 // the previous case).
 [uuid("00A0---C000-0049"),
  uuid("00A0---C000-0049")] class C10;
+
+template 
+void F1() {
+  // Regression test for PR24986. The given GUID should just work as a pointer.
+  const GUID* q = p;
+}
+
+void F2() {
+  // The UUID should work for a non-type template parameter.
+  F1<&__uuidof(C1)>();
+}
+
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r332639 - Fix a mangling failure on clang-cl C++17

2018-05-17 Thread Nico Weber via cfe-commits
You might've forgotten to svn add the test :-)

On Thu, May 17, 2018, 2:16 PM Reid Kleckner via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rnk
> Date: Thu May 17 11:12:18 2018
> New Revision: 332639
>
> URL: http://llvm.org/viewvc/llvm-project?rev=332639&view=rev
> Log:
> Fix a mangling failure on clang-cl C++17
>
> MethodVFTableLocations in MigrosoftVTableContext contains canonicalized
> decl. But, it's sometimes asked to lookup for non-canonicalized decl,
> and that causes assertion failure, and compilation failure.
>
> Fixes PR37481.
>
> Patch by Taiju Tsuiki!
>
> Differential Revision: https://reviews.llvm.org/D46929
>
> Modified:
> cfe/trunk/lib/AST/VTableBuilder.cpp
> cfe/trunk/lib/CodeGen/CGCXX.cpp
> cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
> cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
>
> Modified: cfe/trunk/lib/AST/VTableBuilder.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=332639&r1=332638&r2=332639&view=diff
>
> ==
> --- cfe/trunk/lib/AST/VTableBuilder.cpp (original)
> +++ cfe/trunk/lib/AST/VTableBuilder.cpp Thu May 17 11:12:18 2018
> @@ -2223,6 +2223,7 @@ ItaniumVTableContext::ItaniumVTableConte
>  ItaniumVTableContext::~ItaniumVTableContext() {}
>
>  uint64_t ItaniumVTableContext::getMethodVTableIndex(GlobalDecl GD) {
> +  GD = GD.getCanonicalDecl();
>MethodVTableIndicesTy::iterator I = MethodVTableIndices.find(GD);
>if (I != MethodVTableIndices.end())
>  return I->second;
> @@ -2503,6 +2504,8 @@ private:
>  for (const auto &I : MethodInfoMap) {
>const CXXMethodDecl *MD = I.first;
>const MethodInfo &MI = I.second;
> +  assert(MD == MD->getCanonicalDecl());
> +
>// Skip the methods that the MostDerivedClass didn't override
>// and the entries shadowed by return adjusting thunks.
>if (MD->getParent() != MostDerivedClass || MI.Shadowed)
> @@ -3737,6 +3740,8 @@ MicrosoftVTableContext::getMethodVFTable
>if (isa(GD.getDecl()))
>  assert(GD.getDtorType() == Dtor_Deleting);
>
> +  GD = GD.getCanonicalDecl();
> +
>MethodVFTableLocationsTy::iterator I = MethodVFTableLocations.find(GD);
>if (I != MethodVFTableLocations.end())
>  return I->second;
>
> Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=332639&r1=332638&r2=332639&view=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGCXX.cpp Thu May 17 11:12:18 2018
> @@ -267,7 +267,6 @@ static CGCallee BuildAppleKextVirtualCal
>const CXXRecordDecl *RD) {
>assert(!CGF.CGM.getTarget().getCXXABI().isMicrosoft() &&
>   "No kext in Microsoft ABI");
> -  GD = GD.getCanonicalDecl();
>CodeGenModule &CGM = CGF.CGM;
>llvm::Value *VTable = CGM.getCXXABI().getAddrOfVTable(RD, CharUnits());
>Ty = Ty->getPointerTo()->getPointerTo();
> @@ -283,7 +282,7 @@ static CGCallee BuildAppleKextVirtualCal
>  CGF.Builder.CreateConstInBoundsGEP1_64(VTable, VTableIndex, "vfnkxt");
>llvm::Value *VFunc =
>  CGF.Builder.CreateAlignedLoad(VFuncPtr, CGF.PointerAlignInBytes);
> -  CGCallee Callee(GD.getDecl(), VFunc);
> +  CGCallee Callee(GD.getDecl()->getCanonicalDecl(), VFunc);
>return Callee;
>  }
>
>
> Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=332639&r1=332638&r2=332639&view=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
> +++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Thu May 17 11:12:18 2018
> @@ -825,7 +825,6 @@ ItaniumCXXABI::EmitMemberFunctionPointer
>  llvm::Constant *ItaniumCXXABI::BuildMemberPointer(const CXXMethodDecl *MD,
>CharUnits
> ThisAdjustment) {
>assert(MD->isInstance() && "Member function must not be static!");
> -  MD = MD->getCanonicalDecl();
>
>CodeGenTypes &Types = CGM.getTypes();
>
> @@ -1640,7 +1639,6 @@ CGCallee ItaniumCXXABI::getVirtualFuncti
>Address This,
>llvm::Type *Ty,
>SourceLocation Loc) {
> -  GD = GD.getCanonicalDecl();
>Ty = Ty->getPointerTo()->getPointerTo();
>auto *MethodDecl = cast(GD.getDecl());
>llvm::Value *VTable = CGF.GetVTablePtr(This, Ty,
> MethodDecl->getParent());
> @@ -1674,7 +1672,7 @@ CGCallee ItaniumCXXABI::getVirtualFuncti
>  VFunc = VFuncLoad;
>}
>
> -  CGCallee Callee(MethodDecl, VFunc);
> +  CGCallee Callee(MethodDecl->getCanonicalDecl(), VFunc);
>return Callee;
>  }
>
>
> Modified: cfe/trunk/lib/CodeGen/MicrosoftC

Re: r294879 - [Driver] Use stem() and not filename().

2018-05-18 Thread Nico Weber via cfe-commits
I think this code is probably dead since the stem is "ld.lld" for lld, not
"lld".

On Sat, Feb 11, 2017 at 7:22 PM, Davide Italiano via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Sat, Feb 11, 2017 at 4:19 PM, Rui Ueyama  wrote:
> > On Sat, Feb 11, 2017 at 3:44 PM, Davide Italiano via cfe-commits
> >  wrote:
> >>
> >> Author: davide
> >> Date: Sat Feb 11 17:44:37 2017
> >> New Revision: 294879
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=294879&view=rev
> >> Log:
> >> [Driver] Use stem() and not filename().
> >>
> >> On Windows the filename might have an extension, namely
> >> `.exe`, so the search will fail. Sorry, I don't have a
> >> good way to test this as it seems to fail only in some
> >> weird configurations. r284430 has the same modification
> >> for Fuchsia.
> >>
> >> Modified:
> >> cfe/trunk/lib/Driver/Tools.cpp
> >>
> >> Modified: cfe/trunk/lib/Driver/Tools.cpp
> >> URL:
> >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
> Tools.cpp?rev=294879&r1=294878&r2=294879&view=diff
> >>
> >> 
> ==
> >> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> >> +++ cfe/trunk/lib/Driver/Tools.cpp Sat Feb 11 17:44:37 2017
> >> @@ -10163,7 +10163,7 @@ void gnutools::Linker::ConstructJob(Comp
> >>Args.ClaimAllArgs(options::OPT_w);
> >>
> >>const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
> >> -  if (llvm::sys::path::filename(Exec) == "lld") {
> >> +  if (llvm::sys::path::stem(Exec) == "lld") {
> >>  CmdArgs.push_back("-flavor");
> >>  CmdArgs.push_back("old-gnu");
> >
>
> Probably not, I'm just reducing diffs with out local branch. I think
> we can remove it altogether.
>
> --
> Davide
>
> "There are no solved problems; there are only problems that are more
> or less solved" -- Henri Poincare
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r332822 - Revert 332750, clang part (see comment on D46910).

2018-05-20 Thread Nico Weber via cfe-commits
Author: nico
Date: Sun May 20 16:02:20 2018
New Revision: 332822

URL: http://llvm.org/viewvc/llvm-project?rev=332822&view=rev
Log:
Revert 332750, clang part (see comment on D46910).

Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=332822&r1=332821&r2=332822&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sun May 20 16:02:20 2018
@@ -2927,11 +2927,10 @@ static void ParseTargetArgs(TargetOption
   Opts.FPMath = Args.getLastArgValue(OPT_mfpmath);
   Opts.FeaturesAsWritten = Args.getAllArgValues(OPT_target_feature);
   Opts.LinkerVersion = Args.getLastArgValue(OPT_target_linker_version);
-  Opts.Triple = Args.getLastArgValue(OPT_triple);
+  Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple));
   // Use the default target triple if unspecified.
   if (Opts.Triple.empty())
 Opts.Triple = llvm::sys::getDefaultTargetTriple();
-  Opts.Triple = llvm::Triple::normalize(Opts.Triple);
   Opts.OpenCLExtensionsAsWritten = Args.getAllArgValues(OPT_cl_ext_EQ);
   Opts.ForceEnableInt128 = Args.hasArg(OPT_fforce_enable_int128);
   Opts.NVPTXUseShortPointers = Args.hasFlag(


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r333423 - add test for r332053

2018-05-29 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue May 29 07:48:30 2018
New Revision: 333423

URL: http://llvm.org/viewvc/llvm-project?rev=333423&view=rev
Log:
add test for r332053

Modified:
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/test/Driver/cl-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=333423&r1=333422&r2=333423&view=diff
==
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Tue May 29 07:48:30 2018
@@ -567,6 +567,8 @@
 // RUN: --driver-mode=cl \
 // RUN: -fcolor-diagnostics \
 // RUN: -fno-color-diagnostics \
+// RUN: -fcoverage-mapping \
+// RUN: -fno-coverage-mapping \
 // RUN: -fdiagnostics-color \
 // RUN: -fno-diagnostics-color \
 // RUN: -fdiagnostics-parseable-fixits \


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r332053 - [clang-cl] Make -f[no-]coverage-mapping available

2018-05-29 Thread Nico Weber via cfe-commits
(Added a test for this in r333423)

On Thu, May 10, 2018 at 6:24 PM, Reid Kleckner via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rnk
> Date: Thu May 10 15:24:00 2018
> New Revision: 332053
>
> URL: http://llvm.org/viewvc/llvm-project?rev=332053&view=rev
> Log:
> [clang-cl] Make -f[no-]coverage-mapping available
>
> Modified:
> cfe/trunk/include/clang/Driver/Options.td
>
> Modified: cfe/trunk/include/clang/Driver/Options.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Driver/Options.td?rev=332053&r1=332052&r2=332053&view=diff
> 
> ==
> --- cfe/trunk/include/clang/Driver/Options.td (original)
> +++ cfe/trunk/include/clang/Driver/Options.td Thu May 10 15:24:00 2018
> @@ -718,10 +718,10 @@ def fprofile_instr_use_EQ : Joined<["-"]
>  Group, Flags<[CoreOption]>,
>  HelpText<"Use instrumentation data for profile-guided optimization">;
>  def fcoverage_mapping : Flag<["-"], "fcoverage-mapping">,
> -Group, Flags<[CC1Option]>,
> +Group, Flags<[CC1Option, CoreOption]>,
>  HelpText<"Generate coverage mapping to enable code coverage
> analysis">;
>  def fno_coverage_mapping : Flag<["-"], "fno-coverage-mapping">,
> -Group, Flags<[DriverOption]>,
> +Group, Flags<[DriverOption, CoreOption]>,
>  HelpText<"Disable code coverage analysis">;
>  def fprofile_generate : Flag<["-"], "fprofile-generate">,
>  Group, Flags<[DriverOption]>,
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D47480: clang-cl: Expose -no-canonical-prefixes

2018-05-29 Thread Nico Weber via cfe-commits
But GetExecutablePath isn't called if -no-canonical-prefixes is passed, is
it? (See the first link I pasted above)

On Tue, May 29, 2018, 5:28 PM Takuto Ikuta via Phabricator via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> takuto.ikuta added a comment.
>
> On windows, argv0 is changed to absolute path before we call
> GetExecutablePath.
> That makes resource-dir absolute.
> I need clang-cl on windows has relative --resource-dir.
>
> See around heres.
>
> https://github.com/llvm-project/llvm-project-20170507/blob/83b39c10b1d7a9189b7ee646212eccf6e61dcfbf/clang/tools/driver/driver.cpp#L323
>
> https://github.com/llvm-project/llvm-project-20170507/blob/ca50c5d758541decdb59330fb15fe6b73ba6467d/llvm/lib/Support/InitLLVM.cpp#L28
>
>
> https://reviews.llvm.org/D47480
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r314172 - clang-format/java: Always put space after `assert` keyword.

2017-09-25 Thread Nico Weber via cfe-commits
Author: nico
Date: Mon Sep 25 15:42:49 2017
New Revision: 314172

URL: http://llvm.org/viewvc/llvm-project?rev=314172&view=rev
Log:
clang-format/java: Always put space after `assert` keyword.

Previously, it was missing if the expression after the assert started with a (.

Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTestJava.cpp

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=314172&r1=314171&r2=314172&view=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Mon Sep 25 15:42:49 2017
@@ -2185,6 +2185,8 @@ bool TokenAnnotator::spaceRequiredBetwee
   const FormatToken &Right) {
   if (Left.is(tok::kw_return) && Right.isNot(tok::semi))
 return true;
+  if (Left.is(Keywords.kw_assert) && Style.Language == FormatStyle::LK_Java)
+return true;
   if (Style.ObjCSpaceAfterProperty && Line.Type == LT_ObjCProperty &&
   Left.Tok.getObjCKeywordID() == tok::objc_property)
 return true;

Modified: cfe/trunk/unittests/Format/FormatTestJava.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJava.cpp?rev=314172&r1=314171&r2=314172&view=diff
==
--- cfe/trunk/unittests/Format/FormatTestJava.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJava.cpp Mon Sep 25 15:42:49 2017
@@ -412,6 +412,7 @@ TEST_F(FormatTestJava, SynchronizedKeywo
 
 TEST_F(FormatTestJava, AssertKeyword) {
   verifyFormat("assert a && b;");
+  verifyFormat("assert (a && b);");
 }
 
 TEST_F(FormatTestJava, PackageDeclarations) {


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r309386 - Recommit r308327 3rd time: Add a warning for missing

2017-09-26 Thread Nico Weber via cfe-commits
Another bit of feedback: The Microsoft SDK has pragma adjustment headers
that are used like so:

#include 
// Define structs with alignment 1 here
#include 

This warning fires on that. I haven't seen these headers in active use
recently, but I remember seeing them quite a bit maybe 10 years ago. (It
took me until today to remember their names.) Any ideas on how to deal with
that?

On Fri, Jul 28, 2017 at 2:41 PM, Alex Lorenz via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: arphaman
> Date: Fri Jul 28 07:41:21 2017
> New Revision: 309386
>
> URL: http://llvm.org/viewvc/llvm-project?rev=309386&view=rev
> Log:
> Recommit r308327 3rd time: Add a warning for missing
> '#pragma pack (pop)' and suspicious uses of '#pragma pack' in included
> files
>
> The second recommit (r309106) was reverted because the "non-default #pragma
> pack value chages the alignment of struct or union members in the included
> file"
> warning proved to be too aggressive for external projects like Chromium
> (https://bugs.chromium.org/p/chromium/issues/detail?id=749197). This
> recommit
> makes the problematic warning a non-default one, and gives it the
> -Wpragma-pack-suspicious-include warning option.
>
> The first recommit (r308441) caused a "non-default #pragma pack value might
> change the alignment of struct or union members in the included file"
> warning
> in LLVM itself. This recommit tweaks the added warning to avoid warnings
> for
> #includes that don't have any records that are affected by the non-default
> alignment. This tweak avoids the previously emitted warning in LLVM.
>
> Original message:
>
> This commit adds a new -Wpragma-pack warning. It warns in the following
> cases:
>
> - When a translation unit is missing terminating #pragma pack (pop)
> directives.
> - When entering an included file if the current alignment value as
> determined
>   by '#pragma pack' directives is different from the default alignment
> value.
> - When leaving an included file that changed the state of the current
> alignment
>   value.
>
> rdar://10184173
>
> Differential Revision: https://reviews.llvm.org/D35484
>
> Added:
> cfe/trunk/test/PCH/suspicious-pragma-pack.c
> cfe/trunk/test/Sema/Inputs/pragma-pack1.h
> cfe/trunk/test/Sema/Inputs/pragma-pack2.h
> cfe/trunk/test/Sema/suspicious-pragma-pack.c
> cfe/trunk/test/SemaObjC/Inputs/empty.h
> cfe/trunk/test/SemaObjC/suspicious-pragma-pack.m
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticGroups.td
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/include/clang/Lex/PPCallbacks.h
> cfe/trunk/include/clang/Sema/Sema.h
> cfe/trunk/include/clang/Serialization/ASTReader.h
> cfe/trunk/lib/Parse/ParsePragma.cpp
> cfe/trunk/lib/Sema/Sema.cpp
> cfe/trunk/lib/Sema/SemaAttr.cpp
> cfe/trunk/lib/Serialization/ASTReader.cpp
> cfe/trunk/lib/Serialization/ASTWriter.cpp
> cfe/trunk/test/OpenMP/declare_simd_messages.cpp
> cfe/trunk/test/PCH/pragma-pack.c
> cfe/trunk/test/Parser/pragma-options.c
> cfe/trunk/test/Parser/pragma-options.cpp
> cfe/trunk/test/Parser/pragma-pack.c
> cfe/trunk/test/Sema/pragma-pack.c
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Basic/DiagnosticGroups.td?rev=309386&r1=309385&r2=309386&view=diff
> 
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Fri Jul 28 07:41:21
> 2017
> @@ -471,8 +471,10 @@ def IgnoredPragmaIntrinsic : DiagGroup<"
>  def UnknownPragmas : DiagGroup<"unknown-pragmas">;
>  def IgnoredPragmas : DiagGroup<"ignored-pragmas",
> [IgnoredPragmaIntrinsic]>;
>  def PragmaClangAttribute : DiagGroup<"pragma-clang-attribute">;
> +def PragmaPackSuspiciousInclude : DiagGroup<"pragma-pack-
> suspicious-include">;
> +def PragmaPack : DiagGroup<"pragma-pack", [PragmaPackSuspiciousInclude]>;
>  def Pragmas : DiagGroup<"pragmas", [UnknownPragmas, IgnoredPragmas,
> -PragmaClangAttribute]>;
> +PragmaClangAttribute, PragmaPack]>;
>  def UnknownWarningOption : DiagGroup<"unknown-warning-option">;
>  def NSobjectAttribute : DiagGroup<"NSObject-attribute">;
>  def IndependentClassAttribute : DiagGroup<"IndependentClass-attribute">;
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/
> DiagnosticSemaKinds.td?rev=309386&r1=309385&r2=309386&view=diff
> 
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Jul 28
> 07:41:21 2017
> @@ -712,6 +712,17 @@ def err_pragma_options_align_mac68k_targ
>  def warn_pragma_pack_i

r314232 - Delete trailing whitespace.

2017-09-26 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Sep 26 11:38:56 2017
New Revision: 314232

URL: http://llvm.org/viewvc/llvm-project?rev=314232&view=rev
Log:
Delete trailing whitespace.

Modified:
cfe/trunk/lib/Lex/PPMacroExpansion.cpp

Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=314232&r1=314231&r2=314232&view=diff
==
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Tue Sep 26 11:38:56 2017
@@ -1023,7 +1023,7 @@ Token *Preprocessor::cacheMacroExpandedT
 
   size_t newIndex = MacroExpandedTokens.size();
   bool cacheNeedsToGrow = tokens.size() >
-  
MacroExpandedTokens.capacity()-MacroExpandedTokens.size(); 
+  
MacroExpandedTokens.capacity()-MacroExpandedTokens.size();
   MacroExpandedTokens.append(tokens.begin(), tokens.end());
 
   if (cacheNeedsToGrow) {


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r314325 - clang-format/java: Unbreak genenrics formatting after r299952.

2017-09-27 Thread Nico Weber via cfe-commits
Author: nico
Date: Wed Sep 27 10:57:50 2017
New Revision: 314325

URL: http://llvm.org/viewvc/llvm-project?rev=314325&view=rev
Log:
clang-format/java: Unbreak genenrics formatting after r299952.

https://reviews.llvm.org/rL299952 merged '>>>' tokens into a single
JavaRightLogicalShift token. This broke formatting of generics nested more than
two deep, e.g. Foo>> because the '>>>' now weren't three '>' for
parseAngle().

Luckily, just deleting JavaRightLogicalShift fixes things without breaking the
test added in r299952, so do that.

https://reviews.llvm.org/D38291

Modified:
cfe/trunk/lib/Format/FormatTokenLexer.cpp
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTestJava.cpp

Modified: cfe/trunk/lib/Format/FormatTokenLexer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/FormatTokenLexer.cpp?rev=314325&r1=314324&r2=314325&view=diff
==
--- cfe/trunk/lib/Format/FormatTokenLexer.cpp (original)
+++ cfe/trunk/lib/Format/FormatTokenLexer.cpp Wed Sep 27 10:57:50 2017
@@ -96,12 +96,8 @@ void FormatTokenLexer::tryMergePreviousT
   }
 
   if (Style.Language == FormatStyle::LK_Java) {
-static const tok::TokenKind JavaRightLogicalShift[] = {
-tok::greater, tok::greater, tok::greater};
 static const tok::TokenKind JavaRightLogicalShiftAssign[] = {
 tok::greater, tok::greater, tok::greaterequal};
-if (tryMergeTokens(JavaRightLogicalShift, TT_BinaryOperator))
-  return;
 if (tryMergeTokens(JavaRightLogicalShiftAssign, TT_BinaryOperator))
   return;
   }

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=314325&r1=314324&r2=314325&view=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Wed Sep 27 10:57:50 2017
@@ -47,7 +47,7 @@ private:
 if (NonTemplateLess.count(CurrentToken->Previous))
   return false;
 
-const FormatToken &Previous = *CurrentToken->Previous;
+const FormatToken &Previous = *CurrentToken->Previous;  // The '<'.
 if (Previous.Previous) {
   if (Previous.Previous->Tok.isLiteral())
 return false;
@@ -2323,7 +2323,7 @@ bool TokenAnnotator::spaceRequiredBetwee
   if (Left.is(TT_TemplateCloser) && Left.MatchingParen &&
   Left.MatchingParen->Previous &&
   Left.MatchingParen->Previous->is(tok::period))
-// A.DoSomething();
+// A.>>DoSomething();
 return false;
   if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square))
 return false;

Modified: cfe/trunk/unittests/Format/FormatTestJava.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJava.cpp?rev=314325&r1=314324&r2=314325&view=diff
==
--- cfe/trunk/unittests/Format/FormatTestJava.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJava.cpp Wed Sep 27 10:57:50 2017
@@ -333,6 +333,11 @@ TEST_F(FormatTestJava, Generics) {
   verifyFormat("Iterable a;");
 
   verifyFormat("A.doSomething();");
+  verifyFormat("A.>doSomething();");
+  verifyFormat("A.>>doSomething();");
+  verifyFormat("A.>>>doSomething();");
+
+  verifyFormat("OrderedPair>> p = null;");
 
   verifyFormat("@Override\n"
"public Map getAll() {}");


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r314424 - Fix -Wcast-qual warning after r314336.

2017-09-28 Thread Nico Weber via cfe-commits
Author: nico
Date: Thu Sep 28 08:44:46 2017
New Revision: 314424

URL: http://llvm.org/viewvc/llvm-project?rev=314424&view=rev
Log:
Fix -Wcast-qual warning after r314336.

Modified:
cfe/trunk/lib/AST/ExternalASTMerger.cpp

Modified: cfe/trunk/lib/AST/ExternalASTMerger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExternalASTMerger.cpp?rev=314424&r1=314423&r2=314424&view=diff
==
--- cfe/trunk/lib/AST/ExternalASTMerger.cpp (original)
+++ cfe/trunk/lib/AST/ExternalASTMerger.cpp Thu Sep 28 08:44:46 2017
@@ -212,7 +212,7 @@ void ExternalASTMerger::ForEachMatchingD
 }
 if (!DidCallback && LoggingEnabled())
   logs() << "(ExternalASTMerger*)" << (void*)this
- << " asserting for (DeclContext*)" << (void*)DC
+ << " asserting for (DeclContext*)" << (const void*)DC
  << ", (ASTContext*)" << (void*)&Target.AST
  << "\n";
 assert(DidCallback && "Couldn't find a source context matching our DC");


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r314427 - Consolidate std::move() detection code. No behavior change.

2017-09-28 Thread Nico Weber via cfe-commits
Author: nico
Date: Thu Sep 28 09:16:39 2017
New Revision: 314427

URL: http://llvm.org/viewvc/llvm-project?rev=314427&view=rev
Log:
Consolidate std::move() detection code. No behavior change.

Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/lib/Analysis/Consumed.cpp
cfe/trunk/lib/Analysis/UninitializedValues.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=314427&r1=314426&r2=314427&view=diff
==
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Thu Sep 28 09:16:39 2017
@@ -2348,6 +2348,12 @@ public:
   SourceLocation getLocStart() const LLVM_READONLY;
   SourceLocation getLocEnd() const LLVM_READONLY;
 
+  bool isCallToStdMove() const {
+const FunctionDecl* FD = getDirectCallee();
+return getNumArgs() == 1 && FD && FD->isInStdNamespace() &&
+   FD->getIdentifier() && FD->getIdentifier()->isStr("move");
+  }
+
   static bool classof(const Stmt *T) {
 return T->getStmtClass() >= firstCallExprConstant &&
T->getStmtClass() <= lastCallExprConstant;

Modified: cfe/trunk/lib/Analysis/Consumed.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/Consumed.cpp?rev=314427&r1=314426&r2=314427&view=diff
==
--- cfe/trunk/lib/Analysis/Consumed.cpp (original)
+++ cfe/trunk/lib/Analysis/Consumed.cpp Thu Sep 28 09:16:39 2017
@@ -749,8 +749,7 @@ void ConsumedStmtVisitor::VisitCallExpr(
 
   // Special case for the std::move function.
   // TODO: Make this more specific. (Deferred)
-  if (Call->getNumArgs() == 1 && FunDecl->getNameAsString() == "move" &&
-  FunDecl->isInStdNamespace()) {
+  if (Call->isCallToStdMove()) {
 copyInfo(Call->getArg(0), Call, CS_Consumed);
 return;
   }

Modified: cfe/trunk/lib/Analysis/UninitializedValues.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/UninitializedValues.cpp?rev=314427&r1=314426&r2=314427&view=diff
==
--- cfe/trunk/lib/Analysis/UninitializedValues.cpp (original)
+++ cfe/trunk/lib/Analysis/UninitializedValues.cpp Thu Sep 28 09:16:39 2017
@@ -440,16 +440,11 @@ static bool isPointerToConst(const QualT
 
 void ClassifyRefs::VisitCallExpr(CallExpr *CE) {
   // Classify arguments to std::move as used.
-  if (CE->getNumArgs() == 1) {
-if (FunctionDecl *FD = CE->getDirectCallee()) {
-  if (FD->isInStdNamespace() && FD->getIdentifier() &&
-  FD->getIdentifier()->isStr("move")) {
-// RecordTypes are handled in SemaDeclCXX.cpp.
-if (!CE->getArg(0)->getType()->isRecordType())
-  classify(CE->getArg(0), Use);
-return;
-  }
-}
+  if (CE->isCallToStdMove()) {
+// RecordTypes are handled in SemaDeclCXX.cpp.
+if (!CE->getArg(0)->getType()->isRecordType())
+  classify(CE->getArg(0), Use);
+return;
   }
 
   // If a value is passed by const pointer or by const reference to a function,

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=314427&r1=314426&r2=314427&view=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Sep 28 09:16:39 2017
@@ -11765,9 +11765,7 @@ void Sema::DiagnoseSelfMove(const Expr *
 return;
 
   // Check for a call to std::move
-  const FunctionDecl *FD = CE->getDirectCallee();
-  if (!FD || !FD->isInStdNamespace() || !FD->getIdentifier() ||
-  !FD->getIdentifier()->isStr("move"))
+  if (!CE->isCallToStdMove())
 return;
 
   // Get argument from std::move

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=314427&r1=314426&r2=314427&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Sep 28 09:16:39 2017
@@ -9993,14 +9993,9 @@ namespace {
 
 void VisitCallExpr(CallExpr *E) {
   // Treat std::move as a use.
-  if (E->getNumArgs() == 1) {
-if (FunctionDecl *FD = E->getDirectCallee()) {
-  if (FD->isInStdNamespace() && FD->getIdentifier() &&
-  FD->getIdentifier()->isStr("move")) {
-HandleValue(E->getArg(0));
-return;
-  }
-}
+  if (E->isCallToStdMove()) {
+HandleValue(E->getArg(0));
+return;
   }
 
   Inherited::VisitCallExpr(E);

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cp

Re: r314262 - Emit section information for extern variables.

2017-10-04 Thread Nico Weber via cfe-commits
Hi Erich,

this breaks existing code. NaCl does this:

#include 
struct r_debug _r_debug __attribute__((nocommon, section(".r_debug")));

(There's a lengthy-ish comment for why in
https://cs.chromium.org/chromium/src/native_client/src/trusted/service_runtime/linux/nacl_bootstrap.c?q=nacl_bootstrap.c&sq=package:chromium&dr&l=424
)

link.h in e.g. the debian jessie sysroot says:
extern struct r_debug _r_debug;

After this change, clang complains:

../../native_client/src/trusted/service_runtime/linux/nacl_bootstrap.c:434:16:
error: section attribute is specified on redeclared variable
[-Werror,-Wsection]
struct r_debug _r_debug __attribute__((nocommon, section(".r_debug")));
   ^
../../build/linux/debian_jessie_amd64-sysroot/usr/include/link.h:67:23:
note: previous declaration is here
extern struct r_debug _r_debug;


This code used to work in clang, and continues to work in gcc. So this
patch probably isn't quite the right approach. Ideas?

On Tue, Sep 26, 2017 at 7:42 PM, Erich Keane via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: erichkeane
> Date: Tue Sep 26 16:42:34 2017
> New Revision: 314262
>
> URL: http://llvm.org/viewvc/llvm-project?rev=314262&view=rev
> Log:
> Emit section information for extern variables.
>
> Currently, if _attribute_((section())) is used for extern variables,
> section information is not emitted in generated IR when the variables are
> used.
> This is expected since sections are not generated for external linkage
> objects.
> However NiosII requires this information as it uses special GP-relative
> accesses
> for any objects that use attribute section (.sdata). GCC keeps this
> attribute in
>   middle-end.
>
> This change emits the section information for all targets.
>
> Patch By: Elizabeth Andrews
>
> Differential Revision:https://reviews.llvm.org/D36487
>
>
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> cfe/trunk/lib/Sema/SemaDecl.cpp
> cfe/trunk/test/Sema/attr-section.c
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/
> DiagnosticSemaKinds.td?rev=314262&r1=314261&r2=314262&view=diff
> 
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Sep 26
> 16:42:34 2017
> @@ -2620,6 +2620,8 @@ def err_attribute_section_invalid_for_ta
>"argument to 'section' attribute is not valid for this target: %0">;
>  def warn_mismatched_section : Warning<
>"section does not match previous declaration">, InGroup;
> +def warn_attribute_section_on_redeclaration : Warning<
> +  "section attribute is specified on redeclared variable">,
> InGroup;
>
>  def err_anonymous_property: Error<
>"anonymous property is not supported">;
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/
> CodeGenModule.cpp?rev=314262&r1=314261&r2=314262&view=diff
> 
> ==
> --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue Sep 26 16:42:34 2017
> @@ -2432,6 +2432,12 @@ CodeGenModule::GetOrCreateLLVMGlobal(Str
>EmitGlobalVarDefinition(D);
>  }
>
> +// Emit section information for extern variables.
> +if (D->hasExternalStorage()) {
> +  if (const SectionAttr *SA = D->getAttr())
> +GV->setSection(SA->getName());
> +}
> +
>  // Handle XCore specific ABI requirements.
>  if (getTriple().getArch() == llvm::Triple::xcore &&
>  D->getLanguageLinkage() == CLanguageLinkage &&
>
> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/
> SemaDecl.cpp?rev=314262&r1=314261&r2=314262&view=diff
> 
> ==
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Sep 26 16:42:34 2017
> @@ -2607,6 +2607,16 @@ void Sema::mergeDeclAttributes(NamedDecl
>  }
>}
>
> +  // This redeclaration adds a section attribute.
> +  if (New->hasAttr() && !Old->hasAttr()) {
> +if (auto *VD = dyn_cast(New)) {
> +  if (VD->isThisDeclarationADefinition() != VarDecl::Definition) {
> +Diag(New->getLocation(), diag::warn_attribute_section_
> on_redeclaration);
> +Diag(Old->getLocation(), diag::note_previous_declaration);
> +  }
> +}
> +  }
> +
>if (!Old->hasAttrs())
>  return;
>
>
> Modified: cfe/trunk/test/Sema/attr-section.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/
> attr-section.c?rev=314262&r1=314261&r2=314262&view=diff
> 
> ==
> --- cfe/trunk/test/Sema/attr

Re: r314262 - Emit section information for extern variables.

2017-10-04 Thread Nico Weber via cfe-commits
For why, here's the comment from the code I linked to:

/*
 * GDB looks for this symbol name when it cannot find PT_DYNAMIC->DT_DEBUG.
 * We don't have a PT_DYNAMIC, so it will find this.  Now all we have to do
 * is arrange for this space to be filled in with the dynamic linker's
 * _r_debug contents after they're initialized.  That way, attaching GDB to
 * this process or examining its core file will find the PIE we loaded, the
 * dynamic linker, and all the shared libraries, making debugging pleasant.
 */

On Wed, Oct 4, 2017 at 4:11 PM, Keane, Erich  wrote:

> I’ve added Elizabeth, who is the original patch author.  Hopefully she can
> help out here.  Additionally, Eli did the original review, so hopefully he
> can chime in as well.
>
>
> I believe the necessity for this warning came out of the discussion on
> fixing the section behavior.  The issue here is that redeclaring with a
> different ‘section’ can cause some pretty nasty issues, since it isn’t
> terribly clear what happens if the variable is used in the meantime.
>
>
>
> There is 1 change that I can think of that Elizabeth and I discussed,
> which was to only warn in the case where there was a USAGE between these
> two redeclarations.  I’m not sure that will allow na_cl to compile, however
> it is my belief that if there IS a usage between link.h:64 and
> nacl_bootstrap.c:434, that this is a bug in nacl that is simply being
> uncovered thanks to this new warning.
>
>
>
> Is there a good/reasonable reason the source of nacl wants to redeclare
> this with a different ‘section’?
>
>
>
>
>
> *From:* tha...@google.com [mailto:tha...@google.com] *On Behalf Of *Nico
> Weber
> *Sent:* Wednesday, October 4, 2017 12:59 PM
> *To:* Keane, Erich 
> *Cc:* cfe-commits 
> *Subject:* Re: r314262 - Emit section information for extern variables.
>
>
>
> Hi Erich,
>
>
>
> this breaks existing code. NaCl does this:
>
>
>
> #include 
>
> struct r_debug _r_debug __attribute__((nocommon, section(".r_debug")));
>
>
>
> (There's a lengthy-ish comment for why in https://cs.chromium.org/
> chromium/src/native_client/src/trusted/service_runtime/
> linux/nacl_bootstrap.c?q=nacl_bootstrap.c&sq=package:chromium&dr&l=424)
>
>
>
> link.h in e.g. the debian jessie sysroot says:
>
> extern struct r_debug _r_debug;
>
>
>
> After this change, clang complains:
>
>
>
> ../../native_client/src/trusted/service_runtime/linux/nacl_bootstrap.c:434:16:
> error: section attribute is specified on redeclared variable
> [-Werror,-Wsection]
>
> struct r_debug _r_debug __attribute__((nocommon, section(".r_debug")));
>
>^
>
> ../../build/linux/debian_jessie_amd64-sysroot/usr/include/link.h:67:23:
> note: previous declaration is here
>
> extern struct r_debug _r_debug;
>
>
>
>
>
> This code used to work in clang, and continues to work in gcc. So this
> patch probably isn't quite the right approach. Ideas?
>
>
>
> On Tue, Sep 26, 2017 at 7:42 PM, Erich Keane via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: erichkeane
> Date: Tue Sep 26 16:42:34 2017
> New Revision: 314262
>
> URL: http://llvm.org/viewvc/llvm-project?rev=314262&view=rev
> Log:
> Emit section information for extern variables.
>
> Currently, if _attribute_((section())) is used for extern variables,
> section information is not emitted in generated IR when the variables are
> used.
> This is expected since sections are not generated for external linkage
> objects.
> However NiosII requires this information as it uses special GP-relative
> accesses
> for any objects that use attribute section (.sdata). GCC keeps this
> attribute in
>   middle-end.
>
> This change emits the section information for all targets.
>
> Patch By: Elizabeth Andrews
>
> Differential Revision:https://reviews.llvm.org/D36487
>
>
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> cfe/trunk/lib/Sema/SemaDecl.cpp
> cfe/trunk/test/Sema/attr-section.c
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/
> DiagnosticSemaKinds.td?rev=314262&r1=314261&r2=314262&view=diff
> 
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Sep 26
> 16:42:34 2017
> @@ -2620,6 +2620,8 @@ def err_attribute_section_invalid_for_ta
>"argument to 'section' attribute is not valid for this target: %0">;
>  def warn_mismatched_section : Warning<
>"section does not match previous declaration">, InGroup;
> +def warn_attribute_section_on_redeclaration : Warning<
> +  "section attribute is specified on redeclared variable">,
> InGroup;
>
>  def err_anonymous_property: Error<
>"anonymous property is not supported">;
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/
>

Re: r314262 - Emit section information for extern variables.

2017-10-04 Thread Nico Weber via cfe-commits
All I know about this code that it used to build (and still builds with
gcc) and now it doesn't, sorry :-) What that code does seems somewhat
questionable, but also somewhat useful, and it feels like the behavior
change from this change here for that code might have been unintentional.

Your suggestion sounds reasonable to me.

On Wed, Oct 4, 2017 at 4:18 PM, Keane, Erich  wrote:

> I saw that… I don’t see where it prevents the same change from being made
> in link.h.
>
>
>
> As I mentioned, there is a solution to make this Warning less aggressive
> (in the lib/Sema/SemaDecl.cpp changes, add a condition that Old->isUsed()
> before the warning.  I’m wondering if that solves your issue.
>
>
>
> It would result in
>
> extern struct r_debug _r_debug;
> struct r_debug _r_debug __attribute__((nocommon, section(".r_debug")));
>
> Compiling, but :
>
> extern struct r_debug _r_debug;
> r_debug = something();
> struct r_debug _r_debug __attribute__((nocommon, section(".r_debug")));
>
> NOT compiling (which is almost definitely a bug).
>
>
>
>
>
>
>
> *From:* tha...@google.com [mailto:tha...@google.com] *On Behalf Of *Nico
> Weber
> *Sent:* Wednesday, October 4, 2017 1:14 PM
> *To:* Keane, Erich 
> *Cc:* Andrews, Elizabeth ; Friedman, Eli <
> efrie...@codeaurora.org>; cfe-commits 
>
> *Subject:* Re: r314262 - Emit section information for extern variables.
>
>
>
> For why, here's the comment from the code I linked to:
>
>
>
> /*
>
>  * GDB looks for this symbol name when it cannot find PT_DYNAMIC->DT_DEBUG.
>
>  * We don't have a PT_DYNAMIC, so it will find this.  Now all we have to do
>
>  * is arrange for this space to be filled in with the dynamic linker's
>
>  * _r_debug contents after they're initialized.  That way, attaching GDB to
>
>  * this process or examining its core file will find the PIE we loaded, the
>
>  * dynamic linker, and all the shared libraries, making debugging pleasant.
>
>  */
>
>
>
> On Wed, Oct 4, 2017 at 4:11 PM, Keane, Erich 
> wrote:
>
> I’ve added Elizabeth, who is the original patch author.  Hopefully she can
> help out here.  Additionally, Eli did the original review, so hopefully he
> can chime in as well.
>
>
> I believe the necessity for this warning came out of the discussion on
> fixing the section behavior.  The issue here is that redeclaring with a
> different ‘section’ can cause some pretty nasty issues, since it isn’t
> terribly clear what happens if the variable is used in the meantime.
>
>
>
> There is 1 change that I can think of that Elizabeth and I discussed,
> which was to only warn in the case where there was a USAGE between these
> two redeclarations.  I’m not sure that will allow na_cl to compile, however
> it is my belief that if there IS a usage between link.h:64 and
> nacl_bootstrap.c:434, that this is a bug in nacl that is simply being
> uncovered thanks to this new warning.
>
>
>
> Is there a good/reasonable reason the source of nacl wants to redeclare
> this with a different ‘section’?
>
>
>
>
>
> *From:* tha...@google.com [mailto:tha...@google.com] *On Behalf Of *Nico
> Weber
> *Sent:* Wednesday, October 4, 2017 12:59 PM
> *To:* Keane, Erich 
> *Cc:* cfe-commits 
> *Subject:* Re: r314262 - Emit section information for extern variables.
>
>
>
> Hi Erich,
>
>
>
> this breaks existing code. NaCl does this:
>
>
>
> #include 
>
> struct r_debug _r_debug __attribute__((nocommon, section(".r_debug")));
>
>
>
> (There's a lengthy-ish comment for why in https://cs.chromium.org/
> chromium/src/native_client/src/trusted/service_runtime/
> linux/nacl_bootstrap.c?q=nacl_bootstrap.c&sq=package:chromium&dr&l=424)
>
>
>
> link.h in e.g. the debian jessie sysroot says:
>
> extern struct r_debug _r_debug;
>
>
>
> After this change, clang complains:
>
>
>
> ../../native_client/src/trusted/service_runtime/linux/nacl_bootstrap.c:434:16:
> error: section attribute is specified on redeclared variable
> [-Werror,-Wsection]
>
> struct r_debug _r_debug __attribute__((nocommon, section(".r_debug")));
>
>^
>
> ../../build/linux/debian_jessie_amd64-sysroot/usr/include/link.h:67:23:
> note: previous declaration is here
>
> extern struct r_debug _r_debug;
>
>
>
>
>
> This code used to work in clang, and continues to work in gcc. So this
> patch probably isn't quite the right approach. Ideas?
>
>
>
> On Tue, Sep 26, 2017 at 7:42 PM, Erich Keane via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: erichkeane
> Date: Tue Sep 26 16:42:34 2017
> New Revision: 314262
>
> URL: http://llvm.org/viewvc/llvm-project?rev=314262&view=rev
> Log:
> Emit section information for extern variables.
>
> Currently, if _attribute_((section())) is used for extern variables,
> section information is not emitted in generated IR when the variables are
> used.
> This is expected since sections are not generated for external linkage
> objects.
> However NiosII requires this information as it uses special GP-relative
> accesses
> for any objects that use attribute section (.sdata). GCC kee

Re: r314262 - Emit section information for extern variables.

2017-10-04 Thread Nico Weber via cfe-commits
That does the trick. Thanks for the quick help, everyone!

On Wed, Oct 4, 2017 at 6:18 PM, Keane, Erich  wrote:

> Elizabeth gave me a patch, submitted it with a test in r314939
>
>
>
> *From:* Andrews, Elizabeth
> *Sent:* Wednesday, October 4, 2017 1:54 PM
> *To:* Friedman, Eli ; Keane, Erich <
> erich.ke...@intel.com>; Nico Weber 
> *Cc:* cfe-commits 
> *Subject:* RE: r314262 - Emit section information for extern variables.
>
>
>
> Alright. Will do. Thanks!
>
>
>
> *From:* Friedman, Eli [mailto:efrie...@codeaurora.org
> ]
> *Sent:* Wednesday, October 4, 2017 4:51 PM
> *To:* Keane, Erich ; Andrews, Elizabeth <
> elizabeth.andr...@intel.com>; Nico Weber 
> *Cc:* cfe-commits 
> *Subject:* Re: r314262 - Emit section information for extern variables.
>
>
>
> On 10/4/2017 1:48 PM, Keane, Erich wrote:
>
> Ah, cool!  I didn’t realize that, and that is actually exactly what
> Elizabeth is looking into now.
>
>
>
> Elizabeth, if you send me a diff, I’ll commit it as review-after-commit if
> Eli is alright with this.  It should be something like changing:
>
> +  if (VD->isThisDeclarationADefinition() != VarDecl::Definition) {
>
> To
>
> +  if (VD->isThisDeclarationADefinition() != VarDecl::Definition &&
> VD->isThsDeclarationADefinition() != VarDecl::TentativeDefinition) {
>
>
>
>
>
> Right?
>
>
> I'd probably just write it "if (VD->isThisDeclarationADefinition() ==
> VarDecl::DeclarationOnly)", but yes.  (And don't forget a testcase.)
>
> -Eli
>
>
>
> *From:* Friedman, Eli [mailto:efrie...@codeaurora.org
> ]
> *Sent:* Wednesday, October 4, 2017 1:46 PM
> *To:* Andrews, Elizabeth 
> ; Nico Weber 
> 
> *Cc:* cfe-commits 
> ; Keane, Erich 
> 
> *Subject:* Re: r314262 - Emit section information for extern variables.
>
>
>
> Oh, that's easy to explain; sorry, I didn't think of it when I was
> reviewing.
>
> DefinitionKind has three possible values: DeclarationOnly,
> TentativeDefinition, and Definition.  (Tentative definitions are C
> weirdness that allows you to write "int x; int x = 10;".)
>
> For the purpose of this warning, a TentativeDefinition should count as a
> definition.
>
> -Eli
>
> On 10/4/2017 1:38 PM, Andrews, Elizabeth wrote:
>
> Hello,
>
> I just spoke to Erich. The warning isn’t supposed to be emitted when the
> section attribute is specified on a definition. I’m not sure why struct
> r_debug _r_debug __attribute__((nocommon, section(".r_debug"))); failed
> the isThisDeclarationADefiniton check. I need to look into it.
>
> Thanks,
>
> Elizabeth
>
>
>
> *From:* tha...@google.com [mailto:tha...@google.com ] *On
> Behalf Of *Nico Weber
> *Sent:* Wednesday, October 4, 2017 4:29 PM
> *To:* Keane, Erich  
> *Cc:* Andrews, Elizabeth 
> ; Friedman, Eli 
> ; cfe-commits 
> 
> *Subject:* Re: r314262 - Emit section information for extern variables.
>
>
>
> All I know about this code that it used to build (and still builds with
> gcc) and now it doesn't, sorry :-) What that code does seems somewhat
> questionable, but also somewhat useful, and it feels like the behavior
> change from this change here for that code might have been unintentional.
>
>
>
> Your suggestion sounds reasonable to me.
>
>
>
> On Wed, Oct 4, 2017 at 4:18 PM, Keane, Erich 
> wrote:
>
> I saw that… I don’t see where it prevents the same change from being made
> in link.h.
>
>
>
> As I mentioned, there is a solution to make this Warning less aggressive
> (in the lib/Sema/SemaDecl.cpp changes, add a condition that Old->isUsed()
> before the warning.  I’m wondering if that solves your issue.
>
>
>
> It would result in
>
> extern struct r_debug _r_debug;
> struct r_debug _r_debug __attribute__((nocommon, section(".r_debug")));
>
> Compiling, but :
>
> extern struct r_debug _r_debug;
> r_debug = something();
> struct r_debug _r_debug __attribute__((nocommon, section(".r_debug")));
>
> NOT compiling (which is almost definitely a bug).
>
>
>
>
>
>
>
> *From:* tha...@google.com [mailto:tha...@google.com] *On Behalf Of *Nico
> Weber
> *Sent:* Wednesday, October 4, 2017 1:14 PM
> *To:* Keane, Erich 
> *Cc:* Andrews, Elizabeth ; Friedman, Eli <
> efrie...@codeaurora.org>; cfe-commits 
>
>
> *Subject:* Re: r314262 - Emit section information for extern variables.
>
>
>
> For why, here's the comment from the code I linked to:
>
>
>
> /*
>
>  * GDB looks for this symbol name when it cannot find PT_DYNAMIC->DT_DEBUG.
>
>  * We don't have a PT_DYNAMIC, so it will find this.  Now all we have to do
>
>  * is arrange for this space to be filled in with the dynamic linker's
>
>  * _r_debug contents after they're initialized.  That way, attaching GDB to
>
>  * this process or examining its core file will find the PIE we loaded, the
>
>  * dynamic linker, and all the shared libraries, making debugging pleasant.
>
>  */
>
>
>
> On Wed, Oct 4, 2017 at 4:11 PM, Keane, Erich 
> wrote:
>
> I’ve added Elizabeth, who is the original patch author.  Hopefully she can
> help out here.  Additionally, Eli did the original review, so hopefully he
> can chime in as well.

Re: r315614 - [Sema] Diagnose tautological comparison with type's min/max values

2017-10-12 Thread Nico Weber via cfe-commits
Huh, I consider clang not warning on this a feature, not a bug. Why are we
trying to match what gcc does here?

Say you have code like this:

int64_t aligned_start = 0;
int64_t aligned_size = 0;
CalculateVMAlignedBoundaries(region.offset,
 region.size,
 &aligned_start,
 &aligned_size,
 &data_offset);

// Ensure that the casts in the mmap call below are sane.
if (aligned_start < 0 || aligned_size < 0 ||
aligned_start > std::numeric_limits::max() ||
static_cast(aligned_size) >
std::numeric_limits::max() ||
static_cast(region.size) >
std::numeric_limits::max()) {
  DLOG(ERROR) << "Region bounds are not valid for mmap";
  return false;
}

This code works in 64-bit and 32-bit. off_t has different sizes on both, so
the comparison is useful. The warning uselessly fires on this code.

On Thu, Oct 12, 2017 at 4:16 PM, Roman Lebedev via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: lebedevri
> Date: Thu Oct 12 13:16:51 2017
> New Revision: 315614
>
> URL: http://llvm.org/viewvc/llvm-project?rev=315614&view=rev
> Log:
> [Sema] Diagnose tautological comparison with type's min/max values
>
> Summary:
> Currently, clang only diagnoses completely out-of-range comparisons (e.g.
> `char` and constant `300`),
> and comparisons of unsigned and `0`. But gcc also does diagnose the
> comparisons with the
> `std::numeric_limits<>::max()` / `std::numeric_limits<>::min()` so to speak
>
> Finally Fixes https://bugs.llvm.org/show_bug.cgi?id=34147
> Continuation of https://reviews.llvm.org/D37565
>
> Reviewers: rjmccall, rsmith, aaron.ballman
>
> Reviewed By: rsmith
>
> Subscribers: rtrieu, jroelofs, cfe-commits
>
> Tags: #clang
>
> Differential Revision: https://reviews.llvm.org/D38101
>
> Added:
> cfe/trunk/test/Sema/tautological-constant-compare.c
> Modified:
> cfe/trunk/docs/ReleaseNotes.rst
> cfe/trunk/include/clang/Basic/DiagnosticGroups.td
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/lib/Sema/SemaChecking.cpp
> cfe/trunk/test/Sema/outof-range-constant-compare.c
> cfe/trunk/test/Sema/tautological-unsigned-zero-compare.c
>
> Modified: cfe/trunk/docs/ReleaseNotes.rst
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/
> ReleaseNotes.rst?rev=315614&r1=315613&r2=315614&view=diff
> 
> ==
> --- cfe/trunk/docs/ReleaseNotes.rst (original)
> +++ cfe/trunk/docs/ReleaseNotes.rst Thu Oct 12 13:16:51 2017
> @@ -78,6 +78,10 @@ Improvements to Clang's diagnostics
>when the signed integer is coerced to an unsigned type for the
> comparison.
>``-Wsign-compare`` was adjusted not to warn in this case.
>
> +- ``-Wtautological-constant-compare`` is a new warning that warns on
> +  tautological comparisons between integer variable of the type ``T`` and
> the
> +  largest/smallest possible integer constant of that same type.
> +
>  - ``-Wnull-pointer-arithmetic`` now warns about performing pointer
> arithmetic
>on a null pointer. Such pointer arithmetic has an undefined behavior if
> the
>offset is nonzero. It also now warns about arithmetic on a null pointer
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Basic/DiagnosticGroups.td?rev=315614&r1=315613&r2=315614&view=diff
> 
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Thu Oct 12 13:16:51
> 2017
> @@ -432,13 +432,15 @@ def StrncatSize : DiagGroup<"strncat-siz
>  def TautologicalUnsignedZeroCompare : DiagGroup<"tautological-
> unsigned-zero-compare">;
>  def TautologicalUnsignedEnumZeroCompare : DiagGroup<"tautological-
> unsigned-enum-zero-compare">;
>  def TautologicalOutOfRangeCompare : DiagGroup<"tautological-
> constant-out-of-range-compare">;
> +def TautologicalConstantCompare : DiagGroup<"tautological-
> constant-compare",
> +[
> TautologicalUnsignedZeroCompare,
> +
>  TautologicalUnsignedEnumZeroCompare,
> +
>  TautologicalOutOfRangeCompare]>;
>  def TautologicalPointerCompare : DiagGroup<"tautological-
> pointer-compare">;
>  def TautologicalOverlapCompare : DiagGroup<"tautological-
> overlap-compare">;
>  def TautologicalUndefinedCompare : DiagGroup<"tautological-
> undefined-compare">;
>  def TautologicalCompare : DiagGroup<"tautological-compare",
> -[TautologicalUnsignedZeroCompare,
> - TautologicalUnsignedEnumZeroCompare,
> - TautologicalOutOfRangeCompare,
> +[TautologicalConstantCompare,
>  

r316032 - Fix PR34981, a crash-on-invalid merging dllimport to an invalid redecl.

2017-10-17 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Oct 17 14:14:02 2017
New Revision: 316032

URL: http://llvm.org/viewvc/llvm-project?rev=316032&view=rev
Log:
Fix PR34981, a crash-on-invalid merging dllimport to an invalid redecl.

This is basically like r288207, just the other way round.

Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/dllimport.c

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=316032&r1=316031&r2=316032&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Oct 17 14:14:02 2017
@@ -5975,7 +5975,7 @@ static void checkDLLAttributeRedeclarati
NamedDecl *NewDecl,
bool IsSpecialization,
bool IsDefinition) {
-  if (OldDecl->isInvalidDecl())
+  if (OldDecl->isInvalidDecl() || NewDecl->isInvalidDecl())
 return;
 
   bool IsTemplate = false;
@@ -6081,7 +6081,8 @@ static void checkDLLAttributeRedeclarati
   NewDecl->dropAttr();
 }
   } else if (IsInline && OldImportAttr && !IsMicrosoft) {
-// In MinGW, seeing a function declared inline drops the dllimport 
attribute.
+// In MinGW, seeing a function declared inline drops the dllimport
+// attribute.
 OldDecl->dropAttr();
 NewDecl->dropAttr();
 S.Diag(NewDecl->getLocation(),

Modified: cfe/trunk/test/Sema/dllimport.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/dllimport.c?rev=316032&r1=316031&r2=316032&view=diff
==
--- cfe/trunk/test/Sema/dllimport.c (original)
+++ cfe/trunk/test/Sema/dllimport.c Tue Oct 17 14:14:02 2017
@@ -211,9 +211,14 @@ __declspec(dllimport) void redecl6();
   void redecl7();
 __declspec(dllimport) inline void redecl7() {}
 
-// PR31069: Don't crash trying to merge attributes for redeclaration of 
invalid decl.
+// PR31069: Don't crash trying to merge attributes for redeclaration of invalid
+// decl.
 void __declspec(dllimport) redecl8(unknowntype X); // expected-error{{unknown 
type name 'unknowntype'}}
 void redecl8(unknowntype X) { } // expected-error{{unknown type name 
'unknowntype'}}
+// PR32021: Similarly, don't crash trying to merge attributes from a valid
+// decl to an invalid redeclaration.
+void __declspec(dllimport) redecl9(void); // expected-note{{previous 
declaration is here}}
+int redecl9(void) {} // expected-error{{conflicting types for 'redecl9'}}
 
 // External linkage is required.
 __declspec(dllimport) static int staticFunc(); // expected-error{{'staticFunc' 
must have external linkage when declared 'dllimport'}}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r316335 - clang-cl: Expose --version.

2017-10-23 Thread Nico Weber via cfe-commits
Author: nico
Date: Mon Oct 23 08:54:44 2017
New Revision: 316335

URL: http://llvm.org/viewvc/llvm-project?rev=316335&view=rev
Log:
clang-cl: Expose --version.

This is for consistency with lld-link, see https://reviews.llvm.org/D38972
Also give --version a help text so it shows up in --help / /? output (for
both clang-cl and regular clang).

Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=316335&r1=316334&r2=316335&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Oct 23 08:54:44 2017
@@ -2469,7 +2469,8 @@ def _rtlib : Separate<["--"], "rtlib">,
 def _serialize_diags : Separate<["-", "--"], "serialize-diagnostics">, 
Flags<[DriverOption]>,
   HelpText<"Serialize compiler diagnostics to a file">;
 // We give --version different semantics from -version.
-def _version : Flag<["--"], "version">,  Flags<[CC1Option]>;
+def _version : Flag<["--"], "version">, Flags<[CoreOption, CC1Option]>,
+  HelpText<"Print version information">;
 def _signed_char : Flag<["--"], "signed-char">, Alias;
 def _std : Separate<["--"], "std">, Alias;
 def _stdlib : Separate<["--"], "stdlib">, Alias;

Modified: cfe/trunk/test/Driver/cl-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=316335&r1=316334&r2=316335&view=diff
==
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Mon Oct 23 08:54:44 2017
@@ -574,6 +574,7 @@
 // RUN: -fstandalone-debug \
 // RUN: -flimit-debug-info \
 // RUN: -flto \
+// RUN: --version \
 // RUN: -Werror /Zs -- %s 2>&1
 
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r316447 - Fix spelling in comment, field is isMsStruct, not Strust

2017-10-24 Thread Nico Weber via cfe-commits
This is fine, but a few years ago we agreed that we shouldn't repeat method
names in doxygen. So an Even Better Fix would've been to just remove
everything up to (and including) the ' - ' :-) Just FYI, no need to follow
this up with the deletion.

On Tue, Oct 24, 2017 at 3:34 PM, Erich Keane via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: erichkeane
> Date: Tue Oct 24 08:34:59 2017
> New Revision: 316447
>
> URL: http://llvm.org/viewvc/llvm-project?rev=316447&view=rev
> Log:
> Fix spelling in comment, field is isMsStruct, not Strust
>
> Modified:
> cfe/trunk/include/clang/AST/Decl.h
>
> Modified: cfe/trunk/include/clang/AST/Decl.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/AST/Decl.h?rev=316447&r1=316446&r2=316447&view=diff
> 
> ==
> --- cfe/trunk/include/clang/AST/Decl.h (original)
> +++ cfe/trunk/include/clang/AST/Decl.h Tue Oct 24 08:34:59 2017
> @@ -3540,7 +3540,7 @@ public:
>  return K >= firstRecord && K <= lastRecord;
>}
>
> -  /// isMsStrust - Get whether or not this is an ms_struct which can
> +  /// isMsStruct - Get whether or not this is an ms_struct which can
>/// be turned on with an attribute, pragma, or -mms-bitfields
>/// commandline option.
>bool isMsStruct(const ASTContext &C) const;
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r340743 - fix comment typo

2018-08-27 Thread Nico Weber via cfe-commits
Author: nico
Date: Mon Aug 27 07:23:50 2018
New Revision: 340743

URL: http://llvm.org/viewvc/llvm-project?rev=340743&view=rev
Log:
fix comment typo

Modified:

cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp

Modified: 
cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp?rev=340743&r1=340742&r2=340743&view=diff
==
--- 
cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp
 (original)
+++ 
cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp
 Mon Aug 27 07:23:50 2018
@@ -96,7 +96,7 @@ public:
 static bool isVoidPointer(QualType T);
 
 /// Dereferences \p V and returns the value and dynamic type of the pointee, as
-/// well as wether \p FR needs to be casted back to that type. If for whatever
+/// well as whether \p FR needs to be casted back to that type. If for whatever
 /// reason dereferencing fails, returns with None.
 static llvm::Optional>
 dereference(ProgramStateRef State, const FieldRegion *FR);


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r341130 - Remove LIT_SITE_CFG_IN_FOOTER, clang-tools-extra

2018-08-30 Thread Nico Weber via cfe-commits
Author: nico
Date: Thu Aug 30 15:10:13 2018
New Revision: 341130

URL: http://llvm.org/viewvc/llvm-project?rev=341130&view=rev
Log:
Remove LIT_SITE_CFG_IN_FOOTER, clang-tools-extra

It's always replaced with the same (short) static string, so just put that
there directly.

No intended behavior change.
https://reviews.llvm.org/D51357

Modified:
clang-tools-extra/trunk/test/lit.site.cfg.in

Modified: clang-tools-extra/trunk/test/lit.site.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/lit.site.cfg.in?rev=341130&r1=341129&r2=341130&view=diff
==
--- clang-tools-extra/trunk/test/lit.site.cfg.in (original)
+++ clang-tools-extra/trunk/test/lit.site.cfg.in Thu Aug 30 15:10:13 2018
@@ -23,7 +23,8 @@ except KeyError:
 key, = e.args
 lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % 
(key,key))
 
-@LIT_SITE_CFG_IN_FOOTER@
+import lit
+lit.llvm.initialize(lit_config, config)
 
 # Let the main config do the real work.
 lit_config.load_config(config, "@CLANG_TOOLS_SOURCE_DIR@/test/lit.cfg")


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r341132 - Remove LIT_SITE_CFG_IN_FOOTER, clang

2018-08-30 Thread Nico Weber via cfe-commits
Author: nico
Date: Thu Aug 30 15:11:16 2018
New Revision: 341132

URL: http://llvm.org/viewvc/llvm-project?rev=341132&view=rev
Log:
Remove LIT_SITE_CFG_IN_FOOTER, clang

It's always replaced with the same (short) static string, so just put that
there directly.

No intended behavior change.
https://reviews.llvm.org/D51357

Modified:
cfe/trunk/test/lit.site.cfg.py.in

Modified: cfe/trunk/test/lit.site.cfg.py.in
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.site.cfg.py.in?rev=341132&r1=341131&r2=341132&view=diff
==
--- cfe/trunk/test/lit.site.cfg.py.in (original)
+++ cfe/trunk/test/lit.site.cfg.py.in Thu Aug 30 15:11:16 2018
@@ -40,7 +40,8 @@ except KeyError:
 key, = e.args
 lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % 
(key,key))
 
-@LIT_SITE_CFG_IN_FOOTER@
+import lit
+lit.llvm.initialize(lit_config, config)
 
 # Let the main config do the real work.
 lit_config.load_config(config, "@CLANG_SOURCE_DIR@/test/lit.cfg.py")


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r341390 - clang-cl: Pass /Brepro to linker if it was passed to the compiler

2018-09-04 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Sep  4 11:00:14 2018
New Revision: 341390

URL: http://llvm.org/viewvc/llvm-project?rev=341390&view=rev
Log:
clang-cl: Pass /Brepro to linker if it was passed to the compiler

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

Modified:
cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
cfe/trunk/test/Driver/msvc-link.c

Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSVC.cpp?rev=341390&r1=341389&r2=341390&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp Tue Sep  4 11:00:14 2018
@@ -355,6 +355,15 @@ void visualstudio::Linker::ConstructJob(
   options::OPT__SLASH_Zd))
 CmdArgs.push_back("-debug");
 
+  // Pass on /Brepro if it was passed to the compiler.
+  // Note that /Brepro maps to -mno-incremental-linker-compatible.
+  bool DefaultIncrementalLinkerCompatible =
+  C.getDefaultToolChain().getTriple().isWindowsMSVCEnvironment();
+  if (!Args.hasFlag(options::OPT_mincremental_linker_compatible,
+options::OPT_mno_incremental_linker_compatible,
+DefaultIncrementalLinkerCompatible))
+CmdArgs.push_back("-Brepro");
+
   bool DLL = Args.hasArg(options::OPT__SLASH_LD, options::OPT__SLASH_LDd,
  options::OPT_shared);
   if (DLL) {

Modified: cfe/trunk/test/Driver/msvc-link.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/msvc-link.c?rev=341390&r1=341389&r2=341390&view=diff
==
--- cfe/trunk/test/Driver/msvc-link.c (original)
+++ cfe/trunk/test/Driver/msvc-link.c Tue Sep  4 11:00:14 2018
@@ -3,6 +3,7 @@
 // BASIC: "-out:a.exe"
 // BASIC: "-defaultlib:libcmt"
 // BASIC: "-nologo"
+// BASIC-NOT: "-Brepro"
 
 // RUN: %clang -target i686-pc-windows-msvc -shared -o a.dll -### %s 2>&1 | 
FileCheck --check-prefix=DLL %s
 // DLL: link.exe"
@@ -16,3 +17,14 @@
 // LIBPATH: "-libpath:/usr/lib"
 // LIBPATH: "-nologo"
 
+// RUN: %clang_cl /Brepro -### %s 2>&1 | FileCheck --check-prefix=REPRO %s
+// REPRO: link.exe"
+// REPRO: "-out:msvc-link.exe"
+// REPRO: "-nologo"
+// REPRO: "-Brepro"
+
+// RUN: %clang_cl /Brepro- -### %s 2>&1 | FileCheck --check-prefix=NOREPRO %s
+// NOREPRO: link.exe"
+// NOREPRO: "-out:msvc-link.exe"
+// NOREPRO: "-nologo"
+// NOREPRO-NOT: "-Brepro"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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&view=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&r1=335080&r2=335081&view=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&r1=335080&r2=335081&view=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 &getFileMgr() const { return FileMgr; }

 +  DiagnosticsEngine &getDiags() const { return Diags; }
 +
/// Interface for setting the file search paths.
void SetSearchPaths(const std::vector &dirs,
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&r1=335080&r2=335081&view=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.
 

Re: r341560 - Reverting r 341390 because it is causing test failures on GreenDragon.

2018-09-07 Thread Nico Weber via cfe-commits
Relanded with a fix attempt at 341654.

On Thu, Sep 6, 2018 at 12:31 PM A Bergen via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: sudofortune
> Date: Thu Sep  6 09:29:40 2018
> New Revision: 341560
>
> URL: http://llvm.org/viewvc/llvm-project?rev=341560&view=rev
> Log:
> Reverting r 341390 because it is causing test failures on GreenDragon.
>
> http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental/52810/
>
>
> Modified:
> cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
> cfe/trunk/test/Driver/msvc-link.c
>
> Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSVC.cpp?rev=341560&r1=341559&r2=341560&view=diff
>
> ==
> --- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp Thu Sep  6 09:29:40 2018
> @@ -355,15 +355,6 @@ void visualstudio::Linker::ConstructJob(
>options::OPT__SLASH_Zd))
>  CmdArgs.push_back("-debug");
>
> -  // Pass on /Brepro if it was passed to the compiler.
> -  // Note that /Brepro maps to -mno-incremental-linker-compatible.
> -  bool DefaultIncrementalLinkerCompatible =
> -  C.getDefaultToolChain().getTriple().isWindowsMSVCEnvironment();
> -  if (!Args.hasFlag(options::OPT_mincremental_linker_compatible,
> -options::OPT_mno_incremental_linker_compatible,
> -DefaultIncrementalLinkerCompatible))
> -CmdArgs.push_back("-Brepro");
> -
>bool DLL = Args.hasArg(options::OPT__SLASH_LD, options::OPT__SLASH_LDd,
>   options::OPT_shared);
>if (DLL) {
>
> Modified: cfe/trunk/test/Driver/msvc-link.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/msvc-link.c?rev=341560&r1=341559&r2=341560&view=diff
>
> ==
> --- cfe/trunk/test/Driver/msvc-link.c (original)
> +++ cfe/trunk/test/Driver/msvc-link.c Thu Sep  6 09:29:40 2018
> @@ -3,7 +3,6 @@
>  // BASIC: "-out:a.exe"
>  // BASIC: "-defaultlib:libcmt"
>  // BASIC: "-nologo"
> -// BASIC-NOT: "-Brepro"
>
>  // RUN: %clang -target i686-pc-windows-msvc -shared -o a.dll -### %s 2>&1
> | FileCheck --check-prefix=DLL %s
>  // DLL: link.exe"
> @@ -17,14 +16,3 @@
>  // LIBPATH: "-libpath:/usr/lib"
>  // LIBPATH: "-nologo"
>
> -// RUN: %clang_cl /Brepro -### %s 2>&1 | FileCheck --check-prefix=REPRO %s
> -// REPRO: link.exe"
> -// REPRO: "-out:msvc-link.exe"
> -// REPRO: "-nologo"
> -// REPRO: "-Brepro"
> -
> -// RUN: %clang_cl /Brepro- -### %s 2>&1 | FileCheck
> --check-prefix=NOREPRO %s
> -// NOREPRO: link.exe"
> -// NOREPRO: "-out:msvc-link.exe"
> -// NOREPRO: "-nologo"
> -// NOREPRO-NOT: "-Brepro"
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r341654 - Reland r341390 clang-cl: Pass /Brepro to linker if it was passed to the compiler

2018-09-07 Thread Nico Weber via cfe-commits
Author: nico
Date: Fri Sep  7 05:47:02 2018
New Revision: 341654

URL: http://llvm.org/viewvc/llvm-project?rev=341654&view=rev
Log:
Reland r341390 clang-cl: Pass /Brepro to linker if it was passed to the compiler

The test was missing  '--' on mac as pointed out by -Wslash-u-filename:
:5:69: note: possible intended match here
clang: warning: '/Users/thakis/src/llvm-mono/clang/test/Driver/msvc-link.c' 
treated as the '/U' option [-Wslash-u-filename]

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

Modified:
cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
cfe/trunk/test/Driver/msvc-link.c

Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSVC.cpp?rev=341654&r1=341653&r2=341654&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp Fri Sep  7 05:47:02 2018
@@ -355,6 +355,15 @@ void visualstudio::Linker::ConstructJob(
   options::OPT__SLASH_Zd))
 CmdArgs.push_back("-debug");
 
+  // Pass on /Brepro if it was passed to the compiler.
+  // Note that /Brepro maps to -mno-incremental-linker-compatible.
+  bool DefaultIncrementalLinkerCompatible =
+  C.getDefaultToolChain().getTriple().isWindowsMSVCEnvironment();
+  if (!Args.hasFlag(options::OPT_mincremental_linker_compatible,
+options::OPT_mno_incremental_linker_compatible,
+DefaultIncrementalLinkerCompatible))
+CmdArgs.push_back("-Brepro");
+
   bool DLL = Args.hasArg(options::OPT__SLASH_LD, options::OPT__SLASH_LDd,
  options::OPT_shared);
   if (DLL) {

Modified: cfe/trunk/test/Driver/msvc-link.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/msvc-link.c?rev=341654&r1=341653&r2=341654&view=diff
==
--- cfe/trunk/test/Driver/msvc-link.c (original)
+++ cfe/trunk/test/Driver/msvc-link.c Fri Sep  7 05:47:02 2018
@@ -3,6 +3,7 @@
 // BASIC: "-out:a.exe"
 // BASIC: "-defaultlib:libcmt"
 // BASIC: "-nologo"
+// BASIC-NOT: "-Brepro"
 
 // RUN: %clang -target i686-pc-windows-msvc -shared -o a.dll -### %s 2>&1 | 
FileCheck --check-prefix=DLL %s
 // DLL: link.exe"
@@ -16,3 +17,14 @@
 // LIBPATH: "-libpath:/usr/lib"
 // LIBPATH: "-nologo"
 
+// RUN: %clang_cl /Brepro -### -- %s 2>&1 | FileCheck --check-prefix=REPRO %s
+// REPRO: link.exe"
+// REPRO: "-out:msvc-link.exe"
+// REPRO: "-nologo"
+// REPRO: "-Brepro"
+
+// RUN: %clang_cl /Brepro- -### -- %s 2>&1 | FileCheck --check-prefix=NOREPRO 
%s
+// NOREPRO: link.exe"
+// NOREPRO: "-out:msvc-link.exe"
+// NOREPRO: "-nologo"
+// NOREPRO-NOT: "-Brepro"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r341755 - ms: Insert $$Z in mangling between directly consecutive parameter packs.

2018-09-08 Thread Nico Weber via cfe-commits
Author: nico
Date: Sat Sep  8 13:58:39 2018
New Revision: 341755

URL: http://llvm.org/viewvc/llvm-project?rev=341755&view=rev
Log:
ms: Insert $$Z in mangling between directly consecutive parameter packs.

Fixes PR38783.
Differential Revision: https://reviews.llvm.org/D51784

Modified:
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp

Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=341755&r1=341754&r2=341755&view=diff
==
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Sat Sep  8 13:58:39 2018
@@ -1384,9 +1384,16 @@ void MicrosoftCXXNameMangler::mangleTemp
   assert(TPL->size() == TemplateArgs.size() &&
  "size mismatch between args and parms!");
 
-  unsigned Idx = 0;
-  for (const TemplateArgument &TA : TemplateArgs.asArray())
-mangleTemplateArg(TD, TA, TPL->getParam(Idx++));
+  for (size_t i = 0; i < TemplateArgs.size(); ++i) {
+const TemplateArgument &TA = TemplateArgs[i];
+
+// Separate consecutive packs by $$Z.
+if (i > 0 && TA.getKind() == TemplateArgument::Pack &&
+TemplateArgs[i - 1].getKind() == TemplateArgument::Pack)
+  Out << "$$Z";
+
+mangleTemplateArg(TD, TA, TPL->getParam(i));
+  }
 }
 
 void MicrosoftCXXNameMangler::mangleTemplateArg(const TemplateDecl *TD,

Modified: cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp?rev=341755&r1=341754&r2=341755&view=diff
==
--- cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp Sat Sep  8 13:58:39 2018
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -fms-extensions 
-fdelayed-template-parsing -triple=i386-pc-win32 | FileCheck %s
-// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -fms-extensions 
-fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix 
X64 %s
+// RUN: %clang_cc1 -std=c++11 -fms-compatibility-version=19 -emit-llvm %s -o - 
-fms-extensions -fdelayed-template-parsing -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -fms-compatibility-version=19 -emit-llvm %s -o - 
-fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck 
-check-prefix X64 %s
 
 template
 class Class {
@@ -185,13 +185,35 @@ void spam() {
 // Unlike Itanium, there is no character code to indicate an argument pack.
 // Tested with MSVC 2013, the first version which supports variadic templates.
 
-template  void variadic_fn_template(const Ts &...args) { }
+template  void variadic_fn_template(const Ts &...args);
+template 
+void multi_variadic_fn(Ts... ts, Us... us);
+template 
+void multi_variadic_mixed(Ts... ts, C c, Us... us);
 void variadic_fn_instantiate() {
   variadic_fn_template(0, 1, 3, 4);
   variadic_fn_template(0, 1, 'a', "b");
+
+  // Directlly consecutive packs are separated by $$Z...
+  multi_variadic_fn(1, 2, 3, 4, 5);
+  multi_variadic_fn(1, 2, 3, 4, 5);
+
+  // ...but not if another template parameter is between them.
+  multi_variadic_mixed(1, 2, 3);
+  multi_variadic_mixed(1, 2, 3, 4);
 }
 // CHECK: "??$variadic_fn_template@@@YAXABH000@Z"
+// X64:   "??$variadic_fn_template@@@YAXAEBH000@Z"
 // CHECK: "??$variadic_fn_template@HHD$$BY01D@@YAXABH0ABDAAY01$$CBD@Z"
+// X64:   "??$variadic_fn_template@HHD$$BY01D@@YAXAEBH0AEBDAEAY01$$CBD@Z"
+// CHECK: "??$multi_variadic_fn@HH$$ZHHH@@YAXH@Z"
+// X64:   "??$multi_variadic_fn@HH$$ZHHH@@YAXH@Z"
+// CHECK: "??$multi_variadic_fn@HHH$$ZHH@@YAXH@Z"
+// X64:   "??$multi_variadic_fn@HHH$$ZHH@@YAXH@Z"
+// CHECK: "??$multi_variadic_mixed@HHH$$V@@YAXHHH@Z"
+// X64:   "??$multi_variadic_mixed@HHH$$V@@YAXHHH@Z"
+// CHECK: "??$multi_variadic_mixed@@@YAX@Z"
+// X64:   "??$multi_variadic_mixed@@@YAX@Z"
 
 template 
 struct VariadicClass {


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D51806: [clang-cl] Enable -march

2018-09-10 Thread Nico Weber via cfe-commits
On Mon, Sep 10, 2018 at 10:33 AM Hans Wennborg via Phabricator via
cfe-commits  wrote:

> hans added a comment.
>
> In https://reviews.llvm.org/D51806#1228893, @aganea wrote:
>
> > @hans Just an after thought: maybe we should prevent usage of `-march=`
> and `/arch:` at the same time. What do you think? I can add another patch
> for that purpose.
>
>
> Hmm, yes, at least we should warn or do something smart. Currently it
> doesn't look like they'd interact well together in x86::getX86TargetCPU
>

Wouldn't you get an "unused arg" for /arch if you use -march and /arch at
the same time?


>
>
> Repository:
>   rC Clang
>
> https://reviews.llvm.org/D51806
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r337480 - fix typo in comment

2018-07-19 Thread Nico Weber via cfe-commits
Author: nico
Date: Thu Jul 19 11:59:38 2018
New Revision: 337480

URL: http://llvm.org/viewvc/llvm-project?rev=337480&view=rev
Log:
fix typo in comment

Modified:
cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp

Modified: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=337480&r1=337479&r2=337480&view=diff
==
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Thu Jul 19 11:59:38 2018
@@ -3336,7 +3336,7 @@ CGCXXABI *clang::CodeGen::CreateMicrosof
 //   a reference to the TypeInfo for the type and a reference to the
 //   CompleteHierarchyDescriptor for the type.
 //
-// ClassHieararchyDescriptor: Contains information about a class hierarchy.
+// ClassHierarchyDescriptor: Contains information about a class hierarchy.
 //   Used during dynamic_cast to walk a class hierarchy.  References a base
 //   class array and the size of said array.
 //


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r337619 - [ms] Add __shiftleft128 / __shiftright128 intrinsics

2018-07-20 Thread Nico Weber via cfe-commits
Author: nico
Date: Fri Jul 20 14:02:09 2018
New Revision: 337619

URL: http://llvm.org/viewvc/llvm-project?rev=337619&view=rev
Log:
[ms] Add __shiftleft128 / __shiftright128 intrinsics

Carefully match the pattern matched by ISel so that this produces shld / shrd
(unless Subtarget->isSHLDSlow() is true).

Thanks to Craig Topper for providing the LLVM IR pattern that gets successfully
matched.

Fixes PR37755.

Modified:
cfe/trunk/lib/Headers/intrin.h
cfe/trunk/test/Headers/ms-intrin.cpp

Modified: cfe/trunk/lib/Headers/intrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/intrin.h?rev=337619&r1=337618&r2=337619&view=diff
==
--- cfe/trunk/lib/Headers/intrin.h (original)
+++ cfe/trunk/lib/Headers/intrin.h Fri Jul 20 14:02:09 2018
@@ -863,6 +863,20 @@ __nop(void) {
   __asm__ volatile ("nop");
 }
 #endif
+#if defined(__x86_64__)
+static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
+__shiftleft128(unsigned __int64 __l, unsigned __int64 __h, unsigned char __d) {
+  unsigned __int128 __val = ((unsigned __int128)__h << 64) | __l;
+  unsigned __int128 __res = __val << (__d & 63);
+  return (unsigned __int64)(__res >> 64);
+}
+static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
+__shiftright128(unsigned __int64 __l, unsigned __int64 __h, unsigned char __d) 
{
+  unsigned __int128 __val = ((unsigned __int128)__h << 64) | __l;
+  unsigned __int128 __res = __val >> (__d & 63);
+  return (unsigned __int64)__res;
+}
+#endif
 
 
/**\
 |* Privileged intrinsics

Modified: cfe/trunk/test/Headers/ms-intrin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/ms-intrin.cpp?rev=337619&r1=337618&r2=337619&view=diff
==
--- cfe/trunk/test/Headers/ms-intrin.cpp (original)
+++ cfe/trunk/test/Headers/ms-intrin.cpp Fri Jul 20 14:02:09 2018
@@ -42,6 +42,8 @@ void f() {
   __stosw(0, 0, 0);
 
 #ifdef _M_X64
+  __shiftleft128(1, 2, 3);
+  __shiftright128(1, 2, 3);
   __movsq(0, 0, 0);
   __stosq(0, 0, 0);
 #endif


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r337620 - fix typo

2018-07-20 Thread Nico Weber via cfe-commits
Author: nico
Date: Fri Jul 20 14:06:41 2018
New Revision: 337620

URL: http://llvm.org/viewvc/llvm-project?rev=337620&view=rev
Log:
fix typo

Modified:
cfe/trunk/docs/ReleaseNotes.rst

Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=337620&r1=337619&r2=337620&view=diff
==
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Fri Jul 20 14:06:41 2018
@@ -173,7 +173,7 @@ Windows Support
  the pch file (matching cl.exe).  This speeds up builds using pch files
  by around 30%.
 
-   - The /Ycfoo.h and /Yufoo.h flags an now be used without /FIfoo.h when
+   - The /Ycfoo.h and /Yufoo.h flags can now be used without /FIfoo.h when
  foo.h is instead included by an explicit `#include` directive. This means
  Visual Studio's default stdafx.h setup now uses precompiled headers with
  clang-cl.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r337381 - Mention clang-cl improvements from r335466 and r336379 in ReleaseNotes.rst

2018-07-20 Thread Nico Weber via cfe-commits
Fixed in 337620, thanks!

On Wed, Jul 18, 2018 at 3:55 PM Kim Gräsman via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> This is lovely! Found a bit inline...
>
> On Wed, Jul 18, 2018, 14:00 Nico Weber via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: nico
>> Date: Wed Jul 18 04:55:03 2018
>> New Revision: 337381
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=337381&view=rev
>> Log:
>> Mention clang-cl improvements from r335466 and r336379 in ReleaseNotes.rst
>>
>> Modified:
>> cfe/trunk/docs/ReleaseNotes.rst
>>
>> Modified: cfe/trunk/docs/ReleaseNotes.rst
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=337381&r1=337380&r2=337381&view=diff
>>
>> ==
>> --- cfe/trunk/docs/ReleaseNotes.rst (original)
>> +++ cfe/trunk/docs/ReleaseNotes.rst Wed Jul 18 04:55:03 2018
>> @@ -166,7 +166,19 @@ Attribute Changes in Clang
>>  Windows Support
>>  ---
>>
>> -Clang's support for building native Windows programs ...
>> +- clang-cl's support for precompiled headers has been much improved:
>> +
>> +   - When using a pch file, clang-cl now no longer redundantly emits
>> inline
>> + methods that are already stored in the obj that was built together
>> with
>> + the pch file (matching cl.exe).  This speeds up builds using pch
>> files
>> + by around 30%.
>> +
>> +   - The /Ycfoo.h and /Yufoo.h flags an now be used without /FIfoo.h when
>>
>> typo: an - > can
>>
>> - Kim
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r337470 - [Sema] Add a new warning, -Wmemset-transposed-args

2018-07-21 Thread Nico Weber via cfe-commits
This has a false positive on ffmpeg:

../../third_party/ffmpeg/libavcodec/options.c:273:64: error: 'size'
argument to memset is '0'; did you mean to transpose the last two
arguments? [-Werror,-Wmemset-transposed-args]
alloc_and_copy_or_fail(intra_matrix, 64 * sizeof(int16_t), 0);

With:

#define alloc_and_copy_or_fail(obj, size, pad) \
if (src->obj && size > 0) { \
dest->obj = av_malloc(size + pad); \
if (!dest->obj) \
goto fail; \
memcpy(dest->obj, src->obj, size); \
if (pad) \
memset(((uint8_t *) dest->obj) + size, 0, pad); \
}

(
https://cs.chromium.org/chromium/src/third_party/ffmpeg/libavcodec/options.c?q=alloc_and_copy_or_fail&sq=package:chromium&g=0&l=261
; https://bugs.chromium.org/p/chromium/issues/detail?id=866202)

Maybe the warning shouldn't fire if the memset is from a macro?

On Thu, Jul 19, 2018 at 12:51 PM Erik Pilkington via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: epilk
> Date: Thu Jul 19 09:46:15 2018
> New Revision: 337470
>
> URL: http://llvm.org/viewvc/llvm-project?rev=337470&view=rev
> Log:
> [Sema] Add a new warning, -Wmemset-transposed-args
>
> This diagnoses calls to memset that have the second and third arguments
> transposed, for example:
>
>   memset(buf, sizeof(buf), 0);
>
> This is done by checking if the third argument is a literal 0, or if the
> second
> is a sizeof expression (and the third isn't). The first check is also done
> for
> calls to bzero.
>
> Differential revision: https://reviews.llvm.org/D49112
>
> Added:
> cfe/trunk/test/Sema/transpose-memset.c
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticGroups.td
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/lib/Sema/SemaChecking.cpp
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=337470&r1=337469&r2=337470&view=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Thu Jul 19 09:46:15
> 2018
> @@ -443,6 +443,13 @@ def : DiagGroup<"synth">;
>  def SizeofArrayArgument : DiagGroup<"sizeof-array-argument">;
>  def SizeofArrayDecay : DiagGroup<"sizeof-array-decay">;
>  def SizeofPointerMemaccess : DiagGroup<"sizeof-pointer-memaccess">;
> +def MemsetTransposedArgs : DiagGroup<"memset-transposed-args">;
> +def DynamicClassMemaccess : DiagGroup<"dynamic-class-memaccess">;
> +def NonTrivialMemaccess : DiagGroup<"nontrivial-memaccess">;
> +def SuspiciousBzero : DiagGroup<"suspicious-bzero">;
> +def SuspiciousMemaccess : DiagGroup<"suspicious-memaccess",
> +  [SizeofPointerMemaccess, DynamicClassMemaccess,
> +   NonTrivialMemaccess, MemsetTransposedArgs, SuspiciousBzero]>;
>  def StaticInInline : DiagGroup<"static-in-inline">;
>  def StaticLocalInInline : DiagGroup<"static-local-in-inline">;
>  def GNUStaticFloatInit : DiagGroup<"gnu-static-float-init">;
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=337470&r1=337469&r2=337470&view=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Jul 19
> 09:46:15 2018
> @@ -619,14 +619,14 @@ def warn_cstruct_memaccess : Warning<
>"%select{destination for|source of|first operand of|second operand of}0
> this "
>"%1 call is a pointer to record %2 that is not trivial to "
>"%select{primitive-default-initialize|primitive-copy}3">,
> -  InGroup>;
> +  InGroup;
>  def note_nontrivial_field : Note<
>"field is non-trivial to %select{copy|default-initialize}0">;
>  def warn_dyn_class_memaccess : Warning<
>"%select{destination for|source of|first operand of|second operand of}0
> this "
>"%1 call is a pointer to %select{|class containing a }2dynamic class
> %3; "
>"vtable pointer will be %select{overwritten|copied|moved|compared}4">,
> -  InGroup>;
> +  InGroup;
>  def note_bad_memaccess_silence : Note<
>"explicitly cast the pointer to silence this warning">;
>  def warn_sizeof_pointer_expr_memaccess : Warning<
> @@ -655,7 +655,19 @@ def note_memsize_comparison_paren : Note
>"did you mean to compare the result of %0 instead?">;
>  def note_memsize_comparison_cast_silence : Note<
>"explicitly cast the argument to size_t to silence this warning">;
> -
> +def warn_suspicious_sizeof_memset : Warning<
> +  "%select{'size' argument to memset is '0'|"
> +  "setting buffer to a 'sizeof' expression}0"
> +  "; did you mean to transpose the last two arguments?">,
> +  InGroup;
> +def note_suspicious_sizeof_memset_silence : Note<
> +  "%select{parenthesize the third argument|"
> +  "cast the second ar

r337732 - [ms] Fix mangling of vector types in QMM_Result contexts.

2018-07-23 Thread Nico Weber via cfe-commits
Author: nico
Date: Mon Jul 23 13:04:00 2018
New Revision: 337732

URL: http://llvm.org/viewvc/llvm-project?rev=337732&view=rev
Log:
[ms] Fix mangling of vector types in QMM_Result contexts.

If QMM_Result is set (which it is for return types, RTTI descriptors, and
exception type descriptors), tag types (structs, enums, classes, unions) get
their qualifiers mangled in.

__m64 and friends is a struct/union thingy in MSVC, but not in clang's headers.
To make mangling work, we call mangleArtificalTagType(TTK_Union/TTK_Struct for
the vector types to mangle them as tag types -- but the isa check when
mangling in QMM_Result mode isn't true for these vector types. Add an
isArtificialTagType() function and check for that too. Fixes PR37276 and some
other issues.

I tried to audit all references to TagDecl and TagType in MicrosoftMangle.cpp
to find other places where we need to call mangleArtificalTagType(), but
couldn't find any.

I tried to audit all calls to mangleArtificalTagType() to see if
isArtificialTagType() needs to handle more than just the vector types, but as
far as I can tell all other types we use it for are types that MSVC can't
handle at all (Objective-C types etc).

https://reviews.llvm.org/D49597

Modified:
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-ms-vector-types.cpp

Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=337732&r1=337731&r2=337732&view=diff
==
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Mon Jul 23 13:04:00 2018
@@ -337,6 +337,8 @@ private:
   void mangleArgumentType(QualType T, SourceRange Range);
   void manglePassObjectSizeArg(const PassObjectSizeAttr *POSA);
 
+  bool isArtificialTagType(QualType T) const;
+
   // Declare manglers for every type class.
 #define ABSTRACT_TYPE(CLASS, PARENT)
 #define NON_CANONICAL_TYPE(CLASS, PARENT)
@@ -1751,7 +1753,7 @@ void MicrosoftCXXNameMangler::mangleType
 Quals.removeUnaligned();
 if (Quals.hasObjCLifetime())
   Quals = Quals.withoutObjCLifetime();
-if ((!IsPointer && Quals) || isa(T)) {
+if ((!IsPointer && Quals) || isa(T) || isArtificialTagType(T)) {
   Out << '?';
   mangleQualifiers(Quals, false);
 }
@@ -2280,6 +2282,8 @@ void MicrosoftCXXNameMangler::mangleType
   mangleTagTypeKind(TD->getTagKind());
   mangleName(TD);
 }
+
+// If you add a call to this, consider updating isArtificialTagType() too.
 void MicrosoftCXXNameMangler::mangleArtificalTagType(
 TagTypeKind TK, StringRef UnqualifiedName, ArrayRef 
NestedNames) {
   //  ::=  {[]+ | []}? @
@@ -2468,6 +2472,26 @@ void MicrosoftCXXNameMangler::mangleType
   mangleArtificalTagType(TTK_Struct, TemplateMangling, {"__clang"});
 }
 
+// Returns true for types that mangleArtificalTagType() gets called for with
+// TTK_Union, TTK_Struct, TTK_Class and where compatibility with MSVC's
+// mangling matters.
+// (It doesn't matter for Objective-C types and the like that cl.exe doesn't
+// support.)
+bool MicrosoftCXXNameMangler::isArtificialTagType(QualType T) const {
+  const Type *ty = T.getTypePtr();
+  switch (ty->getTypeClass()) {
+  default:
+return false;
+
+  case Type::Vector: {
+// For ABI compatibility only __m64, __m128(id), and __m256(id) matter,
+// but since mangleType(VectorType*) always calls mangleArtificalTagType()
+// just always return true (the other vector types are clang-only).
+return true;
+  }
+  }
+}
+
 void MicrosoftCXXNameMangler::mangleType(const VectorType *T, Qualifiers Quals,
  SourceRange Range) {
   const BuiltinType *ET = T->getElementType()->getAs();

Modified: cfe/trunk/test/CodeGenCXX/mangle-ms-vector-types.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms-vector-types.cpp?rev=337732&r1=337731&r2=337732&view=diff
==
--- cfe/trunk/test/CodeGenCXX/mangle-ms-vector-types.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-ms-vector-types.cpp Mon Jul 23 13:04:00 
2018
@@ -1,30 +1,91 @@
-// RUN: %clang_cc1 -fms-extensions -ffreestanding -target-feature +avx 
-emit-llvm %s -o - -triple=i686-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -fms-extensions -fcxx-exceptions -ffreestanding 
-target-feature +avx -emit-llvm %s -o - -triple=i686-pc-win32 | FileCheck %s
 
 #include 
 #include 
 #include 
 
+void thow(int i) {
+  switch (i) {
+case 0: throw __m64();
+// CHECK: ??_R0?AT__m64@@@8
+// CHECK: _CT??_R0?AT__m64@@@88
+// CHECK: _CTA1?AT__m64@@
+// CHECK: _TI1?AT__m64@@
+case 1: throw __m128();
+// CHECK: ??_R0?AT__m128@@@8
+// CHECK: _CT??_R0?AT__m128@@@816
+// CHECK: _CTA1?AT__m128@@
+// CHECK: _TI1?AT__m128@@
+case 2: throw __m128d();
+// CHECK: ??_R0?AU__m128d@@@8
+// 

Re: r337746 - [clang-cl] Expose -fblocks and -fno-builtin as driver flags

2018-07-25 Thread Nico Weber via cfe-commits
I thought about adding -fblocks when that thread happened, but since
there's no runtime for them that just works exposing it doesn't seem very
helpful. Maybe we should instead change the warning text to not suggest
-fblocks when building on a non-mac target?

On Mon, Jul 23, 2018 at 5:29 PM Reid Kleckner via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rnk
> Date: Mon Jul 23 14:29:43 2018
> New Revision: 337746
>
> URL: http://llvm.org/viewvc/llvm-project?rev=337746&view=rev
> Log:
> [clang-cl] Expose -fblocks and -fno-builtin as driver flags
>
> Users have requested them.
>
> Helps with PR36427.
>
> Modified:
> cfe/trunk/include/clang/Driver/Options.td
> cfe/trunk/test/Driver/cl-options.c
>
> Modified: cfe/trunk/include/clang/Driver/Options.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=337746&r1=337745&r2=337746&view=diff
>
> ==
> --- cfe/trunk/include/clang/Driver/Options.td (original)
> +++ cfe/trunk/include/clang/Driver/Options.td Mon Jul 23 14:29:43 2018
> @@ -762,12 +762,12 @@ def faddrsig : Flag<["-"], "faddrsig">,
>HelpText<"Emit an address-significance table">;
>  def fno_addrsig : Flag<["-"], "fno-addrsig">, Group,
> Flags<[CoreOption]>,
>HelpText<"Don't emit an address-significance table">;
> -def fblocks : Flag<["-"], "fblocks">, Group, Flags<[CC1Option]>,
> +def fblocks : Flag<["-"], "fblocks">, Group, Flags<[CoreOption,
> CC1Option]>,
>HelpText<"Enable the 'blocks' language feature">;
>  def fbootclasspath_EQ : Joined<["-"], "fbootclasspath=">, Group;
>  def fborland_extensions : Flag<["-"], "fborland-extensions">,
> Group, Flags<[CC1Option]>,
>HelpText<"Accept non-standard constructs supported by the Borland
> compiler">;
> -def fbuiltin : Flag<["-"], "fbuiltin">, Group;
> +def fbuiltin : Flag<["-"], "fbuiltin">, Group,
> Flags<[CoreOption]>;
>  def fbuiltin_module_map : Flag <["-"], "fbuiltin-module-map">,
> Group,
>Flags<[DriverOption]>, HelpText<"Load the clang builtins module map
> file.">;
>  def fcaret_diagnostics : Flag<["-"], "fcaret-diagnostics">,
> Group;
> @@ -1320,11 +1320,11 @@ def fno_asynchronous_unwind_tables : Fla
>  def fno_assume_sane_operator_new : Flag<["-"],
> "fno-assume-sane-operator-new">, Group,
>HelpText<"Don't assume that C++'s global operator new can't alias any
> pointer">,
>Flags<[CC1Option]>;
> -def fno_blocks : Flag<["-"], "fno-blocks">, Group;
> +def fno_blocks : Flag<["-"], "fno-blocks">, Group,
> Flags<[CoreOption]>;
>  def fno_borland_extensions : Flag<["-"], "fno-borland-extensions">,
> Group;
> -def fno_builtin : Flag<["-"], "fno-builtin">, Group,
> Flags<[CC1Option]>,
> +def fno_builtin : Flag<["-"], "fno-builtin">, Group,
> Flags<[CC1Option, CoreOption]>,
>HelpText<"Disable implicit builtin knowledge of functions">;
> -def fno_builtin_ : Joined<["-"], "fno-builtin-">, Group,
> Flags<[CC1Option]>,
> +def fno_builtin_ : Joined<["-"], "fno-builtin-">, Group,
> Flags<[CC1Option, CoreOption]>,
>HelpText<"Disable implicit builtin knowledge of a specific function">;
>  def fno_caret_diagnostics : Flag<["-"], "fno-caret-diagnostics">,
> Group,
>   Flags<[CC1Option]>;
>
> Modified: cfe/trunk/test/Driver/cl-options.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=337746&r1=337745&r2=337746&view=diff
>
> ==
> --- cfe/trunk/test/Driver/cl-options.c (original)
> +++ cfe/trunk/test/Driver/cl-options.c Mon Jul 23 14:29:43 2018
> @@ -565,6 +565,11 @@
>  // (/Zs is for syntax-only, -Werror makes it fail hard on unknown options)
>  // RUN: %clang_cl \
>  // RUN: --driver-mode=cl \
> +// RUN: -fblocks \
> +// RUN: -fno-blocks \
> +// RUN: -fbuiltin \
> +// RUN: -fno-builtin \
> +// RUN: -fno-builtin-strcpy \
>  // RUN: -fcolor-diagnostics \
>  // RUN: -fno-color-diagnostics \
>  // RUN: -fcoverage-mapping \
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r338520 - wrap to 80 cols, no behavior change

2018-08-01 Thread Nico Weber via cfe-commits
Author: nico
Date: Wed Aug  1 04:56:20 2018
New Revision: 338520

URL: http://llvm.org/viewvc/llvm-project?rev=338520&view=rev
Log:
wrap to 80 cols, no behavior change

Modified:
cfe/trunk/lib/AST/MicrosoftMangle.cpp

Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=338520&r1=338519&r2=338520&view=diff
==
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Wed Aug  1 04:56:20 2018
@@ -1373,13 +1373,14 @@ void MicrosoftCXXNameMangler::mangleTemp
   case TemplateArgument::Declaration: {
 const NamedDecl *ND = TA.getAsDecl();
 if (isa(ND) || isa(ND)) {
-  mangleMemberDataPointer(
-  
cast(ND->getDeclContext())->getMostRecentNonInjectedDecl(),
-  cast(ND));
+  mangleMemberDataPointer(cast(ND->getDeclContext())
+  ->getMostRecentNonInjectedDecl(),
+  cast(ND));
 } else if (const FunctionDecl *FD = dyn_cast(ND)) {
   const CXXMethodDecl *MD = dyn_cast(FD);
   if (MD && MD->isInstance()) {
-
mangleMemberFunctionPointer(MD->getParent()->getMostRecentNonInjectedDecl(), 
MD);
+mangleMemberFunctionPointer(
+MD->getParent()->getMostRecentNonInjectedDecl(), MD);
   } else {
 Out << "$1?";
 mangleName(FD);
@@ -2285,7 +2286,8 @@ void MicrosoftCXXNameMangler::mangleType
 
 // If you add a call to this, consider updating isArtificialTagType() too.
 void MicrosoftCXXNameMangler::mangleArtificalTagType(
-TagTypeKind TK, StringRef UnqualifiedName, ArrayRef 
NestedNames) {
+TagTypeKind TK, StringRef UnqualifiedName,
+ArrayRef NestedNames) {
   //  ::=  {[]+ | []}? @
   mangleTagTypeKind(TK);
 
@@ -2372,8 +2374,8 @@ void MicrosoftCXXNameMangler::mangleArra
 //::= 
 //  ::=  
 //   
-void MicrosoftCXXNameMangler::mangleType(const MemberPointerType *T, 
Qualifiers Quals,
- SourceRange Range) {
+void MicrosoftCXXNameMangler::mangleType(const MemberPointerType *T,
+ Qualifiers Quals, SourceRange Range) {
   QualType PointeeType = T->getPointeeType();
   manglePointerCVQualifiers(Quals);
   manglePointerExtQualifiers(Quals, PointeeType);


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r338640 - [NFC][CodeGenCXX] Use -emit-llvm-only instead of -emit-llvm and ignoring it.

2018-08-02 Thread Nico Weber via cfe-commits
Can't you omit '-o -' now too?

On Wed, Aug 1, 2018 at 5:21 PM Roman Lebedev via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: lebedevri
> Date: Wed Aug  1 14:20:58 2018
> New Revision: 338640
>
> URL: http://llvm.org/viewvc/llvm-project?rev=338640&view=rev
> Log:
> [NFC][CodeGenCXX] Use -emit-llvm-only instead of -emit-llvm and ignoring
> it.
>
> As pointed out by Richard Smith in post-review of r338489.
>
> Modified:
> cfe/trunk/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
>
> Modified: cfe/trunk/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp?rev=338640&r1=338639&r2=338640&view=diff
>
> ==
> --- cfe/trunk/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
> (original)
> +++ cfe/trunk/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp Wed Aug
> 1 14:20:58 2018
> @@ -1,4 +1,4 @@
> -// RUN: %clang_cc1 %s -emit-llvm -o -
> +// RUN: %clang_cc1 %s -emit-llvm-only -o -
>
>  // https://bugs.llvm.org/show_bug.cgi?id=38356
>  // We only check that we do not crash.
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r338884 - [NFC] Silence unused variable warning in Attr.td/AttrParsedAttrImpl.inc

2018-08-03 Thread Nico Weber via cfe-commits
This causes a warning:

gen/clang/include/clang/Sema/AttrParsedAttrImpl.inc:1050:12: warning:
expression result unused [-Wunused-value]
return S, false;
   ^

On Fri, Aug 3, 2018 at 9:01 AM Erich Keane via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: erichkeane
> Date: Fri Aug  3 06:01:32 2018
> New Revision: 338884
>
> URL: http://llvm.org/viewvc/llvm-project?rev=338884&view=rev
> Log:
> [NFC] Silence unused variable warning in Attr.td/AttrParsedAttrImpl.inc
>
> Modified:
> cfe/trunk/include/clang/Basic/Attr.td
>
> Modified: cfe/trunk/include/clang/Basic/Attr.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=338884&r1=338883&r2=338884&view=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/Attr.td (original)
> +++ cfe/trunk/include/clang/Basic/Attr.td Fri Aug  3 06:01:32 2018
> @@ -145,7 +145,7 @@ def HasFunctionProto : SubsetSubject  // function. Accepted as a function type attribute on the type of such a
>  // member function.
>  // FIXME: This does not actually ever match currently.
> -def ImplicitObjectParameter : SubsetSubject +def ImplicitObjectParameter : SubsetSubject  "implicit object parameters">;
>
>  // A single argument to an attribute
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r338385 - [RISCV] Add driver for riscv32-unknown-elf baremetal target

2018-08-03 Thread Nico Weber via cfe-commits
I'm getting this warning from the mac linker after this commit:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool:
warning same member name (libclangDriver.RISCV.o) in output file used for
input files: obj/clang/lib/Driver/ToolChains/Arch/libclangDriver.RISCV.o
and: obj/clang/lib/Driver/ToolChains/libclangDriver.RISCV.o (due to use of
basename, truncation, blank padding or duplicate input files)

Could we rename the file to fix that warning?

On Tue, Jul 31, 2018 at 10:40 AM David Bolvansky via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: xbolva00
> Date: Tue Jul 31 07:21:46 2018
> New Revision: 338385
>
> URL: http://llvm.org/viewvc/llvm-project?rev=338385&view=rev
> Log:
> [RISCV] Add driver for riscv32-unknown-elf baremetal target
>
> Summary:
> This patch adds a driver for the baremetal RISC-V target (i.e.
> riscv32-unknown-elf). For reference, D39963 added basic target info and
> added support for riscv32-linux-unknown-elf.
>
> Patch by: asb (Alex Bradbury)
>
> Reviewers: efriedma, phosek, apazos, espindola, mgrang
>
> Reviewed By: mgrang
>
> Subscribers: jrtc27, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe,
> emaste, mgorny, arichardson, rbar, johnrusso, simoncook,
> jordy.potman.lists, sabuasal, niosHD, kito-cheng, shiva0217, zzheng,
> edward-jones, mgrang, cfe-commits
>
> Differential Revision: https://reviews.llvm.org/D46822
>
> Added:
> cfe/trunk/lib/Driver/ToolChains/RISCV.cpp
> cfe/trunk/lib/Driver/ToolChains/RISCV.h
> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/
> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/bin/
>
> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/bin/riscv32-unknown-elf-ld
>  (with props)
> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/lib/
> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/lib/gcc/
>
> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/
>
> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/
>
> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/crtbegin.o
>
> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/crtend.o
> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/riscv32-unknown-elf/
>
> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/riscv32-unknown-elf/include/
>
> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/riscv32-unknown-elf/include/c++/
>
> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/riscv32-unknown-elf/include/c++/8.0.1/
>
> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/riscv32-unknown-elf/include/c++/8.0.1/.keep
>
> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/riscv32-unknown-elf/lib/
>
> cfe/trunk/test/Driver/Inputs/basic_riscv32_tree/riscv32-unknown-elf/lib/crt0.o
> Modified:
> cfe/trunk/lib/Driver/CMakeLists.txt
> cfe/trunk/lib/Driver/Driver.cpp
> cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
> cfe/trunk/test/Driver/riscv32-toolchain.c
>
> Modified: cfe/trunk/lib/Driver/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CMakeLists.txt?rev=338385&r1=338384&r2=338385&view=diff
>
> ==
> --- cfe/trunk/lib/Driver/CMakeLists.txt (original)
> +++ cfe/trunk/lib/Driver/CMakeLists.txt Tue Jul 31 07:21:46 2018
> @@ -57,6 +57,7 @@ add_clang_library(clangDriver
>ToolChains/NetBSD.cpp
>ToolChains/OpenBSD.cpp
>ToolChains/PS4CPU.cpp
> +  ToolChains/RISCV.cpp
>ToolChains/Solaris.cpp
>ToolChains/TCE.cpp
>ToolChains/WebAssembly.cpp
>
> Modified: cfe/trunk/lib/Driver/Driver.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=338385&r1=338384&r2=338385&view=diff
>
> ==
> --- cfe/trunk/lib/Driver/Driver.cpp (original)
> +++ cfe/trunk/lib/Driver/Driver.cpp Tue Jul 31 07:21:46 2018
> @@ -37,6 +37,7 @@
>  #include "ToolChains/NetBSD.h"
>  #include "ToolChains/OpenBSD.h"
>  #include "ToolChains/PS4CPU.h"
> +#include "ToolChains/RISCV.h"
>  #include "ToolChains/Solaris.h"
>  #include "ToolChains/TCE.h"
>  #include "ToolChains/WebAssembly.h"
> @@ -4399,6 +4400,10 @@ const ToolChain &Driver::getToolChain(co
>case llvm::Triple::avr:
>  TC = llvm::make_unique(*this, Target,
> Args);
>  break;
> +  case llvm::Triple::riscv32:
> +  case llvm::Triple::riscv64:
> +TC = llvm::make_unique(*this, Target,
> Args);
> +break;
>default:
>  if (Target.getVendor() == llvm::Triple::Myriad)
>TC = llvm::make_unique(*this,
> Target,
>
> Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=338385&r1=338384&r2=338385&view=diff
>
> ==
> --- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (ori

[libcxx] r324385 - Fix building libc++ with the macOS 10.13 SDK with -mmacosx-version-min=10.12 or lower.

2018-02-06 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Feb  6 11:17:41 2018
New Revision: 324385

URL: http://llvm.org/viewvc/llvm-project?rev=324385&view=rev
Log:
Fix building libc++ with the macOS 10.13 SDK with -mmacosx-version-min=10.12 or 
lower.

The 10.13 SDK always defines utimensat() (with an availability(macosx=10.13) 
annotation)
and unconditionally defines UTIME_OMIT, so use the compile-time availability 
macros
on Apple platforms instead.

For people statically linking libc++, it might make sense to also provide an 
opt-in
option for using __builtin_available() to dynamically check for the OS version,
but for now let's do the smallest thing needed to unbreak the build.

Based on a patch by Eric Fiselier : 
https://reviews.llvm.org/D34249
Fixes PR33469.

Modified:
libcxx/trunk/src/experimental/filesystem/operations.cpp

Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=324385&r1=324384&r2=324385&view=diff
==
--- libcxx/trunk/src/experimental/filesystem/operations.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/operations.cpp Tue Feb  6 11:17:41 
2018
@@ -21,7 +21,34 @@
 #include 
 #include 
 #include   /* values for fchmodat */
-#if !defined(UTIME_OMIT)
+
+#if (__APPLE__)
+#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101300
+#define _LIBCXX_USE_UTIMENSAT
+#endif
+#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 11
+#define _LIBCXX_USE_UTIMENSAT
+#endif
+#elif defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__)
+#if __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 11
+#define _LIBCXX_USE_UTIMENSAT
+#endif
+#elif defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__)
+#if __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 4
+#define _LIBCXX_USE_UTIMENSAT
+#endif
+#endif // __ENVIRONMENT_.*_VERSION_MIN_REQUIRED__
+#else
+// We can use the presence of UTIME_OMIT to detect platforms that provide
+// utimensat.
+#if defined(UTIME_OMIT)
+#define _LIBCXX_USE_UTIMENSAT
+#endif
+#endif // __APPLE__
+
+#if !defined(_LIBCXX_USE_UTIMENSAT)
 #include  // for ::utimes as used in __last_write_time
 #endif
 
@@ -560,9 +587,7 @@ void __last_write_time(const path& p, fi
 using namespace std::chrono;
 std::error_code m_ec;
 
-// We can use the presence of UTIME_OMIT to detect platforms that do not
-// provide utimensat.
-#if !defined(UTIME_OMIT)
+#if !defined(_LIBCXX_USE_UTIMENSAT)
 // This implementation has a race condition between determining the
 // last access time and attempting to set it to the same value using
 // ::utimes


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r325052 - Teach Wreturn-type, Wunreachable-code, and alpha.deadcode.UnreachableCode to treat __assume(0) like __builtin_unreachable.

2018-02-13 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Feb 13 13:31:47 2018
New Revision: 325052

URL: http://llvm.org/viewvc/llvm-project?rev=325052&view=rev
Log:
Teach Wreturn-type, Wunreachable-code, and alpha.deadcode.UnreachableCode to 
treat __assume(0) like __builtin_unreachable.

Fixes PR29134.
https://reviews.llvm.org/D43221

Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/Analysis/CFG.cpp
cfe/trunk/lib/Analysis/ReachableCode.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
cfe/trunk/test/Analysis/unreachable-code-path.c
cfe/trunk/test/Sema/return.c
cfe/trunk/test/Sema/warn-unreachable.c

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=325052&r1=325051&r2=325052&view=diff
==
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Tue Feb 13 13:31:47 2018
@@ -2357,6 +2357,10 @@ public:
   SourceLocation getLocStart() const LLVM_READONLY;
   SourceLocation getLocEnd() const LLVM_READONLY;
 
+  /// Return true if this is a call to __assume() or __builtin_assume() with
+  /// a non-value-dependent constant parameter evaluating as false.
+  bool isBuiltinAssumeFalse(const ASTContext &Ctx) const;
+
   bool isCallToStdMove() const {
 const FunctionDecl* FD = getDirectCallee();
 return getNumArgs() == 1 && FD && FD->isInStdNamespace() &&

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=325052&r1=325051&r2=325052&view=diff
==
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Tue Feb 13 13:31:47 2018
@@ -2917,6 +2917,18 @@ bool Expr::isConstantInitializer(ASTCont
   return false;
 }
 
+bool CallExpr::isBuiltinAssumeFalse(const ASTContext &Ctx) const {
+  const FunctionDecl* FD = getDirectCallee();
+  if (!FD || (FD->getBuiltinID() != Builtin::BI__assume &&
+  FD->getBuiltinID() != Builtin::BI__builtin_assume))
+return false;
+  
+  const Expr* Arg = getArg(0);
+  bool ArgVal;
+  return !Arg->isValueDependent() &&
+ Arg->EvaluateAsBooleanCondition(ArgVal, Ctx) && !ArgVal;
+}
+
 namespace {
   /// \brief Look for any side effects within a Stmt.
   class SideEffectFinder : public ConstEvaluatedExprVisitor {

Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=325052&r1=325051&r2=325052&view=diff
==
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Tue Feb 13 13:31:47 2018
@@ -2134,7 +2134,7 @@ CFGBlock *CFGBuilder::VisitCallExpr(Call
   bool OmitArguments = false;
 
   if (FunctionDecl *FD = C->getDirectCallee()) {
-if (FD->isNoReturn())
+if (FD->isNoReturn() || C->isBuiltinAssumeFalse(*Context))
   NoReturn = true;
 if (FD->hasAttr())
   AddEHEdge = false;

Modified: cfe/trunk/lib/Analysis/ReachableCode.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ReachableCode.cpp?rev=325052&r1=325051&r2=325052&view=diff
==
--- cfe/trunk/lib/Analysis/ReachableCode.cpp (original)
+++ cfe/trunk/lib/Analysis/ReachableCode.cpp Tue Feb 13 13:31:47 2018
@@ -66,6 +66,21 @@ static bool isBuiltinUnreachable(const S
   return false;
 }
 
+static bool isBuiltinAssumeFalse(const CFGBlock *B, const Stmt *S,
+ ASTContext &C) {
+  if (B->empty())  {
+// Happens if S is B's terminator and B contains nothing else
+// (e.g. a CFGBlock containing only a goto).
+return false;
+  }
+  if (Optional CS = B->back().getAs()) {
+if (const auto *CE = dyn_cast(CS->getStmt())) {
+  return CE->getCallee()->IgnoreCasts() == S && 
CE->isBuiltinAssumeFalse(C);
+}
+  }
+  return false;
+}
+
 static bool isDeadReturn(const CFGBlock *B, const Stmt *S) {
   // Look to see if the current control flow ends with a 'return', and see if
   // 'S' is a substatement. The 'return' may not be the last element in the
@@ -372,6 +387,7 @@ namespace {
 llvm::BitVector &Reachable;
 SmallVector WorkList;
 Preprocessor &PP;
+ASTContext &C;
 
 typedef SmallVector, 12>
 DeferredLocsTy;
@@ -379,10 +395,10 @@ namespace {
 DeferredLocsTy DeferredLocs;
 
   public:
-DeadCodeScan(llvm::BitVector &reachable, Preprocessor &PP)
+DeadCodeScan(llvm::BitVector &reachable, Preprocessor &PP, ASTContext &C)
 : Visited(reachable.size()),
   Reachable(reachable),
-  PP(PP) {}
+  PP(PP), C(C) {}
 
 void enqueue(const CFGBlock *block);
 unsigned scanBackwards(const CFGBlock *Start,
@@ -600,7 +616,8 @@ void DeadCodeScan::reportDeadCode(const
 
   if (isa(S)) {
 U

Re: [libcxx] r324290 - Remove ; use instead. See https://libcxx.llvm.org/TS_deprecation.html

2018-02-22 Thread Nico Weber via cfe-commits
Out of interest, do you know why the non-experimental version doesn't have
to_string()? What are folks supposed to use instead?

On Mon, Feb 5, 2018 at 6:43 PM, Marshall Clow via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: marshall
> Date: Mon Feb  5 15:43:34 2018
> New Revision: 324290
>
> URL: http://llvm.org/viewvc/llvm-project?rev=324290&view=rev
> Log:
> Remove ; use  instead. See
> https://libcxx.llvm.org/TS_deprecation.html
>
> Removed:
> libcxx/trunk/test/std/experimental/string.view/
> Modified:
> libcxx/trunk/include/experimental/string_view
> libcxx/trunk/include/module.modulemap
> libcxx/trunk/test/libcxx/double_include.sh.cpp
> libcxx/trunk/test/libcxx/min_max_macros.sh.cpp
> libcxx/trunk/test/std/experimental/nothing_to_do.pass.cpp
>
> Modified: libcxx/trunk/include/experimental/string_view
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/
> experimental/string_view?rev=324290&r1=324289&r2=324290&view=diff
> 
> ==
> --- libcxx/trunk/include/experimental/string_view (original)
> +++ libcxx/trunk/include/experimental/string_view Mon Feb  5 15:43:34 2018
> @@ -8,811 +8,4 @@
>  //
>  //===---
> ---===//
>
> -#ifndef _LIBCPP_LFTS_STRING_VIEW
> -#define _LIBCPP_LFTS_STRING_VIEW
> -
> -/*
> -string_view synopsis
> -
> -namespace std {
> - namespace experimental {
> -  inline namespace library_fundamentals_v1 {
> -
> -// 7.2, Class template basic_string_view
> -template>
> -class basic_string_view;
> -
> -// 7.9, basic_string_view non-member comparison functions
> -template
> -constexpr bool operator==(basic_string_view x,
> -  basic_string_view y)
> noexcept;
> -template
> -constexpr bool operator!=(basic_string_view x,
> -  basic_string_view y)
> noexcept;
> -template
> -constexpr bool operator< (basic_string_view x,
> - basic_string_view y)
> noexcept;
> -template
> -constexpr bool operator> (basic_string_view x,
> -  basic_string_view y)
> noexcept;
> -template
> -constexpr bool operator<=(basic_string_view x,
> - basic_string_view y)
> noexcept;
> -template
> -constexpr bool operator>=(basic_string_view x,
> -  basic_string_view y)
> noexcept;
> -// see below, sufficient additional overloads of comparison functions
> -
> -// 7.10, Inserters and extractors
> -template
> -  basic_ostream&
> -operator<<(basic_ostream& os,
> -   basic_string_view str);
> -
> -// basic_string_view typedef names
> -typedef basic_string_view string_view;
> -typedef basic_string_view u16string_view;
> -typedef basic_string_view u32string_view;
> -typedef basic_string_view wstring_view;
> -
> -template>
> -class basic_string_view {
> -  public:
> -  // types
> -  typedef traits traits_type;
> -  typedef charT value_type;
> -  typedef charT* pointer;
> -  typedef const charT* const_pointer;
> -  typedef charT& reference;
> -  typedef const charT& const_reference;
> -  typedef implementation-defined const_iterator;
> -  typedef const_iterator iterator;
> -  typedef reverse_iterator const_reverse_iterator;
> -  typedef const_reverse_iterator reverse_iterator;
> -  typedef size_t size_type;
> -  typedef ptrdiff_t difference_type;
> -  static constexpr size_type npos = size_type(-1);
> -
> -  // 7.3, basic_string_view constructors and assignment operators
> -  constexpr basic_string_view() noexcept;
> -  constexpr basic_string_view(const basic_string_view&) noexcept =
> default;
> -  basic_string_view& operator=(const basic_string_view&) noexcept =
> default;
> -  template
> -  basic_string_view(const basic_string&
> str) noexcept;
> -  constexpr basic_string_view(const charT* str);
> -  constexpr basic_string_view(const charT* str, size_type len);
> -
> -  // 7.4, basic_string_view iterator support
> -  constexpr const_iterator begin() const noexcept;
> -  constexpr const_iterator end() const noexcept;
> -  constexpr const_iterator cbegin() const noexcept;
> -  constexpr const_iterator cend() const noexcept;
> -  const_reverse_iterator rbegin() const noexcept;
> -  const_reverse_iterator rend() const noexcept;
> -  const_reverse_iterator crbegin() const noexcept;
> -  const_reverse_iterator crend() const noexcept;
> -
> -  // 7.5, basic_string_view capacity
> -  constexpr size_type size() const noexcept;
> -  constexpr size_type length() const noexcept;
> -  constexpr size_type max_size() const noexcept;
> -  constexpr bool empty() const noexcept;
> -
> -  // 7.6, basic_string_v

Re: [libcxx] r323971 - Remove ; use instead. See https://libcxx.llvm.org/TS_deprecation.html

2018-02-22 Thread Nico Weber via cfe-commits
I have a small personal project where I used to use this. I tried switching
to  instead, but that apparently requires -std=c++17. With that,
things build fine with my locally-built clang, but latest Xcode clang
doesn't accept that flag yet. So I tried -std=c++1z, but latest Xcode (9.2)
doesn't event include the  header yet. So now I have no way of
being able to build my project with both trunk clang and Xcode clang. Maybe
a one-year deprecation period is too short?

(It's not a huge deal, I have a optional<> implementation in my project for
platforms that don't ship it yet, but things used to be fine on mac until
this change at least. It's also not an important project, I just thought
I'd point out that this makes life more complicated than it would be if the
deletion period was longer.)

On Thu, Feb 1, 2018 at 9:54 AM, Marshall Clow via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: marshall
> Date: Thu Feb  1 06:54:25 2018
> New Revision: 323971
>
> URL: http://llvm.org/viewvc/llvm-project?rev=323971&view=rev
> Log:
> Remove ; use  instead. See
> https://libcxx.llvm.org/TS_deprecation.html
>
> Removed:
> libcxx/trunk/test/libcxx/experimental/optional/
> libcxx/trunk/test/std/experimental/optional/
> Modified:
> libcxx/trunk/include/experimental/optional
> libcxx/trunk/include/module.modulemap
> libcxx/trunk/src/optional.cpp
> libcxx/trunk/test/libcxx/double_include.sh.cpp
> libcxx/trunk/test/libcxx/min_max_macros.sh.cpp
>
> Modified: libcxx/trunk/include/experimental/optional
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/
> experimental/optional?rev=323971&r1=323970&r2=323971&view=diff
> 
> ==
> --- libcxx/trunk/include/experimental/optional (original)
> +++ libcxx/trunk/include/experimental/optional Thu Feb  1 06:54:25 2018
> @@ -8,915 +8,4 @@
>  //
>  //===---
> ---===//
>
> -#ifndef _LIBCPP_EXPERIMENTAL_OPTIONAL
> -#define _LIBCPP_EXPERIMENTAL_OPTIONAL
> -
> -/*
> -optional synopsis
> -
> -// C++1y
> -
> -namespace std { namespace experimental { inline namespace fundamentals_v1
> {
> -
> -// 5.3, optional for object types
> -template  class optional;
> -
> -// 5.4, In-place construction
> -struct in_place_t{};
> -constexpr in_place_t in_place{};
> -
> -// 5.5, No-value state indicator
> -struct nullopt_t{see below};
> -constexpr nullopt_t nullopt(unspecified);
> -
> -// 5.6, Class bad_optional_access
> -class bad_optional_access;
> -
> -// 5.7, Relational operators
> -template 
> -  constexpr bool operator==(const optional&, const optional&);
> -template 
> -  constexpr bool operator!=(const optional&, const optional&);
> -template 
> -  constexpr bool operator<(const optional&, const optional&);
> -template 
> -  constexpr bool operator>(const optional&, const optional&);
> -template 
> -  constexpr bool operator<=(const optional&, const optional&);
> -template 
> -  constexpr bool operator>=(const optional&, const optional&);
> -
> -// 5.8, Comparison with nullopt
> -template  constexpr bool operator==(const optional&,
> nullopt_t) noexcept;
> -template  constexpr bool operator==(nullopt_t, const
> optional&) noexcept;
> -template  constexpr bool operator!=(const optional&,
> nullopt_t) noexcept;
> -template  constexpr bool operator!=(nullopt_t, const
> optional&) noexcept;
> -template  constexpr bool operator<(const optional&,
> nullopt_t) noexcept;
> -template  constexpr bool operator<(nullopt_t, const
> optional&) noexcept;
> -template  constexpr bool operator<=(const optional&,
> nullopt_t) noexcept;
> -template  constexpr bool operator<=(nullopt_t, const
> optional&) noexcept;
> -template  constexpr bool operator>(const optional&,
> nullopt_t) noexcept;
> -template  constexpr bool operator>(nullopt_t, const
> optional&) noexcept;
> -template  constexpr bool operator>=(const optional&,
> nullopt_t) noexcept;
> -template  constexpr bool operator>=(nullopt_t, const
> optional&) noexcept;
> -
> -// 5.9, Comparison with T
> -template  constexpr bool operator==(const optional&,
> const T&);
> -template  constexpr bool operator==(const T&, const
> optional&);
> -template  constexpr bool operator!=(const optional&,
> const T&);
> -template  constexpr bool operator!=(const T&, const
> optional&);
> -template  constexpr bool operator<(const optional&, const
> T&);
> -template  constexpr bool operator<(const T&, const
> optional&);
> -template  constexpr bool operator<=(const optional&,
> const T&);
> -template  constexpr bool operator<=(const T&, const
> optional&);
> -template  constexpr bool operator>(const optional&, const
> T&);
> -template  constexpr bool operator>(const T&, const
> optional&);
> -template  cons

Re: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-24 Thread Nico Weber via cfe-commits
Was this reviewed somewhere?

Please make it so that this emits a warning. We want clang-cl to warn on
invalid code (and in system headers warnings are suppressed).

On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: erichkeane
> Date: Wed May 24 14:31:19 2017
> New Revision: 303798
>
> URL: http://llvm.org/viewvc/llvm-project?rev=303798&view=rev
> Log:
> For Microsoft compatibility, set fno_operator_names
>
> There's a Microsoft header in the Windows SDK which won't
> compile with clang because it uses an operator name (and)
> as a field name. This patch allows that file to compile by
> setting the option which disables operator names.
> The header which doesn't compile  C:/Program Files (x86)/
> Windows Kits/10/include/10.0.14393.0/um\Query.h:259:40:
> error: expected member name or ';' after declaration specifiers
>
>   /* [case()] */ NODERESTRICTION or;
>~~~ ^
>
>1 error generated.
>
> Contributed for Melanie Blower
>
> Differential Revision:https://reviews.llvm.org/D33505
>
> Modified:
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/test/Parser/MicrosoftExtensions.cpp
> cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp
>
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/
> Frontend/CompilerInvocation.cpp?rev=303798&r1=303797&r2=303798&view=diff
> 
> ==
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed May 24 14:31:19 2017
> @@ -1882,7 +1882,7 @@ static void ParseLangArgs(LangOptions &O
>Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords,
> OPT_fno_gnu_keywords,
>Opts.GNUKeywords);
>
> -  if (Args.hasArg(OPT_fno_operator_names))
> +  if (Args.hasArg(OPT_fno_operator_names) || Args.hasArg(OPT_fms_
> compatibility))
>  Opts.CXXOperatorNames = 0;
>
>if (Args.hasArg(OPT_fcuda_is_device))
>
> Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/
> MicrosoftExtensions.cpp?rev=303798&r1=303797&r2=303798&view=diff
> 
> ==
> --- cfe/trunk/test/Parser/MicrosoftExtensions.cpp (original)
> +++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp Wed May 24 14:31:19 2017
> @@ -261,9 +261,8 @@ int __identifier(else} = __identifier(fo
>  #define identifier_weird(x) __identifier(x
>  int k = identifier_weird(if)); // expected-error {{use of undeclared
> identifier 'if'}}
>
> -// This is a bit weird, but the alternative tokens aren't keywords, and
> this
> -// behavior matches MSVC. FIXME: Consider supporting this anyway.
> -extern int __identifier(and) r; // expected-error {{cannot convert '&&'
> token to an identifier}}
> +// 'and' is not an operator name with Microsoft compatibility.
> +extern int __identifier(and) r; // expected-error {{expected ';' after
> top level declarator}}
>
>  void f() {
>__identifier(() // expected-error {{cannot convert '(' token to an
> identifier}}
> @@ -355,7 +354,6 @@ void TestProperty() {
>++sp.V11;
>  }
>
> -//expected-warning@+1 {{C++ operator 'and' (aka '&&') used as a macro
> name}}
>  #define and foo
>
>  struct __declspec(uuid("---C000-0046"))
> __declspec(novtable) IUnknown {};
>
> Modified: cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> Preprocessor/cxx_oper_keyword.cpp?rev=303798&r1=303797&r2=303798&view=diff
> 
> ==
> --- cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp (original)
> +++ cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp Wed May 24 14:31:19
> 2017
> @@ -1,5 +1,6 @@
>  // RUN: %clang_cc1 %s -E -verify -DOPERATOR_NAMES
>  // RUN: %clang_cc1 %s -E -verify -fno-operator-names
> +// RUN: %clang_cc1 %s-verify -DTESTWIN -fms-compatibility
>
>  #ifndef OPERATOR_NAMES
>  //expected-error@+3 {{token is not a valid binary operator in a
> preprocessor subexpression}}
> @@ -29,3 +30,14 @@
>  #ifdef and
>  #warning and is defined
>  #endif
> +
> +#ifdef TESTWIN
> +// For cl compatibility, fno-operator-names is enabled by default.
> +int and;
> +int bitand;
> +int bitor;
> +int compl;
> +int not;
> +int or;
> +int xor;
> +#endif
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-24 Thread Nico Weber via cfe-commits
Reviewed here: https://reviews.llvm.org/D33505

Still, please make this warn.

On Wed, May 24, 2017 at 3:42 PM, Nico Weber  wrote:

> Was this reviewed somewhere?
>
> Please make it so that this emits a warning. We want clang-cl to warn on
> invalid code (and in system headers warnings are suppressed).
>
> On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: erichkeane
>> Date: Wed May 24 14:31:19 2017
>> New Revision: 303798
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=303798&view=rev
>> Log:
>> For Microsoft compatibility, set fno_operator_names
>>
>> There's a Microsoft header in the Windows SDK which won't
>> compile with clang because it uses an operator name (and)
>> as a field name. This patch allows that file to compile by
>> setting the option which disables operator names.
>> The header which doesn't compile  C:/Program Files (x86)/
>> Windows Kits/10/include/10.0.14393.0/um\Query.h:259:40:
>> error: expected member name or ';' after declaration specifiers
>>
>>   /* [case()] */ NODERESTRICTION or;
>>~~~ ^
>>
>>1 error generated.
>>
>> Contributed for Melanie Blower
>>
>> Differential Revision:https://reviews.llvm.org/D33505
>>
>> Modified:
>> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>> cfe/trunk/test/Parser/MicrosoftExtensions.cpp
>> cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp
>>
>> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/
>> CompilerInvocation.cpp?rev=303798&r1=303797&r2=303798&view=diff
>> 
>> ==
>> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
>> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed May 24 14:31:19
>> 2017
>> @@ -1882,7 +1882,7 @@ static void ParseLangArgs(LangOptions &O
>>Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords,
>> OPT_fno_gnu_keywords,
>>Opts.GNUKeywords);
>>
>> -  if (Args.hasArg(OPT_fno_operator_names))
>> +  if (Args.hasArg(OPT_fno_operator_names) ||
>> Args.hasArg(OPT_fms_compatibility))
>>  Opts.CXXOperatorNames = 0;
>>
>>if (Args.hasArg(OPT_fcuda_is_device))
>>
>> Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/Mi
>> crosoftExtensions.cpp?rev=303798&r1=303797&r2=303798&view=diff
>> 
>> ==
>> --- cfe/trunk/test/Parser/MicrosoftExtensions.cpp (original)
>> +++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp Wed May 24 14:31:19
>> 2017
>> @@ -261,9 +261,8 @@ int __identifier(else} = __identifier(fo
>>  #define identifier_weird(x) __identifier(x
>>  int k = identifier_weird(if)); // expected-error {{use of undeclared
>> identifier 'if'}}
>>
>> -// This is a bit weird, but the alternative tokens aren't keywords, and
>> this
>> -// behavior matches MSVC. FIXME: Consider supporting this anyway.
>> -extern int __identifier(and) r; // expected-error {{cannot convert '&&'
>> token to an identifier}}
>> +// 'and' is not an operator name with Microsoft compatibility.
>> +extern int __identifier(and) r; // expected-error {{expected ';' after
>> top level declarator}}
>>
>>  void f() {
>>__identifier(() // expected-error {{cannot convert '(' token to an
>> identifier}}
>> @@ -355,7 +354,6 @@ void TestProperty() {
>>++sp.V11;
>>  }
>>
>> -//expected-warning@+1 {{C++ operator 'and' (aka '&&') used as a macro
>> name}}
>>  #define and foo
>>
>>  struct __declspec(uuid("---C000-0046"))
>> __declspec(novtable) IUnknown {};
>>
>> Modified: cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preproces
>> sor/cxx_oper_keyword.cpp?rev=303798&r1=303797&r2=303798&view=diff
>> 
>> ==
>> --- cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp (original)
>> +++ cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp Wed May 24 14:31:19
>> 2017
>> @@ -1,5 +1,6 @@
>>  // RUN: %clang_cc1 %s -E -verify -DOPERATOR_NAMES
>>  // RUN: %clang_cc1 %s -E -verify -fno-operator-names
>> +// RUN: %clang_cc1 %s-verify -DTESTWIN -fms-compatibility
>>
>>  #ifndef OPERATOR_NAMES
>>  //expected-error@+3 {{token is not a valid binary operator in a
>> preprocessor subexpression}}
>> @@ -29,3 +30,14 @@
>>  #ifdef and
>>  #warning and is defined
>>  #endif
>> +
>> +#ifdef TESTWIN
>> +// For cl compatibility, fno-operator-names is enabled by default.
>> +int and;
>> +int bitand;
>> +int bitor;
>> +int compl;
>> +int not;
>> +int or;
>> +int xor;
>> +#endif
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>
_

RE: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Nico Weber via cfe-commits
In addition to this making clang-cl silently accept invalid code, it also
breaks existing valid code, building chromium now fails. Let's revert and
come up with something better asynchronously.

FAILED:
obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
E:\b\c\goma_client/gomacc.exe
../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo
/showIncludes /FC
@obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp
/c
../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp
/Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
/Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,7):
error: unknown type name 'definition' if (definition and
definition->Descriptor().LocalName() == desc.LocalName()) { ^
E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\custom\CustomElementRegistry.cpp(229,18):
error: variable declaration in condition must have an initializer if
(definition and definition->Descriptor().LocalName() == desc.LocalName()) {
^ 2 errors generated.

On May 24, 2017 4:01 PM, "Blower, Melanie"  wrote:

Thanks for the feedback, working on it…



*From:* Keane, Erich
*Sent:* Wednesday, May 24, 2017 3:47 PM
*To:* Nico Weber ; Blower, Melanie <
melanie.blo...@intel.com>

*Cc:* cfe-commits ; rnk 
*Subject:* RE: r303798 - For Microsoft compatibility, set fno_operator_names



Adding Melanie, the author of the patch.



*From:* tha...@google.com [mailto:tha...@google.com ] *On
Behalf Of *Nico Weber
*Sent:* Wednesday, May 24, 2017 12:43 PM
*To:* Keane, Erich 
*Cc:* cfe-commits ; rnk 
*Subject:* Re: r303798 - For Microsoft compatibility, set fno_operator_names



Reviewed here: https://reviews.llvm.org/D33505


Still, please make this warn.



On Wed, May 24, 2017 at 3:42 PM, Nico Weber  wrote:

Was this reviewed somewhere?



Please make it so that this emits a warning. We want clang-cl to warn on
invalid code (and in system headers warnings are suppressed).



On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

Author: erichkeane
Date: Wed May 24 14:31:19 2017
New Revision: 303798

URL: http://llvm.org/viewvc/llvm-project?rev=303798&view=rev
Log:
For Microsoft compatibility, set fno_operator_names

There's a Microsoft header in the Windows SDK which won't
compile with clang because it uses an operator name (and)
as a field name. This patch allows that file to compile by
setting the option which disables operator names.
The header which doesn't compile  C:/Program Files (x86)/
Windows Kits/10/include/10.0.14393.0/um\Query.h:259:40:
error: expected member name or ';' after declaration specifiers

  /* [case()] */ NODERESTRICTION or;
   ~~~ ^

   1 error generated.

Contributed for Melanie Blower

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

Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Parser/MicrosoftExtensions.cpp
cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/
Frontend/CompilerInvocation.cpp?rev=303798&r1=303797&r2=303798&view=diff

==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed May 24 14:31:19 2017
@@ -1882,7 +1882,7 @@ static void ParseLangArgs(LangOptions &O
   Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords,
   Opts.GNUKeywords);

-  if (Args.hasArg(OPT_fno_operator_names))
+  if (Args.hasArg(OPT_fno_operator_names) || Args.hasArg(OPT_fms_
compatibility))
 Opts.CXXOperatorNames = 0;

   if (Args.hasArg(OPT_fcuda_is_device))

Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/
MicrosoftExtensions.cpp?rev=303798&r1=303797&r2=303798&view=diff

==
--- cfe/trunk/test/Parser/MicrosoftExtensions.cpp (original)
+++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp Wed May 24 14:31:19 2017
@@ -261,9 +261,8 @@ int __identifier(else} = __identifier(fo
 #define identifier_weird(x) __identifier(x
 int k = identifier_weird(if)); // expected-error {{use of undeclared
identifier 'if'}}

-// This is a bit weird, but the alternative tokens aren't keywords, and
this
-// behavior matches MSVC. FIXME: Consider supporting this anyway.
-extern int __identifier(and) r; // expected-error {{cannot convert '&&'
token to an identifier}}
+// 'and' is not an operator name with Microsoft compatibility.
+extern int __identifier(and) r; // expected-error {{expected ';' after top
level declarator}}

 void f() {
   __identifier(() // expected-error {{cannot convert '(' t

Re: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Nico Weber via cfe-commits
On Thu, May 25, 2017 at 12:18 PM, Keane, Erich 
wrote:

> How does chromium compiler in CL?  It seems that it would have a similar
> problem here…
>

That's a good question! It looks like iso646.h is included, and in MSVC
that contains something like `#define and &&`. But clang's
lib/Headers/iso646.h assumes that the compiler provides this and doesn't
define `and`. So for the reland, that header would have to check if the
operator name is disabled, and if so, define it. (Or, better, maybe we can
come up with something more targeted for the system header, similar to e.g.
http://llvm.org/viewvc/llvm-project?view=revision&revision=212238)

Thanks for the revert!


>
>
> *From:* tha...@google.com [mailto:tha...@google.com] *On Behalf Of *Nico
> Weber
> *Sent:* Thursday, May 25, 2017 9:16 AM
> *To:* Blower, Melanie 
> *Cc:* rnk ; Keane, Erich ;
> cfe-commits ; Hans Wennborg  >
>
> *Subject:* RE: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> In addition to this making clang-cl silently accept invalid code, it also
> breaks existing valid code, building chromium now fails. Let's revert and
> come up with something better asynchronously.
>
>
>
> FAILED: obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
>
>
> E:\b\c\goma_client/gomacc.exe ../../third_party/llvm-build/R
> elease+Asserts/bin/clang-cl.exe /nologo /showIncludes /FC
> @obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp
> /c ../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp
> /Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
> /Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
>
> E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\cu
> stom\CustomElementRegistry.cpp(229,7):  error: unknown type name
> 'definition'
>
>   if (definition and definition->Descriptor().LocalName() ==
> desc.LocalName()) {
>
>   ^
>
> E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\cu
> stom\CustomElementRegistry.cpp(229,18):  error: variable declaration in
> condition must have an initializer
>
>   if (definition and definition->Descriptor().LocalName() ==
> desc.LocalName()) {
>
>  ^
>
> 2 errors generated.
>
>
>
>
>
> On May 24, 2017 4:01 PM, "Blower, Melanie" 
> wrote:
>
> Thanks for the feedback, working on it…
>
>
>
> *From:* Keane, Erich
> *Sent:* Wednesday, May 24, 2017 3:47 PM
> *To:* Nico Weber ; Blower, Melanie <
> melanie.blo...@intel.com>
>
>
> *Cc:* cfe-commits ; rnk 
>
> *Subject:* RE: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> Adding Melanie, the author of the patch.
>
>
>
> *From:* tha...@google.com [mailto:tha...@google.com ] *On
> Behalf Of *Nico Weber
> *Sent:* Wednesday, May 24, 2017 12:43 PM
> *To:* Keane, Erich 
> *Cc:* cfe-commits ; rnk 
> *Subject:* Re: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> Reviewed here: https://reviews.llvm.org/D33505
>
>
> Still, please make this warn.
>
>
>
> On Wed, May 24, 2017 at 3:42 PM, Nico Weber  wrote:
>
> Was this reviewed somewhere?
>
>
>
> Please make it so that this emits a warning. We want clang-cl to warn on
> invalid code (and in system headers warnings are suppressed).
>
>
>
> On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: erichkeane
> Date: Wed May 24 14:31:19 2017
> New Revision: 303798
>
> URL: http://llvm.org/viewvc/llvm-project?rev=303798&view=rev
> Log:
> For Microsoft compatibility, set fno_operator_names
>
> There's a Microsoft header in the Windows SDK which won't
> compile with clang because it uses an operator name (and)
> as a field name. This patch allows that file to compile by
> setting the option which disables operator names.
> The header which doesn't compile  C:/Program Files (x86)/
> Windows Kits/10/include/10.0.14393.0/um\Query.h:259:40:
> error: expected member name or ';' after declaration specifiers
>
>   /* [case()] */ NODERESTRICTION or;
>~~~ ^
>
>1 error generated.
>
> Contributed for Melanie Blower
>
> Differential Revision:https://reviews.llvm.org/D33505
>
> Modified:
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/test/Parser/MicrosoftExtensions.cpp
> cfe/trunk/test/Preprocessor/cxx_oper_keyword.cpp
>
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/
> CompilerInvocation.cpp?rev=303798&r1=303797&r2=303798&view=diff
> 
> ==
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed May 24 14:31:19 2017
> @@ -1882,7 +1882,7 @@ static void ParseLangArgs(LangOptions &O
>Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords,
> OPT_fno_gnu_keywords,
>Opts.GNUKeywords);
>
> -  if (Args.hasArg(OPT_fno_

Re: r303798 - For Microsoft compatibility, set fno_operator_names

2017-05-25 Thread Nico Weber via cfe-commits
Among the goals of the clang-cl project are a) being able to parse MS
system headers b) helper users to write standards-compliant C++ (in
particular, if your code builds with clang-cl without warnings, it'd be
good if it also built with regular clang then).

The regular change plus header change plus warning would be one way to
achieve this, yes.

On Thu, May 25, 2017 at 1:01 PM, Keane, Erich  wrote:

> No problem, I definitely think it was the right choice.
>
>
>
> A change that contains all of what Melanie’s original patch did, plus the
> Header changes (plus the clang-tidy fixes that came out of this) would be
> acceptable?
>
>
>
> Also, I believe she’s working on the warning as well.  We were discussing
> it, and I was thinking that if we track down where the
> operator-identification is done (hints as to where that is is appreciated),
> that we could simply warn if the user is using one of the Operators with
> operators off.  The warning itself could then be suppressed if necessary.
>
>
>
> Thoughts?
>
>
>
>
>
> *From:* Nico Weber [mailto:tha...@google.com]
> *Sent:* Thursday, May 25, 2017 9:56 AM
> *To:* Keane, Erich 
> *Cc:* Blower, Melanie ; rnk ;
> cfe-commits ; Hans Wennborg  >
>
> *Subject:* Re: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> On Thu, May 25, 2017 at 12:18 PM, Keane, Erich 
> wrote:
>
> How does chromium compiler in CL?  It seems that it would have a similar
> problem here…
>
>
>
> That's a good question! It looks like iso646.h is included, and in MSVC
> that contains something like `#define and &&`. But clang's
> lib/Headers/iso646.h assumes that the compiler provides this and doesn't
> define `and`. So for the reland, that header would have to check if the
> operator name is disabled, and if so, define it. (Or, better, maybe we can
> come up with something more targeted for the system header, similar to e.g.
> http://llvm.org/viewvc/llvm-project?view=revision&revision=212238)
>
>
>
> Thanks for the revert!
>
>
>
>
>
> *From:* tha...@google.com [mailto:tha...@google.com] *On Behalf Of *Nico
> Weber
> *Sent:* Thursday, May 25, 2017 9:16 AM
> *To:* Blower, Melanie 
> *Cc:* rnk ; Keane, Erich ;
> cfe-commits ; Hans Wennborg  >
>
>
> *Subject:* RE: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> In addition to this making clang-cl silently accept invalid code, it also
> breaks existing valid code, building chromium now fails. Let's revert and
> come up with something better asynchronously.
>
>
>
> FAILED: obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
>
>
> E:\b\c\goma_client/gomacc.exe ../../third_party/llvm-build/
> Release+Asserts/bin/clang-cl.exe /nologo /showIncludes /FC
> @obj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj.rsp
> /c ../../third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp
> /Foobj/third_party/WebKit/Source/core/dom/dom/CustomElementRegistry.obj
> /Fd"obj/third_party/WebKit/Source/core/dom/dom_cc.pdb"
>
> E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\
> custom\CustomElementRegistry.cpp(229,7):  error: unknown type name
> 'definition'
>
>   if (definition and definition->Descriptor().LocalName() ==
> desc.LocalName()) {
>
>   ^
>
> E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\dom\
> custom\CustomElementRegistry.cpp(229,18):  error: variable declaration in
> condition must have an initializer
>
>   if (definition and definition->Descriptor().LocalName() ==
> desc.LocalName()) {
>
>  ^
>
> 2 errors generated.
>
>
>
>
>
> On May 24, 2017 4:01 PM, "Blower, Melanie" 
> wrote:
>
> Thanks for the feedback, working on it…
>
>
>
> *From:* Keane, Erich
> *Sent:* Wednesday, May 24, 2017 3:47 PM
> *To:* Nico Weber ; Blower, Melanie <
> melanie.blo...@intel.com>
>
>
> *Cc:* cfe-commits ; rnk 
>
> *Subject:* RE: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> Adding Melanie, the author of the patch.
>
>
>
> *From:* tha...@google.com [mailto:tha...@google.com ] *On
> Behalf Of *Nico Weber
> *Sent:* Wednesday, May 24, 2017 12:43 PM
> *To:* Keane, Erich 
> *Cc:* cfe-commits ; rnk 
> *Subject:* Re: r303798 - For Microsoft compatibility, set
> fno_operator_names
>
>
>
> Reviewed here: https://reviews.llvm.org/D33505
>
>
> Still, please make this warn.
>
>
>
> On Wed, May 24, 2017 at 3:42 PM, Nico Weber  wrote:
>
> Was this reviewed somewhere?
>
>
>
> Please make it so that this emits a warning. We want clang-cl to warn on
> invalid code (and in system headers warnings are suppressed).
>
>
>
> On Wed, May 24, 2017 at 3:31 PM, Erich Keane via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: erichkeane
> Date: Wed May 24 14:31:19 2017
> New Revision: 303798
>
> URL: http://llvm.org/viewvc/llvm-project?rev=303798&view=rev
> Log:
> For Microsoft compatibility, set fno_operator_names
>
> There's a Microsoft header in the Windows SDK which won't
> compile with clang because it uses an operator name (and)
> a

r326355 - Fix gcc -Wreturn-type warnings after r326307.

2018-02-28 Thread Nico Weber via cfe-commits
Author: nico
Date: Wed Feb 28 11:28:47 2018
New Revision: 326355

URL: http://llvm.org/viewvc/llvm-project?rev=326355&view=rev
Log:
Fix gcc -Wreturn-type warnings after r326307.

Modified:
cfe/trunk/lib/CodeGen/CGBlocks.cpp

Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=326355&r1=326354&r2=326355&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Wed Feb 28 11:28:47 2018
@@ -1595,6 +1595,7 @@ computeCopyInfoForBlockCapture(const Blo
 return std::make_pair(BlockCaptureEntityKind::None, BlockFieldFlags());
   }
   }
+  llvm_unreachable("after exhaustive PrimitiveCopyKind switch");
 }
 
 /// Find the set of block captures that need to be explicitly copied or 
destroy.
@@ -1797,6 +1798,7 @@ computeDestroyInfoForBlockCapture(const
 return std::make_pair(BlockCaptureEntityKind::None, BlockFieldFlags());
   }
   }
+  llvm_unreachable("after exhaustive DestructionKind switch");
 }
 
 /// Generate the destroy-helper function for a block closure object:


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r326357 - [clang-cl] Implement /X

2018-02-28 Thread Nico Weber via cfe-commits
Author: nico
Date: Wed Feb 28 11:49:07 2018
New Revision: 326357

URL: http://llvm.org/viewvc/llvm-project?rev=326357&view=rev
Log:
[clang-cl] Implement /X

/X makes cl stop looking in %INCLUDE%. Implement this for clang-cl.

As it turns out, the return in ToolChains/MSVC.cpp, AddClangSystemIncludeArgs()
for -nostdlibinc is already in the right place (but -nostdlibinc isn't exposed
by clang-cl), so just alias /X to that.

https://reviews.llvm.org/D43888

Modified:
cfe/trunk/include/clang/Driver/CLCompatOptions.td
cfe/trunk/test/Driver/cl-include.c

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=326357&r1=326356&r2=326357&view=diff
==
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Wed Feb 28 11:49:07 2018
@@ -166,6 +166,9 @@ def _SLASH_wd4996 : CLFlag<"wd4996">, Al
   AliasArgs<["no-deprecated-declarations"]>;
 def _SLASH_vd : CLJoined<"vd">, HelpText<"Control vtordisp placement">,
   Alias;
+def _SLASH_X : CLFlag<"X">,
+  HelpText<"Don't add %INCLUDE% to the include search path">,
+  Alias;
 def _SLASH_Zc_sizedDealloc : CLFlag<"Zc:sizedDealloc">,
   HelpText<"Enable C++14 sized global deallocation functions">,
   Alias;
@@ -388,7 +391,6 @@ def _SLASH_u : CLFlag<"u">;
 def _SLASH_V : CLFlag<"V">;
 def _SLASH_WL : CLFlag<"WL">;
 def _SLASH_Wp64 : CLFlag<"Wp64">;
-def _SLASH_X : CLFlag<"X">;
 def _SLASH_Yd : CLFlag<"Yd">;
 def _SLASH_Yl : CLJoined<"Yl">;
 def _SLASH_Za : CLFlag<"Za">;

Modified: cfe/trunk/test/Driver/cl-include.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-include.c?rev=326357&r1=326356&r2=326357&view=diff
==
--- cfe/trunk/test/Driver/cl-include.c (original)
+++ cfe/trunk/test/Driver/cl-include.c Wed Feb 28 11:49:07 2018
@@ -10,5 +10,16 @@
 // RUN: env INCLUDE=/my/system/inc %clang_cl -### -- %s 2>&1 | FileCheck %s 
--check-prefix=STDINC
 // STDINC: "-internal-isystem" "/my/system/inc"
 
-// RUN: env INCLUDE=/my/system/inc %clang_cl -nostdinc -### -- %s 2>&1 | 
FileCheck %s --check-prefix=NOSTDINC
+// -nostdinc suppresses all of %INCLUDE%, clang resource dirs, and -imsvc dirs.
+// RUN: env INCLUDE=/my/system/inc %clang_cl -nostdinc -imsvc /my/other/inc 
-### -- %s 2>&1 | FileCheck %s --check-prefix=NOSTDINC
+// NOSTDINC: argument unused{{.*}}-imsvc
 // NOSTDINC-NOT: "-internal-isystem" "/my/system/inc"
+// NOSTDINC-NOT: "-internal-isystem" "{{.*}}/lib/clang/{{.*}}/include"
+// NOSTDINC-NOT: "-internal-isystem" "/my/other/inc"
+
+// /X suppresses %INCLUDE% but not clang resource dirs or -imsvc dirs.
+// RUN: env INCLUDE=/my/system/inc %clang_cl /X -imsvc /my/other/inc -### -- 
%s 2>&1 | FileCheck %s --check-prefix=SLASHX
+// SLASHX-NOT: "argument unused{{.*}}-imsvc"
+// SLASHX-NOT: "-internal-isystem" "/my/system/inc"
+// SLASHX: "-internal-isystem" "{{.*}}/lib/clang/{{.*}}/include"
+// SLASHX: "-internal-isystem" "/my/other/inc"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r326370 - Attempt to fix cl-include.c on Windows.

2018-02-28 Thread Nico Weber via cfe-commits
Author: nico
Date: Wed Feb 28 12:58:06 2018
New Revision: 326370

URL: http://llvm.org/viewvc/llvm-project?rev=326370&view=rev
Log:
Attempt to fix cl-include.c on Windows.

Modified:
cfe/trunk/test/Driver/cl-include.c

Modified: cfe/trunk/test/Driver/cl-include.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-include.c?rev=326370&r1=326369&r2=326370&view=diff
==
--- cfe/trunk/test/Driver/cl-include.c (original)
+++ cfe/trunk/test/Driver/cl-include.c Wed Feb 28 12:58:06 2018
@@ -14,12 +14,12 @@
 // RUN: env INCLUDE=/my/system/inc %clang_cl -nostdinc -imsvc /my/other/inc 
-### -- %s 2>&1 | FileCheck %s --check-prefix=NOSTDINC
 // NOSTDINC: argument unused{{.*}}-imsvc
 // NOSTDINC-NOT: "-internal-isystem" "/my/system/inc"
-// NOSTDINC-NOT: "-internal-isystem" "{{.*}}/lib/clang/{{.*}}/include"
+// NOSTDINC-NOT: "-internal-isystem" "{{.*lib.*clang.*include}}"
 // NOSTDINC-NOT: "-internal-isystem" "/my/other/inc"
 
 // /X suppresses %INCLUDE% but not clang resource dirs or -imsvc dirs.
 // RUN: env INCLUDE=/my/system/inc %clang_cl /X -imsvc /my/other/inc -### -- 
%s 2>&1 | FileCheck %s --check-prefix=SLASHX
 // SLASHX-NOT: "argument unused{{.*}}-imsvc"
 // SLASHX-NOT: "-internal-isystem" "/my/system/inc"
-// SLASHX: "-internal-isystem" "{{.*}}/lib/clang/{{.*}}/include"
+// SLASHX: "-internal-isystem" "{{.*lib.*clang.*include}}"
 // SLASHX: "-internal-isystem" "/my/other/inc"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r326434 - UsersManual: beef up the clang-cl text a little

2018-03-01 Thread Nico Weber via cfe-commits
Should we also mention /p:CLToolExe for just swapping out the compiler
without using a full toolset?

Also, should we include some notes on cmake usage? I.e. -G "Visual Studio
14 2015" -T "LLVM-vs2014" for the MSVS generator,
and -DCMAKE_C_COMPILER=/path/to/llvm/bin/clang-cl.exe
-DCMAKE_CXX_COMPILER=/path/to/llvm/bin/clang-cl.exe for the ninja
generator? (Don't know if -T works with ninja and/or setting
CMAKE_C(XX)_COMPILER works for msvc.)

I haven't tested either of these recently, but they all worked at some
point and all were useful at some point.

On Thu, Mar 1, 2018 at 9:00 AM, Hans Wennborg via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: hans
> Date: Thu Mar  1 06:00:19 2018
> New Revision: 326434
>
> URL: http://llvm.org/viewvc/llvm-project?rev=326434&view=rev
> Log:
> UsersManual: beef up the clang-cl text a little
>
> Modified:
> cfe/trunk/docs/UsersManual.rst
>
> Modified: cfe/trunk/docs/UsersManual.rst
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/
> UsersManual.rst?rev=326434&r1=326433&r2=326434&view=diff
> 
> ==
> --- cfe/trunk/docs/UsersManual.rst (original)
> +++ cfe/trunk/docs/UsersManual.rst Thu Mar  1 06:00:19 2018
> @@ -2684,10 +2684,20 @@ compatibility with the Visual C++ compil
>  To enable clang-cl to find system headers, libraries, and the linker when
> run
>  from the command-line, it should be executed inside a Visual Studio
> Native Tools
>  Command Prompt or a regular Command Prompt where the environment has been
> set
> -up using e.g. `vcvars32.bat  us/library/f2ccy3wt.aspx>`_.
> +up using e.g. `vcvarsall.bat  us/library/f2ccy3wt.aspx>`_.
> +
> +clang-cl can also be used from inside Visual Studio by selecting the LLVM
> +Platform Toolset. The toolset is installed by the LLVM installer, which
> can be
> +downloaded from the `LLVM release `_
> or
> +`snapshot build `_ web pages. To use the
> toolset,
> +select a project in Solution Explorer, open its Property Page (Alt+F7),
> and in
> +the "General" section of "Configuration Properties" change "Platform
> Toolset"
> +to e.g. LLVM-vs2014.
> +
> +To use the toolset with MSBuild directly, invoke it with e.g.
> +``/p:PlatformToolset=LLVM-vs2014``. This allows trying out the clang-cl
> +toolchain without modifying your project files.
>
> -clang-cl can also be used from inside Visual Studio by using an LLVM
> Platform
> -Toolset.
>
>  Command-Line Options
>  
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r326141 - Re-land "Emit proper CodeView when -gcodeview is passed without the cl driver."

2018-03-01 Thread Nico Weber via cfe-commits
Should we key the default off the triple? (I thought that what was the
patch did, but I misread.) I.e. with an MSVC triple, default to emitting
codeview?

On Mon, Feb 26, 2018 at 5:55 PM, Reid Kleckner via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rnk
> Date: Mon Feb 26 14:55:33 2018
> New Revision: 326141
>
> URL: http://llvm.org/viewvc/llvm-project?rev=326141&view=rev
> Log:
> Re-land "Emit proper CodeView when -gcodeview is passed without the cl
> driver."
>
> Reverts r326116 and re-lands r326113 with a fix to ASan so that it
> enables column info in its test suite.
>
> Added:
> cfe/trunk/test/Driver/codeview-column-info.c
> Modified:
> cfe/trunk/lib/Driver/ToolChains/Clang.cpp
>
> Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
> ToolChains/Clang.cpp?rev=326141&r1=326140&r2=326141&view=diff
> 
> ==
> --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Mon Feb 26 14:55:33 2018
> @@ -2968,7 +2968,7 @@ static void RenderDebugOptions(const Too
>
>// Forward -gcodeview. EmitCodeView might have been set by
> CL-compatibility
>// argument parsing.
> -  if (Args.hasArg(options::OPT_gcodeview) || EmitCodeView) {
> +  if (EmitCodeView) {
>  // DWARFVersion remains at 0 if no explicit choice was made.
>  CmdArgs.push_back("-gcodeview");
>} else if (DWARFVersion == 0 &&
> @@ -3567,6 +3567,8 @@ void Clang::ConstructJob(Compilation &C,
>types::ID InputType = Input.getType();
>if (D.IsCLMode())
>  AddClangCLArgs(Args, InputType, CmdArgs, &DebugInfoKind,
> &EmitCodeView);
> +  else
> +EmitCodeView = Args.hasArg(options::OPT_gcodeview);
>
>const Arg *SplitDWARFArg = nullptr;
>RenderDebugOptions(getToolChain(), D, RawTriple, Args, EmitCodeView,
>
> Added: cfe/trunk/test/Driver/codeview-column-info.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/
> codeview-column-info.c?rev=326141&view=auto
> 
> ==
> --- cfe/trunk/test/Driver/codeview-column-info.c (added)
> +++ cfe/trunk/test/Driver/codeview-column-info.c Mon Feb 26 14:55:33 2018
> @@ -0,0 +1,13 @@
> +// Check that -dwarf-column-info does not get added to the cc1 line:
> +// 1) When -gcodeview is present via the clang or clang++ driver
> +// 2) When /Z7 is present via the cl driver.
> +
> +// RUN: %clang -### -c -g -gcodeview %s 2> %t1
> +// RUN: FileCheck < %t1 %s
> +// RUN: %clangxx -### -c -g -gcodeview %s 2> %t2
> +// RUN: FileCheck < %t2 %s
> +// RUN: %clang_cl -### /c /Z7 %s 2> %t2
> +// RUN: FileCheck < %t2 %s
> +
> +// CHECK: "-cc1"
> +// CHECK-NOT: "-dwarf-column-info"
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r326622 - Don't claim that va_start has special semantic checks

2018-03-03 Thread Nico Weber via cfe-commits
The 't' was there because __builtin_va_start and __va_start had them, but
those do in fact have custom sema checking so copying that was in fact
incorrect. Thanks for fixing my bugs!

On Fri, Mar 2, 2018 at 4:41 PM, Reid Kleckner via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rnk
> Date: Fri Mar  2 13:41:08 2018
> New Revision: 326622
>
> URL: http://llvm.org/viewvc/llvm-project?rev=326622&view=rev
> Log:
> Don't claim that va_start has special semantic checks
>
> We don't have special checks for BI_va_start in
> Sema::CheckBuiltinFunctionCall, so setting the 't' flag for va_start in
> Builtins.def disables semantic checking for it. That's not desired, and
> IRGen crashes when it tries to generate a call to va_start that doesn't
> have at least one argument.
>
> Follow-up to r322573
>
> Fixes PR36565
>
> Modified:
> cfe/trunk/include/clang/Basic/Builtins.def
> cfe/trunk/test/Sema/varargs.c
>
> Modified: cfe/trunk/include/clang/Basic/Builtins.def
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Basic/Builtins.def?rev=326622&r1=326621&r2=326622&view=diff
> 
> ==
> --- cfe/trunk/include/clang/Basic/Builtins.def (original)
> +++ cfe/trunk/include/clang/Basic/Builtins.def Fri Mar  2 13:41:08 2018
> @@ -803,7 +803,7 @@ LIBBUILTIN(_setjmpex, "iJ", "fj",   "set
>
>  // C99 library functions
>  // C99 stdarg.h
> -LIBBUILTIN(va_start, "vA.",   "fnt",   "stdarg.h", ALL_LANGUAGES)
> +LIBBUILTIN(va_start, "vA.",   "fn","stdarg.h", ALL_LANGUAGES)
>  LIBBUILTIN(va_end, "vA",  "fn","stdarg.h", ALL_LANGUAGES)
>  LIBBUILTIN(va_copy, "vAA","fn","stdarg.h", ALL_LANGUAGES)
>  // C99 stdlib.h
>
> Modified: cfe/trunk/test/Sema/varargs.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/
> varargs.c?rev=326622&r1=326621&r2=326622&view=diff
> 
> ==
> --- cfe/trunk/test/Sema/varargs.c (original)
> +++ cfe/trunk/test/Sema/varargs.c Fri Mar  2 13:41:08 2018
> @@ -112,3 +112,12 @@ void f13(enum E1 e, ...) {
>  #endif
>__builtin_va_end(va);
>  }
> +
> +void f14(int e, ...) {
> +  // expected-warning@+3 {{implicitly declaring library function
> 'va_start'}}
> +  // expected-note@+2 {{include the header }}
> +  // expected-error@+1 {{too few arguments to function call}}
> +  va_start();
> +  __builtin_va_list va;
> +  va_start(va, e);
> +}
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r326665 - Create a subject list for the `used` attribute rather than use custom checking logic.

2018-03-03 Thread Nico Weber via cfe-commits
Is it easy to mention variables first in the diag? That's probably the most
common subject for this attribute. (If it's not easy, nevermind --
definitely a polish thing.)

On Sat, Mar 3, 2018, 4:04 PM Aaron Ballman via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: aaronballman
> Date: Sat Mar  3 13:02:09 2018
> New Revision: 326665
>
> URL: http://llvm.org/viewvc/llvm-project?rev=326665&view=rev
> Log:
> Create a subject list for the `used` attribute rather than use custom
> checking logic.
>
> This changes the diagnostic wording somewhat, but otherwise intends no
> functional change to the attribute.
>
> Modified:
> cfe/trunk/include/clang/Basic/Attr.td
> cfe/trunk/lib/Sema/SemaDeclAttr.cpp
> cfe/trunk/test/Sema/attr-used.c
>
> Modified: cfe/trunk/include/clang/Basic/Attr.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=326665&r1=326664&r2=326665&view=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/Attr.td (original)
> +++ cfe/trunk/include/clang/Basic/Attr.td Sat Mar  3 13:02:09 2018
> @@ -83,6 +83,9 @@ def LocalVar : SubsetSubject  def NonParmVar : SubsetSubject [{S->getKind() != Decl::ParmVar}],
> "variables">;
> +def NonLocalVar : SubsetSubject +[{!S->hasLocalStorage()}],
> +"variables with non-local storage">;
>  def NonBitField : SubsetSubject  [{!S->isBitField()}],
>  "non-bit-field non-static data members">;
> @@ -2007,6 +2010,7 @@ def Unused : InheritableAttr {
>
>  def Used : InheritableAttr {
>let Spellings = [GCC<"used">];
> +  let Subjects = SubjectList<[Function, ObjCMethod, NonLocalVar]>;
>let Documentation = [Undocumented];
>  }
>
>
> Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=326665&r1=326664&r2=326665&view=diff
>
> ==
> --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Sat Mar  3 13:02:09 2018
> @@ -2086,23 +2086,6 @@ static void handleDisableTailCallsAttr(S
>AL.getRange(), S.Context, AL.getAttributeSpellingListIndex()));
>  }
>
> -static void handleUsedAttr(Sema &S, Decl *D, const AttributeList &AL) {
> -  if (const auto *VD = dyn_cast(D)) {
> -if (VD->hasLocalStorage()) {
> -  S.Diag(AL.getLoc(), diag::warn_attribute_ignored) << AL.getName();
> -  return;
> -}
> -  } else if (!isFunctionOrMethod(D)) {
> -S.Diag(AL.getLoc(), diag::warn_attribute_wrong_decl_type)
> -  << AL.getName() << ExpectedVariableOrFunction;
> -return;
> -  }
> -
> -  D->addAttr(::new (S.Context)
> - UsedAttr(AL.getRange(), S.Context,
> -  AL.getAttributeSpellingListIndex()));
> -}
> -
>  static void handleUnusedAttr(Sema &S, Decl *D, const AttributeList &AL) {
>bool IsCXX17Attr = AL.isCXX11Attribute() && !AL.getScopeName();
>
> @@ -6248,7 +6231,7 @@ static void ProcessDeclAttribute(Sema &S
>  handleDisableTailCallsAttr(S, D, AL);
>  break;
>case AttributeList::AT_Used:
> -handleUsedAttr(S, D, AL);
> +handleSimpleAttribute(S, D, AL);
>  break;
>case AttributeList::AT_Visibility:
>  handleVisibilityAttr(S, D, AL, false);
>
> Modified: cfe/trunk/test/Sema/attr-used.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-used.c?rev=326665&r1=326664&r2=326665&view=diff
>
> ==
> --- cfe/trunk/test/Sema/attr-used.c (original)
> +++ cfe/trunk/test/Sema/attr-used.c Sat Mar  3 13:02:09 2018
> @@ -3,7 +3,7 @@
>  extern int l0 __attribute__((used)); // expected-warning {{'used'
> attribute ignored}}
>  __private_extern__ int l1 __attribute__((used)); // expected-warning
> {{'used' attribute ignored}}
>
> -struct __attribute__((used)) s { // expected-warning {{'used' attribute
> only applies to variables and functions}}
> +struct __attribute__((used)) s { // expected-warning {{'used' attribute
> only applies to functions, Objective-C methods, and variables with
> non-local storage}}
>int x;
>  };
>
> @@ -14,7 +14,7 @@ static void __attribute__((used)) f0(voi
>
>  void f1() {
>static int a __attribute__((used));
> -  int b __attribute__((used)); // expected-warning {{'used' attribute
> ignored}}
> +  int b __attribute__((used)); // expected-warning {{'used' attribute
> only applies to functions, Objective-C methods, and variables with
> non-local storage}}
>  }
>
>  static void __attribute__((used)) f0(void);
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
_

Re: r326676 - Amend r326665 to print out the `used` attribute subjects in a different order.

2018-03-04 Thread Nico Weber via cfe-commits
Awesome, thanks!

On Sun, Mar 4, 2018, 11:26 AM Aaron Ballman via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: aaronballman
> Date: Sun Mar  4 08:24:10 2018
> New Revision: 326676
>
> URL: http://llvm.org/viewvc/llvm-project?rev=326676&view=rev
> Log:
> Amend r326665 to print out the `used` attribute subjects in a different
> order.
>
> Modified:
> cfe/trunk/include/clang/Basic/Attr.td
> cfe/trunk/test/Sema/attr-used.c
>
> Modified: cfe/trunk/include/clang/Basic/Attr.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=326676&r1=326675&r2=326676&view=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/Attr.td (original)
> +++ cfe/trunk/include/clang/Basic/Attr.td Sun Mar  4 08:24:10 2018
> @@ -2010,7 +2010,7 @@ def Unused : InheritableAttr {
>
>  def Used : InheritableAttr {
>let Spellings = [GCC<"used">];
> -  let Subjects = SubjectList<[Function, ObjCMethod, NonLocalVar]>;
> +  let Subjects = SubjectList<[NonLocalVar, Function, ObjCMethod]>;
>let Documentation = [Undocumented];
>  }
>
>
> Modified: cfe/trunk/test/Sema/attr-used.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-used.c?rev=326676&r1=326675&r2=326676&view=diff
>
> ==
> --- cfe/trunk/test/Sema/attr-used.c (original)
> +++ cfe/trunk/test/Sema/attr-used.c Sun Mar  4 08:24:10 2018
> @@ -3,7 +3,7 @@
>  extern int l0 __attribute__((used)); // expected-warning {{'used'
> attribute ignored}}
>  __private_extern__ int l1 __attribute__((used)); // expected-warning
> {{'used' attribute ignored}}
>
> -struct __attribute__((used)) s { // expected-warning {{'used' attribute
> only applies to functions, Objective-C methods, and variables with
> non-local storage}}
> +struct __attribute__((used)) s { // expected-warning {{'used' attribute
> only applies to variables with non-local storage, functions, and
> Objective-C methods}}
>int x;
>  };
>
> @@ -14,7 +14,7 @@ static void __attribute__((used)) f0(voi
>
>  void f1() {
>static int a __attribute__((used));
> -  int b __attribute__((used)); // expected-warning {{'used' attribute
> only applies to functions, Objective-C methods, and variables with
> non-local storage}}
> +  int b __attribute__((used)); // expected-warning {{'used' attribute
> only applies to variables with non-local storage, functions, and
> Objective-C methods}}
>  }
>
>  static void __attribute__((used)) f0(void);
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r326862 - Revert r326602, it caused PR36620.

2018-03-06 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Mar  6 18:22:41 2018
New Revision: 326862

URL: http://llvm.org/viewvc/llvm-project?rev=326862&view=rev
Log:
Revert r326602, it caused PR36620.

Removed:
cfe/trunk/test/Sema/attr-ownership.cpp
Modified:
cfe/trunk/include/clang/AST/Attr.h
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp
cfe/trunk/test/CodeGenCXX/alloc-size.cpp
cfe/trunk/test/Misc/ast-dump-attr.cpp
cfe/trunk/test/Sema/attr-print.cpp
cfe/trunk/test/Sema/error-type-safety.cpp
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/include/clang/AST/Attr.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Attr.h?rev=326862&r1=326861&r2=326862&view=diff
==
--- cfe/trunk/include/clang/AST/Attr.h (original)
+++ cfe/trunk/include/clang/AST/Attr.h Tue Mar  6 18:22:41 2018
@@ -195,120 +195,6 @@ public:
}
 };
 
-/// A single parameter index whose accessors require each use to make explicit
-/// the parameter index encoding needed.
-class ParamIdx {
-  // Idx is exposed only via accessors that specify specific encodings.
-  unsigned Idx : 30;
-  unsigned HasThis : 1;
-  unsigned IsValid : 1;
-
-  void assertComparable(const ParamIdx &I) const {
-assert(isValid() && I.isValid() &&
-   "ParamIdx must be valid to be compared");
-// It's possible to compare indices from separate functions, but so far
-// it's not proven useful.  Moreover, it might be confusing because a
-// comparison on the results of getASTIndex might be inconsistent with a
-// comparison on the ParamIdx objects themselves.
-assert(HasThis == I.HasThis &&
-   "ParamIdx must be for the same function to be compared");
-  }
-
-public:
-  /// Construct an invalid parameter index (\c isValid returns false and
-  /// accessors fail an assert).
-  ParamIdx() : Idx(0), HasThis(false), IsValid(false) {}
-
-  /// \param Idx is the parameter index as it is normally specified in
-  /// attributes in the source: one-origin including any C++ implicit this
-  /// parameter.
-  ///
-  /// \param D is the declaration containing the parameters.  It is used to
-  /// determine if there is a C++ implicit this parameter.
-  ParamIdx(unsigned Idx, const Decl *D)
-  : Idx(Idx), HasThis(false), IsValid(true) {
-if (const auto *FD = dyn_cast(D))
-  HasThis = FD->isCXXInstanceMember();
-  }
-
-  /// \param Idx is the parameter index as it is normally specified in
-  /// attributes in the source: one-origin including any C++ implicit this
-  /// parameter.
-  ///
-  /// \param HasThis specifies whether the function has a C++ implicit this
-  /// parameter.
-  ParamIdx(unsigned Idx, bool HasThis)
-  : Idx(Idx), HasThis(HasThis), IsValid(true) {}
-
-  /// Is this parameter index valid?
-  bool isValid() const { return IsValid; }
-
-  /// Is there a C++ implicit this parameter?
-  bool hasThis() const {
-assert(isValid() && "ParamIdx must be valid");
-return HasThis;
-  }
-
-  /// Get the parameter index as it would normally be encoded for attributes at
-  /// the source level of representation: one-origin including any C++ implicit
-  /// this parameter.
-  ///
-  /// This encoding thus makes sense for diagnostics, pretty printing, and
-  /// constructing new attributes from a source-like specification.
-  unsigned getSourceIndex() const {
-assert(isValid() && "ParamIdx must be valid");
-return Idx;
-  }
-
-  /// Get the parameter index as it would normally be encoded at the AST level
-  /// of representation: zero-origin not including any C++ implicit this
-  /// parameter.
-  ///
-  /// This is the encoding primarily used in Sema.  However, in diagnostics,
-  /// Sema uses \c getSourceIndex instead.
-  unsigned getASTIndex() const {
-assert(isValid() && "ParamIdx must be valid");
-assert(Idx >= 1 + HasThis &&
-   "stored index must be base-1 and not specify C++ implicit this");
-return Idx - 1 - HasThis;
-  }
-
-  /// Get the parameter index as it would normally be encoded at the LLVM level
-  /// of representation: zero-origin including any C++ implicit this parameter.
-  ///
-  /// This is the encoding primarily used in CodeGen.
-  unsigned getLLVMIndex() const {
-assert(isValid() && "ParamIdx must be valid");
-assert(Idx >= 1 && "stored index must be base-1");
-return Idx - 1;
-  }
-
-  bool operator==(const ParamIdx &I) const {
-assertComparable(I);
-return Idx == I.Idx;
-  }
-  bool operator!=(const ParamIdx &I) const {
-assertComparable(I);
-return Idx != I.Idx;
-  }
-  bo

Re: r326860 - [Driver] Automatically disable incompatible default sanitizers

2018-03-06 Thread Nico Weber via cfe-commits
Test? (Also below)

On Tue, Mar 6, 2018 at 8:27 PM, Petr Hosek via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: phosek
> Date: Tue Mar  6 17:27:03 2018
> New Revision: 326860
>
> URL: http://llvm.org/viewvc/llvm-project?rev=326860&view=rev
> Log:
> [Driver] Automatically disable incompatible default sanitizers
>
> When a sanitizer incompatible with one of the default sanitizers
> is explicitly enabled, automatically disable all the conflicting
> default sanitizers.
>
> Differential Revision: https://reviews.llvm.org/D44064
>
> Modified:
> cfe/trunk/lib/Driver/SanitizerArgs.cpp
>
> Modified: cfe/trunk/lib/Driver/SanitizerArgs.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
> SanitizerArgs.cpp?rev=326860&r1=326859&r2=326860&view=diff
> 
> ==
> --- cfe/trunk/lib/Driver/SanitizerArgs.cpp (original)
> +++ cfe/trunk/lib/Driver/SanitizerArgs.cpp Tue Mar  6 17:27:03 2018
> @@ -332,8 +332,30 @@ SanitizerArgs::SanitizerArgs(const ToolC
>  }
>}
>
> +  std::pair IncompatibleGroups[] = {
> +  std::make_pair(Address, Thread | Memory),
> +  std::make_pair(Thread, Memory),
> +  std::make_pair(Leak, Thread | Memory),
> +  std::make_pair(KernelAddress, Address | Leak | Thread | Memory),
> +  std::make_pair(HWAddress, Address | Thread | Memory |
> KernelAddress),
> +  std::make_pair(Efficiency, Address | HWAddress | Leak | Thread |
> Memory |
> + KernelAddress),
> +  std::make_pair(Scudo, Address | HWAddress | Leak | Thread | Memory |
> +KernelAddress | Efficiency),
> +  std::make_pair(SafeStack, Address | HWAddress | Leak | Thread |
> Memory |
> +KernelAddress | Efficiency)};
> +
>// Enable toolchain specific default sanitizers if not explicitly
> disabled.
> -  Kinds |= TC.getDefaultSanitizers() & ~AllRemove;
> +  SanitizerMask Default = TC.getDefaultSanitizers() & ~AllRemove;
> +
> +  // Disable default sanitizers that are incompatible with the default
> ones.
>

You probably mean "Disable default sanitizers that are incompatible with
explicitly requested ones"?


> +  for (auto G : IncompatibleGroups) {
> +SanitizerMask Group = G.first;
> +if ((Default & Group) && (Kinds & G.second))
> +  Default &= ~Group;
> +  }
> +
> +  Kinds |= Default;
>
>// We disable the vptr sanitizer if it was enabled by group expansion
> but RTTI
>// is disabled.
> @@ -369,18 +391,6 @@ SanitizerArgs::SanitizerArgs(const ToolC
>}
>
>// Warn about incompatible groups of sanitizers.
> -  std::pair IncompatibleGroups[] = {
> -  std::make_pair(Address, Thread | Memory),
> -  std::make_pair(Thread, Memory),
> -  std::make_pair(Leak, Thread | Memory),
> -  std::make_pair(KernelAddress, Address | Leak | Thread | Memory),
> -  std::make_pair(HWAddress, Address | Thread | Memory |
> KernelAddress),
> -  std::make_pair(Efficiency, Address | HWAddress | Leak | Thread |
> Memory |
> - KernelAddress),
> -  std::make_pair(Scudo, Address | HWAddress | Leak | Thread | Memory |
> -KernelAddress | Efficiency),
> -  std::make_pair(SafeStack, Address | HWAddress | Leak | Thread |
> Memory |
> -KernelAddress | Efficiency)};
>for (auto G : IncompatibleGroups) {
>  SanitizerMask Group = G.first;
>  if (Kinds & Group) {
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r326869 - Revert 326766 too, after r326862 the test fails and I don't know how to fix.

2018-03-06 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Mar  6 19:00:25 2018
New Revision: 326869

URL: http://llvm.org/viewvc/llvm-project?rev=326869&view=rev
Log:
Revert 326766 too, after r326862 the test fails and I don't know how to fix.

Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/test/CodeGenCXX/alloc-size.cpp

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=326869&r1=326868&r2=326869&view=diff
==
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Tue Mar  6 19:00:25 2018
@@ -133,11 +133,7 @@ namespace {
 
 E = E->IgnoreParens();
 // If we're doing a variable assignment from e.g. malloc(N), there will
-// probably be a cast of some kind. In exotic cases, we might also see a
-// top-level ExprWithCleanups. Ignore them either way.
-if (const auto *EC = dyn_cast(E))
-  E = EC->getSubExpr()->IgnoreParens();
-
+// probably be a cast of some kind. Ignore it.
 if (const auto *Cast = dyn_cast(E))
   E = Cast->getSubExpr()->IgnoreParens();
 

Modified: cfe/trunk/test/CodeGenCXX/alloc-size.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/alloc-size.cpp?rev=326869&r1=326868&r2=326869&view=diff
==
--- cfe/trunk/test/CodeGenCXX/alloc-size.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/alloc-size.cpp Tue Mar  6 19:00:25 2018
@@ -70,15 +70,3 @@ int testIt() {
  __builtin_object_size(dependent_calloc2(), 0);
 }
 } // namespace templated_alloc_size
-
-struct D {
-  ~D();
-  void *my_malloc(int N) __attribute__((alloc_size(2)));
-};
-
-// CHECK-LABEL: define i32 @_Z20callExprWithCleanupsv
-int callExprWithCleanups() {
-  int *const p = (int *)D().my_malloc(3);
-  // CHECK: ret i32 3
-  return __builtin_object_size(p, 0);
-}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r326766 - [ExprConstant] Look through ExprWithCleanups for `allocsize`

2018-03-06 Thread Nico Weber via cfe-commits
Apologies, I had to revert the change that touched alloc-size.cpp before
this change in r326862. After that revert, your new test here failed, and
since I didn't understand how to make it passed, I reverted your change
in 326869 too. It should hopefully be easy for you to reland it.

On Tue, Mar 6, 2018 at 2:42 AM, George Burgess IV via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: gbiv
> Date: Mon Mar  5 23:42:36 2018
> New Revision: 326766
>
> URL: http://llvm.org/viewvc/llvm-project?rev=326766&view=rev
> Log:
> [ExprConstant] Look through ExprWithCleanups for `allocsize`
>
> Modified:
> cfe/trunk/lib/AST/ExprConstant.cpp
> cfe/trunk/test/CodeGenCXX/alloc-size.cpp
>
> Modified: cfe/trunk/lib/AST/ExprConstant.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/
> ExprConstant.cpp?rev=326766&r1=326765&r2=326766&view=diff
> 
> ==
> --- cfe/trunk/lib/AST/ExprConstant.cpp (original)
> +++ cfe/trunk/lib/AST/ExprConstant.cpp Mon Mar  5 23:42:36 2018
> @@ -133,7 +133,11 @@ namespace {
>
>  E = E->IgnoreParens();
>  // If we're doing a variable assignment from e.g. malloc(N), there
> will
> -// probably be a cast of some kind. Ignore it.
> +// probably be a cast of some kind. In exotic cases, we might also
> see a
> +// top-level ExprWithCleanups. Ignore them either way.
> +if (const auto *EC = dyn_cast(E))
> +  E = EC->getSubExpr()->IgnoreParens();
> +
>  if (const auto *Cast = dyn_cast(E))
>E = Cast->getSubExpr()->IgnoreParens();
>
>
> Modified: cfe/trunk/test/CodeGenCXX/alloc-size.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> CodeGenCXX/alloc-size.cpp?rev=326766&r1=326765&r2=326766&view=diff
> 
> ==
> --- cfe/trunk/test/CodeGenCXX/alloc-size.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/alloc-size.cpp Mon Mar  5 23:42:36 2018
> @@ -88,3 +88,15 @@ int callMemberCalloc() {
>// CHECK: ret i32 32
>return __builtin_object_size(C().my_calloc(16, 2), 0);
>  }
> +
> +struct D {
> +  ~D();
> +  void *my_malloc(int N) __attribute__((alloc_size(2)));
> +};
> +
> +// CHECK-LABEL: define i32 @_Z20callExprWithCleanupsv
> +int callExprWithCleanups() {
> +  int *const p = (int *)D().my_malloc(3);
> +  // CHECK: ret i32 3
> +  return __builtin_object_size(p, 0);
> +}
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libcxxabi] r326797 - [demangler] Modernize the rest of the demangler.

2018-03-06 Thread Nico Weber via cfe-commits
Hi Erik,

before this change, ___Z10blocksNRVOv_block_invoke demangled to 'invocation
function for block in blocksNRVO()', now it's no longer demangled. Was that
an intentional change?

On Tue, Mar 6, 2018 at 9:21 AM, Erik Pilkington via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: epilk
> Date: Tue Mar  6 06:21:10 2018
> New Revision: 326797
>
> URL: http://llvm.org/viewvc/llvm-project?rev=326797&view=rev
> Log:
> [demangler] Modernize the rest of the demangler.
>
> Modified:
> libcxxabi/trunk/src/cxa_demangle.cpp
> libcxxabi/trunk/test/test_demangle.pass.cpp
>
> Modified: libcxxabi/trunk/src/cxa_demangle.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/
> cxa_demangle.cpp?rev=326797&r1=326796&r2=326797&view=diff
> 
> ==
> --- libcxxabi/trunk/src/cxa_demangle.cpp (original)
> +++ libcxxabi/trunk/src/cxa_demangle.cpp Tue Mar  6 06:21:10 2018
> @@ -2002,6 +2002,8 @@ struct Db {
>
>BumpPointerAllocator ASTAllocator;
>
> +  Db(const char *First_, const char *Last_) : First(First_), Last(Last_)
> {}
> +
>template  T *make(Args &&... args) {
>  return new (ASTAllocator.allocate(sizeof(T)))
>  T(std::forward(args)...);
> @@ -2054,6 +2056,12 @@ struct Db {
>bool parsePositiveInteger(size_t *Out);
>StringView parseBareSourceName();
>
> +  bool parseSeqId(size_t *Out);
> +  Node *parseSubstitution();
> +  Node *parseTemplateParam();
> +  Node *parseTemplateArgs();
> +  Node *parseTemplateArg();
> +
>/// Parse the  production.
>Node *parseExpr();
>Node *parsePrefixExpr(StringView Kind);
> @@ -2109,66 +2117,11 @@ struct Db {
>Node *parseUnresolvedType();
>Node *parseDestructorName();
>
> -  // FIXME: remove this when all the parse_* functions have been
> rewritten.
> -  template 
> -  Node *legacyParse() {
> -size_t BeforeType = Names.size();
> -const char *OrigFirst = First;
> -const char *T = parse_fn(First, Last, *this);
> -if (T == OrigFirst || BeforeType + 1 != Names.size())
> -  return nullptr;
> -First = T;
> -Node *R = Names.back();
> -Names.pop_back();
> -return R;
> -  }
> +  /// Top-level entry point into the parser.
> +  Node *parse();
>  };
>
> -const char *parse_expression(const char *first, const char *last, Db &db)
> {
> -  db.First = first;
> -  db.Last = last;
> -  Node *R = db.parseExpr();
> -  if (R == nullptr)
> -return first;
> -  db.Names.push_back(R);
> -  return db.First;
> -}
> -
> -const char *parse_expr_primary(const char *first, const char *last, Db
> &db) {
> -  db.First = first;
> -  db.Last = last;
> -  Node *R = db.parseExprPrimary();
> -  if (R == nullptr)
> -return first;
> -  db.Names.push_back(R);
> -  return db.First;
> -}
> -
> -const char *parse_type(const char *first, const char *last, Db &db) {
> -  db.First = first;
> -  db.Last = last;
> -  Node *R = db.parseType();
> -  if (R == nullptr)
> -return first;
> -  db.Names.push_back(R);
> -  return db.First;
> -}
> -
> -const char *parse_encoding(const char *first, const char *last, Db &db) {
> -  db.First = first;
> -  db.Last = last;
> -  Node *R = db.parseEncoding();
> -  if (R == nullptr)
> -return first;
> -  db.Names.push_back(R);
> -  return db.First;
> -}
> -
>  const char* parse_discriminator(const char* first, const char* last);
> -const char *parse_template_args(const char *first, const char *last, Db
> &db);
> -const char *parse_template_param(const char *, const char *, Db &);
> -const char *parse_substitution(const char *, const char *, Db &);
> -
>
>  //  ::=  // N
>  //::=  # See Scope Encoding below  // Z
> @@ -2187,10 +2140,12 @@ Node *Db::parseName(NameState *State) {
>
>//::=  
>if (look() == 'S' && look(1) != 't') {
> -Node *S = legacyParse();
> +Node *S = parseSubstitution();
> +if (S == nullptr)
> +  return nullptr;
>  if (look() != 'I')
>return nullptr;
> -Node *TA = legacyParse();
> +Node *TA = parseTemplateArgs();
>  if (TA == nullptr)
>return nullptr;
>  if (State) State->EndsWithTemplateArgs = true;
> @@ -2203,7 +2158,7 @@ Node *Db::parseName(NameState *State) {
>//::=  
>if (look() == 'I') {
>  Subs.push_back(N);
> -Node *TA = legacyParse();
> +Node *TA = parseTemplateArgs();
>  if (TA == nullptr)
>return nullptr;
>  if (State) State->EndsWithTemplateArgs = true;
> @@ -2693,7 +2648,7 @@ Node *Db::parseNestedName(NameState *Sta
>
>  //  ::= 
>  if (look() == 'T') {
> -  Node *TP = legacyParse();
> +  Node *TP = parseTemplateParam();
>if (TP == nullptr)
>  return nullptr;
>PushComponent(TP);
> @@ -2703,7 +2658,7 @@ Node *Db::parseNestedName(NameState *Sta
>
>  //  ::=  
>  if (look() == 'I') {
> -  Node *TA = legacyParse();
> +  Node *TA = parseTemplateArgs();
>if (TA == nullptr || SoFar == n

Re: [libcxxabi] r326797 - [demangler] Modernize the rest of the demangler.

2018-03-06 Thread Nico Weber via cfe-commits
Thanks for the quick fix!

On Tue, Mar 6, 2018 at 11:32 PM, Erik Pilkington 
wrote:

> No, that was a mistake, fixed in r326871. Thanks for pointing this out!
> Erik
>
>
> On 2018-03-06 11:10 PM, Nico Weber wrote:
>
> Hi Erik,
>
> before this change, ___Z10blocksNRVOv_block_invoke demangled to
> 'invocation function for block in blocksNRVO()', now it's no longer
> demangled. Was that an intentional change?
>
> On Tue, Mar 6, 2018 at 9:21 AM, Erik Pilkington via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: epilk
>> Date: Tue Mar  6 06:21:10 2018
>> New Revision: 326797
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=326797&view=rev
>> Log:
>> [demangler] Modernize the rest of the demangler.
>>
>> Modified:
>> libcxxabi/trunk/src/cxa_demangle.cpp
>> libcxxabi/trunk/test/test_demangle.pass.cpp
>>
>> Modified: libcxxabi/trunk/src/cxa_demangle.cpp
>> URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_
>> demangle.cpp?rev=326797&r1=326796&r2=326797&view=diff
>> 
>> ==
>> --- libcxxabi/trunk/src/cxa_demangle.cpp (original)
>> +++ libcxxabi/trunk/src/cxa_demangle.cpp Tue Mar  6 06:21:10 2018
>> @@ -2002,6 +2002,8 @@ struct Db {
>>
>>BumpPointerAllocator ASTAllocator;
>>
>> +  Db(const char *First_, const char *Last_) : First(First_), Last(Last_)
>> {}
>> +
>>template  T *make(Args &&... args) {
>>  return new (ASTAllocator.allocate(sizeof(T)))
>>  T(std::forward(args)...);
>> @@ -2054,6 +2056,12 @@ struct Db {
>>bool parsePositiveInteger(size_t *Out);
>>StringView parseBareSourceName();
>>
>> +  bool parseSeqId(size_t *Out);
>> +  Node *parseSubstitution();
>> +  Node *parseTemplateParam();
>> +  Node *parseTemplateArgs();
>> +  Node *parseTemplateArg();
>> +
>>/// Parse the  production.
>>Node *parseExpr();
>>Node *parsePrefixExpr(StringView Kind);
>> @@ -2109,66 +2117,11 @@ struct Db {
>>Node *parseUnresolvedType();
>>Node *parseDestructorName();
>>
>> -  // FIXME: remove this when all the parse_* functions have been
>> rewritten.
>> -  template 
>> -  Node *legacyParse() {
>> -size_t BeforeType = Names.size();
>> -const char *OrigFirst = First;
>> -const char *T = parse_fn(First, Last, *this);
>> -if (T == OrigFirst || BeforeType + 1 != Names.size())
>> -  return nullptr;
>> -First = T;
>> -Node *R = Names.back();
>> -Names.pop_back();
>> -return R;
>> -  }
>> +  /// Top-level entry point into the parser.
>> +  Node *parse();
>>  };
>>
>> -const char *parse_expression(const char *first, const char *last, Db
>> &db) {
>> -  db.First = first;
>> -  db.Last = last;
>> -  Node *R = db.parseExpr();
>> -  if (R == nullptr)
>> -return first;
>> -  db.Names.push_back(R);
>> -  return db.First;
>> -}
>> -
>> -const char *parse_expr_primary(const char *first, const char *last, Db
>> &db) {
>> -  db.First = first;
>> -  db.Last = last;
>> -  Node *R = db.parseExprPrimary();
>> -  if (R == nullptr)
>> -return first;
>> -  db.Names.push_back(R);
>> -  return db.First;
>> -}
>> -
>> -const char *parse_type(const char *first, const char *last, Db &db) {
>> -  db.First = first;
>> -  db.Last = last;
>> -  Node *R = db.parseType();
>> -  if (R == nullptr)
>> -return first;
>> -  db.Names.push_back(R);
>> -  return db.First;
>> -}
>> -
>> -const char *parse_encoding(const char *first, const char *last, Db &db) {
>> -  db.First = first;
>> -  db.Last = last;
>> -  Node *R = db.parseEncoding();
>> -  if (R == nullptr)
>> -return first;
>> -  db.Names.push_back(R);
>> -  return db.First;
>> -}
>> -
>>  const char* parse_discriminator(const char* first, const char* last);
>> -const char *parse_template_args(const char *first, const char *last, Db
>> &db);
>> -const char *parse_template_param(const char *, const char *, Db &);
>> -const char *parse_substitution(const char *, const char *, Db &);
>> -
>>
>>  //  ::=  // N
>>  //::=  # See Scope Encoding below  // Z
>> @@ -2187,10 +2140,12 @@ Node *Db::parseName(NameState *State) {
>>
>>//::=  
>>if (look() == 'S' && look(1) != 't') {
>> -Node *S = legacyParse();
>> +Node *S = parseSubstitution();
>> +if (S == nullptr)
>> +  return nullptr;
>>  if (look() != 'I')
>>return nullptr;
>> -Node *TA = legacyParse();
>> +Node *TA = parseTemplateArgs();
>>  if (TA == nullptr)
>>return nullptr;
>>  if (State) State->EndsWithTemplateArgs = true;
>> @@ -2203,7 +2158,7 @@ Node *Db::parseName(NameState *State) {
>>//::=  
>>if (look() == 'I') {
>>  Subs.push_back(N);
>> -Node *TA = legacyParse();
>> +Node *TA = parseTemplateArgs();
>>  if (TA == nullptr)
>>return nullptr;
>>  if (State) State->EndsWithTemplateArgs = true;
>> @@ -2693,7 +2648,7 @@ Node *Db::parseNestedName(NameState *Sta
>>
>>  //  ::= 
>>  if (look() == 'T') {
>> -  Node *TP = l

Re: r326926 - Push a function scope when parsing function bodies without a declaration

2018-03-07 Thread Nico Weber via cfe-commits
On Wed, Mar 7, 2018 at 1:55 PM, Reid Kleckner via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rnk
> Date: Wed Mar  7 10:55:10 2018
> New Revision: 326926
>
> URL: http://llvm.org/viewvc/llvm-project?rev=326926&view=rev
> Log:
> Push a function scope when parsing function bodies without a declaration
>
> Summary:
> This is PR36536.
>
> There are a few ways to reach Sema::ActOnStartOfFunctionDef with a null
> Decl. Currently, the parser continues on to attempt to parse the
> statements in the function body without pushing a function scope or
> declaration context. However, lots of statement parsing logic relies on
> getCurFunction() returning something reasonable. It turns out that
> getCurFunction() will never return null today because of an optimization
> where Sema pre-allocates one FunctionScopeInfo and reuses it when
> possible. This goes wrong when something inside the function body causes
> us to push another function scope, such as requiring an implicit
> definition of a special member function. Reusing the state clears it
> out, which will lead to bugs. In PR36536, we found that the SwitchStack
> gets unbalanced, because we push a switch, clear out the stack, and then
> try to pop a switch that isn't there.
>
> As a follow-up, I plan to move the pre-allocated FunctionScopeInfo out
> of the FunctionScopes stack. This means the FunctionScopes stack will
> often be empty, and callers of getCurFunction() will need to check for
> null.
>
> Reviewers: thakis
>
> Subscribers: cfe-commits
>
> Differential Revision: https://reviews.llvm.org/D43980
>
> Added:
> cfe/trunk/test/SemaCXX/pr36536.cpp
> Modified:
> cfe/trunk/lib/Sema/SemaDecl.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/
> SemaDecl.cpp?rev=326926&r1=326925&r2=326926&view=diff
> 
> ==
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Mar  7 10:55:10 2018
> @@ -12406,8 +12406,13 @@ static void RebuildLambdaScopeInfo(CXXMe
>
>  Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D,
>  SkipBodyInfo *SkipBody) {
> -  if (!D)
> +  if (!D) {
> +// Parsing the function declaration failed in some way. Push on a
> fake scope
> +// anyway so we can try to parse the function body.
> +PushFunctionScope();
>  return D;
> +  }
> +
>FunctionDecl *FD = nullptr;
>
>if (FunctionTemplateDecl *FunTmpl = dyn_cast(D))
> @@ -12816,6 +12821,9 @@ Decl *Sema::ActOnFinishFunctionBody(Decl
>getCurFunction()->ObjCWarnForNoInitDelegation = false;
>  }
>} else {
> +// Parsing the function declaration failed in some way. Pop the fake
> scope
> +// we pushed on.
> +PopFunctionScopeInfo(ActivePolicy, dcl);
>  return nullptr;
>}
>
>
> Added: cfe/trunk/test/SemaCXX/pr36536.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> SemaCXX/pr36536.cpp?rev=326926&view=auto
> 
> ==
> --- cfe/trunk/test/SemaCXX/pr36536.cpp (added)
> +++ cfe/trunk/test/SemaCXX/pr36536.cpp Wed Mar  7 10:55:10 2018
> @@ -0,0 +1,44 @@
> +// RUN: %clang_cc1 -std=c++11 %s -verify -fno-spell-checking
> +
> +// These test cases are constructed to make clang call
> ActOnStartOfFunctionDef
> +// with nullptr.
> +
> +struct ImplicitDefaultCtor1 {};
> +struct Foo {
> +  typedef int NameInClass;
> +  void f();
> +};
> +namespace bar {
> +// FIXME: Improved our recovery to make this a redeclaration of Foo::f,
>

(nit: s/Improved/Improve/)


> +// even though this is in the wrong namespace. That will allow name
> lookup to
> +// find NameInClass below. Users are likely to hit this when they forget
> to
> +// close namespaces.
> +// expected-error@+1 {{cannot define or redeclare 'f' here}}
> +void Foo::f() {
> +  switch (0) { case 0: ImplicitDefaultCtor1 o; }
> +  // expected-error@+1 {{unknown type name 'NameInClass'}}
> +  NameInClass var;
> +}
> +} // namespace bar
> +
> +struct ImplicitDefaultCtor2 {};
> +template  class TFoo { void f(); };
> +// expected-error@+1 {{nested name specifier 'decltype(TFoo())::'}}
> +template  void decltype(TFoo())::f() {
> +  switch (0) { case 0: ImplicitDefaultCtor1 o; }
> +}
> +
> +namespace tpl2 {
> +struct ImplicitDefaultCtor3 {};
> +template  class A {
> +  template  class B {
> +void mf2();
> +  };
> +};
> +template 
> +template <>
> +// expected-error@+1 {{nested name specifier 'A::B::'}}
> +void A::B::mf2() {
> +  switch (0) { case 0: ImplicitDefaultCtor3 o; }
> +}
> +}
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cf

Re: [libcxx] r323971 - Remove ; use instead. See https://libcxx.llvm.org/TS_deprecation.html

2018-03-07 Thread Nico Weber via cfe-commits
On Sat, Feb 24, 2018 at 7:17 PM, Marshall Clow 
wrote:

> On Thu, Feb 22, 2018 at 7:58 AM, Nico Weber  wrote:
>
>> I have a small personal project where I used to use this. I tried
>> switching to  instead, but that apparently requires -std=c++17.
>> With that, things build fine with my locally-built clang, but latest Xcode
>> clang doesn't accept that flag yet. So I tried -std=c++1z, but latest Xcode
>> (9.2) doesn't even include the  header yet. So now I have no way
>> of being able to build my project with both trunk clang and Xcode clang.
>> Maybe a one-year deprecation period is too short?
>>
>
> Nico --
>
> I'm sorry you were caught out by this.
>
> (It's not a huge deal, I have a optional<> implementation in my project
>> for platforms that don't ship it yet, but things used to be fine on mac
>> until this change at least. It's also not an important project, I just
>> thought I'd point out that this makes life more complicated than it would
>> be if the deletion period was longer.)
>>
>
> Yes, but it also makes life less complicated also.
>
> In fact, optional was the poster child for removing stuff from
> experimental.
> experimental::optional and std::optional have diverged, and are
> significantly different today (and only going to get more different in the
> future)
>
> The cost for someone to move to std::optional will never be lower than it
> is now. (they're only going to become more different).
>
> I really didn't (and don't) want to maintain two closely related (but
> different, and slowly diverging) code bases - and (repeatedly) explain to
> people the difference between them.
>
> As for Apple not shipping std::optional, I too am dismayed by that, but I
> have no control over that. :-(  I don't know when Apple will ship
> std::optional (they don't share their product plans with me), but it
> requires an update to libc++.dylib
>

Does this mean that if I build a mac program with trunk clang and trunk
libc++ using std::optional and -mmacosx-version-min=10.11 (or any other
version), my program will build without problems but then fail to start at
runtime because system libc++.dylib is missing the required optional code?


> , and in the past they have gone *years* without updating the dylib.
>  Hopefully they will update before LLVM 7 ships in August.
>
> -- Marshall
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r326602 - [Attr] Fix parameter indexing for several attributes

2018-03-07 Thread Nico Weber via cfe-commits
(I had to revert this since it caused
https://bugs.llvm.org/show_bug.cgi?id=36620)

On Fri, Mar 2, 2018 at 2:03 PM, Joel E. Denny via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: jdenny
> Date: Fri Mar  2 11:03:22 2018
> New Revision: 326602
>
> URL: http://llvm.org/viewvc/llvm-project?rev=326602&view=rev
> Log:
> [Attr] Fix parameter indexing for several attributes
>
> The patch fixes a number of bugs related to parameter indexing in
> attributes:
>
> * Parameter indices in some attributes (argument_with_type_tag,
>   pointer_with_type_tag, nonnull, ownership_takes, ownership_holds,
>   and ownership_returns) are specified in source as one-origin
>   including any C++ implicit this parameter, were stored as
>   zero-origin excluding any this parameter, and were erroneously
>   printing (-ast-print) and confusingly dumping (-ast-dump) as the
>   stored values.
>
> * For alloc_size, the C++ implicit this parameter was not subtracted
>   correctly in Sema, leading to assert failures or to silent failures
>   of __builtin_object_size to compute a value.
>
> * For argument_with_type_tag, pointer_with_type_tag, and
>   ownership_returns, the C++ implicit this parameter was not added
>   back to parameter indices in some diagnostics.
>
> This patch fixes the above bugs and aims to prevent similar bugs in
> the future by introducing careful mechanisms for handling parameter
> indices in attributes.  ParamIdx stores a parameter index and is
> designed to hide the stored encoding while providing accessors that
> require each use (such as printing) to make explicit the encoding that
> is needed.  Attribute declarations declare parameter index arguments
> as [Variadic]ParamIdxArgument, which are exposed as ParamIdx[*].  This
> patch rewrites all attribute arguments that are processed by
> checkFunctionOrMethodParameterIndex in SemaDeclAttr.cpp to be declared
> as [Variadic]ParamIdxArgument.  The only exception is xray_log_args's
> argument, which is encoded as a count not an index.
>
> Differential Revision: https://reviews.llvm.org/D43248
>
> Added:
> cfe/trunk/test/Sema/attr-ownership.cpp
> Modified:
> cfe/trunk/include/clang/AST/Attr.h
> cfe/trunk/include/clang/Basic/Attr.td
> cfe/trunk/lib/AST/ExprConstant.cpp
> cfe/trunk/lib/CodeGen/CGCall.cpp
> cfe/trunk/lib/Sema/SemaChecking.cpp
> cfe/trunk/lib/Sema/SemaDecl.cpp
> cfe/trunk/lib/Sema/SemaDeclAttr.cpp
> cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
> cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
> cfe/trunk/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp
> cfe/trunk/test/CodeGenCXX/alloc-size.cpp
> cfe/trunk/test/Misc/ast-dump-attr.cpp
> cfe/trunk/test/Sema/attr-print.cpp
> cfe/trunk/test/Sema/error-type-safety.cpp
> cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
>
> Modified: cfe/trunk/include/clang/AST/Attr.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/AST/Attr.h?rev=326602&r1=326601&r2=326602&view=diff
> 
> ==
> --- cfe/trunk/include/clang/AST/Attr.h (original)
> +++ cfe/trunk/include/clang/AST/Attr.h Fri Mar  2 11:03:22 2018
> @@ -195,6 +195,120 @@ public:
> }
>  };
>
> +/// A single parameter index whose accessors require each use to make
> explicit
> +/// the parameter index encoding needed.
> +class ParamIdx {
> +  // Idx is exposed only via accessors that specify specific encodings.
> +  unsigned Idx : 30;
> +  unsigned HasThis : 1;
> +  unsigned IsValid : 1;
> +
> +  void assertComparable(const ParamIdx &I) const {
> +assert(isValid() && I.isValid() &&
> +   "ParamIdx must be valid to be compared");
> +// It's possible to compare indices from separate functions, but so
> far
> +// it's not proven useful.  Moreover, it might be confusing because a
> +// comparison on the results of getASTIndex might be inconsistent
> with a
> +// comparison on the ParamIdx objects themselves.
> +assert(HasThis == I.HasThis &&
> +   "ParamIdx must be for the same function to be compared");
> +  }
> +
> +public:
> +  /// Construct an invalid parameter index (\c isValid returns false and
> +  /// accessors fail an assert).
> +  ParamIdx() : Idx(0), HasThis(false), IsValid(false) {}
> +
> +  /// \param Idx is the parameter index as it is normally specified in
> +  /// attributes in the source: one-origin including any C++ implicit this
> +  /// parameter.
> +  ///
> +  /// \param D is the declaration containing the parameters.  It is used
> to
> +  /// determine if there is a C++ implicit this parameter.
> +  ParamIdx(unsigned Idx, const Decl *D)
> +  : Idx(Idx), HasThis(false), IsValid(true) {
> +if (const auto *FD = dyn_cast(D))
> +  HasThis = FD->isCXXInstanceMember();
> +  }
> +
> +  /// \param Idx is the parameter index as it is normally specified in
> +  /// attributes in the source: one-origin including any C++ implic

r326960 - [ms] Emit vtordisp initializers in a deterministic order.

2018-03-07 Thread Nico Weber via cfe-commits
Author: nico
Date: Wed Mar  7 15:15:20 2018
New Revision: 326960

URL: http://llvm.org/viewvc/llvm-project?rev=326960&view=rev
Log:
[ms] Emit vtordisp initializers in a deterministic order.

No effective behavior change, just for cleanliness.
Analysis and typing by me, actual patch mostly by Reid.

Fixes PR36159.
https://reviews.llvm.org/D44223

Modified:
cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp

Modified: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=326960&r1=326959&r2=326960&view=diff
==
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Wed Mar  7 15:15:20 2018
@@ -1196,15 +1196,16 @@ void MicrosoftCXXABI::initializeHiddenVi
   unsigned AS = getThisAddress(CGF).getAddressSpace();
   llvm::Value *Int8This = nullptr;  // Initialize lazily.
 
-  for (VBOffsets::const_iterator I = VBaseMap.begin(), E = VBaseMap.end();
-I != E; ++I) {
+  for (const CXXBaseSpecifier &S : RD->vbases()) {
+const CXXRecordDecl *VBase = S.getType()->getAsCXXRecordDecl();
+auto I = VBaseMap.find(VBase);
+assert(I != VBaseMap.end());
 if (!I->second.hasVtorDisp())
   continue;
 
 llvm::Value *VBaseOffset =
-GetVirtualBaseClassOffset(CGF, getThisAddress(CGF), RD, I->first);
-uint64_t ConstantVBaseOffset =
-Layout.getVBaseClassOffset(I->first).getQuantity();
+GetVirtualBaseClassOffset(CGF, getThisAddress(CGF), RD, VBase);
+uint64_t ConstantVBaseOffset = I->second.VBaseOffset.getQuantity();
 
 // vtorDisp_for_vbase = vbptr[vbase_idx] - offsetof(RD, vbase).
 llvm::Value *VtorDispValue = Builder.CreateSub(


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r327105 - CodeGen: simplify and validate exception personalities

2018-03-09 Thread Nico Weber via cfe-commits
Looks like this broke the Windows bot:
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/9365 Can you
fix or revert, please?

On Fri, Mar 9, 2018 at 2:06 AM, Saleem Abdulrasool via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: compnerd
> Date: Thu Mar  8 23:06:42 2018
> New Revision: 327105
>
> URL: http://llvm.org/viewvc/llvm-project?rev=327105&view=rev
> Log:
> CodeGen: simplify and validate exception personalities
>
> Simplify the dispatching for the personality routines.  This really had
> no test coverage previously, so add test coverage for the various cases.
> This turns out to be pretty complicated as the various languages and
> models interact to change personalities around.
>
> You really should feel bad for the compiler if you are using exceptions.
> There is no reason for this type of cruelty.
>
> Added:
> cfe/trunk/test/CodeGen/personality.c
> cfe/trunk/test/CodeGenCXX/personality.cpp
> cfe/trunk/test/CodeGenObjC/personality.m
> cfe/trunk/test/CodeGenObjCXX/personality.mm
> Modified:
> cfe/trunk/lib/CodeGen/CGException.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGException.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/
> CGException.cpp?rev=327105&r1=327104&r2=327105&view=diff
> 
> ==
> --- cfe/trunk/lib/CodeGen/CGException.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGException.cpp Thu Mar  8 23:06:42 2018
> @@ -116,6 +116,10 @@ static const EHPersonality &getCPersonal
>  const LangOptions &L) {
>if (L.SjLjExceptions)
>  return EHPersonality::GNU_C_SJLJ;
> +  if (L.DWARFExceptions)
> +return EHPersonality::GNU_C;
> +  if (T.isWindowsMSVCEnvironment())
> +return EHPersonality::MSVC_CxxFrameHandler3;
>if (L.SEHExceptions)
>  return EHPersonality::GNU_C_SEH;
>return EHPersonality::GNU_C;
> @@ -129,6 +133,8 @@ static const EHPersonality &getObjCPerso
>case ObjCRuntime::MacOSX:
>case ObjCRuntime::iOS:
>case ObjCRuntime::WatchOS:
> +if (T.isWindowsMSVCEnvironment())
> +  return EHPersonality::MSVC_CxxFrameHandler3;
>  return EHPersonality::NeXT_ObjC;
>case ObjCRuntime::GNUstep:
>  if (L.ObjCRuntime.getVersion() >= VersionTuple(1, 7))
> @@ -149,6 +155,10 @@ static const EHPersonality &getCXXPerson
>const LangOptions &L) {
>if (L.SjLjExceptions)
>  return EHPersonality::GNU_CPlusPlus_SJLJ;
> +  if (L.DWARFExceptions)
> +return EHPersonality::GNU_CPlusPlus;
> +  if (T.isWindowsMSVCEnvironment())
> +return EHPersonality::MSVC_CxxFrameHandler3;
>if (L.SEHExceptions)
>  return EHPersonality::GNU_CPlusPlus_SEH;
>return EHPersonality::GNU_CPlusPlus;
> @@ -199,25 +209,9 @@ const EHPersonality &EHPersonality::get(
>if (FD && FD->usesSEHTry())
>  return getSEHPersonalityMSVC(T);
>
> -  // Try to pick a personality function that is compatible with MSVC if
> we're
> -  // not compiling Obj-C. Obj-C users better have an Obj-C runtime that
> supports
> -  // the GCC-style personality function.
> -  if (T.isWindowsMSVCEnvironment() && !L.ObjC1) {
> -if (L.SjLjExceptions)
> -  return EHPersonality::GNU_CPlusPlus_SJLJ;
> -if (L.DWARFExceptions)
> -  return EHPersonality::GNU_CPlusPlus;
> -return EHPersonality::MSVC_CxxFrameHandler3;
> -  }
> -
> -  if (L.CPlusPlus && L.ObjC1)
> -return getObjCXXPersonality(T, L);
> -  else if (L.CPlusPlus)
> -return getCXXPersonality(T, L);
> -  else if (L.ObjC1)
> -return getObjCPersonality(T, L);
> -  else
> -return getCPersonality(T, L);
> +  if (L.ObjC1)
> +return L.CPlusPlus ? getObjCXXPersonality(T, L) :
> getObjCPersonality(T, L);
> +  return L.CPlusPlus ? getCXXPersonality(T, L) : getCPersonality(T, L);
>  }
>
>  const EHPersonality &EHPersonality::get(CodeGenFunction &CGF) {
>
> Added: cfe/trunk/test/CodeGen/personality.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> CodeGen/personality.c?rev=327105&view=auto
> 
> ==
> --- cfe/trunk/test/CodeGen/personality.c (added)
> +++ cfe/trunk/test/CodeGen/personality.c Thu Mar  8 23:06:42 2018
> @@ -0,0 +1,46 @@
> +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fblocks
> -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-GNU
> +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions
> -fdwarf-exceptions -fblocks -S -emit-llvm %s -o - | FileCheck %s
> -check-prefix CHECK-DWARF
> +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions
> -fseh-exceptions -fblocks -S -emit-llvm %s -o - | FileCheck %s
> -check-prefix CHECK-SEH
> +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions
> -fsjlj-exceptions -fblocks -S -emit-llvm %s -o - | FileCheck %s
> -check-prefix CHECK-SJLJ
> +
> +// RUN: %clang_cc1 -triple i686-unknown-windows-msvc -fexcept

Re: r327738 - [MS] Don't escape MS C++ names with \01

2018-03-18 Thread Nico Weber via cfe-commits
Awesome, thanks!

On Sun, Mar 18, 2018, 3:05 PM Reid Kleckner  wrote:

> Yes: https://reviews.llvm.org/D7775
>
> This side is very mechanical, so I did not send it for review.
>
>
> On Sun, Mar 18, 2018, 3:54 AM Nico Weber  wrote:
>
>> Was this discussed or reviewed somewhere? (It looks like a good change to
>> me, I'm just wondering if there was something that triggered this and would
>> like to read about the background if there's anything to read.)
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r333761 - clang-cl: Expose -no-canonical-prefixes

2018-06-01 Thread Nico Weber via cfe-commits
Author: nico
Date: Fri Jun  1 07:59:57 2018
New Revision: 333761

URL: http://llvm.org/viewvc/llvm-project?rev=333761&view=rev
Log:
clang-cl: Expose -no-canonical-prefixes

-no-canonical-prefixes is a weird flag: In gcc, it controls whether realpath()
is called on the path of the driver binary. It's needed to support some
usecases where gcc is symlinked to, see
https://gcc.gnu.org/ml/gcc/2011-01/msg00429.html for some background.

In clang, the resource dir is found relative to the compiler binary, and
without -no-canonical-prefixes that's an absolute path. For clang, the main use
case for -no-canonical-prefixes is to make the -resource-dir path added by the
driver relative instead of absolute. Making it relative seems like the better
default, but since neither clang not gcc have -canonical-prefixes without no-
which makes changing the default tricky, and since some symlink behaviors do
depend on the realpath() call at least for gcc, just expose
-no-canonical-prefixes in clang-cl mode.

Alternatively we could default to no-canonical-prefix-mode for clang-cl since
it's less likely to be used in symlinked scenarios, but since you already need
to about -no-canonical-prefixes for the non-clang-cl bits of your build, not
hooking this of driver mode seems better to me.

https://reviews.llvm.org/D47480

Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=333761&r1=333760&r2=333761&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Jun  1 07:59:57 2018
@@ -2261,7 +2261,7 @@ def multi__module : Flag<["-"], "multi_m
 def multiply__defined__unused : Separate<["-"], "multiply_defined_unused">;
 def multiply__defined : Separate<["-"], "multiply_defined">;
 def mwarn_nonportable_cfstrings : Flag<["-"], "mwarn-nonportable-cfstrings">, 
Group;
-def no_canonical_prefixes : Flag<["-"], "no-canonical-prefixes">, 
Flags<[HelpHidden]>,
+def no_canonical_prefixes : Flag<["-"], "no-canonical-prefixes">, 
Flags<[HelpHidden, CoreOption]>,
   HelpText<"Use relative instead of canonical paths">;
 def no_cpp_precomp : Flag<["-"], "no-cpp-precomp">, 
Group;
 def no_integrated_cpp : Flag<["-", "--"], "no-integrated-cpp">, 
Flags<[DriverOption]>;

Modified: cfe/trunk/test/Driver/cl-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=333761&r1=333760&r2=333761&view=diff
==
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Fri Jun  1 07:59:57 2018
@@ -591,6 +591,8 @@
 // RUN: -flimit-debug-info \
 // RUN: -flto \
 // RUN: -fmerge-all-constants \
+// RUN: -no-canonical-prefixes \
+// RUN: -fno-coverage-mapping \
 // RUN: --version \
 // RUN: -Werror /Zs -- %s 2>&1
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r333762 - Remove redundant -fno-coverage-mapping added in r333761 (already added in r333423)

2018-06-01 Thread Nico Weber via cfe-commits
Author: nico
Date: Fri Jun  1 08:02:43 2018
New Revision: 333762

URL: http://llvm.org/viewvc/llvm-project?rev=333762&view=rev
Log:
Remove redundant -fno-coverage-mapping added in r333761 (already added in 
r333423)

Modified:
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/test/Driver/cl-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=333762&r1=333761&r2=333762&view=diff
==
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Fri Jun  1 08:02:43 2018
@@ -592,7 +592,6 @@
 // RUN: -flto \
 // RUN: -fmerge-all-constants \
 // RUN: -no-canonical-prefixes \
-// RUN: -fno-coverage-mapping \
 // RUN: --version \
 // RUN: -Werror /Zs -- %s 2>&1
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r333874 - Reland "Move #include manipulation code to new lib/Tooling/Inclusions."

2018-06-04 Thread Nico Weber via cfe-commits
All chromium bots build with asserts on and we definitely don't want shared
libs :-) Having the people who care about this build config make sure it
keeps working seems like a good approach to me.

On Mon, Jun 4, 2018 at 8:15 AM, David Zarzycki via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> What’s stopping the project from automatically setting BUILD_SHARED_LIBS
> to TRUE if asserts are enabled? That’d automatically “force” active
> developers to test the scenario on their local machines, but not change the
> way release builds work.
>
>
> > On Jun 4, 2018, at 8:11 AM, Roman Lebedev via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> >
> > This broke building as shared libraries.
> >
> > I've committed the fix, but the bot coverage is clearly severely missing,
> > given that such breakages are very often.
> >
> > Roman.
> >
> > On Mon, Jun 4, 2018 at 12:04 PM, Eric Liu via cfe-commits
> >  wrote:
> >> Author: ioeric
> >> Date: Mon Jun  4 02:04:12 2018
> >> New Revision: 333874
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=333874&view=rev
> >> Log:
> >> Reland "Move #include manipulation code to new lib/Tooling/Inclusions."
> >>
> >> This reverts commit r333534 (i.e. reland r332720) after fixing module
> build.
> >>
> >> Differential Revision: https://reviews.llvm.org/D47068
> >>
> >> Added:
> >>cfe/trunk/include/clang/Tooling/Inclusions/HeaderIncludes.h
> >>  - copied, changed from r333865, cfe/trunk/include/clang/
> Tooling/Core/HeaderIncludes.h
> >>cfe/trunk/include/clang/Tooling/Inclusions/IncludeStyle.h
> >>  - copied, changed from r333865, cfe/trunk/include/clang/
> Tooling/Core/IncludeStyle.h
> >>cfe/trunk/lib/Tooling/Inclusions/CMakeLists.txt
> >>  - copied, changed from r333865, cfe/trunk/lib/Tooling/Core/
> CMakeLists.txt
> >>cfe/trunk/lib/Tooling/Inclusions/HeaderIncludes.cpp
> >>  - copied, changed from r333865, cfe/trunk/lib/Tooling/Core/
> HeaderIncludes.cpp
> >>cfe/trunk/lib/Tooling/Inclusions/IncludeStyle.cpp
> >>  - copied, changed from r333865, cfe/trunk/lib/Tooling/Core/
> IncludeStyle.cpp
> >> Removed:
> >>cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h
> >>cfe/trunk/include/clang/Tooling/Core/IncludeStyle.h
> >>cfe/trunk/lib/Tooling/Core/HeaderIncludes.cpp
> >>cfe/trunk/lib/Tooling/Core/IncludeStyle.cpp
> >> Modified:
> >>cfe/trunk/include/clang/Format/Format.h
> >>cfe/trunk/include/clang/module.modulemap
> >>cfe/trunk/lib/Format/CMakeLists.txt
> >>cfe/trunk/lib/Format/Format.cpp
> >>cfe/trunk/lib/Tooling/CMakeLists.txt
> >>cfe/trunk/lib/Tooling/Core/CMakeLists.txt
> >>cfe/trunk/unittests/Tooling/HeaderIncludesTest.cpp
> >>
> >> Modified: cfe/trunk/include/clang/Format/Format.h
> >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Format/Format.h?rev=333874&r1=333873&r2=333874&view=diff
> >> 
> ==
> >> --- cfe/trunk/include/clang/Format/Format.h (original)
> >> +++ cfe/trunk/include/clang/Format/Format.h Mon Jun  4 02:04:12 2018
> >> @@ -16,8 +16,8 @@
> >> #define LLVM_CLANG_FORMAT_FORMAT_H
> >>
> >> #include "clang/Basic/LangOptions.h"
> >> -#include "clang/Tooling/Core/IncludeStyle.h"
> >> #include "clang/Tooling/Core/Replacement.h"
> >> +#include "clang/Tooling/Inclusions/IncludeStyle.h"
> >> #include "llvm/ADT/ArrayRef.h"
> >> #include "llvm/Support/Regex.h"
> >> #include 
> >>
> >> Removed: cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h
> >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Tooling/Core/HeaderIncludes.h?rev=333873&view=auto
> >> 
> ==
> >> --- cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h (original)
> >> +++ cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h (removed)
> >> @@ -1,137 +0,0 @@
> >> -//===--- HeaderIncludes.h - Insert/Delete #includes for C++ code--*-
> C++-*-===//
> >> -//
> >> -// The LLVM Compiler Infrastructure
> >> -//
> >> -// This file is distributed under the University of Illinois Open
> Source
> >> -// License. See LICENSE.TXT for details.
> >> -//
> >> -//===--
> ===//
> >> -
> >> -#ifndef LLVM_CLANG_TOOLING_CORE_HEADERINCLUDES_H
> >> -#define LLVM_CLANG_TOOLING_CORE_HEADERINCLUDES_H
> >> -
> >> -#include "clang/Basic/SourceManager.h"
> >> -#include "clang/Tooling/Core/Replacement.h"
> >> -#include "clang/Tooling/Core/IncludeStyle.h"
> >> -#include "llvm/Support/Path.h"
> >> -#include "llvm/Support/Regex.h"
> >> -#include 
> >> -
> >> -namespace clang {
> >> -namespace tooling {
> >> -
> >> -/// This class manages priorities of C++ #include categories and
> calculates
> >> -/// priorities for headers.
> >> -/// FIXME(ioeric): move this class into implementation file when
> clang-format's
> >> -/// include sorting functions are also moved her

Re: r333874 - Reland "Move #include manipulation code to new lib/Tooling/Inclusions."

2018-06-04 Thread Nico Weber via cfe-commits
Sure, the bots could do that, the more general point was that many
(probably most) people who want to enable asserts don't want to use shared
libs. I believe that only a few people use that config, so turning things
around why should everyone building with asserts have to pay the cost of
supporting the shared build config?

On Mon, Jun 4, 2018 at 12:51 PM, David Zarzycki  wrote:

> Hi Roman – I agree that people shouldn’t need to manually fix this every
> time it happens.
>
> Hi Nico – What is stopping the Chromium buildbots from setting
> BUILD_SHARED_LIBS to false? That way the default BUILD_SHARED_LIBS policy
> of llvm and/or clang doesn’t matter, right?
>
> Dave
>
>
> > On Jun 4, 2018, at 12:40 PM, Roman Lebedev  wrote:
> >
> > This is n-th time i do this kind of fix.
> > Sure this does resolve the issue, but it would be much better to use
> > proper means,
> > and tell people to fix their code, in an automatic way :)
> >
> > On Mon, Jun 4, 2018 at 7:36 PM, Nico Weber  wrote:
> >> All chromium bots build with asserts on and we definitely don't want
> shared
> >> libs :-) Having the people who care about this build config make sure it
> >> keeps working seems like a good approach to me.
> >>
> >> On Mon, Jun 4, 2018 at 8:15 AM, David Zarzycki via cfe-commits
> >>  wrote:
> >>>
> >>> What’s stopping the project from automatically setting
> BUILD_SHARED_LIBS
> >>> to TRUE if asserts are enabled? That’d automatically “force” active
> >>> developers to test the scenario on their local machines, but not
> change the
> >>> way release builds work.
> >>>
> >>>
>  On Jun 4, 2018, at 8:11 AM, Roman Lebedev via cfe-commits
>   wrote:
> 
>  This broke building as shared libraries.
> 
>  I've committed the fix, but the bot coverage is clearly severely
>  missing,
>  given that such breakages are very often.
> 
>  Roman.
> 
>  On Mon, Jun 4, 2018 at 12:04 PM, Eric Liu via cfe-commits
>   wrote:
> > Author: ioeric
> > Date: Mon Jun  4 02:04:12 2018
> > New Revision: 333874
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=333874&view=rev
> > Log:
> > Reland "Move #include manipulation code to new
> lib/Tooling/Inclusions."
> >
> > This reverts commit r333534 (i.e. reland r332720) after fixing module
> > build.
> >
> > Differential Revision: https://reviews.llvm.org/D47068
> >
> > Added:
> >   cfe/trunk/include/clang/Tooling/Inclusions/HeaderIncludes.h
> > - copied, changed from r333865,
> > cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h
> >   cfe/trunk/include/clang/Tooling/Inclusions/IncludeStyle.h
> > - copied, changed from r333865,
> > cfe/trunk/include/clang/Tooling/Core/IncludeStyle.h
> >   cfe/trunk/lib/Tooling/Inclusions/CMakeLists.txt
> > - copied, changed from r333865,
> > cfe/trunk/lib/Tooling/Core/CMakeLists.txt
> >   cfe/trunk/lib/Tooling/Inclusions/HeaderIncludes.cpp
> > - copied, changed from r333865,
> > cfe/trunk/lib/Tooling/Core/HeaderIncludes.cpp
> >   cfe/trunk/lib/Tooling/Inclusions/IncludeStyle.cpp
> > - copied, changed from r333865,
> > cfe/trunk/lib/Tooling/Core/IncludeStyle.cpp
> > Removed:
> >   cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h
> >   cfe/trunk/include/clang/Tooling/Core/IncludeStyle.h
> >   cfe/trunk/lib/Tooling/Core/HeaderIncludes.cpp
> >   cfe/trunk/lib/Tooling/Core/IncludeStyle.cpp
> > Modified:
> >   cfe/trunk/include/clang/Format/Format.h
> >   cfe/trunk/include/clang/module.modulemap
> >   cfe/trunk/lib/Format/CMakeLists.txt
> >   cfe/trunk/lib/Format/Format.cpp
> >   cfe/trunk/lib/Tooling/CMakeLists.txt
> >   cfe/trunk/lib/Tooling/Core/CMakeLists.txt
> >   cfe/trunk/unittests/Tooling/HeaderIncludesTest.cpp
> >
> > Modified: cfe/trunk/include/clang/Format/Format.h
> > URL:
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Format/Format.h?rev=333874&r1=333873&r2=333874&view=diff
> >
> > 
> ==
> > --- cfe/trunk/include/clang/Format/Format.h (original)
> > +++ cfe/trunk/include/clang/Format/Format.h Mon Jun  4 02:04:12 2018
> > @@ -16,8 +16,8 @@
> > #define LLVM_CLANG_FORMAT_FORMAT_H
> >
> > #include "clang/Basic/LangOptions.h"
> > -#include "clang/Tooling/Core/IncludeStyle.h"
> > #include "clang/Tooling/Core/Replacement.h"
> > +#include "clang/Tooling/Inclusions/IncludeStyle.h"
> > #include "llvm/ADT/ArrayRef.h"
> > #include "llvm/Support/Regex.h"
> > #include 
> >
> > Removed: cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h
> > URL:
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Tooling/Core/HeaderIncludes.h?rev=333873&view=auto
> >
> > 
> 

Re: r333874 - Reland "Move #include manipulation code to new lib/Tooling/Inclusions."

2018-06-04 Thread Nico Weber via cfe-commits
(Cost as in "shared library buildsof clang are ~35% slower than regular
clang" last we checked.)

On Mon, Jun 4, 2018 at 2:14 PM, Nico Weber  wrote:

> Sure, the bots could do that, the more general point was that many
> (probably most) people who want to enable asserts don't want to use shared
> libs. I believe that only a few people use that config, so turning things
> around why should everyone building with asserts have to pay the cost of
> supporting the shared build config?
>
> On Mon, Jun 4, 2018 at 12:51 PM, David Zarzycki  wrote:
>
>> Hi Roman – I agree that people shouldn’t need to manually fix this every
>> time it happens.
>>
>> Hi Nico – What is stopping the Chromium buildbots from setting
>> BUILD_SHARED_LIBS to false? That way the default BUILD_SHARED_LIBS policy
>> of llvm and/or clang doesn’t matter, right?
>>
>> Dave
>>
>>
>> > On Jun 4, 2018, at 12:40 PM, Roman Lebedev 
>> wrote:
>> >
>> > This is n-th time i do this kind of fix.
>> > Sure this does resolve the issue, but it would be much better to use
>> > proper means,
>> > and tell people to fix their code, in an automatic way :)
>> >
>> > On Mon, Jun 4, 2018 at 7:36 PM, Nico Weber  wrote:
>> >> All chromium bots build with asserts on and we definitely don't want
>> shared
>> >> libs :-) Having the people who care about this build config make sure
>> it
>> >> keeps working seems like a good approach to me.
>> >>
>> >> On Mon, Jun 4, 2018 at 8:15 AM, David Zarzycki via cfe-commits
>> >>  wrote:
>> >>>
>> >>> What’s stopping the project from automatically setting
>> BUILD_SHARED_LIBS
>> >>> to TRUE if asserts are enabled? That’d automatically “force” active
>> >>> developers to test the scenario on their local machines, but not
>> change the
>> >>> way release builds work.
>> >>>
>> >>>
>>  On Jun 4, 2018, at 8:11 AM, Roman Lebedev via cfe-commits
>>   wrote:
>> 
>>  This broke building as shared libraries.
>> 
>>  I've committed the fix, but the bot coverage is clearly severely
>>  missing,
>>  given that such breakages are very often.
>> 
>>  Roman.
>> 
>>  On Mon, Jun 4, 2018 at 12:04 PM, Eric Liu via cfe-commits
>>   wrote:
>> > Author: ioeric
>> > Date: Mon Jun  4 02:04:12 2018
>> > New Revision: 333874
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=333874&view=rev
>> > Log:
>> > Reland "Move #include manipulation code to new
>> lib/Tooling/Inclusions."
>> >
>> > This reverts commit r333534 (i.e. reland r332720) after fixing
>> module
>> > build.
>> >
>> > Differential Revision: https://reviews.llvm.org/D47068
>> >
>> > Added:
>> >   cfe/trunk/include/clang/Tooling/Inclusions/HeaderIncludes.h
>> > - copied, changed from r333865,
>> > cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h
>> >   cfe/trunk/include/clang/Tooling/Inclusions/IncludeStyle.h
>> > - copied, changed from r333865,
>> > cfe/trunk/include/clang/Tooling/Core/IncludeStyle.h
>> >   cfe/trunk/lib/Tooling/Inclusions/CMakeLists.txt
>> > - copied, changed from r333865,
>> > cfe/trunk/lib/Tooling/Core/CMakeLists.txt
>> >   cfe/trunk/lib/Tooling/Inclusions/HeaderIncludes.cpp
>> > - copied, changed from r333865,
>> > cfe/trunk/lib/Tooling/Core/HeaderIncludes.cpp
>> >   cfe/trunk/lib/Tooling/Inclusions/IncludeStyle.cpp
>> > - copied, changed from r333865,
>> > cfe/trunk/lib/Tooling/Core/IncludeStyle.cpp
>> > Removed:
>> >   cfe/trunk/include/clang/Tooling/Core/HeaderIncludes.h
>> >   cfe/trunk/include/clang/Tooling/Core/IncludeStyle.h
>> >   cfe/trunk/lib/Tooling/Core/HeaderIncludes.cpp
>> >   cfe/trunk/lib/Tooling/Core/IncludeStyle.cpp
>> > Modified:
>> >   cfe/trunk/include/clang/Format/Format.h
>> >   cfe/trunk/include/clang/module.modulemap
>> >   cfe/trunk/lib/Format/CMakeLists.txt
>> >   cfe/trunk/lib/Format/Format.cpp
>> >   cfe/trunk/lib/Tooling/CMakeLists.txt
>> >   cfe/trunk/lib/Tooling/Core/CMakeLists.txt
>> >   cfe/trunk/unittests/Tooling/HeaderIncludesTest.cpp
>> >
>> > Modified: cfe/trunk/include/clang/Format/Format.h
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/
>> Format/Format.h?rev=333874&r1=333873&r2=333874&view=diff
>> >
>> > 
>> ==
>> > --- cfe/trunk/include/clang/Format/Format.h (original)
>> > +++ cfe/trunk/include/clang/Format/Format.h Mon Jun  4 02:04:12
>> 2018
>> > @@ -16,8 +16,8 @@
>> > #define LLVM_CLANG_FORMAT_FORMAT_H
>> >
>> > #include "clang/Basic/LangOptions.h"
>> > -#include "clang/Tooling/Core/IncludeStyle.h"
>> > #include "clang/Tooling/Core/Replacement.h"
>> > +#include "clang/Tooling/Inclusions/IncludeStyle.h"
>> > #include "llvm/ADT/ArrayRef.h"
>> > #include "llvm/Support/Regex.h"
>> > #include 
>> >
>> > R

r334972 - Don't let test/Driver/no-canonical-prefixes.c form a symlink cycle the second time it runs.

2018-06-18 Thread Nico Weber via cfe-commits
Author: nico
Date: Mon Jun 18 11:50:35 2018
New Revision: 334972

URL: http://llvm.org/viewvc/llvm-project?rev=334972&view=rev
Log:
Don't let test/Driver/no-canonical-prefixes.c form a symlink cycle the second 
time it runs.

The test makes %t.fake a symlink to %t.real by running `ln -sf %t.real
%t.fake`. If %t.fake already is a symlink to %t.real when this runs (e.g. if
the test has run before), then this effectively becomes `ln -sf %t.real 
%t.real`,
symlinking the directory to itself. At least on my mac, this leads to the
directory containing itself.

As fix, just remove %t.fake before creating the symlink. To clean up build dirs
on bots, also remove %t.real for a while.

https://reviews.llvm.org/D48224

Modified:
cfe/trunk/test/Driver/no-canonical-prefixes.c

Modified: cfe/trunk/test/Driver/no-canonical-prefixes.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/no-canonical-prefixes.c?rev=334972&r1=334971&r2=334972&view=diff
==
--- cfe/trunk/test/Driver/no-canonical-prefixes.c (original)
+++ cfe/trunk/test/Driver/no-canonical-prefixes.c Mon Jun 18 11:50:35 2018
@@ -1,9 +1,14 @@
 // Due to ln -sf:
 // REQUIRES: shell
+// RUN: rm -rf %t.real
 // RUN: mkdir -p %t.real
 // RUN: cd %t.real
 // RUN: ln -sf %clang test-clang
 // RUN: cd ..
+// Important to remove %t.fake: If it already is a symlink to %t.real when
+// `ln -sf %t.real %t.fake` runs, then that would symlink %t.real to itself,
+// forming a cycle.
+// RUN: rm -rf %t.fake
 // RUN: ln -sf %t.real %t.fake
 // RUN: cd %t.fake
 // RUN: ./test-clang -v -S %s 2>&1 | FileCheck --check-prefix=CANONICAL %s


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r335082 - clang-cl: Emit narrowing diag for initializer lists if -fmsc-version is at least 1900 (i.e. MSVC2015).

2018-06-19 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Jun 19 16:19:34 2018
New Revision: 335082

URL: http://llvm.org/viewvc/llvm-project?rev=335082&view=rev
Log:
clang-cl: Emit narrowing diag for initializer lists if -fmsc-version is at 
least 1900 (i.e. MSVC2015).

Diagnostics for narrowing conversions in initializer lists are currently
DefaultIgnored in Microsoft mode. But MSVC 2015 did add warnings about
narrowing conversions (C2397), so clang-cl can remove its special case code if
MSCompatibilityVersion is new enough.

(In MSVC, C2397 is just a warning and in clang it's default-mapped to an error,
but it can be remapped, and disabled with -Wno-c++11-narrowing, so that should
be fine.)

Fixes PR37314.
https://reviews.llvm.org/D48296

Added:
cfe/trunk/test/SemaCXX/ms-initlist-narrowing.cpp
Modified:
cfe/trunk/lib/Sema/SemaInit.cpp

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=335082&r1=335081&r2=335082&view=diff
==
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Tue Jun 19 16:19:34 2018
@@ -8331,6 +8331,11 @@ void InitializationSequence::dump() cons
   dump(llvm::errs());
 }
 
+static bool NarrowingErrs(const LangOptions &L) {
+  return L.CPlusPlus11 &&
+ (!L.MicrosoftExt || L.isCompatibleWithMSVC(LangOptions::MSVC2015));
+}
+
 static void DiagnoseNarrowingInInitList(Sema &S,
 const ImplicitConversionSequence &ICS,
 QualType PreNarrowingType,
@@ -8364,35 +8369,34 @@ static void DiagnoseNarrowingInInitList(
 // This was a floating-to-integer conversion, which is always considered a
 // narrowing conversion even if the value is a constant and can be
 // represented exactly as an integer.
-S.Diag(PostInit->getLocStart(),
-   (S.getLangOpts().MicrosoftExt || !S.getLangOpts().CPlusPlus11)
-   ? diag::warn_init_list_type_narrowing
-   : diag::ext_init_list_type_narrowing)
-  << PostInit->getSourceRange()
-  << PreNarrowingType.getLocalUnqualifiedType()
-  << EntityType.getLocalUnqualifiedType();
+S.Diag(PostInit->getLocStart(), NarrowingErrs(S.getLangOpts())
+? diag::ext_init_list_type_narrowing
+: diag::warn_init_list_type_narrowing)
+<< PostInit->getSourceRange()
+<< PreNarrowingType.getLocalUnqualifiedType()
+<< EntityType.getLocalUnqualifiedType();
 break;
 
   case NK_Constant_Narrowing:
 // A constant value was narrowed.
 S.Diag(PostInit->getLocStart(),
-   (S.getLangOpts().MicrosoftExt || !S.getLangOpts().CPlusPlus11)
-   ? diag::warn_init_list_constant_narrowing
-   : diag::ext_init_list_constant_narrowing)
-  << PostInit->getSourceRange()
-  << ConstantValue.getAsString(S.getASTContext(), ConstantType)
-  << EntityType.getLocalUnqualifiedType();
+   NarrowingErrs(S.getLangOpts())
+   ? diag::ext_init_list_constant_narrowing
+   : diag::warn_init_list_constant_narrowing)
+<< PostInit->getSourceRange()
+<< ConstantValue.getAsString(S.getASTContext(), ConstantType)
+<< EntityType.getLocalUnqualifiedType();
 break;
 
   case NK_Variable_Narrowing:
 // A variable's value may have been narrowed.
 S.Diag(PostInit->getLocStart(),
-   (S.getLangOpts().MicrosoftExt || !S.getLangOpts().CPlusPlus11)
-   ? diag::warn_init_list_variable_narrowing
-   : diag::ext_init_list_variable_narrowing)
-  << PostInit->getSourceRange()
-  << PreNarrowingType.getLocalUnqualifiedType()
-  << EntityType.getLocalUnqualifiedType();
+   NarrowingErrs(S.getLangOpts())
+   ? diag::ext_init_list_variable_narrowing
+   : diag::warn_init_list_variable_narrowing)
+<< PostInit->getSourceRange()
+<< PreNarrowingType.getLocalUnqualifiedType()
+<< EntityType.getLocalUnqualifiedType();
 break;
   }
 

Added: cfe/trunk/test/SemaCXX/ms-initlist-narrowing.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ms-initlist-narrowing.cpp?rev=335082&view=auto
==
--- cfe/trunk/test/SemaCXX/ms-initlist-narrowing.cpp (added)
+++ cfe/trunk/test/SemaCXX/ms-initlist-narrowing.cpp Tue Jun 19 16:19:34 2018
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions 
-fms-compatibility-version=19.0 -std=c++11
+
+int ai[] = { 1, 2.0 };  // expected-error {{type 'double' cannot be narrowed 
to 'int' in initializer list}} expected-note {{silence}}
+
+template
+struct Agg {
+  T t;
+};
+
+void f(int i) {
+  // Constant expression.
+  Agg f8 = {1E50};  // expected-error {{constant expression evaluates 
to 1.00e+50 whic

r335139 - Simplify. No behavior change.

2018-06-20 Thread Nico Weber via cfe-commits
Author: nico
Date: Wed Jun 20 08:57:38 2018
New Revision: 335139

URL: http://llvm.org/viewvc/llvm-project?rev=335139&view=rev
Log:
Simplify. No behavior change.

Modified:
cfe/trunk/lib/Sema/SemaInit.cpp

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=335139&r1=335138&r2=335139&view=diff
==
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Wed Jun 20 08:57:38 2018
@@ -6446,13 +6446,7 @@ static void CheckMoveOnConstruction(Sema
 
   // Find the std::move call and get the argument.
   const CallExpr *CE = dyn_cast(InitExpr->IgnoreParens());
-  if (!CE || CE->getNumArgs() != 1)
-return;
-
-  const FunctionDecl *MoveFunction = CE->getDirectCallee();
-  if (!MoveFunction || !MoveFunction->isInStdNamespace() ||
-  !MoveFunction->getIdentifier() ||
-  !MoveFunction->getIdentifier()->isStr("move"))
+  if (!CE || !CE->isCallToStdMove())
 return;
 
   const Expr *Arg = CE->getArg(0)->IgnoreImplicit();


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r335375 - Re-apply: Warning for framework headers using double quote includes

2018-06-22 Thread Nico Weber via cfe-commits
Why not enable it by default, or put it in -Wall at least? We don't like
off-by-default warnings :-)

On Fri, Jun 22, 2018 at 2:09 PM Bruno Cardoso Lopes via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: bruno
> Date: Fri Jun 22 11:05:17 2018
> New Revision: 335375
>
> URL: http://llvm.org/viewvc/llvm-project?rev=335375&view=rev
> Log:
> Re-apply: Warning for framework headers using double quote includes
>
> Introduce -Wquoted-include-in-framework-header, which should fire a warning
> whenever a quote include appears in a framework header and suggest a
> fix-it.
> For instance, for header A.h added in the tests, this is how the warning
> looks
> like:
>
> ./A.framework/Headers/A.h:2:10: warning: double-quoted include "A0.h" in
> framework header, expected angle-bracketed instead
> [-Wquoted-include-in-framework-header]
> #include "A0.h"
>  ^~
>  
> ./A.framework/Headers/A.h:3:10: warning: double-quoted include "B.h" in
> framework header, expected angle-bracketed instead
> [-Wquoted-include-in-framework-header]
> #include "B.h"
>  ^
>  
>
> This helps users to prevent frameworks from using local headers when in
> fact
> they should be targetting system level ones.
>
> The warning is off by default.
>
> Differential Revision: https://reviews.llvm.org/D47157
>
> rdar://problem/37077034
>
> Added:
> cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Headers/A.h
> cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Headers/A0.h
>
> cfe/trunk/test/Modules/Inputs/double-quotes/A.framework/Modules/module.modulemap
> cfe/trunk/test/Modules/Inputs/double-quotes/B.h
> cfe/trunk/test/Modules/Inputs/double-quotes/X.framework/Headers/X.h
>
> cfe/trunk/test/Modules/Inputs/double-quotes/X.framework/Modules/module.modulemap
> cfe/trunk/test/Modules/Inputs/double-quotes/a.hmap.json
> cfe/trunk/test/Modules/Inputs/double-quotes/flat-header-path/Z.h
>
> cfe/trunk/test/Modules/Inputs/double-quotes/flat-header-path/Z.modulemap
> cfe/trunk/test/Modules/Inputs/double-quotes/x.hmap.json
> cfe/trunk/test/Modules/Inputs/double-quotes/z.yaml
> cfe/trunk/test/Modules/double-quotes.m
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticGroups.td
> cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
> cfe/trunk/lib/Lex/HeaderSearch.cpp
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=335375&r1=335374&r2=335375&view=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Fri Jun 22 11:05:17
> 2018
> @@ -31,6 +31,7 @@ def AutoDisableVptrSanitizer : DiagGroup
>  def Availability : DiagGroup<"availability">;
>  def Section : DiagGroup<"section">;
>  def AutoImport : DiagGroup<"auto-import">;
> +def FrameworkHdrQuotedInclude :
> DiagGroup<"quoted-include-in-framework-header">;
>  def CXX14BinaryLiteral : DiagGroup<"c++14-binary-literal">;
>  def CXXPre14CompatBinaryLiteral :
> DiagGroup<"c++98-c++11-compat-binary-literal">;
>  def GNUBinaryLiteral : DiagGroup<"gnu-binary-literal">;
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=335375&r1=335374&r2=335375&view=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Fri Jun 22
> 11:05:17 2018
> @@ -714,6 +714,11 @@ def warn_mmap_redundant_export_as : Warn
>  def err_mmap_submodule_export_as : Error<
>"only top-level modules can be re-exported as public">;
>
> +def warn_quoted_include_in_framework_header : Warning<
> +  "double-quoted include \"%0\" in framework header, "
> +  "expected angle-bracketed instead"
> +  >, InGroup, DefaultIgnore;
> +
>  def warn_auto_module_import : Warning<
>"treating #%select{include|import|include_next|__include_macros}0 as an
> "
>"import of module '%1'">, InGroup, DefaultIgnore;
>
> Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=335375&r1=335374&r2=335375&view=diff
>
> ==
> --- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
> +++ cfe/trunk/lib/Lex/HeaderSearch.cpp Fri Jun 22 11:05:17 2018
> @@ -621,6 +621,59 @@ static const char *copyString(StringRef
>return CopyStr;
>  }
>
> +static bool isFrameworkStylePath(StringRef Path,
> + SmallVectorImpl &FrameworkName) {
> +  using namespace llvm::sys;
> +  path::const_iterator I = path::begin(Path);
> +  path::const_iterator E = path::end(Path);
> +
> +  // Detect diff

Re: r339163 - [WebAssembly] Remove use of lld -flavor flag

2018-10-16 Thread Nico Weber via cfe-commits
$ bin/clang -target wasm32-unknown-unknown -fuse-ld=wasm-ld -o test.wasm
test.cc
clang: error: invalid linker name in argument '-fuse-ld=wasm-ld'

This here http://llvm-cs.pcc.me.uk/tools/clang/lib/Driver/ToolChain.cpp#453
makes clang look for "ld.wasm-ld", but the wasm lld symlink is called
"wasm-ld". Does the driver need updating? Is the symlink name wrong? Am I
doing something wrong?

On Tue, Aug 7, 2018 at 2:56 PM Sam Clegg via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: sbc
> Date: Tue Aug  7 11:55:41 2018
> New Revision: 339163
>
> URL: http://llvm.org/viewvc/llvm-project?rev=339163&view=rev
> Log:
> [WebAssembly] Remove use of lld -flavor flag
>
> This flag is deprecated. The preferred way to select the lld
> flavor is by calling it by one of its aliases.
>
> Differential Revision: https://reviews.llvm.org/D50395
>
> Modified:
> cfe/trunk/lib/Driver/ToolChains/WebAssembly.cpp
> cfe/trunk/lib/Driver/ToolChains/WebAssembly.h
> cfe/trunk/test/Driver/wasm-toolchain.c
> cfe/trunk/test/Driver/wasm-toolchain.cpp
>
> Modified: cfe/trunk/lib/Driver/ToolChains/WebAssembly.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/WebAssembly.cpp?rev=339163&r1=339162&r2=339163&view=diff
>
> ==
> --- cfe/trunk/lib/Driver/ToolChains/WebAssembly.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains/WebAssembly.cpp Tue Aug  7 11:55:41
> 2018
> @@ -41,8 +41,6 @@ void wasm::Linker::ConstructJob(Compilat
>const ToolChain &ToolChain = getToolChain();
>const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath());
>ArgStringList CmdArgs;
> -  CmdArgs.push_back("-flavor");
> -  CmdArgs.push_back("wasm");
>
>if (Args.hasArg(options::OPT_s))
>  CmdArgs.push_back("--strip-all");
>
> Modified: cfe/trunk/lib/Driver/ToolChains/WebAssembly.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/WebAssembly.h?rev=339163&r1=339162&r2=339163&view=diff
>
> ==
> --- cfe/trunk/lib/Driver/ToolChains/WebAssembly.h (original)
> +++ cfe/trunk/lib/Driver/ToolChains/WebAssembly.h Tue Aug  7 11:55:41 2018
> @@ -66,9 +66,7 @@ private:
> llvm::opt::ArgStringList &CmdArgs) const
> override;
>std::string getThreadModel() const override;
>
> -  const char *getDefaultLinker() const override {
> -return "lld";
> -  }
> +  const char *getDefaultLinker() const override { return "wasm-ld"; }
>
>Tool *buildLinker() const override;
>  };
>
> Modified: cfe/trunk/test/Driver/wasm-toolchain.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/wasm-toolchain.c?rev=339163&r1=339162&r2=339163&view=diff
>
> ==
> --- cfe/trunk/test/Driver/wasm-toolchain.c (original)
> +++ cfe/trunk/test/Driver/wasm-toolchain.c Tue Aug  7 11:55:41 2018
> @@ -12,12 +12,12 @@
>
>  // A basic C link command-line.
>
> -// RUN: %clang -### -no-canonical-prefixes -target wasm32-unknown-unknown
> --sysroot=/foo -fuse-ld=lld %s 2>&1 | FileCheck -check-prefix=LINK %s
> +// RUN: %clang -### -no-canonical-prefixes -target wasm32-unknown-unknown
> --sysroot=/foo -fuse-ld=wasm-ld %s 2>&1 | FileCheck -check-prefix=LINK %s
>  // LINK: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
> -// LINK: lld{{.*}}" "-flavor" "wasm" "-L/foo/lib" "crt1.o" "[[temp]]"
> "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
> +// LINK: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc"
> "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
>
>  // A basic C link command-line with optimization.
>
> -// RUN: %clang -### -O2 -no-canonical-prefixes -target
> wasm32-unknown-unknown --sysroot=/foo -fuse-ld=lld %s 2>&1 | FileCheck
> -check-prefix=LINK_OPT %s
> +// RUN: %clang -### -O2 -no-canonical-prefixes -target
> wasm32-unknown-unknown --sysroot=/foo -fuse-ld=wasm-ld %s 2>&1 | FileCheck
> -check-prefix=LINK_OPT %s
>  // LINK_OPT: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
> -// LINK_OPT: lld{{.*}}" "-flavor" "wasm" "-L/foo/lib" "crt1.o" "[[temp]]"
> "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
> +// LINK_OPT: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc"
> "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
>
> Modified: cfe/trunk/test/Driver/wasm-toolchain.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/wasm-toolchain.cpp?rev=339163&r1=339162&r2=339163&view=diff
>
> ==
> --- cfe/trunk/test/Driver/wasm-toolchain.cpp (original)
> +++ cfe/trunk/test/Driver/wasm-toolchain.cpp Tue Aug  7 11:55:41 2018
> @@ -12,12 +12,12 @@
>
>  // A basic C++ link command-line.
>
> -// RUN: %clangxx -### -no-canonical-prefixes -target
> wasm32-unknown-unknown --sysroot=/foo --stdlib=c++ -fuse-ld=lld %s 2>&1

Re: r345330 - Add MS ABI mangling for operator<=>.

2018-10-25 Thread Nico Weber via cfe-commits
Could you update the demangler too?

On Thu, Oct 25, 2018 at 6:53 PM Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rsmith
> Date: Thu Oct 25 15:51:16 2018
> New Revision: 345330
>
> URL: http://llvm.org/viewvc/llvm-project?rev=345330&view=rev
> Log:
> Add MS ABI mangling for operator<=>.
>
> Thanks to Cameron DaCamara at Microsoft for letting us know what their
> chosen mangling is here!
>
> Added:
> cfe/trunk/test/CodeGenCXX/mangle-ms-cxx2a.cpp
> Modified:
> cfe/trunk/lib/AST/MicrosoftMangle.cpp
> cfe/trunk/test/CodeGenCXX/cxx2a-three-way-comparison.cpp
>
> Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=345330&r1=345329&r2=345330&view=diff
>
> ==
> --- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
> +++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Thu Oct 25 15:51:16 2018
> @@ -1240,15 +1240,8 @@ void MicrosoftCXXNameMangler::mangleOper
>case OO_Array_Delete: Out << "?_V"; break;
>//  ::= ?__L # co_await
>case OO_Coawait: Out << "?__L"; break;
> -
> -  case OO_Spaceship: {
> -// FIXME: Once MS picks a mangling, use it.
> -DiagnosticsEngine &Diags = Context.getDiags();
> -unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
> -  "cannot mangle this three-way comparison operator yet");
> -Diags.Report(Loc, DiagID);
> -break;
> -  }
> +  //  ::= ?__M # <=>
> +  case OO_Spaceship: Out << "?__M"; break;
>
>case OO_Conditional: {
>  DiagnosticsEngine &Diags = Context.getDiags();
>
> Modified: cfe/trunk/test/CodeGenCXX/cxx2a-three-way-comparison.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/cxx2a-three-way-comparison.cpp?rev=345330&r1=345329&r2=345330&view=diff
>
> ==
> --- cfe/trunk/test/CodeGenCXX/cxx2a-three-way-comparison.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/cxx2a-three-way-comparison.cpp Thu Oct 25
> 15:51:16 2018
> @@ -1,24 +1,28 @@
> -// RUN: %clang_cc1 -std=c++2a -emit-llvm %s -o - -triple
> %itanium_abi_triple | FileCheck %s --check-prefix=ITANIUM
> -// RUN: not %clang_cc1 -std=c++2a -emit-llvm %s -o - -triple
> %ms_abi_triple 2>&1 | FileCheck %s --check-prefix=MSABI
> +// RUN: %clang_cc1 -std=c++2a -emit-llvm %s -o - -triple
> %itanium_abi_triple | FileCheck %s --check-prefixes=CHECK,ITANIUM
> +// RUN: %clang_cc1 -std=c++2a -emit-llvm %s -o - -triple %ms_abi_triple |
> FileCheck %s --check-prefixes=CHECK,MSABI
>  // RUN: not %clang_cc1 -std=c++2a -emit-llvm %s -o - -triple
> %itanium_abi_triple -DBUILTIN 2>&1 | FileCheck %s --check-prefix=BUILTIN
> -// MSABI: cannot mangle this three-way comparison operator yet
> +// RUN: not %clang_cc1 -std=c++2a -emit-llvm %s -o - -triple
> %ms_abi_triple -DBUILTIN 2>&1 | FileCheck %s --check-prefix=BUILTIN
>
>  struct A {
>void operator<=>(int);
>  };
>
>  // ITANIUM: define {{.*}}@_ZN1AssEi(
> +// MSABI: define {{.*}}@"??__MA@@QEAAXH@Z"(
>  void A::operator<=>(int) {}
>
>  // ITANIUM: define {{.*}}@_Zssi1A(
> +// MSABI: define {{.*}}@"??__M@YAXHUA@@@Z"(
>  void operator<=>(int, A) {}
>
>  int operator<=>(A, A);
>
>  // ITANIUM: define {{.*}}_Z1f1A(
> +// MSABI: define {{.*}}"?f@@YAHUA@@@Z"(
>  int f(A a) {
>// ITANIUM: %[[RET:.*]] = call {{.*}}_Zss1AS_(
> -  // ITANIUM: ret i32 %[[RET]]
> +  // MSABI: %[[RET:.*]] = call {{.*}}"??__M@YAHUA@@0@Z"(
> +  // CHECK: ret i32 %[[RET]]
>return a <=> a;
>  }
>
>
> Added: cfe/trunk/test/CodeGenCXX/mangle-ms-cxx2a.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms-cxx2a.cpp?rev=345330&view=auto
>
> ==
> --- cfe/trunk/test/CodeGenCXX/mangle-ms-cxx2a.cpp (added)
> +++ cfe/trunk/test/CodeGenCXX/mangle-ms-cxx2a.cpp Thu Oct 25 15:51:16 2018
> @@ -0,0 +1,6 @@
> +// RUN: %clang_cc1 -std=c++2a -fms-extensions -emit-llvm %s -o -
> -triple=i386-pc-win32 -fms-compatibility-version=19.00 | FileCheck %s
> +
> +struct A {};
> +
> +// CHECK-DAG: define {{.*}} @"??__M@YAXUA@@0@Z"
> +void operator<=>(A, A) {}
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r350768 - [ObjC] Allow the use of implemented unavailable methods from within

2019-01-11 Thread Nico Weber via cfe-commits
Here's some user feedback on this new feature.

It looks like the warning is only suppressed if `init` has a definition in
the @interface block. In the 4 cases where we saw this warning fire after
r349841, it still fires after this change because in all 4 cases a class
marked init as unavailable in the @interface but didn't add a definition of
it in the classes @implementation (instead relying on calling the
superclass's (NSObject) init).

It's pretty easy to just add

- (instancetype)init { return [super init]; }

to these 4 classes, but:
a) it doesn't Just Work
b) the diagnostic doesn't make it clear that adding a definition of init
will suppress the warning.

Up to you to decide what (if anything) to do with this feedback :-)

(https://bugs.chromium.org/p/chromium/issues/detail?id=917351#c17 has a
full reduced code snippet.)

On Wed, Jan 9, 2019 at 5:35 PM Alex Lorenz via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: arphaman
> Date: Wed Jan  9 14:31:37 2019
> New Revision: 350768
>
> URL: http://llvm.org/viewvc/llvm-project?rev=350768&view=rev
> Log:
> [ObjC] Allow the use of implemented unavailable methods from within
> the @implementation context
>
> In Objective-C, it's common for some frameworks to mark some methods like
> init
> as unavailable in the @interface to prohibit their usage. However, these
> frameworks then often implemented said method and refer to it in another
> method
> that acts as a factory for that object. The recent change to how messages
> to
> self are type checked in clang (r349841) introduced a regression which
> started
> to prohibit this pattern with an X is unavailable error. This commit
> addresses
> the aforementioned regression.
>
> rdar://47134898
>
> Differential Revision: https://reviews.llvm.org/D56469
>
> Added:
> cfe/trunk/test/SemaObjC/call-unavailable-init-in-self.m
> Modified:
> cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=350768&r1=350767&r2=350768&view=diff
>
> ==
> --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Wed Jan  9 14:31:37 2019
> @@ -7269,9 +7269,10 @@ ShouldDiagnoseAvailabilityOfDecl(Sema &S
>  /// whether we should emit a diagnostic for \c K and \c DeclVersion in
>  /// the context of \c Ctx. For example, we should emit an unavailable
> diagnostic
>  /// in a deprecated context, but not the other way around.
> -static bool ShouldDiagnoseAvailabilityInContext(Sema &S,
> AvailabilityResult K,
> -VersionTuple DeclVersion,
> -Decl *Ctx) {
> +static bool
> +ShouldDiagnoseAvailabilityInContext(Sema &S, AvailabilityResult K,
> +VersionTuple DeclVersion, Decl *Ctx,
> +const NamedDecl *OffendingDecl) {
>assert(K != AR_Available && "Expected an unavailable declaration
> here!");
>
>// Checks if we should emit the availability diagnostic in the context
> of C.
> @@ -7280,9 +7281,22 @@ static bool ShouldDiagnoseAvailabilityIn
>if (const AvailabilityAttr *AA = getAttrForPlatform(S.Context, C))
>  if (AA->getIntroduced() >= DeclVersion)
>return true;
> -} else if (K == AR_Deprecated)
> +} else if (K == AR_Deprecated) {
>if (C->isDeprecated())
>  return true;
> +} else if (K == AR_Unavailable) {
> +  // It is perfectly fine to refer to an 'unavailable' Objective-C
> method
> +  // when it's actually defined and is referenced from within the
> +  // @implementation itself. In this context, we interpret
> unavailable as a
> +  // form of access control.
> +  if (const auto *MD = dyn_cast(OffendingDecl)) {
> +if (const auto *Impl = dyn_cast(C)) {
> +  if (MD->getClassInterface() == Impl->getClassInterface() &&
> +  MD->isDefined())
> +return true;
> +}
> +  }
> +}
>
>  if (C->isUnavailable())
>return true;
> @@ -7471,7 +7485,8 @@ static void DoEmitAvailabilityWarning(Se
>if (const AvailabilityAttr *AA = getAttrForPlatform(S.Context,
> OffendingDecl))
>  DeclVersion = AA->getIntroduced();
>
> -  if (!ShouldDiagnoseAvailabilityInContext(S, K, DeclVersion, Ctx))
> +  if (!ShouldDiagnoseAvailabilityInContext(S, K, DeclVersion, Ctx,
> +   OffendingDecl))
>  return;
>
>SourceLocation Loc = Locs.front();
> @@ -7955,7 +7970,8 @@ void DiagnoseUnguardedAvailability::Diag
>
>  // If the context of this function is less available than D, we
> should not
>  // emit a diagnostic.
> -if (!ShouldDiagnoseAvailabilityInContext(SemaRef, Result, Introduced,
> Ctx))
> +if (!ShouldDiagnoseAvailabilityInContext(SemaRef, Result, Introduced

r351061 - clang-cl: Align help texts for /O1 and O2

2019-01-14 Thread Nico Weber via cfe-commits
Author: nico
Date: Mon Jan 14 04:41:13 2019
New Revision: 351061

URL: http://llvm.org/viewvc/llvm-project?rev=351061&view=rev
Log:
clang-cl: Align help texts for /O1 and O2

Makes it a bit easier to see what exactly the difference is.

Also use "same as" instead of "equivalent to", because that's faster to read.

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

Modified:
cfe/trunk/include/clang/Driver/CLCompatOptions.td

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=351061&r1=351060&r2=351061&view=diff
==
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Mon Jan 14 04:41:13 2019
@@ -121,9 +121,9 @@ def _SLASH_O : CLJoined<"O">,
 // FIXME: Not sure why we have -O0 here; MSVC doesn't support that.
 def : CLFlag<"O0">, Alias, HelpText<"Disable optimization">;
 def : CLFlag<"O1">, Alias<_SLASH_O>, AliasArgs<["1"]>,
-  HelpText<"Optimize for size (equivalent to /Og /Os /Oy /Ob2 /GF /Gy)">;
+  HelpText<"Optimize for size  (same as /Og /Os /Oy /Ob2 /GF /Gy)">;
 def : CLFlag<"O2">, Alias<_SLASH_O>, AliasArgs<["2"]>,
-  HelpText<"Optimize for speed (equivalent to /Og /Oi /Ot /Oy /Ob2 /GF /Gy)">;
+  HelpText<"Optimize for speed (same as /Og /Oi /Ot /Oy /Ob2 /GF /Gy)">;
 def : CLFlag<"Ob0">, Alias<_SLASH_O>, AliasArgs<["b0"]>,
   HelpText<"Disable function inlining">;
 def : CLFlag<"Ob1">, Alias<_SLASH_O>, AliasArgs<["b1"]>,
@@ -143,7 +143,7 @@ def : CLFlag<"Os">, Alias<_SLASH_O>, Ali
 def : CLFlag<"Ot">, Alias<_SLASH_O>, AliasArgs<["t"]>,
   HelpText<"Optimize for speed">;
 def : CLFlag<"Ox">, Alias<_SLASH_O>, AliasArgs<["x"]>,
-  HelpText<"Deprecated (equivalent to /Og /Oi /Ot /Oy /Ob2); use /O2 instead">;
+  HelpText<"Deprecated (same as /Og /Oi /Ot /Oy /Ob2); use /O2 instead">;
 def : CLFlag<"Oy">, Alias<_SLASH_O>, AliasArgs<["y"]>,
   HelpText<"Enable frame pointer omission (x86 only)">;
 def : CLFlag<"Oy-">, Alias<_SLASH_O>, AliasArgs<["y-"]>,


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r351062 - clang-cl: Fix help text for /O: '/O2y-' means '/O2 /Oy-', not '/O2 /y-'

2019-01-14 Thread Nico Weber via cfe-commits
Author: nico
Date: Mon Jan 14 04:42:35 2019
New Revision: 351062

URL: http://llvm.org/viewvc/llvm-project?rev=351062&view=rev
Log:
clang-cl: Fix help text for /O: '/O2y-' means '/O2 /Oy-', not '/O2 /y-'

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

Modified:
cfe/trunk/include/clang/Driver/CLCompatOptions.td

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=351062&r1=351061&r2=351062&view=diff
==
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Mon Jan 14 04:42:35 2019
@@ -116,7 +116,7 @@ def _SLASH_J : CLFlag<"J">, HelpText<"Ma
 // The _SLASH_O option handles all the /O flags, but we also provide separate
 // aliased options to provide separate help messages.
 def _SLASH_O : CLJoined<"O">,
-  HelpText<"Set multiple /O flags at once; e.g. '/O2y-' is the same as '/O2 
/y-'">,
+  HelpText<"Set multiple /O flags at once; e.g. '/O2y-' for '/O2 /Oy-'">,
   MetaVarName<"">;
 // FIXME: Not sure why we have -O0 here; MSVC doesn't support that.
 def : CLFlag<"O0">, Alias, HelpText<"Disable optimization">;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r344241 - [tests] Include Python binding tests in CMake rules

2019-01-15 Thread Nico Weber via cfe-commits
The tests probably shouldn't run when LLVM_ENABLE_PIC=OFF is set, since
they all fail there (due to lib/libclang.so not existing).

On Thu, Oct 11, 2018 at 7:59 AM Michal Gorny via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: mgorny
> Date: Thu Oct 11 04:58:14 2018
> New Revision: 344241
>
> URL: http://llvm.org/viewvc/llvm-project?rev=344241&view=rev
> Log:
> [tests] Include Python binding tests in CMake rules
>
> Add a new CMake rule check-clang-python to run the Python bindings'
> test suite, and include it in check-all.
>
> Differential Revision: https://reviews.llvm.org/D52840
>
> Added:
> cfe/trunk/bindings/python/tests/CMakeLists.txt
> Modified:
> cfe/trunk/CMakeLists.txt
>
> Modified: cfe/trunk/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=344241&r1=344240&r2=344241&view=diff
>
> ==
> --- cfe/trunk/CMakeLists.txt (original)
> +++ cfe/trunk/CMakeLists.txt Thu Oct 11 04:58:14 2018
> @@ -502,6 +502,7 @@ if( CLANG_INCLUDE_TESTS )
>)
>endif()
>add_subdirectory(utils/perf-training)
> +  add_subdirectory(bindings/python/tests)
>  endif()
>
>  option(CLANG_INCLUDE_DOCS "Generate build targets for the Clang docs."
>
> Added: cfe/trunk/bindings/python/tests/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/CMakeLists.txt?rev=344241&view=auto
>
> ==
> --- cfe/trunk/bindings/python/tests/CMakeLists.txt (added)
> +++ cfe/trunk/bindings/python/tests/CMakeLists.txt Thu Oct 11 04:58:14 2018
> @@ -0,0 +1,7 @@
> +# Test target to run Python test suite from main build.
> +
> +add_custom_target(check-clang-python
> +   COMMAND CLANG_LIBRARY_PATH=$
> ${PYTHON_EXECUTABLE} -m unittest discover
> +   DEPENDS libclang
> +   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)
> +add_dependencies(check-all check-clang-python)
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r344241 - [tests] Include Python binding tests in CMake rules

2019-01-15 Thread Nico Weber via cfe-commits
As long as check-all passes with LLVM_ENABLE_PIC=OFF I'm happy :-) (Note
it's .dylib on macOS and .dll on Windows, and by default
setting LLVM_ENABLE_PIC=OFF causes a static library to be created instead
on non-win).

On Tue, Jan 15, 2019 at 1:16 PM Michał Górny  wrote:

> On Tue, 2019-01-15 at 13:10 -0500, Nico Weber wrote:
> > The tests probably shouldn't run when LLVM_ENABLE_PIC=OFF is set, since
> > they all fail there (due to lib/libclang.so not existing).
>
> Hmm, maybe we could make them conditional to the existence
> of libclang.so target?  Would that work for you?
>
> >
> > On Thu, Oct 11, 2018 at 7:59 AM Michal Gorny via cfe-commits <
> > cfe-commits@lists.llvm.org> wrote:
> >
> > > Author: mgorny
> > > Date: Thu Oct 11 04:58:14 2018
> > > New Revision: 344241
> > >
> > > URL: http://llvm.org/viewvc/llvm-project?rev=344241&view=rev
> > > Log:
> > > [tests] Include Python binding tests in CMake rules
> > >
> > > Add a new CMake rule check-clang-python to run the Python bindings'
> > > test suite, and include it in check-all.
> > >
> > > Differential Revision: https://reviews.llvm.org/D52840
> > >
> > > Added:
> > > cfe/trunk/bindings/python/tests/CMakeLists.txt
> > > Modified:
> > > cfe/trunk/CMakeLists.txt
> > >
> > > Modified: cfe/trunk/CMakeLists.txt
> > > URL:
> > >
> http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=344241&r1=344240&r2=344241&view=diff
> > >
> > >
> ==
> > > --- cfe/trunk/CMakeLists.txt (original)
> > > +++ cfe/trunk/CMakeLists.txt Thu Oct 11 04:58:14 2018
> > > @@ -502,6 +502,7 @@ if( CLANG_INCLUDE_TESTS )
> > >)
> > >endif()
> > >add_subdirectory(utils/perf-training)
> > > +  add_subdirectory(bindings/python/tests)
> > >  endif()
> > >
> > >  option(CLANG_INCLUDE_DOCS "Generate build targets for the Clang docs."
> > >
> > > Added: cfe/trunk/bindings/python/tests/CMakeLists.txt
> > > URL:
> > >
> http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/CMakeLists.txt?rev=344241&view=auto
> > >
> > >
> ==
> > > --- cfe/trunk/bindings/python/tests/CMakeLists.txt (added)
> > > +++ cfe/trunk/bindings/python/tests/CMakeLists.txt Thu Oct 11 04:58:14
> 2018
> > > @@ -0,0 +1,7 @@
> > > +# Test target to run Python test suite from main build.
> > > +
> > > +add_custom_target(check-clang-python
> > > +   COMMAND CLANG_LIBRARY_PATH=$
> > > ${PYTHON_EXECUTABLE} -m unittest discover
> > > +   DEPENDS libclang
> > > +   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)
> > > +add_dependencies(check-all check-clang-python)
> > >
> > >
> > > ___
> > > cfe-commits mailing list
> > > cfe-commits@lists.llvm.org
> > > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> > >
>
> --
> Best regards,
> Michał Górny
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r344241 - [tests] Include Python binding tests in CMake rules

2019-01-16 Thread Nico Weber via cfe-commits
(Follow-up: Michał landed a fix in r351304. Thanks!)

On Tue, Jan 15, 2019 at 1:21 PM Nico Weber  wrote:

> As long as check-all passes with LLVM_ENABLE_PIC=OFF I'm happy :-) (Note
> it's .dylib on macOS and .dll on Windows, and by default
> setting LLVM_ENABLE_PIC=OFF causes a static library to be created instead
> on non-win).
>
> On Tue, Jan 15, 2019 at 1:16 PM Michał Górny  wrote:
>
>> On Tue, 2019-01-15 at 13:10 -0500, Nico Weber wrote:
>> > The tests probably shouldn't run when LLVM_ENABLE_PIC=OFF is set, since
>> > they all fail there (due to lib/libclang.so not existing).
>>
>> Hmm, maybe we could make them conditional to the existence
>> of libclang.so target?  Would that work for you?
>>
>> >
>> > On Thu, Oct 11, 2018 at 7:59 AM Michal Gorny via cfe-commits <
>> > cfe-commits@lists.llvm.org> wrote:
>> >
>> > > Author: mgorny
>> > > Date: Thu Oct 11 04:58:14 2018
>> > > New Revision: 344241
>> > >
>> > > URL: http://llvm.org/viewvc/llvm-project?rev=344241&view=rev
>> > > Log:
>> > > [tests] Include Python binding tests in CMake rules
>> > >
>> > > Add a new CMake rule check-clang-python to run the Python bindings'
>> > > test suite, and include it in check-all.
>> > >
>> > > Differential Revision: https://reviews.llvm.org/D52840
>> > >
>> > > Added:
>> > > cfe/trunk/bindings/python/tests/CMakeLists.txt
>> > > Modified:
>> > > cfe/trunk/CMakeLists.txt
>> > >
>> > > Modified: cfe/trunk/CMakeLists.txt
>> > > URL:
>> > >
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=344241&r1=344240&r2=344241&view=diff
>> > >
>> > >
>> ==
>> > > --- cfe/trunk/CMakeLists.txt (original)
>> > > +++ cfe/trunk/CMakeLists.txt Thu Oct 11 04:58:14 2018
>> > > @@ -502,6 +502,7 @@ if( CLANG_INCLUDE_TESTS )
>> > >)
>> > >endif()
>> > >add_subdirectory(utils/perf-training)
>> > > +  add_subdirectory(bindings/python/tests)
>> > >  endif()
>> > >
>> > >  option(CLANG_INCLUDE_DOCS "Generate build targets for the Clang
>> docs."
>> > >
>> > > Added: cfe/trunk/bindings/python/tests/CMakeLists.txt
>> > > URL:
>> > >
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/CMakeLists.txt?rev=344241&view=auto
>> > >
>> > >
>> ==
>> > > --- cfe/trunk/bindings/python/tests/CMakeLists.txt (added)
>> > > +++ cfe/trunk/bindings/python/tests/CMakeLists.txt Thu Oct 11
>> 04:58:14 2018
>> > > @@ -0,0 +1,7 @@
>> > > +# Test target to run Python test suite from main build.
>> > > +
>> > > +add_custom_target(check-clang-python
>> > > +   COMMAND CLANG_LIBRARY_PATH=$
>> > > ${PYTHON_EXECUTABLE} -m unittest discover
>> > > +   DEPENDS libclang
>> > > +   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)
>> > > +add_dependencies(check-all check-clang-python)
>> > >
>> > >
>> > > ___
>> > > cfe-commits mailing list
>> > > cfe-commits@lists.llvm.org
>> > > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>> > >
>>
>> --
>> Best regards,
>> Michał Górny
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r350768 - [ObjC] Allow the use of implemented unavailable methods from within

2019-01-17 Thread Nico Weber via cfe-commits
For the archives, here's said patch: https://reviews.llvm.org/D56816

(Thanks!)

On Wed, Jan 16, 2019 at 5:26 PM Alex L  wrote:

> Hi,
>
> We are planning to fix this issue by not checking if the method is
> defined. I will post a patch this week.
>
> Cheers,
> Alex
>
> On Fri, 11 Jan 2019 at 10:26, Alex L  wrote:
>
>> Thanks, we might have similar cases in our code base as well. We'll see
>> if we can fix that too.
>>
>> On Fri, 11 Jan 2019 at 06:13, Nico Weber  wrote:
>>
>>> Here's some user feedback on this new feature.
>>>
>>> It looks like the warning is only suppressed if `init` has a definition
>>> in the @interface block. In the 4 cases where we saw this warning fire
>>> after r349841, it still fires after this change because in all 4 cases a
>>> class marked init as unavailable in the @interface but didn't add a
>>> definition of it in the classes @implementation (instead relying on calling
>>> the superclass's (NSObject) init).
>>>
>>> It's pretty easy to just add
>>>
>>> - (instancetype)init { return [super init]; }
>>>
>>> to these 4 classes, but:
>>> a) it doesn't Just Work
>>> b) the diagnostic doesn't make it clear that adding a definition of init
>>> will suppress the warning.
>>>
>>> Up to you to decide what (if anything) to do with this feedback :-)
>>>
>>> (https://bugs.chromium.org/p/chromium/issues/detail?id=917351#c17 has a
>>> full reduced code snippet.)
>>>
>>> On Wed, Jan 9, 2019 at 5:35 PM Alex Lorenz via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Author: arphaman
 Date: Wed Jan  9 14:31:37 2019
 New Revision: 350768

 URL: http://llvm.org/viewvc/llvm-project?rev=350768&view=rev
 Log:
 [ObjC] Allow the use of implemented unavailable methods from within
 the @implementation context

 In Objective-C, it's common for some frameworks to mark some methods
 like init
 as unavailable in the @interface to prohibit their usage. However, these
 frameworks then often implemented said method and refer to it in
 another method
 that acts as a factory for that object. The recent change to how
 messages to
 self are type checked in clang (r349841) introduced a regression which
 started
 to prohibit this pattern with an X is unavailable error. This commit
 addresses
 the aforementioned regression.

 rdar://47134898

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

 Added:
 cfe/trunk/test/SemaObjC/call-unavailable-init-in-self.m
 Modified:
 cfe/trunk/lib/Sema/SemaDeclAttr.cpp

 Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=350768&r1=350767&r2=350768&view=diff

 ==
 --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
 +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Wed Jan  9 14:31:37 2019
 @@ -7269,9 +7269,10 @@ ShouldDiagnoseAvailabilityOfDecl(Sema &S
  /// whether we should emit a diagnostic for \c K and \c DeclVersion in
  /// the context of \c Ctx. For example, we should emit an unavailable
 diagnostic
  /// in a deprecated context, but not the other way around.
 -static bool ShouldDiagnoseAvailabilityInContext(Sema &S,
 AvailabilityResult K,
 -VersionTuple
 DeclVersion,
 -Decl *Ctx) {
 +static bool
 +ShouldDiagnoseAvailabilityInContext(Sema &S, AvailabilityResult K,
 +VersionTuple DeclVersion, Decl
 *Ctx,
 +const NamedDecl *OffendingDecl) {
assert(K != AR_Available && "Expected an unavailable declaration
 here!");

// Checks if we should emit the availability diagnostic in the
 context of C.
 @@ -7280,9 +7281,22 @@ static bool ShouldDiagnoseAvailabilityIn
if (const AvailabilityAttr *AA = getAttrForPlatform(S.Context,
 C))
  if (AA->getIntroduced() >= DeclVersion)
return true;
 -} else if (K == AR_Deprecated)
 +} else if (K == AR_Deprecated) {
if (C->isDeprecated())
  return true;
 +} else if (K == AR_Unavailable) {
 +  // It is perfectly fine to refer to an 'unavailable' Objective-C
 method
 +  // when it's actually defined and is referenced from within the
 +  // @implementation itself. In this context, we interpret
 unavailable as a
 +  // form of access control.
 +  if (const auto *MD = dyn_cast(OffendingDecl)) {
 +if (const auto *Impl = dyn_cast(C)) {
 +  if (MD->getClassInterface() == Impl->getClassInterface() &&
 +  MD->isDefined())
 +return true;
 +}
 +  }
 +}

  if (C->is

Re: r232680 - MS ABI: Don't try to emit VF/VB-Tables for extern class templates

2019-01-18 Thread Nico Weber via cfe-commits
(-old cfe-commits, +new cfe-commits)

On Fri, Jan 18, 2019 at 8:21 AM Nico Weber  wrote:

> I found this comment useful, but from your reply it sounds like it's no
> longer true:
>
> -  // We must indicate which VFTable is larger to support linking
> between
> -  // translation units which do and do not have RTTI data.  The
> largest
> -  // VFTable contains the RTTI data; translation units which
> reference
> -  // the smaller VFTable always reference it relative to the first
> -  // virtual method.
>
> If it's no longer true, why do we still call
> setSelectionKind(llvm::Comdat::Largest)?
>
> On Thu, Jan 17, 2019 at 5:09 PM David Majnemer 
> wrote:
>
>> Yes, the comments don't look like they were relevant after this change.
>>
>> On Sat, Jan 12, 2019 at 4:52 PM Nico Weber  wrote:
>>
>>> This removed two of the comments you had added in
>>> https://reviews.llvm.org/rL212142 -- was that intentional?
>>>
>>> On Wed, Mar 18, 2015 at 6:08 PM David Majnemer 
>>> wrote:
>>>
 Author: majnemer
 Date: Wed Mar 18 17:04:43 2015
 New Revision: 232680

 URL: http://llvm.org/viewvc/llvm-project?rev=232680&view=rev
 Log:
 MS ABI: Don't try to emit VF/VB-Tables for extern class templates

 There will be an explicit template instantiation in another translation
 unit which will provide the definition of the VF/VB-Tables.

 This fixes PR22932.

 Modified:
 cfe/trunk/lib/AST/VTableBuilder.cpp
 cfe/trunk/lib/CodeGen/CGVTables.cpp
 cfe/trunk/lib/CodeGen/CodeGenModule.cpp
 cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
 cfe/trunk/test/CodeGenCXX/microsoft-abi-vbtables.cpp
 cfe/trunk/test/CodeGenCXX/microsoft-abi-vftables.cpp

 Modified: cfe/trunk/lib/AST/VTableBuilder.cpp
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=232680&r1=232679&r2=232680&view=diff

 ==
 --- cfe/trunk/lib/AST/VTableBuilder.cpp (original)
 +++ cfe/trunk/lib/AST/VTableBuilder.cpp Wed Mar 18 17:04:43 2015
 @@ -2589,7 +2589,9 @@ public:
  // Only include the RTTI component if we know that we will provide
 a
  // definition of the vftable.
  HasRTTIComponent = Context.getLangOpts().RTTIData &&
 -   !MostDerivedClass->hasAttr();
 +   !MostDerivedClass->hasAttr() &&
 +
  MostDerivedClass->getTemplateSpecializationKind() !=
 +   TSK_ExplicitInstantiationDeclaration;

  LayoutVFTable();


 Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=232680&r1=232679&r2=232680&view=diff

 ==
 --- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
 +++ cfe/trunk/lib/CodeGen/CGVTables.cpp Wed Mar 18 17:04:43 2015
 @@ -743,7 +743,7 @@ CodeGenModule::getVTableLinkage(const CX
  return DiscardableODRLinkage;

case TSK_ExplicitInstantiationDeclaration:
 -llvm_unreachable("Should not have been asked to emit this");
 +return llvm::GlobalVariable::ExternalLinkage;

case TSK_ExplicitInstantiationDefinition:
  return NonDiscardableODRLinkage;

 Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=232680&r1=232679&r2=232680&view=diff

 ==
 --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
 +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed Mar 18 17:04:43 2015
 @@ -1851,7 +1851,8 @@ CodeGenModule::CreateOrReplaceCXXRuntime
  OldGV->eraseFromParent();
}

 -  if (supportsCOMDAT() && GV->isWeakForLinker())
 +  if (supportsCOMDAT() && GV->isWeakForLinker() &&
 +  !GV->hasAvailableExternallyLinkage())
  GV->setComdat(TheModule.getOrInsertComdat(GV->getName()));

return GV;

 Modified: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=232680&r1=232679&r2=232680&view=diff

 ==
 --- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
 +++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Wed Mar 18 17:04:43 2015
 @@ -1487,102 +1487,97 @@ llvm::GlobalVariable *MicrosoftCXXABI::g
  #endif
}

 -  for (size_t J = 0, F = VFPtrs.size(); J != F; ++J) {
 -if (VFPtrs[J]->FullOffsetInMDC != VPtrOffset)
 -  continue;
 -SmallString<256> VFTableName;
 -mangleVFTableName(getMangle

Re: r351603 - [ASTDump] NFC: Remove non-needed braces

2019-01-21 Thread Nico Weber via cfe-commits
Please don't do changes like this. They have marginal utility and make
blame output more annoying to work with.

On Fri, Jan 18, 2019 at 5:18 PM Stephen Kelly via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: steveire
> Date: Fri Jan 18 14:14:59 2019
> New Revision: 351603
>
> URL: http://llvm.org/viewvc/llvm-project?rev=351603&view=rev
> Log:
> [ASTDump] NFC: Remove non-needed braces
>
> Modified:
> cfe/trunk/lib/AST/ASTDumper.cpp
>
> Modified: cfe/trunk/lib/AST/ASTDumper.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=351603&r1=351602&r2=351603&view=diff
>
> ==
> --- cfe/trunk/lib/AST/ASTDumper.cpp (original)
> +++ cfe/trunk/lib/AST/ASTDumper.cpp Fri Jan 18 14:14:59 2019
> @@ -1242,12 +1242,11 @@ void ASTDumper::VisitObjCMethodDecl(cons
>if (D->isVariadic())
>  OS << " variadic";
>
> -  if (D->isThisDeclarationADefinition()) {
> +  if (D->isThisDeclarationADefinition())
>  dumpDeclContext(D);
> -  } else {
> +  else
>  for (const ParmVarDecl *Parameter : D->parameters())
>dumpDecl(Parameter);
> -  }
>
>if (D->hasBody())
>  dumpStmt(D->getBody());
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r351603 - [ASTDump] NFC: Remove non-needed braces

2019-01-21 Thread Nico Weber via cfe-commits
(To be clear, your 3 others around the same time are all fine! I mean just
bracing tweaks.)

On Mon, Jan 21, 2019 at 9:03 PM Nico Weber  wrote:

> Please don't do changes like this. They have marginal utility and make
> blame output more annoying to work with.
>
> On Fri, Jan 18, 2019 at 5:18 PM Stephen Kelly via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: steveire
>> Date: Fri Jan 18 14:14:59 2019
>> New Revision: 351603
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=351603&view=rev
>> Log:
>> [ASTDump] NFC: Remove non-needed braces
>>
>> Modified:
>> cfe/trunk/lib/AST/ASTDumper.cpp
>>
>> Modified: cfe/trunk/lib/AST/ASTDumper.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=351603&r1=351602&r2=351603&view=diff
>>
>> ==
>> --- cfe/trunk/lib/AST/ASTDumper.cpp (original)
>> +++ cfe/trunk/lib/AST/ASTDumper.cpp Fri Jan 18 14:14:59 2019
>> @@ -1242,12 +1242,11 @@ void ASTDumper::VisitObjCMethodDecl(cons
>>if (D->isVariadic())
>>  OS << " variadic";
>>
>> -  if (D->isThisDeclarationADefinition()) {
>> +  if (D->isThisDeclarationADefinition())
>>  dumpDeclContext(D);
>> -  } else {
>> +  else
>>  for (const ParmVarDecl *Parameter : D->parameters())
>>dumpDecl(Parameter);
>> -  }
>>
>>if (D->hasBody())
>>  dumpStmt(D->getBody());
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r347205 - [FileManager] getFile(open=true) after getFile(open=false) should open the file.

2019-01-22 Thread Nico Weber via cfe-commits
I don't have a reduced test case yet, but this seems to cause clang to
sometimes claim that an included file isn't found even if it's there, at
least on macOS: https://bugs.chromium.org/p/chromium/issues/detail?id=924225

On Mon, Nov 19, 2018 at 8:40 AM Sam McCall via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: sammccall
> Date: Mon Nov 19 05:37:46 2018
> New Revision: 347205
>
> URL: http://llvm.org/viewvc/llvm-project?rev=347205&view=rev
> Log:
> [FileManager] getFile(open=true) after getFile(open=false) should open the
> file.
>
> Summary:
> Old behavior is to just return the cached entry regardless of opened-ness.
> That feels buggy (though I guess nobody ever actually needed this).
>
> This came up in the context of clangd+clang-tidy integration: we're
> going to getFile(open=false) to replay preprocessor actions obscured by
> the preamble, but the compilation may subsequently getFile(open=true)
> for non-preamble includes.
>
> Reviewers: ilya-biryukov
>
> Subscribers: ioeric, kadircet, cfe-commits
>
> Differential Revision: https://reviews.llvm.org/D54691
>
> Modified:
> cfe/trunk/include/clang/Basic/FileManager.h
> cfe/trunk/lib/Basic/FileManager.cpp
> cfe/trunk/unittests/Basic/FileManagerTest.cpp
>
> Modified: cfe/trunk/include/clang/Basic/FileManager.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/FileManager.h?rev=347205&r1=347204&r2=347205&view=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/FileManager.h (original)
> +++ cfe/trunk/include/clang/Basic/FileManager.h Mon Nov 19 05:37:46 2018
> @@ -70,14 +70,15 @@ class FileEntry {
>bool IsNamedPipe;
>bool InPCH;
>bool IsValid;   // Is this \c FileEntry initialized and
> valid?
> +  bool DeferredOpen;  // Created by getFile(OpenFile=0); may open
> later.
>
>/// The open file, if it is owned by the \p FileEntry.
>mutable std::unique_ptr File;
>
>  public:
>FileEntry()
> -  : UniqueID(0, 0), IsNamedPipe(false), InPCH(false), IsValid(false)
> -  {}
> +  : UniqueID(0, 0), IsNamedPipe(false), InPCH(false), IsValid(false),
> +DeferredOpen(false) {}
>
>FileEntry(const FileEntry &) = delete;
>FileEntry &operator=(const FileEntry &) = delete;
>
> Modified: cfe/trunk/lib/Basic/FileManager.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileManager.cpp?rev=347205&r1=347204&r2=347205&view=diff
>
> ==
> --- cfe/trunk/lib/Basic/FileManager.cpp (original)
> +++ cfe/trunk/lib/Basic/FileManager.cpp Mon Nov 19 05:37:46 2018
> @@ -221,15 +221,21 @@ const FileEntry *FileManager::getFile(St
>*SeenFileEntries.insert(std::make_pair(Filename, nullptr)).first;
>
>// See if there is already an entry in the map.
> -  if (NamedFileEnt.second)
> -return NamedFileEnt.second == NON_EXISTENT_FILE ? nullptr
> -: NamedFileEnt.second;
> +  if (NamedFileEnt.second) {
> +if (NamedFileEnt.second == NON_EXISTENT_FILE)
> +  return nullptr;
> +// Entry exists: return it *unless* it wasn't opened and open is
> requested.
> +if (!(NamedFileEnt.second->DeferredOpen && openFile))
> +  return NamedFileEnt.second;
> +// We previously stat()ed the file, but didn't open it: do that below.
> +// FIXME: the below does other redundant work too (stats the dir and
> file).
> +  } else {
> +// By default, initialize it to invalid.
> +NamedFileEnt.second = NON_EXISTENT_FILE;
> +  }
>
>++NumFileCacheMisses;
>
> -  // By default, initialize it to invalid.
> -  NamedFileEnt.second = NON_EXISTENT_FILE;
> -
>// Get the null-terminated file name as stored as the key of the
>// SeenFileEntries map.
>StringRef InterndFileName = NamedFileEnt.first();
> @@ -267,6 +273,7 @@ const FileEntry *FileManager::getFile(St
>// It exists.  See if we have already opened a file with the same inode.
>// This occurs when one dir is symlinked to another, for example.
>FileEntry &UFE = UniqueRealFiles[Data.UniqueID];
> +  UFE.DeferredOpen = !openFile;
>
>NamedFileEnt.second = &UFE;
>
> @@ -283,6 +290,23 @@ const FileEntry *FileManager::getFile(St
>  InterndFileName = NamedFileEnt.first().data();
>}
>
> +  // If we opened the file for the first time, record the resulting info.
> +  // Do this even if the cache entry was valid, maybe we didn't
> previously open.
> +  if (F && !UFE.File) {
> +if (auto PathName = F->getName()) {
> +  llvm::SmallString<128> AbsPath(*PathName);
> +  // This is not the same as `VFS::getRealPath()`, which resolves
> symlinks
> +  // but can be very expensive on real file systems.
> +  // FIXME: the semantic of RealPathName is unclear, and the name
> might be
> +  // misleading. We need to clean up the interface here.
> +  makeAbsolutePath(AbsP

  1   2   3   4   5   6   7   8   9   10   >