r345258 - [ms] Prevent explicit constructor name lookup if scope is missing

2018-10-25 Thread Will Wilson via cfe-commits
Author: lantictac
Date: Thu Oct 25 04:45:32 2018
New Revision: 345258

URL: http://llvm.org/viewvc/llvm-project?rev=345258&view=rev
Log:
[ms] Prevent explicit constructor name lookup if scope is missing

MicrosoftExt allows explicit constructor calls. Prevent lookup of constructor 
name unless the name has explicit scope.
This avoids a compile-time crash due to confusing a member access for a 
constructor name.

Test case included. All tests pass.

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

Modified:
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp

Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=345258&r1=345257&r2=345258&view=diff
==
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Thu Oct 25 04:45:32 2018
@@ -1809,7 +1809,8 @@ Parser::ParsePostfixExpressionSuffix(Exp
 /*EnteringContext=*/false,
 /*AllowDestructorName=*/true,
 /*AllowConstructorName=*/
-  getLangOpts().MicrosoftExt,
+getLangOpts().MicrosoftExt &&
+SS.isNotEmpty(),
 /*AllowDeductionGuide=*/false,
 ObjectType, &TemplateKWLoc, Name)) {
 (void)Actions.CorrectDelayedTyposInExpr(LHS);

Modified: cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp?rev=345258&r1=345257&r2=345258&view=diff
==
--- cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp (original)
+++ cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp Thu Oct 25 04:45:32 2018
@@ -302,3 +302,23 @@ void function_to_voidptr_conv() {
   void *a2 = &function_prototype; // expected-warning {{implicit conversion 
between pointer-to-function and pointer-to-object is a Microsoft extension}}
   void *a3 = function_ptr;// expected-warning {{implicit conversion 
between pointer-to-function and pointer-to-object is a Microsoft extension}}
 }
+
+namespace member_lookup {
+
+template
+struct ConfuseLookup {
+  T* m_val;
+  struct m_val {
+static size_t ms_test;
+  };
+};
+
+// Microsoft mode allows explicit constructor calls
+// This could confuse name lookup in cases such as this
+template
+size_t ConfuseLookup::m_val::ms_test
+  = size_t(&(char&)(reinterpret_cast*>(0)->m_val));
+
+void instantiate() { ConfuseLookup::m_val::ms_test = 1; }
+}
+


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


Re: [PATCH] D22955: [MSVC] Improved late parsing of template functions.

2016-11-16 Thread Will Wilson via cfe-commits
A backup ping. Sorry for the noise but this would be a very useful patch to
get done and dusted.

On 10 November 2016 at 08:17, Alexey Bataev via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> ABataev added a comment.
>
> Ping
>
>
> https://reviews.llvm.org/D22955
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>



-- 
*Indefiant *: http://www.indefiant.com
Home of Recode : Runtime C++ Editing for VS
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13203: [Clang] - Massaging code to fix MSVS 2015 win32-release configuration

2015-10-27 Thread Will Wilson via cfe-commits
Building latest HEAD using:

cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
-DLLVM_USE_CRT_RELWITHDEBINFO=MT -DLLVM_BUILD_TOOLS=OFF
-DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_ENABLE_ASSERTIONS=OFF
LLVM_BUILD_32_BITS=ON ..\llvm


VC++ version: Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026
for x86

Also produces the ICE mentioned before by grimar:

[1003/1049] Building CXX object
tools\...eFiles\clangAST.dir\ASTContext.cpp.obj
FAILED: C:\PROGRA~2\MI0E91~1.0\VC\bin\cl.exe   /nologo /TP /DWIN32
/D_WINDOWS -wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345
-wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722
-wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245
-wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577
-wd4091 -wd4324 -w14062 -we4238 /W4 /Zc:inline /Zc:sizedDealloc- /MT /Zi
/O2 /Ob1 /D NDEBUG -Itools\clang\lib\AST -IW:\rec\llvm\tools\clang\lib\AST
-IW:\rec\llvm\tools\clang\include -Itools\clang\include -Iinclude
-IW:\rec\llvm\include /EHs-c- /GR- /showIncludes -DCLANG_ENABLE_ARCMT
-DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER
-DGTEST_HAS_RTTI=0 -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_GNU_SOURCE
-D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
/Fotools\clang\lib\AST\CMakeFiles\clangAST.dir\ASTContext.cpp.obj
/Fdtools\clang\lib\AST\CMakeFiles\clangAST.dir\ /FS -c
W:\rec\llvm\tools\clang\lib\AST\ASTContext.cpp
w:\rec\llvm\tools\clang\lib\ast\astcontext.cpp(334) : fatal error C1001: An
internal error has occurred in the compiler.
(compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 246)
 To work around this problem, try simplifying or changing the program near
the locations listed above.
Please choose the Technical Support command on the Visual C++
 Help menu, or open the Technical Support help file for more information

INTERNAL COMPILER ERROR in 'C:\PROGRA~2\MI0E91~1.0\VC\bin\cl.exe'
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information


Did anyone find a non-invasive workaround or is the patch still the way to
go?

Thanks,
Will.

On 5 October 2015 at 13:39, Manuel Klimek via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> klimek added a comment.
>
> Note: with VS Professional 14.0.23107.0 D14REL I do not get this error.
>
>
> http://reviews.llvm.org/D13203
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>



-- 
*Indefiant *: http://www.indefiant.com
Home of Recode : Runtime C++ Editing for VS
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13203: [Clang] - Massaging code to fix MSVS 2015 win32-release configuration

2015-10-27 Thread Will Wilson via cfe-commits
I've ended up using the simplified fix described on the MS connect bug
report for this issue:

https://connect.microsoft.com/VisualStudio/feedback/details/1741530

I’ve been able to work around this by changing ASTContext.cpp:368 from

if (RC) {
Raw.setRaw(RC);
Raw.setKind(RawCommentAndCacheFlags::FromDecl);
} else

to

if (RC) {
Raw.setKind(RawCommentAndCacheFlags::FromDecl);
Raw.setRaw(RC);
} else


Since this simply swaps two orthogonal calls I've checked it passes the
tests and attached the patch.

Let me know if it's okay to commit.

Thanks,
Will.

On 27 October 2015 at 11:42, Will Wilson  wrote:

> Building latest HEAD using:
>
> cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
> -DLLVM_USE_CRT_RELWITHDEBINFO=MT -DLLVM_BUILD_TOOLS=OFF
> -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_ENABLE_ASSERTIONS=OFF
> LLVM_BUILD_32_BITS=ON ..\llvm
>
>
> VC++ version: Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026
> for x86
>
> Also produces the ICE mentioned before by grimar:
>
> [1003/1049] Building CXX object
> tools\...eFiles\clangAST.dir\ASTContext.cpp.obj
> FAILED: C:\PROGRA~2\MI0E91~1.0\VC\bin\cl.exe   /nologo /TP /DWIN32
> /D_WINDOWS -wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345
> -wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722
> -wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245
> -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577
> -wd4091 -wd4324 -w14062 -we4238 /W4 /Zc:inline /Zc:sizedDealloc- /MT /Zi
> /O2 /Ob1 /D NDEBUG -Itools\clang\lib\AST -IW:\rec\llvm\tools\clang\lib\AST
> -IW:\rec\llvm\tools\clang\include -Itools\clang\include -Iinclude
> -IW:\rec\llvm\include /EHs-c- /GR- /showIncludes -DCLANG_ENABLE_ARCMT
> -DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER
> -DGTEST_HAS_RTTI=0 -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
> -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_GNU_SOURCE
> -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS
> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
> /Fotools\clang\lib\AST\CMakeFiles\clangAST.dir\ASTContext.cpp.obj
> /Fdtools\clang\lib\AST\CMakeFiles\clangAST.dir\ /FS -c
> W:\rec\llvm\tools\clang\lib\AST\ASTContext.cpp
> w:\rec\llvm\tools\clang\lib\ast\astcontext.cpp(334) : fatal error C1001:
> An internal error has occurred in the compiler.
> (compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 246)
>  To work around this problem, try simplifying or changing the program near
> the locations listed above.
> Please choose the Technical Support command on the Visual C++
>  Help menu, or open the Technical Support help file for more information
>
> INTERNAL COMPILER ERROR in 'C:\PROGRA~2\MI0E91~1.0\VC\bin\cl.exe'
> Please choose the Technical Support command on the Visual C++
> Help menu, or open the Technical Support help file for more information
>
>
> Did anyone find a non-invasive workaround or is the patch still the way to
> go?
>
> Thanks,
> Will.
>
> On 5 October 2015 at 13:39, Manuel Klimek via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> klimek added a comment.
>>
>> Note: with VS Professional 14.0.23107.0 D14REL I do not get this error.
>>
>>
>> http://reviews.llvm.org/D13203
>>
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>
>
> --
> *Indefiant *: http://www.indefiant.com
> Home of Recode : Runtime C++ Editing for VS
>



-- 
*Indefiant *: http://www.indefiant.com
Home of Recode : Runtime C++ Editing for VS


msvc_ice_workaround.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r251415 - [MSVC] Workaround for ICE in cl.exe when compiling ASTContext.cpp in Release Win32

2015-10-27 Thread Will Wilson via cfe-commits
Author: lantictac
Date: Tue Oct 27 12:01:10 2015
New Revision: 251415

URL: http://llvm.org/viewvc/llvm-project?rev=251415&view=rev
Log:
[MSVC] Workaround for ICE in cl.exe when compiling ASTContext.cpp in Release 
Win32

Microsoft connect bug: 
https://connect.microsoft.com/VisualStudio/feedback/details/1741530

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

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=251415&r1=251414&r2=251415&view=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Tue Oct 27 12:01:10 2015
@@ -366,8 +366,10 @@ const RawComment *ASTContext::getRawComm
   OriginalDeclForRC = I;
   RawCommentAndCacheFlags Raw;
   if (RC) {
-Raw.setRaw(RC);
+// Call order swapped to work around ICE in VS2015 RTM (Release Win32)
+// https://connect.microsoft.com/VisualStudio/feedback/details/1741530
 Raw.setKind(RawCommentAndCacheFlags::FromDecl);
+Raw.setRaw(RC);
   } else
 Raw.setKind(RawCommentAndCacheFlags::NoCommentInDecl);
   Raw.setOriginalDecl(I);


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


Re: [PATCH] D13203: [Clang] - Massaging code to fix MSVS 2015 win32-release configuration

2015-10-27 Thread Will Wilson via cfe-commits
Thanks David,

Committed as r251415.

On 27 October 2015 at 17:01, David Majnemer 
wrote:

> Looks fine Will, please commit but keep a comment and a link to the
> connect bug.  We don't want somebody to accidentally "clean-up" the code
> and break things again.
>
> On Tue, Oct 27, 2015 at 7:49 AM, Will Wilson via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> I've ended up using the simplified fix described on the MS connect bug
>> report for this issue:
>>
>> https://connect.microsoft.com/VisualStudio/feedback/details/1741530
>>
>> I’ve been able to work around this by changing ASTContext.cpp:368 from
>>
>> if (RC) {
>> Raw.setRaw(RC);
>> Raw.setKind(RawCommentAndCacheFlags::FromDecl);
>> } else
>>
>> to
>>
>> if (RC) {
>> Raw.setKind(RawCommentAndCacheFlags::FromDecl);
>> Raw.setRaw(RC);
>> } else
>>
>>
>> Since this simply swaps two orthogonal calls I've checked it passes the
>> tests and attached the patch.
>>
>> Let me know if it's okay to commit.
>>
>> Thanks,
>> Will.
>>
>> On 27 October 2015 at 11:42, Will Wilson  wrote:
>>
>>> Building latest HEAD using:
>>>
>>> cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
>>> -DLLVM_USE_CRT_RELWITHDEBINFO=MT -DLLVM_BUILD_TOOLS=OFF
>>> -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_ENABLE_ASSERTIONS=OFF
>>> LLVM_BUILD_32_BITS=ON ..\llvm
>>>
>>>
>>> VC++ version: Microsoft (R) C/C++ Optimizing Compiler Version
>>> 19.00.23026 for x86
>>>
>>> Also produces the ICE mentioned before by grimar:
>>>
>>> [1003/1049] Building CXX object
>>> tools\...eFiles\clangAST.dir\ASTContext.cpp.obj
>>> FAILED: C:\PROGRA~2\MI0E91~1.0\VC\bin\cl.exe   /nologo /TP /DWIN32
>>> /D_WINDOWS -wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345
>>> -wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722
>>> -wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245
>>> -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577
>>> -wd4091 -wd4324 -w14062 -we4238 /W4 /Zc:inline /Zc:sizedDealloc- /MT /Zi
>>> /O2 /Ob1 /D NDEBUG -Itools\clang\lib\AST -IW:\rec\llvm\tools\clang\lib\AST
>>> -IW:\rec\llvm\tools\clang\include -Itools\clang\include -Iinclude
>>> -IW:\rec\llvm\include /EHs-c- /GR- /showIncludes -DCLANG_ENABLE_ARCMT
>>> -DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER
>>> -DGTEST_HAS_RTTI=0 -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
>>> -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_GNU_SOURCE
>>> -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS
>>> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
>>> /Fotools\clang\lib\AST\CMakeFiles\clangAST.dir\ASTContext.cpp.obj
>>> /Fdtools\clang\lib\AST\CMakeFiles\clangAST.dir\ /FS -c
>>> W:\rec\llvm\tools\clang\lib\AST\ASTContext.cpp
>>> w:\rec\llvm\tools\clang\lib\ast\astcontext.cpp(334) : fatal error C1001:
>>> An internal error has occurred in the compiler.
>>> (compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 246)
>>>  To work around this problem, try simplifying or changing the program
>>> near the locations listed above.
>>> Please choose the Technical Support command on the Visual C++
>>>  Help menu, or open the Technical Support help file for more information
>>>
>>> INTERNAL COMPILER ERROR in 'C:\PROGRA~2\MI0E91~1.0\VC\bin\cl.exe'
>>> Please choose the Technical Support command on the Visual C++
>>> Help menu, or open the Technical Support help file for more
>>> information
>>>
>>>
>>> Did anyone find a non-invasive workaround or is the patch still the way
>>> to go?
>>>
>>> Thanks,
>>> Will.
>>>
>>> On 5 October 2015 at 13:39, Manuel Klimek via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
>>>> klimek added a comment.
>>>>
>>>> Note: with VS Professional 14.0.23107.0 D14REL I do not get this error.
>>>>
>>>>
>>>> http://reviews.llvm.org/D13203
>>>>
>>>>
>>>>
>>>> ___
>>>> cfe-commits mailing list
>>>> cfe-commits@lists.llvm.org
>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>>
>>>
>>>
>>>
>>> --
>>> *Indefiant *: http://www.indefiant.com
>>> Home of Recode : Runtime C++ Editing for VS
>>>
>>
>>
>>
>> --
>> *Indefiant *: http://www.indefiant.com
>> Home of Recode : Runtime C++ Editing for VS
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>>
>


-- 
*Indefiant *: http://www.indefiant.com
Home of Recode : Runtime C++ Editing for VS
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] Fix stack overflow in MSVC unqualified type lookup logic

2016-05-27 Thread Will Wilson via cfe-commits
Hi Alexey,

A customer encountered a stack overflow in the code from r229817. I've
created a small repro for testing the issue and a fix. The fix should also
better deal with lookup into partially specialized base templates.

Test case included and tested against latest trunk.

Let me know if it looks acceptable!

Cheers,
Will.

-- 
*Indefiant *: http://www.indefiant.com
Home of Recode : Runtime C++ Editing for VS


msvc_partial_template_lookup.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] Fix stack overflow in MSVC unqualified type lookup logic

2016-05-30 Thread Will Wilson via cfe-commits
Hi Alexey,

On 31 May 2016 at 12:25, Alexey Bataev  wrote:

> Hi Will,
> Thanks for the report and sorry for a delay with answer. Generally, your
> patch looks good with some small nits. I can fix some minor issues like
> extra braces etc. and commit it if you don't mind.
>

Sure thing. Commit away!

Thanks,
Will.

-- 
*Indefiant *: http://www.indefiant.com
Home of Recode : Runtime C++ Editing for VS
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits