Re: r250418 - [CodeGen] Remove dead code. NFC.

2015-10-20 Thread Chandler Carruth via cfe-commits
Is it possible to add a unittest that exercises this extension point
in-tree? For example the way I did for AA extension hooks?

On Mon, Oct 19, 2015 at 9:00 PM Michael Gottesman via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Oct 19, 2015, at 4:40 PM, Michael Gottesman via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>
> On Oct 15, 2015, at 8:29 AM, Benjamin Kramer via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: d0k
> Date: Thu Oct 15 10:29:40 2015
> New Revision: 250418
>
> URL: http://llvm.org/viewvc/llvm-project?rev=250418=rev
> Log:
> [CodeGen] Remove dead code. NFC.
>
> Modified:
>   cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>   cfe/trunk/lib/CodeGen/CGCall.cpp
>   cfe/trunk/lib/CodeGen/CGCleanup.cpp
>   cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>   cfe/trunk/lib/CodeGen/CGDebugInfo.h
>   cfe/trunk/lib/CodeGen/CGObjC.cpp
>   cfe/trunk/lib/CodeGen/CGObjCMac.cpp
>   cfe/trunk/lib/CodeGen/CGVTables.h
>   cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp
>   cfe/trunk/lib/CodeGen/CodeGenFunction.h
>   cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>   cfe/trunk/lib/CodeGen/CodeGenModule.h
>   cfe/trunk/lib/CodeGen/CodeGenPGO.h
>   cfe/trunk/lib/CodeGen/EHScopeStack.h
>   cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=250418=250417=250418=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Oct 15 10:29:40 2015
> @@ -4106,15 +4106,6 @@ Value *CodeGenFunction::vectorWrapScalar
>  return Op;
> }
>
> -Value *CodeGenFunction::vectorWrapScalar8(Value *Op) {
> -  llvm::Type *VTy = llvm::VectorType::get(Int8Ty, 8);
> -  Op = Builder.CreateBitCast(Op, Int8Ty);
> -  Value *V = UndefValue::get(VTy);
> -  llvm::Constant *CI = ConstantInt::get(SizeTy, 0);
> -  Op = Builder.CreateInsertElement(V, Op, CI);
> -  return Op;
> -}
> -
> Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
>   const CallExpr *E) {
>  unsigned HintID = static_cast(-1);
>
> Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=250418=250417=250418=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGCall.cpp Thu Oct 15 10:29:40 2015
> @@ -3038,12 +3038,6 @@ CodeGenFunction::EmitRuntimeCallOrInvoke
>  return callSite;
> }
>
> -llvm::CallSite
> -CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee,
> -  const Twine ) {
> -  return EmitCallOrInvoke(Callee, None, Name);
> -}
> -
> /// Emits a call or invoke instruction to the given function, depending
> /// on the current state of the EH stack.
> llvm::CallSite
>
> Modified: cfe/trunk/lib/CodeGen/CGCleanup.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.cpp?rev=250418=250417=250418=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGCleanup.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGCleanup.cpp Thu Oct 15 10:29:40 2015
> @@ -167,23 +167,6 @@ EHScopeStack::getInnermostActiveNormalCl
>  return stable_end();
> }
>
> -EHScopeStack::stable_iterator EHScopeStack::getInnermostActiveEHScope()
> const {
> -  for (stable_iterator si = getInnermostEHScope(), se = stable_end();
> - si != se; ) {
> -// Skip over inactive cleanups.
> -EHCleanupScope *cleanup = dyn_cast(&*find(si));
> -if (cleanup && !cleanup->isActive()) {
> -  si = cleanup->getEnclosingEHScope();
> -  continue;
> -}
> -
> -// All other scopes are always active.
> -return si;
> -  }
> -
> -  return stable_end();
> -}
> -
>
> void *EHScopeStack::pushCleanup(CleanupKind Kind, size_t Size) {
>  char *Buffer = allocate(EHCleanupScope::getSizeForCleanupSize(Size));
>
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=250418=250417=250418=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Oct 15 10:29:40 2015
> @@ -2159,30 +2159,6 @@ llvm::DIType *CGDebugInfo::getOrCreateTy
>  return Res;
> }
>
> -unsigned CGDebugInfo::Checksum(const ObjCInterfaceDecl *ID) {
> -  // The assumption is that the number of ivars can only increase
> -  // monotonically, so it is safe to just use their current number as
> -  // a checksum.
> -  unsigned Sum = 0;
> -  for (const ObjCIvarDecl *Ivar = ID->all_declared_ivar_begin();
> -   Ivar != nullptr; Ivar = Ivar->getNextIvar())
> -++Sum;
> -
> -  return Sum;
> -}
> -
> -ObjCInterfaceDecl 

Re: r250418 - [CodeGen] Remove dead code. NFC.

2015-10-20 Thread Michael Gottesman via cfe-commits
Let me play with it a bit (I did not read the code, I just was tracking down 
the linkage error).

Michael

> On Oct 20, 2015, at 12:07 AM, Chandler Carruth  wrote:
> 
> Is it possible to add a unittest that exercises this extension point in-tree? 
> For example the way I did for AA extension hooks?
> 
> On Mon, Oct 19, 2015 at 9:00 PM Michael Gottesman via cfe-commits 
> > wrote:
>> On Oct 19, 2015, at 4:40 PM, Michael Gottesman via cfe-commits 
>> > wrote:
>> 
>>> 
>>> On Oct 15, 2015, at 8:29 AM, Benjamin Kramer via cfe-commits 
>>> > wrote:
>>> 
>>> Author: d0k
>>> Date: Thu Oct 15 10:29:40 2015
>>> New Revision: 250418
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=250418=rev 
>>> 
>>> Log:
>>> [CodeGen] Remove dead code. NFC.
>>> 
>>> Modified:
>>>   cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>>>   cfe/trunk/lib/CodeGen/CGCall.cpp
>>>   cfe/trunk/lib/CodeGen/CGCleanup.cpp
>>>   cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>>   cfe/trunk/lib/CodeGen/CGDebugInfo.h
>>>   cfe/trunk/lib/CodeGen/CGObjC.cpp
>>>   cfe/trunk/lib/CodeGen/CGObjCMac.cpp
>>>   cfe/trunk/lib/CodeGen/CGVTables.h
>>>   cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp
>>>   cfe/trunk/lib/CodeGen/CodeGenFunction.h
>>>   cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>>>   cfe/trunk/lib/CodeGen/CodeGenModule.h
>>>   cfe/trunk/lib/CodeGen/CodeGenPGO.h
>>>   cfe/trunk/lib/CodeGen/EHScopeStack.h
>>>   cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
>>> 
>>> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=250418=250417=250418=diff
>>>  
>>> 
>>> ==
>>> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Oct 15 10:29:40 2015
>>> @@ -4106,15 +4106,6 @@ Value *CodeGenFunction::vectorWrapScalar
>>>  return Op;
>>> }
>>> 
>>> -Value *CodeGenFunction::vectorWrapScalar8(Value *Op) {
>>> -  llvm::Type *VTy = llvm::VectorType::get(Int8Ty, 8);
>>> -  Op = Builder.CreateBitCast(Op, Int8Ty);
>>> -  Value *V = UndefValue::get(VTy);
>>> -  llvm::Constant *CI = ConstantInt::get(SizeTy, 0);
>>> -  Op = Builder.CreateInsertElement(V, Op, CI);
>>> -  return Op;
>>> -}
>>> -
>>> Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
>>>   const CallExpr *E) {
>>>  unsigned HintID = static_cast(-1);
>>> 
>>> Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=250418=250417=250418=diff
>>>  
>>> 
>>> ==
>>> --- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGCall.cpp Thu Oct 15 10:29:40 2015
>>> @@ -3038,12 +3038,6 @@ CodeGenFunction::EmitRuntimeCallOrInvoke
>>>  return callSite;
>>> }
>>> 
>>> -llvm::CallSite
>>> -CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee,
>>> -  const Twine ) {
>>> -  return EmitCallOrInvoke(Callee, None, Name);
>>> -}
>>> -
>>> /// Emits a call or invoke instruction to the given function, depending
>>> /// on the current state of the EH stack.
>>> llvm::CallSite
>>> 
>>> Modified: cfe/trunk/lib/CodeGen/CGCleanup.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.cpp?rev=250418=250417=250418=diff
>>>  
>>> 
>>> ==
>>> --- cfe/trunk/lib/CodeGen/CGCleanup.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGCleanup.cpp Thu Oct 15 10:29:40 2015
>>> @@ -167,23 +167,6 @@ EHScopeStack::getInnermostActiveNormalCl
>>>  return stable_end();
>>> }
>>> 
>>> -EHScopeStack::stable_iterator EHScopeStack::getInnermostActiveEHScope() 
>>> const {
>>> -  for (stable_iterator si = getInnermostEHScope(), se = stable_end();
>>> - si != se; ) {
>>> -// Skip over inactive cleanups.
>>> -EHCleanupScope *cleanup = dyn_cast(&*find(si));
>>> -if (cleanup && !cleanup->isActive()) {
>>> -  si = cleanup->getEnclosingEHScope();
>>> -  continue;
>>> -}
>>> -
>>> -// All other scopes are always active.
>>> -return si;
>>> -  }
>>> -
>>> -  return stable_end();
>>> -}
>>> -
>>> 
>>> void *EHScopeStack::pushCleanup(CleanupKind Kind, size_t Size) {
>>>  char *Buffer = 

Re: r250418 - [CodeGen] Remove dead code. NFC.

2015-10-20 Thread Michael Gottesman via cfe-commits

> On Oct 19, 2015, at 4:40 PM, Michael Gottesman via cfe-commits 
>  wrote:
> 
>> 
>> On Oct 15, 2015, at 8:29 AM, Benjamin Kramer via cfe-commits 
>>  wrote:
>> 
>> Author: d0k
>> Date: Thu Oct 15 10:29:40 2015
>> New Revision: 250418
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=250418=rev
>> Log:
>> [CodeGen] Remove dead code. NFC.
>> 
>> Modified:
>>   cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>>   cfe/trunk/lib/CodeGen/CGCall.cpp
>>   cfe/trunk/lib/CodeGen/CGCleanup.cpp
>>   cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>   cfe/trunk/lib/CodeGen/CGDebugInfo.h
>>   cfe/trunk/lib/CodeGen/CGObjC.cpp
>>   cfe/trunk/lib/CodeGen/CGObjCMac.cpp
>>   cfe/trunk/lib/CodeGen/CGVTables.h
>>   cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp
>>   cfe/trunk/lib/CodeGen/CodeGenFunction.h
>>   cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>>   cfe/trunk/lib/CodeGen/CodeGenModule.h
>>   cfe/trunk/lib/CodeGen/CodeGenPGO.h
>>   cfe/trunk/lib/CodeGen/EHScopeStack.h
>>   cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
>> 
>> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=250418=250417=250418=diff
>> ==
>> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Oct 15 10:29:40 2015
>> @@ -4106,15 +4106,6 @@ Value *CodeGenFunction::vectorWrapScalar
>>  return Op;
>> }
>> 
>> -Value *CodeGenFunction::vectorWrapScalar8(Value *Op) {
>> -  llvm::Type *VTy = llvm::VectorType::get(Int8Ty, 8);
>> -  Op = Builder.CreateBitCast(Op, Int8Ty);
>> -  Value *V = UndefValue::get(VTy);
>> -  llvm::Constant *CI = ConstantInt::get(SizeTy, 0);
>> -  Op = Builder.CreateInsertElement(V, Op, CI);
>> -  return Op;
>> -}
>> -
>> Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
>>   const CallExpr *E) {
>>  unsigned HintID = static_cast(-1);
>> 
>> Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=250418=250417=250418=diff
>> ==
>> --- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGCall.cpp Thu Oct 15 10:29:40 2015
>> @@ -3038,12 +3038,6 @@ CodeGenFunction::EmitRuntimeCallOrInvoke
>>  return callSite;
>> }
>> 
>> -llvm::CallSite
>> -CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee,
>> -  const Twine ) {
>> -  return EmitCallOrInvoke(Callee, None, Name);
>> -}
>> -
>> /// Emits a call or invoke instruction to the given function, depending
>> /// on the current state of the EH stack.
>> llvm::CallSite
>> 
>> Modified: cfe/trunk/lib/CodeGen/CGCleanup.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.cpp?rev=250418=250417=250418=diff
>> ==
>> --- cfe/trunk/lib/CodeGen/CGCleanup.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGCleanup.cpp Thu Oct 15 10:29:40 2015
>> @@ -167,23 +167,6 @@ EHScopeStack::getInnermostActiveNormalCl
>>  return stable_end();
>> }
>> 
>> -EHScopeStack::stable_iterator EHScopeStack::getInnermostActiveEHScope() 
>> const {
>> -  for (stable_iterator si = getInnermostEHScope(), se = stable_end();
>> - si != se; ) {
>> -// Skip over inactive cleanups.
>> -EHCleanupScope *cleanup = dyn_cast(&*find(si));
>> -if (cleanup && !cleanup->isActive()) {
>> -  si = cleanup->getEnclosingEHScope();
>> -  continue;
>> -}
>> -
>> -// All other scopes are always active.
>> -return si;
>> -  }
>> -
>> -  return stable_end();
>> -}
>> -
>> 
>> void *EHScopeStack::pushCleanup(CleanupKind Kind, size_t Size) {
>>  char *Buffer = allocate(EHCleanupScope::getSizeForCleanupSize(Size));
>> 
>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=250418=250417=250418=diff
>> ==
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Oct 15 10:29:40 2015
>> @@ -2159,30 +2159,6 @@ llvm::DIType *CGDebugInfo::getOrCreateTy
>>  return Res;
>> }
>> 
>> -unsigned CGDebugInfo::Checksum(const ObjCInterfaceDecl *ID) {
>> -  // The assumption is that the number of ivars can only increase
>> -  // monotonically, so it is safe to just use their current number as
>> -  // a checksum.
>> -  unsigned Sum = 0;
>> -  for (const ObjCIvarDecl *Ivar = ID->all_declared_ivar_begin();
>> -   Ivar != nullptr; Ivar = Ivar->getNextIvar())
>> -++Sum;
>> -
>> -  return Sum;
>> -}
>> -
>> -ObjCInterfaceDecl *CGDebugInfo::getObjCInterfaceDecl(QualType Ty) {
>> -  switch (Ty->getTypeClass()) {
>> -  case 

r250803 - Put back dead code that's used out-of-tree.

2015-10-20 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Tue Oct 20 02:50:21 2015
New Revision: 250803

URL: http://llvm.org/viewvc/llvm-project?rev=250803=rev
Log:
Put back dead code that's used out-of-tree.

Partially reverts r250418.

Modified:
cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp
cfe/trunk/lib/Tooling/Core/CMakeLists.txt
cfe/trunk/unittests/Tooling/CMakeLists.txt

Modified: cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp?rev=250803=250802=250803=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp Tue Oct 20 02:50:21 2015
@@ -36,3 +36,33 @@ CodeGenABITypes::CodeGenABITypes(ASTCont
 // Explicitly out-of-line because ~CodeGenModule() is private but
 // CodeGenABITypes.h is part of clang's API.
 CodeGenABITypes::~CodeGenABITypes() = default;
+
+const CGFunctionInfo &
+CodeGenABITypes::arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD,
+ QualType receiverType) {
+  return CGM->getTypes().arrangeObjCMessageSendSignature(MD, receiverType);
+}
+
+const CGFunctionInfo &
+CodeGenABITypes::arrangeFreeFunctionType(CanQual Ty) {
+  return CGM->getTypes().arrangeFreeFunctionType(Ty);
+}
+
+const CGFunctionInfo &
+CodeGenABITypes::arrangeFreeFunctionType(CanQual Ty) {
+  return CGM->getTypes().arrangeFreeFunctionType(Ty);
+}
+
+const CGFunctionInfo &
+CodeGenABITypes::arrangeCXXMethodType(const CXXRecordDecl *RD,
+  const FunctionProtoType *FTP) {
+  return CGM->getTypes().arrangeCXXMethodType(RD, FTP);
+}
+
+const CGFunctionInfo ::arrangeFreeFunctionCall(
+CanQualType returnType, ArrayRef argTypes,
+FunctionType::ExtInfo info, RequiredArgs args) {
+  return CGM->getTypes().arrangeLLVMFunctionInfo(
+  returnType, /*IsInstanceMethod=*/false, /*IsChainCall=*/false, argTypes,
+  info, args);
+}

Modified: cfe/trunk/lib/Tooling/Core/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/CMakeLists.txt?rev=250803=250802=250803=diff
==
--- cfe/trunk/lib/Tooling/Core/CMakeLists.txt (original)
+++ cfe/trunk/lib/Tooling/Core/CMakeLists.txt Tue Oct 20 02:50:21 2015
@@ -1,6 +1,7 @@
 set(LLVM_LINK_COMPONENTS support)
 
 add_clang_library(clangToolingCore
+  Lookup.cpp
   Replacement.cpp
 
   LINK_LIBS

Modified: cfe/trunk/unittests/Tooling/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/CMakeLists.txt?rev=250803=250802=250803=diff
==
--- cfe/trunk/unittests/Tooling/CMakeLists.txt (original)
+++ cfe/trunk/unittests/Tooling/CMakeLists.txt Tue Oct 20 02:50:21 2015
@@ -6,6 +6,7 @@ set(LLVM_LINK_COMPONENTS
 add_clang_unittest(ToolingTests
   CommentHandlerTest.cpp
   CompilationDatabaseTest.cpp
+  LookupTest.cpp
   ToolingTest.cpp
   RecursiveASTVisitorTest.cpp
   RecursiveASTVisitorTestCallVisitor.cpp


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


Re: [PATCH] D13811: [clang-format] AllowShortFunctionsOnASingleLine: true/Empty didn't work with BreakBeforeBraces: Linux/Allman.

2015-10-20 Thread Marek Kurdej via cfe-commits
curdeius updated this revision to Diff 37832.
curdeius added a comment.

- AllowShortFunctionsOnASingleLine: true didn't work with BreakBeforeBraces: 
Linux/Allman.
- Add test checking that non-empty functions in styles with 
`BraceWrapping.AfterFunction = true` don't get merged into one line. Fix the 
merge condition.


http://reviews.llvm.org/D13811

Files:
  lib/Format/UnwrappedLineFormatter.cpp
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -6518,6 +6518,21 @@
"  return 42;\n"
"}",
MergeInlineOnly);
+
+  FormatStyle MergeEmptyCustom = getLLVMStyle();
+  MergeEmptyCustom.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty;
+  MergeEmptyCustom.BreakBeforeBraces = FormatStyle::BS_Custom;
+  MergeEmptyCustom.BraceWrapping.AfterFunction = true;
+  verifyFormat("class C {\n"
+   "  int f() {}\n"
+   "};",
+   MergeEmptyCustom);
+  verifyFormat("int f() {}", MergeEmptyCustom);
+  verifyFormat("int f()\n"
+   "{\n"
+   "  return 0;\n"
+   "}",
+   MergeEmptyCustom);
 }
 
 TEST_F(FormatTest, UnderstandContextOfRecordTypeKeywords) {
Index: lib/Format/UnwrappedLineFormatter.cpp
===
--- lib/Format/UnwrappedLineFormatter.cpp
+++ lib/Format/UnwrappedLineFormatter.cpp
@@ -185,14 +185,18 @@
 ? 0
 : Limit - TheLine->Last->TotalLength;
 
+bool EmptyFunction =
+(Style.AllowShortFunctionsOnASingleLine >= FormatStyle::SFS_Empty) &&
+(((Style.BraceWrapping.AfterFunction && (I + 2 != E)) ? I[2] : I[1])
+ ->First->is(tok::r_brace));
 // FIXME: TheLine->Level != 0 might or might not be the right check to do.
 // If necessary, change to something smarter.
+bool InlineFunction =
+(Style.AllowShortFunctionsOnASingleLine == FormatStyle::SFS_Inline) &&
+(TheLine->Level != 0);
 bool MergeShortFunctions =
 Style.AllowShortFunctionsOnASingleLine == FormatStyle::SFS_All ||
-(Style.AllowShortFunctionsOnASingleLine >= FormatStyle::SFS_Empty &&
- I[1]->First->is(tok::r_brace)) ||
-(Style.AllowShortFunctionsOnASingleLine == FormatStyle::SFS_Inline &&
- TheLine->Level != 0);
+EmptyFunction || InlineFunction;
 
 if (TheLine->Last->is(TT_FunctionLBrace) &&
 TheLine->First != TheLine->Last) {


Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -6518,6 +6518,21 @@
"  return 42;\n"
"}",
MergeInlineOnly);
+
+  FormatStyle MergeEmptyCustom = getLLVMStyle();
+  MergeEmptyCustom.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty;
+  MergeEmptyCustom.BreakBeforeBraces = FormatStyle::BS_Custom;
+  MergeEmptyCustom.BraceWrapping.AfterFunction = true;
+  verifyFormat("class C {\n"
+   "  int f() {}\n"
+   "};",
+   MergeEmptyCustom);
+  verifyFormat("int f() {}", MergeEmptyCustom);
+  verifyFormat("int f()\n"
+   "{\n"
+   "  return 0;\n"
+   "}",
+   MergeEmptyCustom);
 }
 
 TEST_F(FormatTest, UnderstandContextOfRecordTypeKeywords) {
Index: lib/Format/UnwrappedLineFormatter.cpp
===
--- lib/Format/UnwrappedLineFormatter.cpp
+++ lib/Format/UnwrappedLineFormatter.cpp
@@ -185,14 +185,18 @@
 ? 0
 : Limit - TheLine->Last->TotalLength;
 
+bool EmptyFunction =
+(Style.AllowShortFunctionsOnASingleLine >= FormatStyle::SFS_Empty) &&
+(((Style.BraceWrapping.AfterFunction && (I + 2 != E)) ? I[2] : I[1])
+ ->First->is(tok::r_brace));
 // FIXME: TheLine->Level != 0 might or might not be the right check to do.
 // If necessary, change to something smarter.
+bool InlineFunction =
+(Style.AllowShortFunctionsOnASingleLine == FormatStyle::SFS_Inline) &&
+(TheLine->Level != 0);
 bool MergeShortFunctions =
 Style.AllowShortFunctionsOnASingleLine == FormatStyle::SFS_All ||
-(Style.AllowShortFunctionsOnASingleLine >= FormatStyle::SFS_Empty &&
- I[1]->First->is(tok::r_brace)) ||
-(Style.AllowShortFunctionsOnASingleLine == FormatStyle::SFS_Inline &&
- TheLine->Level != 0);
+EmptyFunction || InlineFunction;
 
 if (TheLine->Last->is(TT_FunctionLBrace) &&
 TheLine->First != TheLine->Last) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13871: Add modernize-use-default check to clang-tidy.

2015-10-20 Thread Angel Garcia via cfe-commits
angelgarcia updated this revision to Diff 37833.
angelgarcia added a comment.

Global variable -> static, and a few other additions.

> Will be good idea to add handling of cases where default constructor is empty 
> and only call base class(es) default constructor/members default constructors


I agree, but checking all members and base classes is the main difficulty of 
the copy-constructor/copy-assignment operator. When I implement those I will 
probably update this.


http://reviews.llvm.org/D13871

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseDefaultCheck.cpp
  clang-tidy/modernize/UseDefaultCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-default.rst
  test/clang-tidy/modernize-use-default.cpp

Index: test/clang-tidy/modernize-use-default.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-default.cpp
@@ -0,0 +1,137 @@
+// RUN: %python %S/check_clang_tidy.py %s modernize-use-default %t
+
+class A {
+public:
+  A();
+  ~A();
+};
+
+A::A() {}
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use '= default' to define a trivial default constructor [modernize-use-default]
+// CHECK-FIXES: A::A() = default;
+A::~A() {}
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use '= default' to define a trivial destructor [modernize-use-default]
+// CHECK-FIXES: A::~A() = default;
+
+// Inline definitions.
+class B {
+public:
+  B() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: B() = default;
+  ~B() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: ~B() = default;
+};
+
+void f();
+
+class C {
+public:
+  // Non-empty constructor body.
+  C() { f(); }
+  // Non-empty destructor body.
+  ~C() { f(); }
+};
+
+class D {
+public:
+  // Constructor with initializer.
+  D() : Field(5) {}
+  // Constructor with arguments.
+  D(int Arg1, int Arg2) {}
+  int Field;
+};
+
+// Private constructor/destructor.
+class E {
+  E() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: E() = default;
+  ~E() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: ~E() = default;
+};
+
+// struct.
+struct F {
+  F() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: F() = default;
+  ~F() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: F() = default;
+};
+
+// Deleted constructor/destructor.
+class G {
+public:
+  G() = delete;
+  ~G() = delete;
+};
+
+// Do not remove other keywords.
+class H {
+public:
+  explicit H() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: explicit H() = default;
+  virtual ~H() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: virtual ~H() = default;
+};
+
+// Nested class.
+struct I {
+  struct II {
+II() {}
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use '= default'
+// CHECK-FIXES: II() = default;
+~II() {}
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use '= default'
+// CHECK-FIXES: ~II() = default;
+  };
+  int Int;
+};
+
+// Class template.
+template 
+class J {
+public:
+  J() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: J() = default;
+  ~J() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: ~J() = default;
+};
+
+// Non user-provided constructor/destructor.
+struct K {
+  int Int;
+};
+void g() {
+  K *PtrK = new K();
+  PtrK->~K();
+  delete PtrK;
+}
+
+// Already using default.
+struct L {
+  L() = default;
+  ~L() = default;
+};
+struct M {
+  M();
+  ~M();
+};
+M::M() = default;
+M::~M() = default;
+
+// Delegating constructor and overriden destructor.
+struct N : H {
+  N() : H() {}
+  ~N() override {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: ~N() override = default;
+};
Index: docs/clang-tidy/checks/modernize-use-default.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-use-default.rst
@@ -0,0 +1,27 @@
+modernize-use-default
+=
+
+This check replaces default bodies of special member functions with ``=
+default;``.  The explicitly defaulted function declarations enable more
+opportunities in optimization, because the compiler might treat explicitly
+defaulted functions as trivial.
+
+.. code-block:: c++
+
+  struct A {
+A() {}
+~A();
+  };
+  A::~A() {}
+
+  // becomes
+
+  struct A {
+A() = default;
+~A();
+  };
+  A::~A() = default;
+
+.. note::
+  Copy-constructor, copy-assignment operator, move-constructor and
+  move-assignment operator are not supported yet.
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ 

Re: r250577 - [modules] Allow the error when explicitly loading an incompatible module file

2015-10-20 Thread Manuel Klimek via cfe-commits
On Tue, Oct 20, 2015 at 10:41 AM Sean Silva  wrote:

> On Tue, Oct 20, 2015 at 1:38 AM, Manuel Klimek  wrote:
>
>> On Tue, Oct 20, 2015 at 5:52 AM Sean Silva  wrote:
>>
>>> On Mon, Oct 19, 2015 at 2:10 AM, Manuel Klimek 
>>> wrote:
>>>
 On Sat, Oct 17, 2015 at 3:41 AM Richard Smith via cfe-commits <
 cfe-commits@lists.llvm.org> wrote:

> On Fri, Oct 16, 2015 at 6:30 PM, Sean Silva 
> wrote:
>
>> On Fri, Oct 16, 2015 at 6:26 PM, Richard Smith > > wrote:
>>
>>> On Fri, Oct 16, 2015 at 6:25 PM, Sean Silva 
>>> wrote:
>>>
 On Fri, Oct 16, 2015 at 6:12 PM, Richard Smith <
 rich...@metafoo.co.uk> wrote:

> On Fri, Oct 16, 2015 at 4:43 PM, Sean Silva  > wrote:
>
>> On Fri, Oct 16, 2015 at 4:20 PM, Richard Smith via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: rsmith
>>> Date: Fri Oct 16 18:20:19 2015
>>> New Revision: 250577
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=250577=rev
>>> Log:
>>> [modules] Allow the error when explicitly loading an
>>> incompatible module file
>>> via -fmodule-file= to be turned off; in that case, just include
>>> the relevant
>>> files textually. This allows module files to be unconditionally
>>> passed to all
>>> compile actions via CXXFLAGS, and to be ignored for rules that
>>> specify custom
>>> incompatible flags.
>>>
>>
>> What direction are you trying to go with this? Are you thinking
>> something like having CMake build a bunch of modules up front?
>>
>
> That's certainly one thing you can do with this. Another is that
> you can make cmake automatically and explicitly build a module for 
> each
> library, and then provide that for all the dependencies of that 
> library,
>

 How does CMake know which headers are part of which library?
 Strategically named top-level modules in the module map?

>>>
>>> The idea would be for CMake to generate the module map itself based
>>> on the build rules.
>>>
>>
>> How would it know which headers to include? Do
>> our ADDITIONAL_HEADER_DIRS things in our CMakeLists.txt have enough
>> information for this?
>>
>
> Some additional information may need to be added to the CMakeLists to
> enable this. Some build systems already model the headers for a library,
> and so already have the requisite information.
>

 CMake supports specifying headers for libraries (mainly used for MS
 VS). If we need this for modules, we'll probably need to update our build
 rules (which will probably make sense anyway, for a better experience for
 VS users ;)

>>>
>>> Nice.
>>>
>>> Brad, do you have any idea how hard it would be to get cmake to generate
>>> clang module map files and add explicit module build steps? Basically, the
>>> requirements (off the top of my head) are:
>>> - for each library, generate a module map which is essentially just a
>>> list of the headers in that library (it's not just a flat list, but that's
>>> the gist of it).
>>> - for each module map, add a build step that invokes clang on it to say
>>> "build the module corresponding to this module map" (it's basically
>>> `clang++ path/to/foo.modulemap -o foo.pcm` with a little bit of fluff
>>> around it). There is also a dependency from foo.pcm on each of the
>>> libraries that library "foo" depends on.
>>> - for each library $Dep that library $Lib depends on, add $Dep's .pcm
>>> file as a dependency of the .o build steps for $Lib. $Dep's .pcm file also
>>> needs to be passed on the command line of the .o build steps for $Lib.
>>>
>>> It seems like similar requirements are going to be common in the
>>> standardized modules feature (except for the module map I think? Richard?).
>>> Basically, in order to avoid redundantly parsing textual headers, you need
>>> to run a build step on headers that turns them into some form that can be
>>> processed more efficiently than just parsing it. E.g. the build step on
>>> slide 36 of this cppcon presentation about the Microsoft experimental
>>> modules implementation https://www.youtube.com/watch?v=RwdQA0pGWa4
>>> (slides: https://goo.gl/t4Eg89 ).
>>>
>>> Let me know if there is anything I can do to help (up to and including
>>> patches, but I'll need pointers and possibly some hand-holding as I'm
>>> unfamiliar with the CMake language and CMake codebase).
>>>
>>> There's also some issues of detecting if the host clang is new enough
>>> that we want to use its modules feature and also the issue of detecting

Re: r250577 - [modules] Allow the error when explicitly loading an incompatible module file

2015-10-20 Thread Manuel Klimek via cfe-commits
On Tue, Oct 20, 2015 at 5:52 AM Sean Silva  wrote:

> On Mon, Oct 19, 2015 at 2:10 AM, Manuel Klimek  wrote:
>
>> On Sat, Oct 17, 2015 at 3:41 AM Richard Smith via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> On Fri, Oct 16, 2015 at 6:30 PM, Sean Silva 
>>> wrote:
>>>
 On Fri, Oct 16, 2015 at 6:26 PM, Richard Smith 
 wrote:

> On Fri, Oct 16, 2015 at 6:25 PM, Sean Silva 
> wrote:
>
>> On Fri, Oct 16, 2015 at 6:12 PM, Richard Smith > > wrote:
>>
>>> On Fri, Oct 16, 2015 at 4:43 PM, Sean Silva 
>>> wrote:
>>>
 On Fri, Oct 16, 2015 at 4:20 PM, Richard Smith via cfe-commits <
 cfe-commits@lists.llvm.org> wrote:

> Author: rsmith
> Date: Fri Oct 16 18:20:19 2015
> New Revision: 250577
>
> URL: http://llvm.org/viewvc/llvm-project?rev=250577=rev
> Log:
> [modules] Allow the error when explicitly loading an incompatible
> module file
> via -fmodule-file= to be turned off; in that case, just include
> the relevant
> files textually. This allows module files to be unconditionally
> passed to all
> compile actions via CXXFLAGS, and to be ignored for rules that
> specify custom
> incompatible flags.
>

 What direction are you trying to go with this? Are you thinking
 something like having CMake build a bunch of modules up front?

>>>
>>> That's certainly one thing you can do with this. Another is that you
>>> can make cmake automatically and explicitly build a module for each
>>> library, and then provide that for all the dependencies of that library,
>>>
>>
>> How does CMake know which headers are part of which library?
>> Strategically named top-level modules in the module map?
>>
>
> The idea would be for CMake to generate the module map itself based on
> the build rules.
>

 How would it know which headers to include? Do
 our ADDITIONAL_HEADER_DIRS things in our CMakeLists.txt have enough
 information for this?

>>>
>>> Some additional information may need to be added to the CMakeLists to
>>> enable this. Some build systems already model the headers for a library,
>>> and so already have the requisite information.
>>>
>>
>> CMake supports specifying headers for libraries (mainly used for MS VS).
>> If we need this for modules, we'll probably need to update our build rules
>> (which will probably make sense anyway, for a better experience for VS
>> users ;)
>>
>
> Nice.
>
> Brad, do you have any idea how hard it would be to get cmake to generate
> clang module map files and add explicit module build steps? Basically, the
> requirements (off the top of my head) are:
> - for each library, generate a module map which is essentially just a list
> of the headers in that library (it's not just a flat list, but that's the
> gist of it).
> - for each module map, add a build step that invokes clang on it to say
> "build the module corresponding to this module map" (it's basically
> `clang++ path/to/foo.modulemap -o foo.pcm` with a little bit of fluff
> around it). There is also a dependency from foo.pcm on each of the
> libraries that library "foo" depends on.
> - for each library $Dep that library $Lib depends on, add $Dep's .pcm file
> as a dependency of the .o build steps for $Lib. $Dep's .pcm file also needs
> to be passed on the command line of the .o build steps for $Lib.
>
> It seems like similar requirements are going to be common in the
> standardized modules feature (except for the module map I think? Richard?).
> Basically, in order to avoid redundantly parsing textual headers, you need
> to run a build step on headers that turns them into some form that can be
> processed more efficiently than just parsing it. E.g. the build step on
> slide 36 of this cppcon presentation about the Microsoft experimental
> modules implementation https://www.youtube.com/watch?v=RwdQA0pGWa4
> (slides: https://goo.gl/t4Eg89 ).
>
> Let me know if there is anything I can do to help (up to and including
> patches, but I'll need pointers and possibly some hand-holding as I'm
> unfamiliar with the CMake language and CMake codebase).
>
> There's also some issues of detecting if the host clang is new enough that
> we want to use its modules feature and also the issue of detecting
> modularized system headers if available, but we can hammer those things out
> as we run into them.
>
> Manuel, I heard through the grape vine that you were the one that
> implemented the explicit modules stuff for bazel? Did I miss anything in my
> list above?
>

I think that's about right. We also embed the module maps into the modules,
but most of these things only matter for distributed 

Re: r250577 - [modules] Allow the error when explicitly loading an incompatible module file

2015-10-20 Thread Sean Silva via cfe-commits
On Tue, Oct 20, 2015 at 1:38 AM, Manuel Klimek  wrote:

> On Tue, Oct 20, 2015 at 5:52 AM Sean Silva  wrote:
>
>> On Mon, Oct 19, 2015 at 2:10 AM, Manuel Klimek  wrote:
>>
>>> On Sat, Oct 17, 2015 at 3:41 AM Richard Smith via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 On Fri, Oct 16, 2015 at 6:30 PM, Sean Silva 
 wrote:

> On Fri, Oct 16, 2015 at 6:26 PM, Richard Smith 
> wrote:
>
>> On Fri, Oct 16, 2015 at 6:25 PM, Sean Silva 
>> wrote:
>>
>>> On Fri, Oct 16, 2015 at 6:12 PM, Richard Smith <
>>> rich...@metafoo.co.uk> wrote:
>>>
 On Fri, Oct 16, 2015 at 4:43 PM, Sean Silva 
 wrote:

> On Fri, Oct 16, 2015 at 4:20 PM, Richard Smith via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: rsmith
>> Date: Fri Oct 16 18:20:19 2015
>> New Revision: 250577
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=250577=rev
>> Log:
>> [modules] Allow the error when explicitly loading an incompatible
>> module file
>> via -fmodule-file= to be turned off; in that case, just include
>> the relevant
>> files textually. This allows module files to be unconditionally
>> passed to all
>> compile actions via CXXFLAGS, and to be ignored for rules that
>> specify custom
>> incompatible flags.
>>
>
> What direction are you trying to go with this? Are you thinking
> something like having CMake build a bunch of modules up front?
>

 That's certainly one thing you can do with this. Another is that
 you can make cmake automatically and explicitly build a module for each
 library, and then provide that for all the dependencies of that 
 library,

>>>
>>> How does CMake know which headers are part of which library?
>>> Strategically named top-level modules in the module map?
>>>
>>
>> The idea would be for CMake to generate the module map itself based
>> on the build rules.
>>
>
> How would it know which headers to include? Do
> our ADDITIONAL_HEADER_DIRS things in our CMakeLists.txt have enough
> information for this?
>

 Some additional information may need to be added to the CMakeLists to
 enable this. Some build systems already model the headers for a library,
 and so already have the requisite information.

>>>
>>> CMake supports specifying headers for libraries (mainly used for MS VS).
>>> If we need this for modules, we'll probably need to update our build rules
>>> (which will probably make sense anyway, for a better experience for VS
>>> users ;)
>>>
>>
>> Nice.
>>
>> Brad, do you have any idea how hard it would be to get cmake to generate
>> clang module map files and add explicit module build steps? Basically, the
>> requirements (off the top of my head) are:
>> - for each library, generate a module map which is essentially just a
>> list of the headers in that library (it's not just a flat list, but that's
>> the gist of it).
>> - for each module map, add a build step that invokes clang on it to say
>> "build the module corresponding to this module map" (it's basically
>> `clang++ path/to/foo.modulemap -o foo.pcm` with a little bit of fluff
>> around it). There is also a dependency from foo.pcm on each of the
>> libraries that library "foo" depends on.
>> - for each library $Dep that library $Lib depends on, add $Dep's .pcm
>> file as a dependency of the .o build steps for $Lib. $Dep's .pcm file also
>> needs to be passed on the command line of the .o build steps for $Lib.
>>
>> It seems like similar requirements are going to be common in the
>> standardized modules feature (except for the module map I think? Richard?).
>> Basically, in order to avoid redundantly parsing textual headers, you need
>> to run a build step on headers that turns them into some form that can be
>> processed more efficiently than just parsing it. E.g. the build step on
>> slide 36 of this cppcon presentation about the Microsoft experimental
>> modules implementation https://www.youtube.com/watch?v=RwdQA0pGWa4
>> (slides: https://goo.gl/t4Eg89 ).
>>
>> Let me know if there is anything I can do to help (up to and including
>> patches, but I'll need pointers and possibly some hand-holding as I'm
>> unfamiliar with the CMake language and CMake codebase).
>>
>> There's also some issues of detecting if the host clang is new enough
>> that we want to use its modules feature and also the issue of detecting
>> modularized system headers if available, but we can hammer those things out
>> as we run into them.
>>
>> Manuel, I heard through the grape vine that you were the one that
>> implemented the explicit 

Re: [PATCH] D13861: [x86] fix wrong maskload/store intrinsic definitions in avxintrin.h (follow up of D13776).

2015-10-20 Thread Elena Demikhovsky via cfe-commits
delena added a comment.

LGTM


http://reviews.llvm.org/D13861



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


Re: [PATCH] D13861: [x86] fix wrong maskload/store intrinsic definitions in avxintrin.h (follow up of D13776).

2015-10-20 Thread Andrea Di Biagio via cfe-commits
andreadb added a comment.

In http://reviews.llvm.org/D13861#270811, @delena wrote:

> LGTM


Thanks Elena!
Committed revision250816.


Repository:
  rL LLVM

http://reviews.llvm.org/D13861



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


Re: [PATCH] D13673: Add initial support for the MUSL C library.

2015-10-20 Thread Vasileios Kalintiris via cfe-commits
vkalintiris updated this revision to Diff 37850.
vkalintiris marked 6 inline comments as done.
vkalintiris added a comment.

Sorry for the delay.

Addressed reviewer comments and modifed CMake to check that
LIBCXX_INSTALL_SUPPORT_HEADERS is not turned off when LIBCXX_LIBC_IS_MUSL is ON.


http://reviews.llvm.org/D13673

Files:
  CMakeLists.txt
  include/__config
  include/__config_site.in
  include/__locale
  include/support/musl/xlocale.h
  src/locale.cpp

Index: src/locale.cpp
===
--- src/locale.cpp
+++ src/locale.cpp
@@ -812,7 +812,8 @@
 {
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 return isascii(c) ? ctype::__classic_upper_table()[c] : c;
 #else
 return (isascii(c) && iswlower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'a'+L'A' : c;
@@ -825,7 +826,8 @@
 for (; low != high; ++low)
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ? ctype::__classic_upper_table()[*low]
  : *low;
 #else
@@ -839,7 +841,8 @@
 {
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD_) || defined(_LIBCPP_HAS_MUSL_LIBC)
 return isascii(c) ? ctype::__classic_lower_table()[c] : c;
 #else
 return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'A'+'a' : c;
@@ -852,7 +855,8 @@
 for (; low != high; ++low)
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ? ctype::__classic_lower_table()[*low]
  : *low;
 #else
@@ -921,8 +925,8 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_upper_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
-return isascii(c) ? 
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+return isascii(c) ?
   static_cast(__classic_upper_table()[static_cast(c)]) : c;
 #else
 return (isascii(c) && islower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-'a'+'A' : c;
@@ -938,7 +942,7 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_upper_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ?
   static_cast(__classic_upper_table()[static_cast(*low)]) : *low;
 #else
@@ -955,7 +959,7 @@
   static_cast(_DefaultRuneLocale.__maplower[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_lower_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 return isascii(c) ?
   static_cast(__classic_lower_table()[static_cast(c)]) : c;
 #else
@@ -971,7 +975,7 @@
 *low = isascii(*low) ? static_cast(_DefaultRuneLocale.__maplower[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_lower_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ? static_cast(__classic_lower_table()[static_cast(*low)]) : *low;
 #else
 *low = (isascii(*low) && isupper_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low-'A'+'a' : *low;
@@ -1012,7 +1016,7 @@
 return low;
 }
 
-#ifdef __EMSCRIPTEN__
+#if defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 extern "C" const unsigned short ** __ctype_b_loc();
 extern "C" const int ** __ctype_tolower_loc();
 extern "C" const int ** __ctype_toupper_loc();
@@ -1114,7 +1118,7 @@
 return _ctype+1; // internal ctype mask table defined in msvcrt.dll
 // This is assumed to be safe, which is a nonsense assumption because we're
 // going to end up dereferencing it later...
-#elif defined(__EMSCRIPTEN__)

Re: [PATCH] D13861: [x86] fix wrong maskload/store intrinsic definitions in avxintrin.h (follow up of D13776).

2015-10-20 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL250816: [x86] Fix maskload/store intrinsic definitions in 
avxintrin.h (authored by adibiagio).

Changed prior to commit:
  http://reviews.llvm.org/D13861?vs=37741=37852#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13861

Files:
  cfe/trunk/include/clang/Basic/BuiltinsX86.def
  cfe/trunk/lib/Headers/avxintrin.h
  cfe/trunk/test/CodeGen/builtins-x86.c

Index: cfe/trunk/lib/Headers/avxintrin.h
===
--- cfe/trunk/lib/Headers/avxintrin.h
+++ cfe/trunk/lib/Headers/avxintrin.h
@@ -835,53 +835,53 @@
 
 /* Conditional load ops */
 static __inline __m128d __DEFAULT_FN_ATTRS
-_mm_maskload_pd(double const *__p, __m128d __m)
+_mm_maskload_pd(double const *__p, __m128i __m)
 {
-  return (__m128d)__builtin_ia32_maskloadpd((const __v2df *)__p, (__v2df)__m);
+  return (__m128d)__builtin_ia32_maskloadpd((const __v2df *)__p, (__v2di)__m);
 }
 
 static __inline __m256d __DEFAULT_FN_ATTRS
-_mm256_maskload_pd(double const *__p, __m256d __m)
+_mm256_maskload_pd(double const *__p, __m256i __m)
 {
   return (__m256d)__builtin_ia32_maskloadpd256((const __v4df *)__p,
-   (__v4df)__m);
+   (__v4di)__m);
 }
 
 static __inline __m128 __DEFAULT_FN_ATTRS
-_mm_maskload_ps(float const *__p, __m128 __m)
+_mm_maskload_ps(float const *__p, __m128i __m)
 {
-  return (__m128)__builtin_ia32_maskloadps((const __v4sf *)__p, (__v4sf)__m);
+  return (__m128)__builtin_ia32_maskloadps((const __v4sf *)__p, (__v4si)__m);
 }
 
 static __inline __m256 __DEFAULT_FN_ATTRS
-_mm256_maskload_ps(float const *__p, __m256 __m)
+_mm256_maskload_ps(float const *__p, __m256i __m)
 {
-  return (__m256)__builtin_ia32_maskloadps256((const __v8sf *)__p, (__v8sf)__m);
+  return (__m256)__builtin_ia32_maskloadps256((const __v8sf *)__p, (__v8si)__m);
 }
 
 /* Conditional store ops */
 static __inline void __DEFAULT_FN_ATTRS
-_mm256_maskstore_ps(float *__p, __m256 __m, __m256 __a)
+_mm256_maskstore_ps(float *__p, __m256i __m, __m256 __a)
 {
-  __builtin_ia32_maskstoreps256((__v8sf *)__p, (__v8sf)__m, (__v8sf)__a);
+  __builtin_ia32_maskstoreps256((__v8sf *)__p, (__v8si)__m, (__v8sf)__a);
 }
 
 static __inline void __DEFAULT_FN_ATTRS
-_mm_maskstore_pd(double *__p, __m128d __m, __m128d __a)
+_mm_maskstore_pd(double *__p, __m128i __m, __m128d __a)
 {
-  __builtin_ia32_maskstorepd((__v2df *)__p, (__v2df)__m, (__v2df)__a);
+  __builtin_ia32_maskstorepd((__v2df *)__p, (__v2di)__m, (__v2df)__a);
 }
 
 static __inline void __DEFAULT_FN_ATTRS
-_mm256_maskstore_pd(double *__p, __m256d __m, __m256d __a)
+_mm256_maskstore_pd(double *__p, __m256i __m, __m256d __a)
 {
-  __builtin_ia32_maskstorepd256((__v4df *)__p, (__v4df)__m, (__v4df)__a);
+  __builtin_ia32_maskstorepd256((__v4df *)__p, (__v4di)__m, (__v4df)__a);
 }
 
 static __inline void __DEFAULT_FN_ATTRS
-_mm_maskstore_ps(float *__p, __m128 __m, __m128 __a)
+_mm_maskstore_ps(float *__p, __m128i __m, __m128 __a)
 {
-  __builtin_ia32_maskstoreps((__v4sf *)__p, (__v4sf)__m, (__v4sf)__a);
+  __builtin_ia32_maskstoreps((__v4sf *)__p, (__v4si)__m, (__v4sf)__a);
 }
 
 /* Cacheability support ops */
Index: cfe/trunk/include/clang/Basic/BuiltinsX86.def
===
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def
@@ -503,14 +503,14 @@
 TARGET_BUILTIN(__builtin_ia32_movntdq256, "vV4LLi*V4LLi", "", "avx")
 TARGET_BUILTIN(__builtin_ia32_movntpd256, "vd*V4d", "", "avx")
 TARGET_BUILTIN(__builtin_ia32_movntps256, "vf*V8f", "", "avx")
-TARGET_BUILTIN(__builtin_ia32_maskloadpd, "V2dV2dC*V2d", "", "avx")
-TARGET_BUILTIN(__builtin_ia32_maskloadps, "V4fV4fC*V4f", "", "avx")
-TARGET_BUILTIN(__builtin_ia32_maskloadpd256, "V4dV4dC*V4d", "", "avx")
-TARGET_BUILTIN(__builtin_ia32_maskloadps256, "V8fV8fC*V8f", "", "avx")
-TARGET_BUILTIN(__builtin_ia32_maskstorepd, "vV2d*V2dV2d", "", "avx")
-TARGET_BUILTIN(__builtin_ia32_maskstoreps, "vV4f*V4fV4f", "", "avx")
-TARGET_BUILTIN(__builtin_ia32_maskstorepd256, "vV4d*V4dV4d", "", "avx")
-TARGET_BUILTIN(__builtin_ia32_maskstoreps256, "vV8f*V8fV8f", "", "avx")
+TARGET_BUILTIN(__builtin_ia32_maskloadpd, "V2dV2dC*V2LLi", "", "avx")
+TARGET_BUILTIN(__builtin_ia32_maskloadps, "V4fV4fC*V4i", "", "avx")
+TARGET_BUILTIN(__builtin_ia32_maskloadpd256, "V4dV4dC*V4LLi", "", "avx")
+TARGET_BUILTIN(__builtin_ia32_maskloadps256, "V8fV8fC*V8i", "", "avx")
+TARGET_BUILTIN(__builtin_ia32_maskstorepd, "vV2d*V2LLiV2d", "", "avx")
+TARGET_BUILTIN(__builtin_ia32_maskstoreps, "vV4f*V4iV4f", "", "avx")
+TARGET_BUILTIN(__builtin_ia32_maskstorepd256, "vV4d*V4LLiV4d", "", "avx")
+TARGET_BUILTIN(__builtin_ia32_maskstoreps256, "vV8f*V8iV8f", "", "avx")
 
 // AVX2
 TARGET_BUILTIN(__builtin_ia32_mpsadbw256, "V32cV32cV32cIc", "", "avx2")
Index: cfe/trunk/test/CodeGen/builtins-x86.c

Re: [PATCH] D13871: Add modernize-use-default check to clang-tidy.

2015-10-20 Thread Angel Garcia via cfe-commits
angelgarcia updated this revision to Diff 37859.
angelgarcia added a comment.

Remove the fixme.


http://reviews.llvm.org/D13871

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseDefaultCheck.cpp
  clang-tidy/modernize/UseDefaultCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-default.rst
  test/clang-tidy/modernize-use-default.cpp

Index: test/clang-tidy/modernize-use-default.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-default.cpp
@@ -0,0 +1,137 @@
+// RUN: %python %S/check_clang_tidy.py %s modernize-use-default %t
+
+class A {
+public:
+  A();
+  ~A();
+};
+
+A::A() {}
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use '= default' to define a trivial default constructor [modernize-use-default]
+// CHECK-FIXES: A::A() = default;
+A::~A() {}
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use '= default' to define a trivial destructor [modernize-use-default]
+// CHECK-FIXES: A::~A() = default;
+
+// Inline definitions.
+class B {
+public:
+  B() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: B() = default;
+  ~B() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: ~B() = default;
+};
+
+void f();
+
+class C {
+public:
+  // Non-empty constructor body.
+  C() { f(); }
+  // Non-empty destructor body.
+  ~C() { f(); }
+};
+
+class D {
+public:
+  // Constructor with initializer.
+  D() : Field(5) {}
+  // Constructor with arguments.
+  D(int Arg1, int Arg2) {}
+  int Field;
+};
+
+// Private constructor/destructor.
+class E {
+  E() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: E() = default;
+  ~E() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: ~E() = default;
+};
+
+// struct.
+struct F {
+  F() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: F() = default;
+  ~F() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: F() = default;
+};
+
+// Deleted constructor/destructor.
+class G {
+public:
+  G() = delete;
+  ~G() = delete;
+};
+
+// Do not remove other keywords.
+class H {
+public:
+  explicit H() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: explicit H() = default;
+  virtual ~H() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: virtual ~H() = default;
+};
+
+// Nested class.
+struct I {
+  struct II {
+II() {}
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use '= default'
+// CHECK-FIXES: II() = default;
+~II() {}
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use '= default'
+// CHECK-FIXES: ~II() = default;
+  };
+  int Int;
+};
+
+// Class template.
+template 
+class J {
+public:
+  J() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: J() = default;
+  ~J() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: ~J() = default;
+};
+
+// Non user-provided constructor/destructor.
+struct K {
+  int Int;
+};
+void g() {
+  K *PtrK = new K();
+  PtrK->~K();
+  delete PtrK;
+}
+
+// Already using default.
+struct L {
+  L() = default;
+  ~L() = default;
+};
+struct M {
+  M();
+  ~M();
+};
+M::M() = default;
+M::~M() = default;
+
+// Delegating constructor and overriden destructor.
+struct N : H {
+  N() : H() {}
+  ~N() override {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default'
+  // CHECK-FIXES: ~N() override = default;
+};
Index: docs/clang-tidy/checks/modernize-use-default.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-use-default.rst
@@ -0,0 +1,27 @@
+modernize-use-default
+=
+
+This check replaces default bodies of special member functions with ``=
+default;``.  The explicitly defaulted function declarations enable more
+opportunities in optimization, because the compiler might treat explicitly
+defaulted functions as trivial.
+
+.. code-block:: c++
+
+  struct A {
+A() {}
+~A();
+  };
+  A::~A() {}
+
+  // becomes
+
+  struct A {
+A() = default;
+~A();
+  };
+  A::~A() = default;
+
+.. note::
+  Copy-constructor, copy-assignment operator, move-constructor and
+  move-assignment operator are not supported yet.
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -54,6 +54,7 @@
modernize-replace-auto-ptr
modernize-shrink-to-fit
modernize-use-auto
+   modernize-use-default
modernize-use-nullptr
modernize-use-override
readability-braces-around-statements
Index: clang-tidy/modernize/UseDefaultCheck.h
===
--- /dev/null

[PATCH] D13889: Apply modernize-use-default to clang-tools-extra.

2015-10-20 Thread Angel Garcia via cfe-commits
angelgarcia created this revision.
angelgarcia added a reviewer: klimek.
angelgarcia added subscribers: cfe-commits, alexfh.

Replace empty bodies of default constructors and destructors with '= default'.

http://reviews.llvm.org/D13889

Files:
  clang-modernize/Core/IncludeDirectives.cpp
  clang-modernize/Core/Transform.cpp
  clang-query/Query.cpp
  clang-tidy/ClangTidyModule.h
  clang-tidy/ClangTidyOptions.h
  clang-tidy/utils/IncludeInserter.cpp
  modularize/CoverageChecker.cpp
  modularize/PreprocessorTracker.cpp
  pp-trace/PPCallbacksTracker.cpp
  unittests/clang-tidy/IncludeInserterTest.cpp

Index: unittests/clang-tidy/IncludeInserterTest.cpp
===
--- unittests/clang-tidy/IncludeInserterTest.cpp
+++ unittests/clang-tidy/IncludeInserterTest.cpp
@@ -98,7 +98,7 @@
 public:
   CXXSystemIncludeInserterCheck(StringRef CheckName, ClangTidyContext *Context)
   : IncludeInserterCheckBase(CheckName, Context) {}
-  virtual ~CXXSystemIncludeInserterCheck() {}
+  virtual ~CXXSystemIncludeInserterCheck() = default;
 
   std::vector HeadersToInclude() const override { return {"set"}; }
   bool IsAngledInclude() const override { return true; }
Index: pp-trace/PPCallbacksTracker.cpp
===
--- pp-trace/PPCallbacksTracker.cpp
+++ pp-trace/PPCallbacksTracker.cpp
@@ -93,7 +93,7 @@
clang::Preprocessor )
 : CallbackCalls(CallbackCalls), Ignore(Ignore), PP(PP) {}
 
-PPCallbacksTracker::~PPCallbacksTracker() {}
+PPCallbacksTracker::~PPCallbacksTracker() = default;
 
 // Callback functions.
 
Index: modularize/PreprocessorTracker.cpp
===
--- modularize/PreprocessorTracker.cpp
+++ modularize/PreprocessorTracker.cpp
@@ -746,7 +746,7 @@
   PreprocessorCallbacks(PreprocessorTrackerImpl ,
 clang::Preprocessor , llvm::StringRef rootHeaderFile)
   : PPTracker(ppTracker), PP(PP), RootHeaderFile(rootHeaderFile) {}
-  ~PreprocessorCallbacks() override {}
+  ~PreprocessorCallbacks() override = default;
 
   // Overridden handlers.
   void InclusionDirective(clang::SourceLocation HashLoc,
@@ -812,7 +812,7 @@
 }
   }
 
-  ~PreprocessorTrackerImpl() override {}
+  ~PreprocessorTrackerImpl() override = default;
 
   // Handle entering a preprocessing session.
   void handlePreprocessorEntry(clang::Preprocessor ,
@@ -1288,7 +1288,7 @@
 // PreprocessorTracker functions.
 
 // PreprocessorTracker desctructor.
-PreprocessorTracker::~PreprocessorTracker() {}
+PreprocessorTracker::~PreprocessorTracker() = default;
 
 // Create instance of PreprocessorTracker.
 PreprocessorTracker *PreprocessorTracker::create(
Index: modularize/CoverageChecker.cpp
===
--- modularize/CoverageChecker.cpp
+++ modularize/CoverageChecker.cpp
@@ -83,7 +83,7 @@
 class CoverageCheckerCallbacks : public PPCallbacks {
 public:
   CoverageCheckerCallbacks(CoverageChecker ) : Checker(Checker) {}
-  ~CoverageCheckerCallbacks() override {}
+  ~CoverageCheckerCallbacks() override = default;
 
   // Include directive callback.
   void InclusionDirective(SourceLocation HashLoc, const Token ,
Index: clang-tidy/utils/IncludeInserter.cpp
===
--- clang-tidy/utils/IncludeInserter.cpp
+++ clang-tidy/utils/IncludeInserter.cpp
@@ -38,7 +38,7 @@
  IncludeSorter::IncludeStyle Style)
 : SourceMgr(SourceMgr), LangOpts(LangOpts), Style(Style) {}
 
-IncludeInserter::~IncludeInserter() {}
+IncludeInserter::~IncludeInserter() = default;
 
 std::unique_ptr IncludeInserter::CreatePPCallbacks() {
   return llvm::make_unique(this);
Index: clang-tidy/ClangTidyOptions.h
===
--- clang-tidy/ClangTidyOptions.h
+++ clang-tidy/ClangTidyOptions.h
@@ -88,7 +88,7 @@
 /// \brief Abstract interface for retrieving various ClangTidy options.
 class ClangTidyOptionsProvider {
 public:
-  virtual ~ClangTidyOptionsProvider() {}
+  virtual ~ClangTidyOptionsProvider() = default;
 
   /// \brief Returns global options, which are independent of the file.
   virtual const ClangTidyGlobalOptions () = 0;
Index: clang-tidy/ClangTidyModule.h
===
--- clang-tidy/ClangTidyModule.h
+++ clang-tidy/ClangTidyModule.h
@@ -82,7 +82,7 @@
 /// them a prefixed name.
 class ClangTidyModule {
 public:
-  virtual ~ClangTidyModule() {}
+  virtual ~ClangTidyModule() = default;
 
   /// \brief Implement this function in order to register all \c CheckFactories
   /// belonging to this module.
Index: clang-query/Query.cpp
===
--- clang-query/Query.cpp
+++ clang-query/Query.cpp
@@ -20,7 +20,7 @@
 namespace clang {
 namespace query {

Re: [PATCH] D13890: Apply modernize-use-default to clang.

2015-10-20 Thread Benjamin Kramer via cfe-commits
bkramer added a comment.

feel free to submit


http://reviews.llvm.org/D13890



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


Re: [PATCH] D13892: Apply modernize-use-default to compiler-rt.

2015-10-20 Thread Angel Garcia via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL250823: Apply modernize-use-default to compiler-rt. 
(authored by angelgarcia).

Changed prior to commit:
  http://reviews.llvm.org/D13892?vs=37868=37869#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13892

Files:
  compiler-rt/trunk/lib/asan/asan_fake_stack.h
  compiler-rt/trunk/lib/msan/msan_allocator.h
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_bitvector.h
  compiler-rt/trunk/lib/tsan/rtl/tsan_clock.h
  compiler-rt/trunk/lib/tsan/rtl/tsan_mutex.cc
  compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc
  compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc
  compiler-rt/trunk/lib/ubsan/ubsan_diag.h

Index: compiler-rt/trunk/lib/asan/asan_fake_stack.h
===
--- compiler-rt/trunk/lib/asan/asan_fake_stack.h
+++ compiler-rt/trunk/lib/asan/asan_fake_stack.h
@@ -155,7 +155,7 @@
   void ForEachFakeFrame(RangeIteratorCallback callback, void *arg);
 
  private:
-  FakeStack() { }
+  FakeStack() = default;
   static const uptr kFlagsOffset = 4096;  // This is were the flags begin.
   // Must match the number of uses of DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID
   COMPILER_CHECK(kNumberOfSizeClasses == 11);
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_bitvector.h
===
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_bitvector.h
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_bitvector.h
@@ -87,7 +87,7 @@
   // }
   class Iterator {
public:
-Iterator() { }
+Iterator() = default;
 explicit Iterator(const BasicBitVector ) : bv_(bv) {}
 bool hasNext() const { return !bv_.empty(); }
 uptr next() { return bv_.getAndClearFirstOne(); }
@@ -273,7 +273,7 @@
   // }
   class Iterator {
public:
-Iterator() { }
+Iterator() = default;
 explicit Iterator(const TwoLevelBitVector ) : bv_(bv), i0_(0), i1_(0) {
   it1_.clear();
   it2_.clear();
Index: compiler-rt/trunk/lib/msan/msan_allocator.h
===
--- compiler-rt/trunk/lib/msan/msan_allocator.h
+++ compiler-rt/trunk/lib/msan/msan_allocator.h
@@ -26,7 +26,7 @@
 
  private:
   // These objects are allocated via mmap() and are zero-initialized.
-  MsanThreadLocalMallocStorage() {}
+  MsanThreadLocalMallocStorage() = default;
 };
 
 } // namespace __msan
Index: compiler-rt/trunk/lib/ubsan/ubsan_diag.h
===
--- compiler-rt/trunk/lib/ubsan/ubsan_diag.h
+++ compiler-rt/trunk/lib/ubsan/ubsan_diag.h
@@ -150,7 +150,7 @@
 
   /// An individual diagnostic message argument.
   struct Arg {
-Arg() {}
+Arg() = default;
 Arg(const char *String) : Kind(AK_String), String(String) {}
 Arg(TypeName TN) : Kind(AK_TypeName), String(TN.getName()) {}
 Arg(UIntMax UInt) : Kind(AK_UInt), UInt(UInt) {}
Index: compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc
===
--- compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc
@@ -67,9 +67,8 @@
 : mset(MBlockReportMutex) {
 }
 
-ReportDesc::~ReportDesc() {
-  // FIXME(dvyukov): it must be leaking a lot of memory.
-}
+// FIXME(dvyukov): it must be leaking a lot of memory.
+ReportDesc::~ReportDesc() = default;
 
 #ifndef SANITIZER_GO
 
Index: compiler-rt/trunk/lib/tsan/rtl/tsan_mutex.cc
===
--- compiler-rt/trunk/lib/tsan/rtl/tsan_mutex.cc
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_mutex.cc
@@ -126,9 +126,8 @@
 #endif
 }
 
-InternalDeadlockDetector::InternalDeadlockDetector() {
-  // Rely on zero initialization because some mutexes can be locked before ctor.
-}
+// Rely on zero initialization because some mutexes can be locked before ctor.
+InternalDeadlockDetector::InternalDeadlockDetector() = default;
 
 #if SANITIZER_DEBUG && !SANITIZER_GO
 void InternalDeadlockDetector::Lock(MutexType t) {
Index: compiler-rt/trunk/lib/tsan/rtl/tsan_clock.h
===
--- compiler-rt/trunk/lib/tsan/rtl/tsan_clock.h
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_clock.h
@@ -33,8 +33,7 @@
 ClockElem clock[kClockCount];
   };
 
-  ClockBlock() {
-  }
+  ClockBlock() = default;
 };
 
 typedef DenseSlabAlloc ClockAlloc;
Index: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc
===
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc
@@ -31,8 +31,7 @@
 }
 
 #ifndef SANITIZER_GO
-ThreadContext::~ThreadContext() {
-}
+ThreadContext::~ThreadContext() = default;
 #endif
 
 void ThreadContext::OnDead() {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org

Re: [PATCH] D13890: Apply modernize-use-default to clang.

2015-10-20 Thread Benjamin Kramer via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

Looks good with one comment.



Comment at: lib/StaticAnalyzer/Core/MemRegion.cpp:141-143
@@ -140,5 +141,1 @@
-MemRegionManager::~MemRegionManager() {
-  // All regions and their data are BumpPtrAllocated.  No need to call
-  // their destructors.
-}
 

Please keep the comments.


http://reviews.llvm.org/D13890



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


Re: [PATCH] D13336: [MSVC] 'property' with an empty array in array subscript expression.

2015-10-20 Thread Alexey Bataev via cfe-commits
ABataev updated this revision to Diff 37854.
ABataev added a comment.

Update after review


http://reviews.llvm.org/D13336

Files:
  include/clang/AST/ASTContext.h
  include/clang/AST/BuiltinTypes.def
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/ASTContext.cpp
  lib/AST/Type.cpp
  lib/AST/TypeLoc.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaPseudoObject.cpp
  lib/Serialization/ASTCommon.cpp
  lib/Serialization/ASTReader.cpp
  test/CodeGenCXX/ms-property.cpp
  test/SemaCXX/ms-property-error.cpp
  test/SemaCXX/ms-property.cpp

Index: lib/Serialization/ASTReader.cpp
===
--- lib/Serialization/ASTReader.cpp
+++ lib/Serialization/ASTReader.cpp
@@ -5955,6 +5955,10 @@
 case PREDEF_TYPE_OMP_ARRAY_SECTION:
   T = Context.OMPArraySectionTy;
   break;
+
+case PREDEF_TYPE_MS_PROPERTY_SUBSCRIPT:
+  T = Context.MSPropertySubscriptTy;
+  break;
 }
 
 assert(!T.isNull() && "Unknown predefined type");
Index: lib/Serialization/ASTCommon.cpp
===
--- lib/Serialization/ASTCommon.cpp
+++ lib/Serialization/ASTCommon.cpp
@@ -187,6 +187,9 @@
   case BuiltinType::OMPArraySection:
 ID = PREDEF_TYPE_OMP_ARRAY_SECTION;
 break;
+  case BuiltinType::MSPropertySubscript:
+ID = PREDEF_TYPE_MS_PROPERTY_SUBSCRIPT;
+break;
   }
 
   return TypeIdx(ID);
Index: lib/AST/Type.cpp
===
--- lib/AST/Type.cpp
+++ lib/AST/Type.cpp
@@ -2597,6 +2597,8 @@
 return "reserve_id_t";
   case OMPArraySection:
 return "";
+  case MSPropertySubscript:
+return "";
   }
 
   llvm_unreachable("Invalid builtin type.");
@@ -3554,6 +3556,7 @@
 case BuiltinType::BuiltinFn:
 case BuiltinType::NullPtr:
 case BuiltinType::OMPArraySection:
+case BuiltinType::MSPropertySubscript:
   return false;
 }
 
Index: lib/AST/ASTContext.cpp
===
--- lib/AST/ASTContext.cpp
+++ lib/AST/ASTContext.cpp
@@ -1055,6 +1055,9 @@
   if (LangOpts.OpenMP)
 InitBuiltinType(OMPArraySectionTy, BuiltinType::OMPArraySection);
 
+  if(LangOpts.MSVCCompat)
+InitBuiltinType(MSPropertySubscriptTy, BuiltinType::MSPropertySubscript);
+
   // C99 6.2.5p11.
   FloatComplexTy  = getComplexType(FloatTy);
   DoubleComplexTy = getComplexType(DoubleTy);
Index: lib/AST/TypeLoc.cpp
===
--- lib/AST/TypeLoc.cpp
+++ lib/AST/TypeLoc.cpp
@@ -353,6 +353,7 @@
   case BuiltinType::OCLReserveID:
   case BuiltinType::BuiltinFn:
   case BuiltinType::OMPArraySection:
+  case BuiltinType::MSPropertySubscript:
 return TST_unspecified;
   }
 
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -3917,7 +3917,21 @@
   // operand might be an overloadable type, in which case the overload
   // resolution for the operator overload should get the first crack
   // at the overload.
-  if (base->getType()->isNonOverloadPlaceholderType()) {
+  // MSDN, property (C++)
+  // https://msdn.microsoft.com/en-us/library/yhfk0thd(v=vs.120).aspx
+  // This attribute can also be used in the declaration of an empty array in a
+  // class or structure definition. For example:
+  // __declspec(property(get=GetX, put=PutX)) int x[];
+  // The above statement indicates that x[] can be used with one or more array
+  // indices. In this case, i=p->x[a][b] will be turned into i=p->GetX(a, b),
+  // and p->x[a][b] = i will be turned into p->PutX(a, b, i);
+  auto *MSProp = dyn_cast(base->IgnoreParens());
+  bool IsMSPropertySubscript =
+  (MSProp && MSProp->getPropertyDecl()->getType()->isArrayType()) ||
+  base->getType()->isSpecificPlaceholderType(
+  BuiltinType::MSPropertySubscript);
+  if (!IsMSPropertySubscript &&
+  base->getType()->isNonOverloadPlaceholderType()) {
 ExprResult result = CheckPlaceholderExpr(base);
 if (result.isInvalid()) return ExprError();
 base = result.get();
@@ -4093,7 +4107,12 @@
   Expr *RHSExp = Idx;
 
   // Perform default conversions.
-  if (!LHSExp->getType()->getAs()) {
+  auto *MSProp = dyn_cast(LHSExp->IgnoreParens());
+  bool IsMSPropertySubscript =
+  (MSProp && MSProp->getPropertyDecl()->getType()->isArrayType()) ||
+  LHSExp->getType()->isSpecificPlaceholderType(
+  BuiltinType::MSPropertySubscript);
+  if (!LHSExp->getType()->getAs() && !IsMSPropertySubscript) {
 ExprResult Result = DefaultFunctionArrayLvalueConversion(LHSExp);
 if (Result.isInvalid())
   return ExprError();
@@ -4118,6 +4137,10 @@
 BaseExpr = LHSExp;
 IndexExpr = RHSExp;
 ResultType = Context.DependentTy;
+  } else if (IsMSPropertySubscript) {
+BaseExpr = LHSExp;
+IndexExpr = RHSExp;
+ResultType = Context.MSPropertySubscriptTy;
   } else if 

Re: [PATCH] D13871: Add modernize-use-default check to clang-tidy.

2015-10-20 Thread Manuel Klimek via cfe-commits
klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.

LG. Yay!



Comment at: clang-tidy/modernize/UseDefaultCheck.cpp:59-60
@@ +58,4 @@
+  "= default;");
+  // FIXME: this can generate a -Wpedantic warning if there is a semicolon 
after
+  // the body: "A() {};" is converted to "A() = default;;"
+}

Delete the fixme. There already is an extra semicolon in the first case.


http://reviews.llvm.org/D13871



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


[PATCH] D13890: Apply modernize-use-default to clang.

2015-10-20 Thread Angel Garcia via cfe-commits
angelgarcia created this revision.
angelgarcia added a reviewer: klimek.
angelgarcia added subscribers: cfe-commits, alexfh.
Herald added a subscriber: klimek.

Replace empty bodies of default constructors and destructors with '= default'.

http://reviews.llvm.org/D13890

Files:
  include/clang/AST/ASTConsumer.h
  include/clang/AST/CanonicalType.h
  include/clang/AST/DeclFriend.h
  include/clang/AST/DeclTemplate.h
  include/clang/AST/Expr.h
  include/clang/AST/ExprCXX.h
  include/clang/AST/Mangle.h
  include/clang/AST/MangleNumberingContext.h
  include/clang/AST/Redeclarable.h
  include/clang/AST/StmtIterator.h
  include/clang/AST/UnresolvedSet.h
  include/clang/AST/VTableBuilder.h
  include/clang/ASTMatchers/ASTMatchersInternal.h
  include/clang/Analysis/Analyses/FormatString.h
  include/clang/Analysis/Analyses/LiveVariables.h
  include/clang/Analysis/Analyses/ReachableCode.h
  include/clang/Analysis/Analyses/ThreadSafetyTraverse.h
  include/clang/Analysis/Analyses/UninitializedValues.h
  include/clang/Analysis/AnalysisContext.h
  include/clang/Analysis/CFG.h
  include/clang/Basic/FileSystemStatCache.h
  include/clang/Basic/IdentifierTable.h
  include/clang/Driver/Job.h
  include/clang/Edit/EditsReceiver.h
  include/clang/Frontend/SerializedDiagnosticReader.h
  include/clang/Frontend/VerifyDiagnosticConsumer.h
  include/clang/Lex/ModuleMap.h
  include/clang/Lex/PTHLexer.h
  include/clang/Lex/PreprocessorLexer.h
  include/clang/Sema/Sema.h
  include/clang/Sema/TypoCorrection.h
  include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
  include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
  include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
  include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
  include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
  include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
  include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
  include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
  include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
  include/clang/StaticAnalyzer/Core/PathSensitive/TaintManager.h
  include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h
  include/clang/Tooling/FileMatchTrie.h
  include/clang/Tooling/Tooling.h
  lib/ARCMigrate/ARCMT.cpp
  lib/ARCMigrate/TransformActions.cpp
  lib/ARCMigrate/Transforms.cpp
  lib/AST/ASTContext.cpp
  lib/AST/ASTImporter.cpp
  lib/AST/DeclBase.cpp
  lib/AST/ExternalASTSource.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/VTableBuilder.cpp
  lib/ASTMatchers/ASTMatchFinder.cpp
  lib/ASTMatchers/Dynamic/Marshallers.h
  lib/ASTMatchers/Dynamic/Parser.cpp
  lib/ASTMatchers/Dynamic/VariantValue.cpp
  lib/Analysis/AnalysisDeclContext.cpp
  lib/Analysis/CFG.cpp
  lib/Analysis/CodeInjector.cpp
  lib/Analysis/Consumed.cpp
  lib/Analysis/FormatString.cpp
  lib/Analysis/ProgramPoint.cpp
  lib/Analysis/ThreadSafety.cpp
  lib/Analysis/UninitializedValues.cpp
  lib/Basic/Diagnostic.cpp
  lib/Basic/FileManager.cpp
  lib/Basic/IdentifierTable.cpp
  lib/Basic/SourceManager.cpp
  lib/Basic/TargetInfo.cpp
  lib/Basic/VirtualFileSystem.cpp
  lib/CodeGen/CGBlocks.cpp
  lib/CodeGen/CGCUDARuntime.cpp
  lib/CodeGen/CGCXXABI.cpp
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGObjC.cpp
  lib/CodeGen/CGOpenCLRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenTBAA.cpp
  lib/CodeGen/TargetInfo.cpp
  lib/Driver/Tool.cpp
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Format/BreakableToken.h
  lib/Format/FormatToken.cpp
  lib/Format/UnwrappedLineFormatter.cpp
  lib/Format/UnwrappedLineParser.cpp
  lib/Format/UnwrappedLineParser.h
  lib/Frontend/ASTUnit.cpp
  lib/Frontend/CacheTokens.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/DependencyFile.cpp
  lib/Frontend/DiagnosticRenderer.cpp
  lib/Frontend/FrontendAction.cpp
  lib/Frontend/MultiplexConsumer.cpp
  lib/Frontend/Rewrite/FixItRewriter.cpp
  lib/Frontend/Rewrite/FrontendActions.cpp
  lib/Frontend/Rewrite/RewriteModernObjC.cpp
  lib/Frontend/Rewrite/RewriteObjC.cpp
  lib/Frontend/SerializedDiagnosticPrinter.cpp
  lib/Frontend/TextDiagnostic.cpp
  lib/Index/CommentToXML.cpp
  lib/Lex/HeaderSearch.cpp
  lib/Lex/PPLexerChange.cpp
  lib/Lex/PTHLexer.cpp
  lib/Lex/Pragma.cpp
  lib/Lex/PreprocessingRecord.cpp
  lib/Lex/Preprocessor.cpp
  lib/Parse/ParseCXXInlineMethods.cpp
  lib/Rewrite/TokenRewriter.cpp
  lib/Sema/AttributeList.cpp
  lib/Sema/CodeCompleteConsumer.cpp
  lib/Sema/MultiplexExternalSemaSource.cpp
  lib/Sema/ScopeInfo.cpp
  lib/Sema/Sema.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/SemaPseudoObject.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTCommon.cpp
  lib/Serialization/ASTReader.cpp
  lib/Serialization/GeneratePCH.cpp
  lib/Serialization/MultiOnDiskHashTable.h
  lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
  lib/StaticAnalyzer/Core/BugReporter.cpp
  lib/StaticAnalyzer/Core/ConstraintManager.cpp
  

Re: [PATCH] D13890: Apply modernize-use-default to clang.

2015-10-20 Thread Manuel Klimek via cfe-commits
klimek added a reviewer: bkramer.
klimek added a comment.

+benjamin, who has been doing those changes lately...


http://reviews.llvm.org/D13890



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


Re: [PATCH] D13889: Apply modernize-use-default to clang-tools-extra.

2015-10-20 Thread Manuel Klimek via cfe-commits
klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.

LG


http://reviews.llvm.org/D13889



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


[PATCH] D13892: Apply modernize-use-default to compiler-rt.

2015-10-20 Thread Angel Garcia via cfe-commits
angelgarcia created this revision.
angelgarcia added a reviewer: klimek.
angelgarcia added subscribers: cfe-commits, alexfh.

Replace empty bodies of default constructors and destructors with '= default'.

http://reviews.llvm.org/D13892

Files:
  lib/asan/asan_fake_stack.h
  lib/msan/msan_allocator.h
  lib/sanitizer_common/sanitizer_bitvector.h
  lib/tsan/rtl/tsan_clock.h
  lib/tsan/rtl/tsan_mutex.cc
  lib/tsan/rtl/tsan_report.cc
  lib/tsan/rtl/tsan_rtl_thread.cc
  lib/ubsan/ubsan_diag.h

Index: lib/ubsan/ubsan_diag.h
===
--- lib/ubsan/ubsan_diag.h
+++ lib/ubsan/ubsan_diag.h
@@ -150,7 +150,7 @@
 
   /// An individual diagnostic message argument.
   struct Arg {
-Arg() {}
+Arg() = default;
 Arg(const char *String) : Kind(AK_String), String(String) {}
 Arg(TypeName TN) : Kind(AK_TypeName), String(TN.getName()) {}
 Arg(UIntMax UInt) : Kind(AK_UInt), UInt(UInt) {}
Index: lib/tsan/rtl/tsan_rtl_thread.cc
===
--- lib/tsan/rtl/tsan_rtl_thread.cc
+++ lib/tsan/rtl/tsan_rtl_thread.cc
@@ -31,8 +31,7 @@
 }
 
 #ifndef SANITIZER_GO
-ThreadContext::~ThreadContext() {
-}
+ThreadContext::~ThreadContext() = default;
 #endif
 
 void ThreadContext::OnDead() {
Index: lib/tsan/rtl/tsan_report.cc
===
--- lib/tsan/rtl/tsan_report.cc
+++ lib/tsan/rtl/tsan_report.cc
@@ -67,9 +67,7 @@
 : mset(MBlockReportMutex) {
 }
 
-ReportDesc::~ReportDesc() {
-  // FIXME(dvyukov): it must be leaking a lot of memory.
-}
+ReportDesc::~ReportDesc() = default;
 
 #ifndef SANITIZER_GO
 
Index: lib/tsan/rtl/tsan_mutex.cc
===
--- lib/tsan/rtl/tsan_mutex.cc
+++ lib/tsan/rtl/tsan_mutex.cc
@@ -126,9 +126,7 @@
 #endif
 }
 
-InternalDeadlockDetector::InternalDeadlockDetector() {
-  // Rely on zero initialization because some mutexes can be locked before ctor.
-}
+InternalDeadlockDetector::InternalDeadlockDetector() = default;
 
 #if SANITIZER_DEBUG && !SANITIZER_GO
 void InternalDeadlockDetector::Lock(MutexType t) {
Index: lib/tsan/rtl/tsan_clock.h
===
--- lib/tsan/rtl/tsan_clock.h
+++ lib/tsan/rtl/tsan_clock.h
@@ -33,8 +33,7 @@
 ClockElem clock[kClockCount];
   };
 
-  ClockBlock() {
-  }
+  ClockBlock() = default;
 };
 
 typedef DenseSlabAlloc ClockAlloc;
Index: lib/sanitizer_common/sanitizer_bitvector.h
===
--- lib/sanitizer_common/sanitizer_bitvector.h
+++ lib/sanitizer_common/sanitizer_bitvector.h
@@ -87,7 +87,7 @@
   // }
   class Iterator {
public:
-Iterator() { }
+Iterator() = default;
 explicit Iterator(const BasicBitVector ) : bv_(bv) {}
 bool hasNext() const { return !bv_.empty(); }
 uptr next() { return bv_.getAndClearFirstOne(); }
@@ -273,7 +273,7 @@
   // }
   class Iterator {
public:
-Iterator() { }
+Iterator() = default;
 explicit Iterator(const TwoLevelBitVector ) : bv_(bv), i0_(0), i1_(0) {
   it1_.clear();
   it2_.clear();
Index: lib/msan/msan_allocator.h
===
--- lib/msan/msan_allocator.h
+++ lib/msan/msan_allocator.h
@@ -26,7 +26,7 @@
 
  private:
   // These objects are allocated via mmap() and are zero-initialized.
-  MsanThreadLocalMallocStorage() {}
+  MsanThreadLocalMallocStorage() = default;
 };
 
 } // namespace __msan
Index: lib/asan/asan_fake_stack.h
===
--- lib/asan/asan_fake_stack.h
+++ lib/asan/asan_fake_stack.h
@@ -155,7 +155,7 @@
   void ForEachFakeFrame(RangeIteratorCallback callback, void *arg);
 
  private:
-  FakeStack() { }
+  FakeStack() = default;
   static const uptr kFlagsOffset = 4096;  // This is were the flags begin.
   // Must match the number of uses of DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID
   COMPILER_CHECK(kNumberOfSizeClasses == 11);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13892: Apply modernize-use-default to compiler-rt.

2015-10-20 Thread Benjamin Kramer via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg with comments.



Comment at: lib/tsan/rtl/tsan_mutex.cc:130
@@ -129,3 @@
-InternalDeadlockDetector::InternalDeadlockDetector() {
-  // Rely on zero initialization because some mutexes can be locked before 
ctor.
-}

Please keep the comments.


Comment at: lib/tsan/rtl/tsan_report.cc:71
@@ -70,3 @@
-ReportDesc::~ReportDesc() {
-  // FIXME(dvyukov): it must be leaking a lot of memory.
-}

dito


http://reviews.llvm.org/D13892



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


Re: [PATCH] D13890: Apply modernize-use-default to clang.

2015-10-20 Thread Angel Garcia via cfe-commits
angelgarcia updated this revision to Diff 37867.
angelgarcia added a comment.

Put comment back.


http://reviews.llvm.org/D13890

Files:
  include/clang/AST/ASTConsumer.h
  include/clang/AST/CanonicalType.h
  include/clang/AST/DeclFriend.h
  include/clang/AST/DeclTemplate.h
  include/clang/AST/Expr.h
  include/clang/AST/ExprCXX.h
  include/clang/AST/Mangle.h
  include/clang/AST/MangleNumberingContext.h
  include/clang/AST/Redeclarable.h
  include/clang/AST/StmtIterator.h
  include/clang/AST/UnresolvedSet.h
  include/clang/AST/VTableBuilder.h
  include/clang/ASTMatchers/ASTMatchersInternal.h
  include/clang/Analysis/Analyses/FormatString.h
  include/clang/Analysis/Analyses/LiveVariables.h
  include/clang/Analysis/Analyses/ReachableCode.h
  include/clang/Analysis/Analyses/ThreadSafetyTraverse.h
  include/clang/Analysis/Analyses/UninitializedValues.h
  include/clang/Analysis/AnalysisContext.h
  include/clang/Analysis/CFG.h
  include/clang/Basic/FileSystemStatCache.h
  include/clang/Basic/IdentifierTable.h
  include/clang/Driver/Job.h
  include/clang/Edit/EditsReceiver.h
  include/clang/Frontend/SerializedDiagnosticReader.h
  include/clang/Frontend/VerifyDiagnosticConsumer.h
  include/clang/Lex/ModuleMap.h
  include/clang/Lex/PTHLexer.h
  include/clang/Lex/PreprocessorLexer.h
  include/clang/Sema/Sema.h
  include/clang/Sema/TypoCorrection.h
  include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
  include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
  include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
  include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
  include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
  include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
  include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
  include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
  include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
  include/clang/StaticAnalyzer/Core/PathSensitive/TaintManager.h
  include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h
  include/clang/Tooling/FileMatchTrie.h
  include/clang/Tooling/Tooling.h
  lib/ARCMigrate/ARCMT.cpp
  lib/ARCMigrate/TransformActions.cpp
  lib/ARCMigrate/Transforms.cpp
  lib/AST/ASTContext.cpp
  lib/AST/ASTImporter.cpp
  lib/AST/DeclBase.cpp
  lib/AST/ExternalASTSource.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/VTableBuilder.cpp
  lib/ASTMatchers/ASTMatchFinder.cpp
  lib/ASTMatchers/Dynamic/Marshallers.h
  lib/ASTMatchers/Dynamic/Parser.cpp
  lib/ASTMatchers/Dynamic/VariantValue.cpp
  lib/Analysis/AnalysisDeclContext.cpp
  lib/Analysis/CFG.cpp
  lib/Analysis/CodeInjector.cpp
  lib/Analysis/Consumed.cpp
  lib/Analysis/FormatString.cpp
  lib/Analysis/ProgramPoint.cpp
  lib/Analysis/ThreadSafety.cpp
  lib/Analysis/UninitializedValues.cpp
  lib/Basic/Diagnostic.cpp
  lib/Basic/FileManager.cpp
  lib/Basic/IdentifierTable.cpp
  lib/Basic/SourceManager.cpp
  lib/Basic/TargetInfo.cpp
  lib/Basic/VirtualFileSystem.cpp
  lib/CodeGen/CGBlocks.cpp
  lib/CodeGen/CGCUDARuntime.cpp
  lib/CodeGen/CGCXXABI.cpp
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGObjC.cpp
  lib/CodeGen/CGOpenCLRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenTBAA.cpp
  lib/CodeGen/TargetInfo.cpp
  lib/Driver/Tool.cpp
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Format/BreakableToken.h
  lib/Format/FormatToken.cpp
  lib/Format/UnwrappedLineFormatter.cpp
  lib/Format/UnwrappedLineParser.cpp
  lib/Format/UnwrappedLineParser.h
  lib/Frontend/ASTUnit.cpp
  lib/Frontend/CacheTokens.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/DependencyFile.cpp
  lib/Frontend/DiagnosticRenderer.cpp
  lib/Frontend/FrontendAction.cpp
  lib/Frontend/MultiplexConsumer.cpp
  lib/Frontend/Rewrite/FixItRewriter.cpp
  lib/Frontend/Rewrite/FrontendActions.cpp
  lib/Frontend/Rewrite/RewriteModernObjC.cpp
  lib/Frontend/Rewrite/RewriteObjC.cpp
  lib/Frontend/SerializedDiagnosticPrinter.cpp
  lib/Frontend/TextDiagnostic.cpp
  lib/Index/CommentToXML.cpp
  lib/Lex/HeaderSearch.cpp
  lib/Lex/PPLexerChange.cpp
  lib/Lex/PTHLexer.cpp
  lib/Lex/Pragma.cpp
  lib/Lex/PreprocessingRecord.cpp
  lib/Lex/Preprocessor.cpp
  lib/Parse/ParseCXXInlineMethods.cpp
  lib/Rewrite/TokenRewriter.cpp
  lib/Sema/AttributeList.cpp
  lib/Sema/CodeCompleteConsumer.cpp
  lib/Sema/MultiplexExternalSemaSource.cpp
  lib/Sema/ScopeInfo.cpp
  lib/Sema/Sema.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/SemaPseudoObject.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTCommon.cpp
  lib/Serialization/ASTReader.cpp
  lib/Serialization/GeneratePCH.cpp
  lib/Serialization/MultiOnDiskHashTable.h
  lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
  lib/StaticAnalyzer/Core/BugReporter.cpp
  lib/StaticAnalyzer/Core/ConstraintManager.cpp
  lib/StaticAnalyzer/Core/CoreEngine.cpp
  lib/StaticAnalyzer/Core/ExplodedGraph.cpp
  lib/StaticAnalyzer/Core/MemRegion.cpp
  

[clang-tools-extra] r250824 - Apply modernize-use-default to clang-tools-extra.

2015-10-20 Thread Angel Garcia Gomez via cfe-commits
Author: angelgarcia
Date: Tue Oct 20 07:56:27 2015
New Revision: 250824

URL: http://llvm.org/viewvc/llvm-project?rev=250824=rev
Log:
Apply modernize-use-default to clang-tools-extra.

Summary: Replace empty bodies of default constructors and destructors with '= 
default'.

Reviewers: klimek

Subscribers: alexfh, cfe-commits

Differential Revision: http://reviews.llvm.org/D13889

Modified:
clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp
clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp
clang-tools-extra/trunk/clang-query/Query.cpp
clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h
clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h
clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
clang-tools-extra/trunk/modularize/CoverageChecker.cpp
clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp
clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp
clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp

Modified: clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp?rev=250824=250823=250824=diff
==
--- clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp 
(original)
+++ clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp Tue Oct 
20 07:56:27 2015
@@ -60,7 +60,7 @@ class IncludeDirectivesPPCallback : publ
 public:
   IncludeDirectivesPPCallback(IncludeDirectives *Self)
   : Self(Self), Guard(nullptr) {}
-  ~IncludeDirectivesPPCallback() override {}
+  ~IncludeDirectivesPPCallback() override = default;
 
 private:
   void InclusionDirective(SourceLocation HashLoc, const Token ,

Modified: clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp?rev=250824=250823=250824=diff
==
--- clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp (original)
+++ clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp Tue Oct 20 
07:56:27 2015
@@ -82,7 +82,7 @@ Transform::Transform(llvm::StringRef Nam
   Reset();
 }
 
-Transform::~Transform() {}
+Transform::~Transform() = default;
 
 bool Transform::isFileModifiable(const SourceManager ,
  SourceLocation Loc) const {
@@ -150,7 +150,7 @@ Version Version::getFromString(llvm::Str
   return V;
 }
 
-TransformFactory::~TransformFactory() {}
+TransformFactory::~TransformFactory() = default;
 
 namespace {
 bool versionSupported(Version Required, Version AvailableSince) {

Modified: clang-tools-extra/trunk/clang-query/Query.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-query/Query.cpp?rev=250824=250823=250824=diff
==
--- clang-tools-extra/trunk/clang-query/Query.cpp (original)
+++ clang-tools-extra/trunk/clang-query/Query.cpp Tue Oct 20 07:56:27 2015
@@ -20,7 +20,7 @@ using namespace clang::ast_matchers::dyn
 namespace clang {
 namespace query {
 
-Query::~Query() {}
+Query::~Query() = default;
 
 bool InvalidQuery::run(llvm::raw_ostream , QuerySession ) const {
   OS << ErrStr << "\n";

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h?rev=250824=250823=250824=diff
==
--- clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h Tue Oct 20 07:56:27 
2015
@@ -82,7 +82,7 @@ private:
 /// them a prefixed name.
 class ClangTidyModule {
 public:
-  virtual ~ClangTidyModule() {}
+  virtual ~ClangTidyModule() = default;
 
   /// \brief Implement this function in order to register all \c CheckFactories
   /// belonging to this module.

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h?rev=250824=250823=250824=diff
==
--- clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h Tue Oct 20 07:56:27 
2015
@@ -88,7 +88,7 @@ struct ClangTidyOptions {
 /// \brief Abstract interface for retrieving various ClangTidy options.
 class ClangTidyOptionsProvider {
 public:
-  virtual ~ClangTidyOptionsProvider() {}
+  virtual ~ClangTidyOptionsProvider() = default;
 
   /// \brief Returns global options, which are independent of the file.
   virtual const ClangTidyGlobalOptions () = 0;

Modified: clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
URL: 

Re: r250418 - [CodeGen] Remove dead code. NFC.

2015-10-20 Thread Benjamin Kramer via cfe-commits
Put it back in r250803. Tests very welcome ;)

- Benjamin

On Tue, Oct 20, 2015 at 9:14 AM, Michael Gottesman via cfe-commits
 wrote:
> Let me play with it a bit (I did not read the code, I just was tracking down
> the linkage error).
>
> Michael
>
> On Oct 20, 2015, at 12:07 AM, Chandler Carruth  wrote:
>
> Is it possible to add a unittest that exercises this extension point
> in-tree? For example the way I did for AA extension hooks?
>
> On Mon, Oct 19, 2015 at 9:00 PM Michael Gottesman via cfe-commits
>  wrote:
>>
>> On Oct 19, 2015, at 4:40 PM, Michael Gottesman via cfe-commits
>>  wrote:
>>
>>
>> On Oct 15, 2015, at 8:29 AM, Benjamin Kramer via cfe-commits
>>  wrote:
>>
>> Author: d0k
>> Date: Thu Oct 15 10:29:40 2015
>> New Revision: 250418
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=250418=rev
>> Log:
>> [CodeGen] Remove dead code. NFC.
>>
>> Modified:
>>   cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>>   cfe/trunk/lib/CodeGen/CGCall.cpp
>>   cfe/trunk/lib/CodeGen/CGCleanup.cpp
>>   cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>   cfe/trunk/lib/CodeGen/CGDebugInfo.h
>>   cfe/trunk/lib/CodeGen/CGObjC.cpp
>>   cfe/trunk/lib/CodeGen/CGObjCMac.cpp
>>   cfe/trunk/lib/CodeGen/CGVTables.h
>>   cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp
>>   cfe/trunk/lib/CodeGen/CodeGenFunction.h
>>   cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>>   cfe/trunk/lib/CodeGen/CodeGenModule.h
>>   cfe/trunk/lib/CodeGen/CodeGenPGO.h
>>   cfe/trunk/lib/CodeGen/EHScopeStack.h
>>   cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=250418=250417=250418=diff
>>
>> ==
>> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Oct 15 10:29:40 2015
>> @@ -4106,15 +4106,6 @@ Value *CodeGenFunction::vectorWrapScalar
>>  return Op;
>> }
>>
>> -Value *CodeGenFunction::vectorWrapScalar8(Value *Op) {
>> -  llvm::Type *VTy = llvm::VectorType::get(Int8Ty, 8);
>> -  Op = Builder.CreateBitCast(Op, Int8Ty);
>> -  Value *V = UndefValue::get(VTy);
>> -  llvm::Constant *CI = ConstantInt::get(SizeTy, 0);
>> -  Op = Builder.CreateInsertElement(V, Op, CI);
>> -  return Op;
>> -}
>> -
>> Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
>>   const CallExpr *E) {
>>  unsigned HintID = static_cast(-1);
>>
>> Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=250418=250417=250418=diff
>>
>> ==
>> --- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGCall.cpp Thu Oct 15 10:29:40 2015
>> @@ -3038,12 +3038,6 @@ CodeGenFunction::EmitRuntimeCallOrInvoke
>>  return callSite;
>> }
>>
>> -llvm::CallSite
>> -CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee,
>> -  const Twine ) {
>> -  return EmitCallOrInvoke(Callee, None, Name);
>> -}
>> -
>> /// Emits a call or invoke instruction to the given function, depending
>> /// on the current state of the EH stack.
>> llvm::CallSite
>>
>> Modified: cfe/trunk/lib/CodeGen/CGCleanup.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.cpp?rev=250418=250417=250418=diff
>>
>> ==
>> --- cfe/trunk/lib/CodeGen/CGCleanup.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGCleanup.cpp Thu Oct 15 10:29:40 2015
>> @@ -167,23 +167,6 @@ EHScopeStack::getInnermostActiveNormalCl
>>  return stable_end();
>> }
>>
>> -EHScopeStack::stable_iterator EHScopeStack::getInnermostActiveEHScope()
>> const {
>> -  for (stable_iterator si = getInnermostEHScope(), se = stable_end();
>> - si != se; ) {
>> -// Skip over inactive cleanups.
>> -EHCleanupScope *cleanup = dyn_cast(&*find(si));
>> -if (cleanup && !cleanup->isActive()) {
>> -  si = cleanup->getEnclosingEHScope();
>> -  continue;
>> -}
>> -
>> -// All other scopes are always active.
>> -return si;
>> -  }
>> -
>> -  return stable_end();
>> -}
>> -
>>
>> void *EHScopeStack::pushCleanup(CleanupKind Kind, size_t Size) {
>>  char *Buffer = allocate(EHCleanupScope::getSizeForCleanupSize(Size));
>>
>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=250418=250417=250418=diff
>>
>> ==
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Oct 15 10:29:40 2015
>> @@ -2159,30 +2159,6 @@ llvm::DIType 

r250804 - Revert accidental commit. This isn't ready yet.

2015-10-20 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Tue Oct 20 02:53:14 2015
New Revision: 250804

URL: http://llvm.org/viewvc/llvm-project?rev=250804=rev
Log:
Revert accidental commit. This isn't ready yet.

Modified:
cfe/trunk/lib/Tooling/Core/CMakeLists.txt
cfe/trunk/unittests/Tooling/CMakeLists.txt

Modified: cfe/trunk/lib/Tooling/Core/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/CMakeLists.txt?rev=250804=250803=250804=diff
==
--- cfe/trunk/lib/Tooling/Core/CMakeLists.txt (original)
+++ cfe/trunk/lib/Tooling/Core/CMakeLists.txt Tue Oct 20 02:53:14 2015
@@ -1,7 +1,6 @@
 set(LLVM_LINK_COMPONENTS support)
 
 add_clang_library(clangToolingCore
-  Lookup.cpp
   Replacement.cpp
 
   LINK_LIBS

Modified: cfe/trunk/unittests/Tooling/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/CMakeLists.txt?rev=250804=250803=250804=diff
==
--- cfe/trunk/unittests/Tooling/CMakeLists.txt (original)
+++ cfe/trunk/unittests/Tooling/CMakeLists.txt Tue Oct 20 02:53:14 2015
@@ -6,7 +6,6 @@ set(LLVM_LINK_COMPONENTS
 add_clang_unittest(ToolingTests
   CommentHandlerTest.cpp
   CompilationDatabaseTest.cpp
-  LookupTest.cpp
   ToolingTest.cpp
   RecursiveASTVisitorTest.cpp
   RecursiveASTVisitorTestCallVisitor.cpp


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


Re: [PATCH] D13643: [Sema] Warn on ternary comparison

2015-10-20 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a subscriber: danielmarjamaki.
danielmarjamaki added a comment.

Interesting checker.

I'll test it on some debian projects.

If you're interested.. it does not currently warn about "1.0 < 2.0 < 3.0" as 
far as I see.


http://reviews.llvm.org/D13643



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


[libcxx] r250802 - Detect relaxed constexpr rules for gcc versions

2015-10-20 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Oct 20 02:37:11 2015
New Revision: 250802

URL: http://llvm.org/viewvc/llvm-project?rev=250802=rev
Log:
Detect relaxed constexpr rules for gcc versions

Modified:
libcxx/trunk/include/__config

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=250802=250801=250802=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Tue Oct 20 02:37:11 2015
@@ -451,8 +451,11 @@ namespace std {
 #define _LIBCPP_HAS_NO_CONSTEXPR
 #endif
 
-// No version of GCC supports relaxed constexpr rules
+// Determine if GCC supports relaxed constexpr
+#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
+#endif
+
 // GCC 5 will support variable templates
 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
 


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


Re: [ALERT:Possible Phishing] r250418 - [CodeGen] Remove dead code. NFC.

2015-10-20 Thread Michael Gottesman via cfe-commits
Thanks!

Michael

> On Oct 20, 2015, at 12:55 AM, Benjamin Kramer  wrote:
> 
> Put it back in r250803. Tests very welcome ;)
> 
> - Benjamin
> 
> On Tue, Oct 20, 2015 at 9:14 AM, Michael Gottesman via cfe-commits
>  wrote:
>> Let me play with it a bit (I did not read the code, I just was tracking down
>> the linkage error).
>> 
>> Michael
>> 
>> On Oct 20, 2015, at 12:07 AM, Chandler Carruth  wrote:
>> 
>> Is it possible to add a unittest that exercises this extension point
>> in-tree? For example the way I did for AA extension hooks?
>> 
>> On Mon, Oct 19, 2015 at 9:00 PM Michael Gottesman via cfe-commits
>>  wrote:
>>> 
>>> On Oct 19, 2015, at 4:40 PM, Michael Gottesman via cfe-commits
>>>  wrote:
>>> 
>>> 
>>> On Oct 15, 2015, at 8:29 AM, Benjamin Kramer via cfe-commits
>>>  wrote:
>>> 
>>> Author: d0k
>>> Date: Thu Oct 15 10:29:40 2015
>>> New Revision: 250418
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=250418=rev
>>> Log:
>>> [CodeGen] Remove dead code. NFC.
>>> 
>>> Modified:
>>>  cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>>>  cfe/trunk/lib/CodeGen/CGCall.cpp
>>>  cfe/trunk/lib/CodeGen/CGCleanup.cpp
>>>  cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>>  cfe/trunk/lib/CodeGen/CGDebugInfo.h
>>>  cfe/trunk/lib/CodeGen/CGObjC.cpp
>>>  cfe/trunk/lib/CodeGen/CGObjCMac.cpp
>>>  cfe/trunk/lib/CodeGen/CGVTables.h
>>>  cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp
>>>  cfe/trunk/lib/CodeGen/CodeGenFunction.h
>>>  cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>>>  cfe/trunk/lib/CodeGen/CodeGenModule.h
>>>  cfe/trunk/lib/CodeGen/CodeGenPGO.h
>>>  cfe/trunk/lib/CodeGen/EHScopeStack.h
>>>  cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
>>> 
>>> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=250418=250417=250418=diff
>>> 
>>> ==
>>> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Oct 15 10:29:40 2015
>>> @@ -4106,15 +4106,6 @@ Value *CodeGenFunction::vectorWrapScalar
>>> return Op;
>>> }
>>> 
>>> -Value *CodeGenFunction::vectorWrapScalar8(Value *Op) {
>>> -  llvm::Type *VTy = llvm::VectorType::get(Int8Ty, 8);
>>> -  Op = Builder.CreateBitCast(Op, Int8Ty);
>>> -  Value *V = UndefValue::get(VTy);
>>> -  llvm::Constant *CI = ConstantInt::get(SizeTy, 0);
>>> -  Op = Builder.CreateInsertElement(V, Op, CI);
>>> -  return Op;
>>> -}
>>> -
>>> Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
>>>  const CallExpr *E) {
>>> unsigned HintID = static_cast(-1);
>>> 
>>> Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=250418=250417=250418=diff
>>> 
>>> ==
>>> --- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGCall.cpp Thu Oct 15 10:29:40 2015
>>> @@ -3038,12 +3038,6 @@ CodeGenFunction::EmitRuntimeCallOrInvoke
>>> return callSite;
>>> }
>>> 
>>> -llvm::CallSite
>>> -CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee,
>>> -  const Twine ) {
>>> -  return EmitCallOrInvoke(Callee, None, Name);
>>> -}
>>> -
>>> /// Emits a call or invoke instruction to the given function, depending
>>> /// on the current state of the EH stack.
>>> llvm::CallSite
>>> 
>>> Modified: cfe/trunk/lib/CodeGen/CGCleanup.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.cpp?rev=250418=250417=250418=diff
>>> 
>>> ==
>>> --- cfe/trunk/lib/CodeGen/CGCleanup.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGCleanup.cpp Thu Oct 15 10:29:40 2015
>>> @@ -167,23 +167,6 @@ EHScopeStack::getInnermostActiveNormalCl
>>> return stable_end();
>>> }
>>> 
>>> -EHScopeStack::stable_iterator EHScopeStack::getInnermostActiveEHScope()
>>> const {
>>> -  for (stable_iterator si = getInnermostEHScope(), se = stable_end();
>>> - si != se; ) {
>>> -// Skip over inactive cleanups.
>>> -EHCleanupScope *cleanup = dyn_cast(&*find(si));
>>> -if (cleanup && !cleanup->isActive()) {
>>> -  si = cleanup->getEnclosingEHScope();
>>> -  continue;
>>> -}
>>> -
>>> -// All other scopes are always active.
>>> -return si;
>>> -  }
>>> -
>>> -  return stable_end();
>>> -}
>>> -
>>> 
>>> void *EHScopeStack::pushCleanup(CleanupKind Kind, size_t Size) {
>>> char *Buffer = allocate(EHCleanupScope::getSizeForCleanupSize(Size));
>>> 
>>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=250418=250417=250418=diff
>>> 
>>> 

Re: [PATCH] D13673: Add initial support for the MUSL C library.

2015-10-20 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added inline comments.


Comment at: src/locale.cpp:958
@@ -957,3 +961,3 @@
 return static_cast(__classic_lower_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
 return isascii(c) ?

EricWF wrote:
> Where did the `__NetBSD__` case go?
It's in the previous #line directive, check line 956. 


http://reviews.llvm.org/D13673



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


Re: [PATCH] D13336: [MSVC] 'property' with an empty array in array subscript expression.

2015-10-20 Thread John McCall via cfe-commits
rjmccall added a comment.

Needs more tests.

1. Dependent template instantiation.
2. Non-dependent template instantiation.
3. Indexes which are themselves pseudo-objects.
4. Templated getters and setters.
5. Non-POD by-value argument types.



Comment at: include/clang/AST/BuiltinTypes.def:253
@@ -251,1 +252,3 @@
+PLACEHOLDER_TYPE(MSPropertySubscript, MSPropertySubscriptTy)
+
 #ifdef LAST_BUILTIN_TYPE

Hmm.  I don't think you need a new placeholder type.  These subscripts are 
still an ordinary pseudo-object; you can load and store at any point.  Instead, 
you should detect this case by the expression node used, which can either be an 
ArraySubscriptExpr or a new node if you find it necessary.


Comment at: lib/Sema/SemaExpr.cpp:3934
@@ -3921,1 +3933,3 @@
+  if (!IsMSPropertySubscript &&
+  base->getType()->isNonOverloadPlaceholderType()) {
 ExprResult result = CheckPlaceholderExpr(base);

I think what you should do here is:
1. Detect whether the base type has pseudo-object type.
2. If so, give the pseudo-object code a chance to work on the expression.  In 
most cases, it will just load; but if the base is an MSPropertyRefExpr of array 
type, or an ArraySubscriptExpr, it can leave it alone.
3. If the pseudo-object code returned an expression that's still of 
pseudo-object type, just build an ArraySubscriptExpr of pseudo-object type 
after you've folded pseudo-objects in the index as well.


Comment at: lib/Sema/SemaExpr.cpp:4115
@@ -4097,1 +4114,3 @@
+  BuiltinType::MSPropertySubscript);
+  if (!LHSExp->getType()->getAs() && !IsMSPropertySubscript) {
 ExprResult Result = DefaultFunctionArrayLvalueConversion(LHSExp);

Placeholders should never get here.


Comment at: lib/Sema/SemaPseudoObject.cpp:1458
@@ -1433,4 +1457,3 @@
   }
 
   return S.ActOnCallExpr(S.getCurScope(), GetterExpr.get(),

Don't modify ArgExprs in buildGet or buildSet; you might need to build both, 
e.g. when building a compound assignment or inc/dec.

Since you need to copy into a new array anyway, you might as well accumulate 
them index expressions in stack order and then reverse them when adding them to 
this array.


http://reviews.llvm.org/D13336



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


Re: [clang-tools-extra] r250742 - Added check uniqueptr-delete-release to replace "delete x.release()" with "x = nullptr"

2015-10-20 Thread David Blaikie via cfe-commits
On Tue, Oct 20, 2015 at 8:39 AM, Samuel Benzaquen  wrote:

>
> On Mon, Oct 19, 2015 at 6:00 PM, David Blaikie  wrote:
>
>>
>>
>> On Mon, Oct 19, 2015 at 2:49 PM, Samuel Benzaquen via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: sbenza
>>> Date: Mon Oct 19 16:49:51 2015
>>> New Revision: 250742
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=250742=rev
>>> Log:
>>> Added check uniqueptr-delete-release to replace "delete x.release()"
>>> with "x = nullptr"
>>>
>>
>> Any stats on this? Have we seen many instances of "delete x.release()"
>>
>
> I would say in the hundreds.
>
>
>> Also, an interesting question: should the fixit be "x = nullptr" or
>> "x.reset()" ? I remember having this discussion with at least Lang Hames &
>> he preferred the latter, which I can see, though my initial reaction is to
>> use the former.
>>
>
> The opinions have been split half and half on this one, but no one feels
> strongly one way or another.
> Given that I implemented it, I went with my preference.
>

Sounds fair - thanks for the context!


>
>
>>
>>
>>>
>>> Reviewers: alexfh
>>>
>>> Differential Revision: http://reviews.llvm.org/D13179
>>>
>>> Added:
>>>
>>> clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
>>>
>>> clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.h
>>>
>>> clang-tools-extra/trunk/docs/clang-tidy/checks/readability-uniqueptr-delete-release.rst
>>>
>>> clang-tools-extra/trunk/test/clang-tidy/readability-uniqueptr-delete-release.cpp
>>> Modified:
>>> clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt
>>>
>>> clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.cpp
>>> clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst
>>>
>>> Modified: clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt?rev=250742=250741=250742=diff
>>>
>>> ==
>>> --- clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt
>>> (original)
>>> +++ clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt Mon
>>> Oct 19 16:49:51 2015
>>> @@ -13,6 +13,7 @@ add_clang_library(clangTidyReadabilityMo
>>>RedundantStringCStrCheck.cpp
>>>RedundantSmartptrGetCheck.cpp
>>>SimplifyBooleanExprCheck.cpp
>>> +  UniqueptrDeleteReleaseCheck.cpp
>>>
>>>LINK_LIBS
>>>clangAST
>>>
>>> Modified:
>>> clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.cpp?rev=250742=250741=250742=diff
>>>
>>> ==
>>> ---
>>> clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.cpp
>>> (original)
>>> +++
>>> clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.cpp
>>> Mon Oct 19 16:49:51 2015
>>> @@ -20,6 +20,7 @@
>>>  #include "RedundantSmartptrGetCheck.h"
>>>  #include "RedundantStringCStrCheck.h"
>>>  #include "SimplifyBooleanExprCheck.h"
>>> +#include "UniqueptrDeleteReleaseCheck.h"
>>>
>>>  namespace clang {
>>>  namespace tidy {
>>> @@ -40,6 +41,8 @@ public:
>>>  "readability-identifier-naming");
>>>
>>>  CheckFactories.registerCheck(
>>>  "readability-inconsistent-declaration-parameter-name");
>>> +CheckFactories.registerCheck(
>>> +"readability-uniqueptr-delete-release");
>>>  CheckFactories.registerCheck(
>>>  "readability-named-parameter");
>>>  CheckFactories.registerCheck(
>>>
>>> Added:
>>> clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp?rev=250742=auto
>>>
>>> ==
>>> ---
>>> clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
>>> (added)
>>> +++
>>> clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
>>> Mon Oct 19 16:49:51 2015
>>> @@ -0,0 +1,69 @@
>>> +//===--- UniqueptrDeleteReleaseCheck.cpp -
>>> clang-tidy--===//
>>> +//
>>> +// The LLVM Compiler Infrastructure
>>> +//
>>> +// This file is distributed under the University of Illinois Open Source
>>> +// License. See LICENSE.TXT for details.
>>> +//
>>>
>>> +//===--===//
>>> +
>>> +#include "UniqueptrDeleteReleaseCheck.h"
>>> +#include "clang/AST/ASTContext.h"
>>> +#include "clang/ASTMatchers/ASTMatchFinder.h"
>>> +#include "clang/Lex/Lexer.h"
>>> +
>>> +using namespace clang::ast_matchers;
>>> +
>>> +namespace clang {
>>> +namespace tidy {
>>> +
>>> +void 

r250839 - Look through using decls when classifying implicit member access

2015-10-20 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Tue Oct 20 13:12:08 2015
New Revision: 250839

URL: http://llvm.org/viewvc/llvm-project?rev=250839=rev
Log:
Look through using decls when classifying implicit member access

Clang will now accept this valid C++11 code:
  struct A { int field; };
  struct B : A {
using A::field;
enum { TheSize = sizeof(field) };
  };

Previously we would classify the 'field' reference as something other
than a field, and then forget to apply the C++11 rule to allow
non-static data member references in unevaluated contexts.

This usually arises in class templates that want to reference fields of
a dependent base in an unevaluated context outside of an instance
method. Such contexts do not allow references to 'this', so the only way
to access the field is with a using decl and an implicit member
reference.

Modified:
cfe/trunk/lib/Sema/SemaExprMember.cpp
cfe/trunk/test/SemaCXX/using-decl-1.cpp

Modified: cfe/trunk/lib/Sema/SemaExprMember.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprMember.cpp?rev=250839=250838=250839=diff
==
--- cfe/trunk/lib/Sema/SemaExprMember.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprMember.cpp Tue Oct 20 13:12:08 2015
@@ -102,8 +102,9 @@ static IMAKind ClassifyImplicitMemberAcc
   bool hasNonInstance = false;
   bool isField = false;
   BaseSet Classes;
-  for (LookupResult::iterator I = R.begin(), E = R.end(); I != E; ++I) {
-NamedDecl *D = *I;
+  for (NamedDecl *D : R) {
+// Look through any using decls.
+D = D->getUnderlyingDecl();
 
 if (D->isCXXInstanceMember()) {
   isField |= isa(D) || isa(D) ||
@@ -111,8 +112,7 @@ static IMAKind ClassifyImplicitMemberAcc
 
   CXXRecordDecl *R = cast(D->getDeclContext());
   Classes.insert(R->getCanonicalDecl());
-}
-else
+} else
   hasNonInstance = true;
   }
 

Modified: cfe/trunk/test/SemaCXX/using-decl-1.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/using-decl-1.cpp?rev=250839=250838=250839=diff
==
--- cfe/trunk/test/SemaCXX/using-decl-1.cpp (original)
+++ cfe/trunk/test/SemaCXX/using-decl-1.cpp Tue Oct 20 13:12:08 2015
@@ -327,3 +327,16 @@ namespace PR24033 {
 using PR24033::st; // expected-error {{target of using declaration 
conflicts with declaration already in scope}}
   }
 }
+
+namespace field_use {
+struct A { int field; };
+struct B : A {
+  // Previously Clang rejected this valid C++11 code because it didn't look
+  // through the UsingShadowDecl.
+  using A::field;
+#if __cplusplus < 201103L
+  // expected-error@+2 {{invalid use of non-static data member 'field'}}
+#endif
+  enum { X = sizeof(field) };
+};
+}


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


r250844 - Add back null check removed accidentally in r250554

2015-10-20 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Tue Oct 20 13:45:57 2015
New Revision: 250844

URL: http://llvm.org/viewvc/llvm-project?rev=250844=rev
Log:
Add back null check removed accidentally in r250554

Fixes PR25262

Added:
cfe/trunk/test/Frontend/force-include-not-found.c
Modified:
cfe/trunk/lib/Lex/HeaderSearch.cpp

Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=250844=250843=250844=diff
==
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Tue Oct 20 13:45:57 2015
@@ -256,6 +256,8 @@ const FileEntry *HeaderSearch::getFileAn
   // If we have a module map that might map this header, load it and
   // check whether we'll have a suggestion for a module.
   const FileEntry *File = getFileMgr().getFile(FileName, /*OpenFile=*/true);
+  if (!File)
+return nullptr;
 
   // If there is a module that corresponds to this header, suggest it.
   if (!findUsableModuleForHeader(File, Dir ? Dir : File->getDir(),

Added: cfe/trunk/test/Frontend/force-include-not-found.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/force-include-not-found.c?rev=250844=auto
==
--- cfe/trunk/test/Frontend/force-include-not-found.c (added)
+++ cfe/trunk/test/Frontend/force-include-not-found.c Tue Oct 20 13:45:57 2015
@@ -0,0 +1,3 @@
+// RUN: not %clang_cc1 %s -include "/abspath/missing file with spaces.h" 2>&1 
| FileCheck %s
+// CHECK: file not found
+int main() { }


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


r250840 - [CMake] Make clang/tools subdirectories controlled via options

2015-10-20 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Tue Oct 20 13:12:12 2015
New Revision: 250840

URL: http://llvm.org/viewvc/llvm-project?rev=250840=rev
Log:
[CMake] Make clang/tools subdirectories controlled via options

Setting CLANG_TOOL_*_BUILD=Off on the CMake command line will disable inclusion 
of a clang/tools subdirectory.

Modified:
cfe/trunk/CMakeLists.txt
cfe/trunk/tools/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=250840=250839=250840=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Tue Oct 20 13:12:12 2015
@@ -348,6 +348,10 @@ macro(set_clang_windows_version_resource
   endif()
 endmacro()
 
+macro(add_clang_subdirectory name)
+  add_llvm_subdirectory(CLANG TOOL ${name})
+endmacro()
+
 macro(add_clang_library name)
   cmake_parse_arguments(ARG
 ""

Modified: cfe/trunk/tools/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CMakeLists.txt?rev=250840=250839=250840=diff
==
--- cfe/trunk/tools/CMakeLists.txt (original)
+++ cfe/trunk/tools/CMakeLists.txt Tue Oct 20 13:12:12 2015
@@ -1,19 +1,21 @@
-add_subdirectory(diagtool)
-add_subdirectory(driver)
-add_subdirectory(clang-format)
-add_subdirectory(clang-format-vs)
-add_subdirectory(clang-fuzzer)
+create_subdirectory_options(CLANG TOOL)
 
-add_subdirectory(c-index-test)
-add_subdirectory(libclang)
+add_clang_subdirectory(diagtool)
+add_clang_subdirectory(driver)
+add_clang_subdirectory(clang-format)
+add_clang_subdirectory(clang-format-vs)
+add_clang_subdirectory(clang-fuzzer)
+
+add_clang_subdirectory(c-index-test)
+add_clang_subdirectory(libclang)
 
 if(CLANG_ENABLE_ARCMT)
-  add_subdirectory(arcmt-test)
-  add_subdirectory(c-arcmt-test)
+  add_clang_subdirectory(arcmt-test)
+  add_clang_subdirectory(c-arcmt-test)
 endif()
 
 if(CLANG_ENABLE_STATIC_ANALYZER)
-  add_subdirectory(clang-check)
+  add_clang_subdirectory(clang-check)
 endif()
 
 # We support checking out the clang-tools-extra repository into the 'extra'


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


[PATCH] D13909: clang-offload-bundler - offload files bundling/unbundling tool

2015-10-20 Thread Samuel Antao via cfe-commits
sfantao created this revision.
sfantao added reviewers: hfinkel, rsmith, echristo, ABataev, chandlerc.
sfantao added a subscriber: cfe-commits.

One of the goals of programming models that support offloading (e.g. OpenMP) is 
to enable users to offload with little effort, by annotating the code with a 
few pragmas. I'd also like to save users the trouble of changing their existent 
applications' build system. So having the compiler always return a single file 
instead of one for the host and each target even if the user is doing separate 
compilation is desirable.

This diff proposes a tool named clang-offload-bundler (happy to change the name 
if required) that is used to bundle files associated with the same user source 
file but different targets, or to unbundle a file into separate files 
associated with different targets.

This tool supports the driver support for OpenMP under review in 
http://reviews.llvm.org/D9888. The tool is used there to enable separate 
compilation, so that the very first action on input files that are not source 
files is a "unbundling action" and the very last non-linking action is a 
"bundling action".

The format of the bundled files is currently very simple: text formats are 
concatenated with comments that have a magic string and target identifying 
triple in between, and binary formats have a header that contains the triple 
and the offset and size of the code for host and each target.

The goal is to improve this tool in the future to deal with archive files so 
that each individual file in the archive is properly dealt with. We see that 
archives are very commonly used in current applications to combine separate 
compilation results. So I'm convinced users would enjoy this feature.

This tool can be used like this:

`clang-offload-bundler -targets=triple1,triple2 -type=ii 
-inputs=a.triple1.ii,a.triple2.ii -outputs=a.ii`

or 

`clang-offload-bundler -targets=triple1,triple2 -type=ii 
-outputs=a.triple1.ii,a.triple2.ii -inputs=a.ii -unbundle`

I implemented the tool under clang/tools. Please let me know if something like 
this should live somewhere else.

This patch is prerequisite for http://reviews.llvm.org/D9888.



http://reviews.llvm.org/D13909

Files:
  tools/CMakeLists.txt
  tools/Makefile
  tools/clang-offload-bundler/CMakeLists.txt
  tools/clang-offload-bundler/ClangOffloadBundler.cpp
  tools/clang-offload-bundler/Makefile

Index: tools/clang-offload-bundler/Makefile
===
--- /dev/null
+++ tools/clang-offload-bundler/Makefile
@@ -0,0 +1,21 @@
+##===- clang-offload-bundler/Makefile --*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===--===##
+
+CLANG_LEVEL := ../..
+
+TOOLNAME = clang-offload-bundler
+
+# No plugins, optimize startup time.
+TOOL_NO_EXPORTS = 1
+
+include $(CLANG_LEVEL)/../../Makefile.config
+LINK_COMPONENTS := $(TARGETS_TO_BUILD) support option
+USEDLIBS = clangBasic.a
+
+include $(CLANG_LEVEL)/Makefile
Index: tools/clang-offload-bundler/ClangOffloadBundler.cpp
===
--- /dev/null
+++ tools/clang-offload-bundler/ClangOffloadBundler.cpp
@@ -0,0 +1,548 @@
+//===-- clang-offload-bundler/ClangOffloadBundler.cpp - Clang format tool -===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+///
+/// \file
+/// \brief This file implements a clang-offload-bundler that bundles different
+/// files that relate with the same source code but different targets into a
+/// single one. Also the implements the opposite functionality, i.e. unbundle
+/// files previous created by this tool.
+///
+//===--===//
+
+#include "clang/Basic/FileManager.h"
+#include "clang/Basic/Version.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Signals.h"
+
+using namespace llvm;
+
+static cl::opt Help("h", cl::desc("Alias for -help"), cl::Hidden);
+
+// Mark all our options with this category, everything else (except for -version
+// and -help) will be hidden.
+static cl::OptionCategory
+ClangOffloadBundlerCategory("clang-offload-bundler options");
+
+static cl::list
+InputFileNames("inputs", cl::CommaSeparated, cl::OneOrMore,
+   cl::desc("[,...]"),
+   cl::cat(ClangOffloadBundlerCategory));
+static cl::list
+OutputFileNames("outputs", cl::CommaSeparated, cl::OneOrMore,
+   

Re: r250803 - Put back dead code that's used out-of-tree.

2015-10-20 Thread David Blaikie via cfe-commits
Nevermind, I see this was floated/discussed in the review thread of the
original commit ( 250418  )

On Tue, Oct 20, 2015 at 11:46 AM, David Blaikie  wrote:

>
>
> On Tue, Oct 20, 2015 at 12:50 AM, Benjamin Kramer via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: d0k
>> Date: Tue Oct 20 02:50:21 2015
>> New Revision: 250803
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=250803=rev
>> Log:
>> Put back dead code that's used out-of-tree.
>>
>
> Might be worth adding some unit tests (& comments there to give people
> some idea about it)?
>
>
>>
>> Partially reverts r250418.
>>
>> Modified:
>> cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp
>> cfe/trunk/lib/Tooling/Core/CMakeLists.txt
>> cfe/trunk/unittests/Tooling/CMakeLists.txt
>>
>> Modified: cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp?rev=250803=250802=250803=diff
>>
>> ==
>> --- cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp Tue Oct 20 02:50:21 2015
>> @@ -36,3 +36,33 @@ CodeGenABITypes::CodeGenABITypes(ASTCont
>>  // Explicitly out-of-line because ~CodeGenModule() is private but
>>  // CodeGenABITypes.h is part of clang's API.
>>  CodeGenABITypes::~CodeGenABITypes() = default;
>> +
>> +const CGFunctionInfo &
>> +CodeGenABITypes::arrangeObjCMessageSendSignature(const ObjCMethodDecl
>> *MD,
>> + QualType receiverType) {
>> +  return CGM->getTypes().arrangeObjCMessageSendSignature(MD,
>> receiverType);
>> +}
>> +
>> +const CGFunctionInfo &
>> +CodeGenABITypes::arrangeFreeFunctionType(CanQual Ty) {
>> +  return CGM->getTypes().arrangeFreeFunctionType(Ty);
>> +}
>> +
>> +const CGFunctionInfo &
>> +CodeGenABITypes::arrangeFreeFunctionType(CanQual
>> Ty) {
>> +  return CGM->getTypes().arrangeFreeFunctionType(Ty);
>> +}
>> +
>> +const CGFunctionInfo &
>> +CodeGenABITypes::arrangeCXXMethodType(const CXXRecordDecl *RD,
>> +  const FunctionProtoType *FTP) {
>> +  return CGM->getTypes().arrangeCXXMethodType(RD, FTP);
>> +}
>> +
>> +const CGFunctionInfo ::arrangeFreeFunctionCall(
>> +CanQualType returnType, ArrayRef argTypes,
>> +FunctionType::ExtInfo info, RequiredArgs args) {
>> +  return CGM->getTypes().arrangeLLVMFunctionInfo(
>> +  returnType, /*IsInstanceMethod=*/false, /*IsChainCall=*/false,
>> argTypes,
>> +  info, args);
>> +}
>>
>> Modified: cfe/trunk/lib/Tooling/Core/CMakeLists.txt
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/CMakeLists.txt?rev=250803=250802=250803=diff
>>
>> ==
>> --- cfe/trunk/lib/Tooling/Core/CMakeLists.txt (original)
>> +++ cfe/trunk/lib/Tooling/Core/CMakeLists.txt Tue Oct 20 02:50:21 2015
>> @@ -1,6 +1,7 @@
>>  set(LLVM_LINK_COMPONENTS support)
>>
>>  add_clang_library(clangToolingCore
>> +  Lookup.cpp
>>Replacement.cpp
>>
>>LINK_LIBS
>>
>> Modified: cfe/trunk/unittests/Tooling/CMakeLists.txt
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/CMakeLists.txt?rev=250803=250802=250803=diff
>>
>> ==
>> --- cfe/trunk/unittests/Tooling/CMakeLists.txt (original)
>> +++ cfe/trunk/unittests/Tooling/CMakeLists.txt Tue Oct 20 02:50:21 2015
>> @@ -6,6 +6,7 @@ set(LLVM_LINK_COMPONENTS
>>  add_clang_unittest(ToolingTests
>>CommentHandlerTest.cpp
>>CompilationDatabaseTest.cpp
>> +  LookupTest.cpp
>>ToolingTest.cpp
>>RecursiveASTVisitorTest.cpp
>>RecursiveASTVisitorTestCallVisitor.cpp
>>
>>
>> ___
>> 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: r250803 - Put back dead code that's used out-of-tree.

2015-10-20 Thread David Blaikie via cfe-commits
On Tue, Oct 20, 2015 at 12:50 AM, Benjamin Kramer via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: d0k
> Date: Tue Oct 20 02:50:21 2015
> New Revision: 250803
>
> URL: http://llvm.org/viewvc/llvm-project?rev=250803=rev
> Log:
> Put back dead code that's used out-of-tree.
>

Might be worth adding some unit tests (& comments there to give people some
idea about it)?


>
> Partially reverts r250418.
>
> Modified:
> cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp
> cfe/trunk/lib/Tooling/Core/CMakeLists.txt
> cfe/trunk/unittests/Tooling/CMakeLists.txt
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp?rev=250803=250802=250803=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp Tue Oct 20 02:50:21 2015
> @@ -36,3 +36,33 @@ CodeGenABITypes::CodeGenABITypes(ASTCont
>  // Explicitly out-of-line because ~CodeGenModule() is private but
>  // CodeGenABITypes.h is part of clang's API.
>  CodeGenABITypes::~CodeGenABITypes() = default;
> +
> +const CGFunctionInfo &
> +CodeGenABITypes::arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD,
> + QualType receiverType) {
> +  return CGM->getTypes().arrangeObjCMessageSendSignature(MD,
> receiverType);
> +}
> +
> +const CGFunctionInfo &
> +CodeGenABITypes::arrangeFreeFunctionType(CanQual Ty) {
> +  return CGM->getTypes().arrangeFreeFunctionType(Ty);
> +}
> +
> +const CGFunctionInfo &
> +CodeGenABITypes::arrangeFreeFunctionType(CanQual Ty)
> {
> +  return CGM->getTypes().arrangeFreeFunctionType(Ty);
> +}
> +
> +const CGFunctionInfo &
> +CodeGenABITypes::arrangeCXXMethodType(const CXXRecordDecl *RD,
> +  const FunctionProtoType *FTP) {
> +  return CGM->getTypes().arrangeCXXMethodType(RD, FTP);
> +}
> +
> +const CGFunctionInfo ::arrangeFreeFunctionCall(
> +CanQualType returnType, ArrayRef argTypes,
> +FunctionType::ExtInfo info, RequiredArgs args) {
> +  return CGM->getTypes().arrangeLLVMFunctionInfo(
> +  returnType, /*IsInstanceMethod=*/false, /*IsChainCall=*/false,
> argTypes,
> +  info, args);
> +}
>
> Modified: cfe/trunk/lib/Tooling/Core/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/CMakeLists.txt?rev=250803=250802=250803=diff
>
> ==
> --- cfe/trunk/lib/Tooling/Core/CMakeLists.txt (original)
> +++ cfe/trunk/lib/Tooling/Core/CMakeLists.txt Tue Oct 20 02:50:21 2015
> @@ -1,6 +1,7 @@
>  set(LLVM_LINK_COMPONENTS support)
>
>  add_clang_library(clangToolingCore
> +  Lookup.cpp
>Replacement.cpp
>
>LINK_LIBS
>
> Modified: cfe/trunk/unittests/Tooling/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/CMakeLists.txt?rev=250803=250802=250803=diff
>
> ==
> --- cfe/trunk/unittests/Tooling/CMakeLists.txt (original)
> +++ cfe/trunk/unittests/Tooling/CMakeLists.txt Tue Oct 20 02:50:21 2015
> @@ -6,6 +6,7 @@ set(LLVM_LINK_COMPONENTS
>  add_clang_unittest(ToolingTests
>CommentHandlerTest.cpp
>CompilationDatabaseTest.cpp
> +  LookupTest.cpp
>ToolingTest.cpp
>RecursiveASTVisitorTest.cpp
>RecursiveASTVisitorTestCallVisitor.cpp
>
>
> ___
> 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


r250834 - [CMake] Make external compiler-rt install scripts relative to CMAKE_INSTALL_PREFIX.

2015-10-20 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Tue Oct 20 11:39:25 2015
New Revision: 250834

URL: http://llvm.org/viewvc/llvm-project?rev=250834=rev
Log:
[CMake] Make external compiler-rt install scripts relative to 
CMAKE_INSTALL_PREFIX.

This change makes LLVM_BUILD_EXTERNAL_COMPILER_RT work correctly when 
overriding CMAKE_INSTALL_PREFIX on the install action (which is how 
LLVM_CREATE_XCODE_TOOLCHAIN works).

This fix is two parts:
(1) Pass CMAKE_INSTALL_PREFIX in as a variable from the parent install to the 
child install
(2) When passing COMPILER_RT_INSTALL_PATH into the external project make sure 
it is passed as a string not a path.

Not specifying the full path for COMPILER_RT_INSTALL_PATH isn't enough to fix 
the issue because relative paths specified on the CMake command line are 
expanded relative to the working directory before the cache is populated. 
Forcing this to a string allows it to remain a relative path through to the 
install() calls. Relative paths specified in install() calls are expanded 
relative to CMAKE_INSTALL_PREFIX at install time.

Modified:
cfe/trunk/runtime/CMakeLists.txt

Modified: cfe/trunk/runtime/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/runtime/CMakeLists.txt?rev=250834=250833=250834=diff
==
--- cfe/trunk/runtime/CMakeLists.txt (original)
+++ cfe/trunk/runtime/CMakeLists.txt Tue Oct 20 11:39:25 2015
@@ -66,7 +66,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND E
-DLLVM_CONFIG_PATH=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-config

-DCOMPILER_RT_OUTPUT_DIR=${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}
-DCOMPILER_RT_EXEC_OUTPUT_DIR=${LLVM_RUNTIME_OUTPUT_INTDIR}
-   
-DCOMPILER_RT_INSTALL_PATH=${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}
+   
-DCOMPILER_RT_INSTALL_PATH:STRING=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}
-DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
${COMPILER_RT_PASSTHROUGH_VARIABLES}
@@ -87,7 +87,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND E
 
   add_dependencies(compiler-rt-configure clang llvm-config)
 
-  install(CODE "execute_process\(COMMAND ${CMAKE_COMMAND} -P 
${BINARY_DIR}/cmake_install.cmake \)"
+  install(CODE "execute_process\(COMMAND \${CMAKE_COMMAND} 
-DCMAKE_INSTALL_PREFIX=\${CMAKE_INSTALL_PREFIX} -P 
${BINARY_DIR}/cmake_install.cmake \)"
 COMPONENT compiler-rt)
 
   add_custom_target(install-compiler-rt


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


[PATCH] D13899: Fix bug in suggested fix that truncated variable names to 1 character.

2015-10-20 Thread Samuel Benzaquen via cfe-commits
sbenza created this revision.
sbenza added reviewers: alexfh, aaron.ballman.
sbenza added a subscriber: cfe-commits.

Fix bug in suggested fix that truncated variable names to 1 character.
Also, rework the suggested fix to try to remove unnecessary whitespace.

http://reviews.llvm.org/D13899

Files:
  clang-tidy/misc/UnusedParametersCheck.cpp
  test/clang-tidy/misc-unused-parameters.cpp

Index: test/clang-tidy/misc-unused-parameters.cpp
===
--- test/clang-tidy/misc-unused-parameters.cpp
+++ test/clang-tidy/misc-unused-parameters.cpp
@@ -42,7 +42,7 @@
 
 static void staticFunctionC(int i, int j) { (void)j; }
 // CHECK-MESSAGES: :[[@LINE-1]]:33: warning
-// CHECK-FIXES: {{^}}static void staticFunctionC( int j)
+// CHECK-FIXES: {{^}}static void staticFunctionC(int j)
 
 static void staticFunctionD(int i, int j, int k) { (void)i; (void)k; }
 // CHECK-MESSAGES: :[[@LINE-1]]:40: warning
@@ -59,12 +59,38 @@
   staticFunctionB(1, 2);
 // CHECK-FIXES: staticFunctionB(1);
   staticFunctionC(1, 2);
-// CHECK-FIXES: staticFunctionC( 2);
+// CHECK-FIXES: staticFunctionC(2);
   staticFunctionD(1, 2, 3);
 // CHECK-FIXES: staticFunctionD(1, 3);
   staticFunctionE();
 }
 
+/*
+ * FIXME: This fails because the removals overlap and ClangTidy doesn't apply
+ *them.
+ * static void bothVarsUnused(int a, int b) {}
+ */
+
+// Regression test for long variable names and expressions
+// ===
+static int variableWithLongName1(int LongName1, int LongName2) {
+// CHECK-MESSAGES: :[[@LINE-1]]:53: warning: parameter 'LongName2' is unused
+// CHECK-FIXES: {{^}}static int variableWithLongName1(int LongName1) {
+  return LongName1;
+}
+static int variableWithLongName2(int LongName1, int LongName2) {
+// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: parameter 'LongName1' is unused
+// CHECK-FIXES: {{^}}static int variableWithLongName2(int LongName2) {
+  return LongName2;
+}
+static void someLongNameCallSites() {
+  int LongName1 = 7, LongName2 = 17;
+  variableWithLongName1(LongName1, LongName2);
+// CHECK-FIXES: variableWithLongName1(LongName1);
+  variableWithLongName2(LongName1, LongName2);
+// CHECK-FIXES: variableWithLongName2(LongName2);
+}
+
 class SomeClass {
   static void f(int i) {}
 // CHECK-MESSAGES: :[[@LINE-1]]:21: warning
Index: clang-tidy/misc/UnusedParametersCheck.cpp
===
--- clang-tidy/misc/UnusedParametersCheck.cpp
+++ clang-tidy/misc/UnusedParametersCheck.cpp
@@ -10,6 +10,7 @@
 #include "UnusedParametersCheck.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Lex/Lexer.h"
 
 using namespace clang::ast_matchers;
 
@@ -20,36 +21,39 @@
   Finder->addMatcher(functionDecl().bind("function"), this);
 }
 
-static FixItHint removeParameter(const FunctionDecl *Function, unsigned Index) {
-  const ParmVarDecl *Param = Function->getParamDecl(Index);
-  unsigned ParamCount = Function->getNumParams();
-  SourceRange RemovalRange = Param->getSourceRange();
-  if (ParamCount == 1)
-return FixItHint::CreateRemoval(RemovalRange);
-
-  if (Index == 0)
-RemovalRange.setEnd(
-Function->getParamDecl(Index + 1)->getLocStart().getLocWithOffset(-1));
-  else
-RemovalRange.setBegin(
-Function->getParamDecl(Index - 1)->getLocEnd().getLocWithOffset(1));
-
-  return FixItHint::CreateRemoval(RemovalRange);
+template 
+static CharSourceRange removeNode(const MatchFinder::MatchResult ,
+  const T *PrevNode, const T *Node,
+  const T *NextNode) {
+  if (NextNode)
+return CharSourceRange::getCharRange(Node->getLocStart(),
+ NextNode->getLocStart());
+
+  if (PrevNode)
+return CharSourceRange::getTokenRange(
+Lexer::getLocForEndOfToken(PrevNode->getLocEnd(), 0,
+   *Result.SourceManager,
+   Result.Context->getLangOpts()),
+Node->getLocEnd());
+
+  return CharSourceRange::getTokenRange(Node->getSourceRange());
+}
+
+static FixItHint removeParameter(const MatchFinder::MatchResult ,
+ const FunctionDecl *Function, unsigned Index) {
+  return FixItHint::CreateRemoval(removeNode(
+  Result, Index > 0 ? Function->getParamDecl(Index - 1) : nullptr,
+  Function->getParamDecl(Index),
+  Index + 1 < Function->getNumParams() ? Function->getParamDecl(Index + 1)
+   : nullptr));
 }
 
-static FixItHint removeArgument(const CallExpr *Call, unsigned Index) {
-  unsigned ArgCount = Call->getNumArgs();
-  const Expr *Arg = Call->getArg(Index);
-  SourceRange RemovalRange = Arg->getSourceRange();
-  if (ArgCount == 1)
-return FixItHint::CreateRemoval(RemovalRange);
-  if (Index == 0)
-RemovalRange.setEnd(
-Call->getArg(Index 

Re: [PATCH] D13787: [clang-tidy] add check cppcoreguidelines-pro-type-vararg-use

2015-10-20 Thread Matthias Gehre via cfe-commits
mgehre updated this revision to Diff 37925.
mgehre added a comment.

removed __builtin_va_start; change f->foo() to f.foo()


http://reviews.llvm.org/D13787

Files:
  clang-tidy/cppcoreguidelines/CMakeLists.txt
  clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
  clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp
  clang-tidy/cppcoreguidelines/ProTypeVarargCheck.h
  docs/clang-tidy/checks/cppcoreguidelines-pro-type-vararg.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/cppcoreguidelines-pro-type-vararg.cpp

Index: test/clang-tidy/cppcoreguidelines-pro-type-vararg.cpp
===
--- /dev/null
+++ test/clang-tidy/cppcoreguidelines-pro-type-vararg.cpp
@@ -0,0 +1,51 @@
+// RUN: %python %S/check_clang_tidy.py %s cppcoreguidelines-pro-type-vararg %t
+
+void f(int i);
+void f_vararg(int i, ...);
+
+struct C {
+  void g_vararg(...);
+  void g(const char*);
+} c;
+
+template
+void cpp_vararg(P... p);
+
+void check() {
+  f_vararg(1, 7, 9);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg]
+  c.g_vararg("foo");
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not call c-style vararg functions
+
+  f(3); // OK
+  c.g("foo"); // OK
+  cpp_vararg(1, 7, 9); // OK
+}
+
+// ... as a parameter is allowed (e.g. for SFINAE)
+template 
+void CallFooIfAvailableImpl(T& t, ...) {
+  // nothing
+}
+template 
+void CallFooIfAvailableImpl(T& t, decltype(t.foo())*) {
+  t.foo();
+}
+template 
+void CallFooIfAvailable(T& t) {
+  CallFooIfAvailableImpl(t, 0); // OK to call variadic function when the argument is a literal 0
+}
+
+#include 
+void my_printf(const char* format, ...) {
+  va_list ap;
+  va_start(ap, format);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not call c-style vararg functions
+  va_list n;
+  va_copy(n, ap); // Don't warn, va_copy is anyway useless without va_start
+  int i = va_arg(ap, int);
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: do not use va_start/va_arg to define c-style vararg functions; use variadic templates instead
+  va_end(ap); // Don't warn, va_end is anyway useless without va_start
+}
+
+int my_vprintf(const char* format, va_list arg ); // OK to declare function taking va_list
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -8,6 +8,7 @@
cppcoreguidelines-pro-type-const-cast
cppcoreguidelines-pro-type-reinterpret-cast
cppcoreguidelines-pro-type-static-cast-downcast
+   cppcoreguidelines-pro-type-vararg
google-build-explicit-make-pair
google-build-namespaces
google-build-using-namespace
Index: docs/clang-tidy/checks/cppcoreguidelines-pro-type-vararg.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/cppcoreguidelines-pro-type-vararg.rst
@@ -0,0 +1,12 @@
+cppcoreguidelines-pro-type-vararg
+=
+
+This check flags all calls to c-style vararg functions and all use
+of va_arg.
+To allow for SFINAE use of vararg functions, a call is not flagged if
+a literal 0 is passed as the only vararg argument.
+
+Passing to varargs assumes the correct type will be read. This is fragile because it cannot generally be enforced to be safe in the language and so relies on programmer discipline to get it right.
+
+This rule is part of the "Type safety" profile of the C++ Core Guidelines, see
+https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type8-avoid-reading-from-varargs-or-passing-vararg-arguments-prefer-variadic-template-parameters-instead
Index: clang-tidy/cppcoreguidelines/ProTypeVarargCheck.h
===
--- /dev/null
+++ clang-tidy/cppcoreguidelines/ProTypeVarargCheck.h
@@ -0,0 +1,34 @@
+//===--- ProTypeVarargCheck.h - clang-tidy*- 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_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_PRO_TYPE_VARARG_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_PRO_TYPE_VARARG_H
+
+#include "../ClangTidy.h"
+
+namespace clang {
+namespace tidy {
+
+/// This check flags all calls to c-style variadic functions and all use
+/// of va_arg.
+///
+/// For the user-facing documentation see:
+/// http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-pro-type-vararg.html
+class ProTypeVarargCheck : public ClangTidyCheck {
+public:
+  ProTypeVarargCheck(StringRef Name, ClangTidyContext *Context)
+  : ClangTidyCheck(Name, Context) {}
+  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
+  void 

Re: [PATCH] D13673: Add initial support for the MUSL C library.

2015-10-20 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

Thanks for the update, I think this should be good to go. I'll give it a final 
once over tonight.



Comment at: src/locale.cpp:958
@@ -957,3 +961,3 @@
 return static_cast(__classic_lower_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
 return isascii(c) ?

Ah, sorry I missed that. So this was an existing bug. Thanks.


http://reviews.llvm.org/D13673



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


Re: [clang-tools-extra] r250824 - Apply modernize-use-default to clang-tools-extra.

2015-10-20 Thread Tobias Grosser via cfe-commits

On 10/20/2015 11:37 PM, David Blaikie wrote:



On Tue, Oct 20, 2015 at 2:24 PM, Tobias Grosser via cfe-commits
> wrote:

On 10/20/2015 02:56 PM, Angel Garcia Gomez via cfe-commits wrote:

Author: angelgarcia
Date: Tue Oct 20 07:56:27 2015
New Revision: 250824

URL: http://llvm.org/viewvc/llvm-project?rev=250824=rev
Log:
Apply modernize-use-default to clang-tools-extra.

Summary: Replace empty bodies of default constructors and
destructors with '= default'.


Hi Angel,

this breaks http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3.
The builder runs gcc 4.7.2.


Ah, I was/am seeing this on the GDB 7.5 buildbot too - but figured it
might be GCC 4.6, because I couldn't reproduce similar behavior in small
samples on GCC 4.7, but it might be that I have GCC 4.7.3 locally, not
4.7.2...

I think I have some ideas on how to fix this while keeping the change,
but probably best to revert first, then try some things once we've got a
reproduction locally to experiment with. (I think maybe Optional and
possibly some other types are missing noexcept on their user-defined
dtors, and GCC 4.old is assuming user defined dtors are noexcept(false),
which is incorrect in C++11)


This seems to be the same issue (or at least a similar issue) to what we 
had seen in the Polly source. It would be interesting to understand what 
is going on.


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


Re: [PATCH] D13787: [clang-tidy] add check cppcoreguidelines-pro-type-vararg-use

2015-10-20 Thread Samuel Benzaquen via cfe-commits
sbenza accepted this revision.
sbenza added a comment.
This revision is now accepted and ready to land.

Thanks for check.


http://reviews.llvm.org/D13787



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


r250854 - [-fms-extensions] Allow missing exception specifications in redeclarations as an extension

2015-10-20 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Tue Oct 20 15:49:21 2015
New Revision: 250854

URL: http://llvm.org/viewvc/llvm-project?rev=250854=rev
Log:
[-fms-extensions]  Allow missing exception specifications in redeclarations as 
an extension

Microsoft's ATL headers make use of this MSVC extension, add support for
it and issue a diagnostic under -Wmicrosoft-exception-spec.

This fixes PR25265.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=250854=250853=250854=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Oct 20 15:49:21 
2015
@@ -1154,11 +1154,14 @@ def err_incompatible_exception_specs : E
   "target exception specification is not superset of source">;
 def err_deep_exception_specs_differ : Error<
   "exception specifications of %select{return|argument}0 types differ">;
-def ext_missing_exception_specification : ExtWarn<
-  "%0 is missing exception specification '%1'">,
-  InGroup>;
 def err_missing_exception_specification : Error<
   "%0 is missing exception specification '%1'">;
+def ext_missing_exception_specification : ExtWarn<
+  err_missing_exception_specification.Text>,
+  InGroup>;
+def ext_ms_missing_exception_specification : ExtWarn<
+  err_missing_exception_specification.Text>,
+  InGroup;
 def err_noexcept_needs_constant_expression : Error<
   "argument to noexcept specifier must be a constant expression">;
 def err_exception_spec_not_parsed : Error<

Modified: cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExceptionSpec.cpp?rev=250854=250853=250854=diff
==
--- cfe/trunk/lib/Sema/SemaExceptionSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExceptionSpec.cpp Tue Oct 20 15:49:21 2015
@@ -285,10 +285,14 @@ bool Sema::CheckEquivalentExceptionSpec(
 NewProto->getExtProtoInfo().withExceptionSpec(ESI)));
   }
 
-  // Allow missing exception specifications in redeclarations as an extension,
-  // when declaring a replaceable global allocation function.
-  if (New->isReplaceableGlobalAllocationFunction() &&
-  ESI.Type != EST_ComputedNoexcept) {
+  if (getLangOpts().MicrosoftExt && ESI.Type != EST_ComputedNoexcept) {
+// Allow missing exception specifications in redeclarations as an 
extension.
+DiagID = diag::ext_ms_missing_exception_specification;
+ReturnValueOnError = false;
+  } else if (New->isReplaceableGlobalAllocationFunction() &&
+ ESI.Type != EST_ComputedNoexcept) {
+// Allow missing exception specifications in redeclarations as an 
extension,
+// when declaring a replaceable global allocation function.
 DiagID = diag::ext_missing_exception_specification;
 ReturnValueOnError = false;
   } else {

Modified: cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp?rev=250854=250853=250854=diff
==
--- cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp (original)
+++ cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp Tue Oct 20 15:49:21 2015
@@ -422,3 +422,11 @@ template  struct A {
   };
 };
 }
+
+namespace PR25265 {
+struct S {
+  int fn() throw(); // expected-note {{previous declaration is here}}
+};
+
+int S::fn() { return 0; } // expected-warning {{is missing exception 
specification}}
+}


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


[PATCH] D13913: Allow linking multiple bitcode files.

2015-10-20 Thread Artem Belevich via cfe-commits
tra created this revision.
tra added reviewers: echristo, pcc.
tra added a subscriber: cfe-commits.

This will be used for CUDA where we need to link with vendor-supplied bitcode 
library and with a bitcode library pretending to be  libm for GPUs.

Linking options for particular file depend on the option that specifies the 
file.
Currently there are two:
  
* -mlink-bitcode-file links in complete content of the specified file.
* -mlink-cuda-bitcode links in only the symbols needed by current TU.
   Linked symbols are internalized. This bitcode linking mode is used to
   link device-specific bitcode provided by CUDA.

Files are linked in order they are specified on command line.

-mlink-cuda-bitcode replaces -fcuda-uses-libdevice flag.


http://reviews.llvm.org/D13913

Files:
  include/clang/Basic/LangOptions.def
  include/clang/CodeGen/CodeGenAction.h
  include/clang/Driver/CC1Options.td
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/CodeGenAction.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/link-bitcode-file.c
  test/CodeGenCUDA/Inputs/device-code-2.ll
  test/CodeGenCUDA/link-device-bitcode.cu

Index: test/CodeGenCUDA/link-device-bitcode.cu
===
--- test/CodeGenCUDA/link-device-bitcode.cu
+++ test/CodeGenCUDA/link-device-bitcode.cu
@@ -6,13 +6,21 @@
 // Prepare bitcode file to link with
 // RUN: %clang_cc1 -triple nvptx-unknown-cuda -emit-llvm-bc -o %t.bc \
 // RUN:%S/Inputs/device-code.ll
+// RUN: %clang_cc1 -triple nvptx-unknown-cuda -emit-llvm-bc -o %t-2.bc \
+// RUN:%S/Inputs/device-code-2.ll
 //
 // Make sure function in device-code gets linked in and internalized.
 // RUN: %clang_cc1 -triple nvptx-unknown-cuda -fcuda-is-device \
-// RUN:-mlink-bitcode-file %t.bc -fcuda-uses-libdevice -emit-llvm \
+// RUN:-mlink-cuda-bitcode %t.bc  -emit-llvm \
 // RUN:-disable-llvm-passes -o - %s \
 // RUN:| FileCheck %s -check-prefix CHECK-IR
 //
+// Make sure we can link two bitcode files.
+// RUN: %clang_cc1 -triple nvptx-unknown-cuda -fcuda-is-device \
+// RUN:-mlink-cuda-bitcode %t.bc -mlink-cuda-bitcode %t-2.bc \
+// RUN:-emit-llvm -disable-llvm-passes -o - %s \
+// RUN:| FileCheck %s -check-prefix CHECK-IR -check-prefix CHECK-IR-2
+//
 // Make sure function in device-code gets linked but is not internalized
 // without -fcuda-uses-libdevice
 // RUN: %clang_cc1 -triple nvptx-unknown-cuda -fcuda-is-device \
@@ -22,7 +30,7 @@
 //
 // Make sure NVVMReflect pass is enabled in NVPTX back-end.
 // RUN: %clang_cc1 -triple nvptx-unknown-cuda -fcuda-is-device \
-// RUN:-mlink-bitcode-file %t.bc -fcuda-uses-libdevice -S -o /dev/null %s \
+// RUN:-mlink-cuda-bitcode %t.bc -S -o /dev/null %s \
 // RUN:-backend-option -debug-pass=Structure 2>&1 \
 // RUN:| FileCheck %s -check-prefix CHECK-REFLECT
 
@@ -52,5 +60,9 @@
 // CHECK-IR: call i32 @__nvvm_reflect
 // CHECK-IR: ret float
 
+// CHECK-IR-2-LABEL: define internal double @__nv_sin
+// CHECK-IR-2-LABEL: define internal double @__nv_exp
+// CHECK-IR-2-NOT: define internal double @__unused
+
 // Verify that NVVMReflect pass is among the passes run by NVPTX back-end.
 // CHECK-REFLECT: Replace occurrences of __nvvm_reflect() calls with 0/1
Index: test/CodeGenCUDA/Inputs/device-code-2.ll
===
--- /dev/null
+++ test/CodeGenCUDA/Inputs/device-code-2.ll
@@ -0,0 +1,18 @@
+; Simple bit of IR to mimic CUDA's libdevice. We want to be
+; able to link with it and we need to make sure all __nvvm_reflect
+; calls are eliminated by the time PTX has been produced.
+
+target triple = "nvptx-unknown-cuda"
+
+define double @__nv_sin(double %a) {
+   ret double 1.0
+}
+
+define double @__nv_exp(double %a) {
+   ret double 3.0
+}
+
+define double @__unused(double %a) {
+   ret double 2.0
+}
+
Index: test/CodeGen/link-bitcode-file.c
===
--- test/CodeGen/link-bitcode-file.c
+++ test/CodeGen/link-bitcode-file.c
@@ -1,19 +1,29 @@
 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -DBITCODE -emit-llvm-bc -o %t.bc %s
-// RUN: %clang_cc1 -triple i386-pc-linux-gnu -mlink-bitcode-file %t.bc -O3 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-NO-BC %s
-// RUN: not %clang_cc1 -triple i386-pc-linux-gnu -DBITCODE -mlink-bitcode-file %t.bc -O3 -emit-llvm -o - %s 2>&1 | FileCheck -check-prefix=CHECK-BC %s
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -DBITCODE2 -emit-llvm-bc -o %t-2.bc %s
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -mlink-bitcode-file %t.bc \
+// RUN: -O3 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-NO-BC %s
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -O3 -emit-llvm -o - \
+// RUN: -mlink-bitcode-file %t.bc -mlink-bitcode-file %t-2.bc %s \
+// RUN: | FileCheck -check-prefix=CHECK-NO-BC -check-prefix=CHECK-NO-BC2 %s
+// RUN: not %clang_cc1 -triple i386-pc-linux-gnu -DBITCODE -O3 -emit-llvm -o - \
+// 

Re: r250577 - [modules] Allow the error when explicitly loading an incompatible module file

2015-10-20 Thread Sean Silva via cfe-commits
On Tue, Oct 20, 2015 at 6:45 AM, Manuel Klimek  wrote:

> On Tue, Oct 20, 2015 at 3:38 PM Brad King  wrote:
>
>> On 10/20/2015 04:38 AM, Manuel Klimek wrote:
>> > On Tue, Oct 20, 2015 at 5:52 AM Sean Silva wrote:
>> >> get cmake to generate clang module map files and add explicit module
>> build steps?
>> >
>> > I have some experience hacking on cmake, and from my experience I think
>> > this shouldn't be too hard to get working (mainly work ;)
>>
>> I agree this shouldn't be too hard on the CMake side.  Manuel, please
>> come over to the cmake dev list to raise the design discussion.  Then
>> we can guide your implementation work.
>
>
> I think Sean volunteered :) (but please keep me cc'ed if you start
> discussing this on cmake-dev)
>
>
>>   The main design challenges
>> I foresee are:
>>
>> 1. Deciding how this behavior should be activated for a project by
>>its code and/or by the user.
>>
>> 2. Selection of the proper set of headers if it is not exactly the set
>>listed in the target for some reason.  Might this ever by more
>>granular than a whole library target?
>>
>
> I don't think so.
> Main concerns are:
> 1. we need to be able to say something is a "textual" header; those are
> still needed; we can do that by calling them .inc, or by putting something
> into cmake to specify textual headers (that's what we do in our build
> system)
> 2. for the "slow rollout" case we use per-header submodules; but that's
> more an implementation detail than anything else, I think
>

What is the "slow rollout" case?

-- Sean Silva


>
>
>>
>> 3. Finding the right place during the CMake generation process to add
>>the rules for this.
>>
>> We already detect the Clang compiler version so deciding if it is
>> new enough to support the feature should not be hard.
>>
>> Thanks,
>> -Brad
>>
>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r250862 - Revert "Apply modernize-use-default to clang-tools-extra."

2015-10-20 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Tue Oct 20 16:45:52 2015
New Revision: 250862

URL: http://llvm.org/viewvc/llvm-project?rev=250862=rev
Log:
Revert "Apply modernize-use-default to clang-tools-extra."

Breaks the build in GCC 4.7.2 (see
http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3 for example)

This reverts commit r250824.

Modified:
clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp
clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp
clang-tools-extra/trunk/clang-query/Query.cpp
clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h
clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h
clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
clang-tools-extra/trunk/modularize/CoverageChecker.cpp
clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp
clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp
clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp

Modified: clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp?rev=250862=250861=250862=diff
==
--- clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp 
(original)
+++ clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp Tue Oct 
20 16:45:52 2015
@@ -60,7 +60,7 @@ class IncludeDirectivesPPCallback : publ
 public:
   IncludeDirectivesPPCallback(IncludeDirectives *Self)
   : Self(Self), Guard(nullptr) {}
-  ~IncludeDirectivesPPCallback() override = default;
+  ~IncludeDirectivesPPCallback() override {}
 
 private:
   void InclusionDirective(SourceLocation HashLoc, const Token ,

Modified: clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp?rev=250862=250861=250862=diff
==
--- clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp (original)
+++ clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp Tue Oct 20 
16:45:52 2015
@@ -82,7 +82,7 @@ Transform::Transform(llvm::StringRef Nam
   Reset();
 }
 
-Transform::~Transform() = default;
+Transform::~Transform() {}
 
 bool Transform::isFileModifiable(const SourceManager ,
  SourceLocation Loc) const {
@@ -150,7 +150,7 @@ Version Version::getFromString(llvm::Str
   return V;
 }
 
-TransformFactory::~TransformFactory() = default;
+TransformFactory::~TransformFactory() {}
 
 namespace {
 bool versionSupported(Version Required, Version AvailableSince) {

Modified: clang-tools-extra/trunk/clang-query/Query.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-query/Query.cpp?rev=250862=250861=250862=diff
==
--- clang-tools-extra/trunk/clang-query/Query.cpp (original)
+++ clang-tools-extra/trunk/clang-query/Query.cpp Tue Oct 20 16:45:52 2015
@@ -20,7 +20,7 @@ using namespace clang::ast_matchers::dyn
 namespace clang {
 namespace query {
 
-Query::~Query() = default;
+Query::~Query() {}
 
 bool InvalidQuery::run(llvm::raw_ostream , QuerySession ) const {
   OS << ErrStr << "\n";

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h?rev=250862=250861=250862=diff
==
--- clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyModule.h Tue Oct 20 16:45:52 
2015
@@ -82,7 +82,7 @@ private:
 /// them a prefixed name.
 class ClangTidyModule {
 public:
-  virtual ~ClangTidyModule() = default;
+  virtual ~ClangTidyModule() {}
 
   /// \brief Implement this function in order to register all \c CheckFactories
   /// belonging to this module.

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h?rev=250862=250861=250862=diff
==
--- clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h Tue Oct 20 16:45:52 
2015
@@ -88,7 +88,7 @@ struct ClangTidyOptions {
 /// \brief Abstract interface for retrieving various ClangTidy options.
 class ClangTidyOptionsProvider {
 public:
-  virtual ~ClangTidyOptionsProvider() = default;
+  virtual ~ClangTidyOptionsProvider() {}
 
   /// \brief Returns global options, which are independent of the file.
   virtual const ClangTidyGlobalOptions () = 0;

Modified: clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.cpp
URL: 

Re: [clang-tools-extra] r250824 - Apply modernize-use-default to clang-tools-extra.

2015-10-20 Thread David Blaikie via cfe-commits
Reverted in r250862

On Tue, Oct 20, 2015 at 2:39 PM, Tobias Grosser  wrote:

> On 10/20/2015 11:37 PM, David Blaikie wrote:
>
>>
>>
>> On Tue, Oct 20, 2015 at 2:24 PM, Tobias Grosser via cfe-commits
>> > wrote:
>>
>> On 10/20/2015 02:56 PM, Angel Garcia Gomez via cfe-commits wrote:
>>
>> Author: angelgarcia
>> Date: Tue Oct 20 07:56:27 2015
>> New Revision: 250824
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=250824=rev
>> Log:
>> Apply modernize-use-default to clang-tools-extra.
>>
>> Summary: Replace empty bodies of default constructors and
>> destructors with '= default'.
>>
>>
>> Hi Angel,
>>
>> this breaks http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3.
>> The builder runs gcc 4.7.2.
>>
>>
>> Ah, I was/am seeing this on the GDB 7.5 buildbot too - but figured it
>> might be GCC 4.6, because I couldn't reproduce similar behavior in small
>> samples on GCC 4.7, but it might be that I have GCC 4.7.3 locally, not
>> 4.7.2...
>>
>> I think I have some ideas on how to fix this while keeping the change,
>> but probably best to revert first, then try some things once we've got a
>> reproduction locally to experiment with. (I think maybe Optional and
>> possibly some other types are missing noexcept on their user-defined
>> dtors, and GCC 4.old is assuming user defined dtors are noexcept(false),
>> which is incorrect in C++11)
>>
>
> This seems to be the same issue (or at least a similar issue) to what we
> had seen in the Polly source. It would be interesting to understand what is
> going on.
>
> Best,
> Tobias
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13171: [CUDA] Added a wrapper header for inclusion of stock CUDA headers.

2015-10-20 Thread Artem Belevich via cfe-commits
tra updated this revision to Diff 37912.
tra added a comment.
Herald added a subscriber: klimek.

Changed header wrapping strategy. Previous version was attempting to
make CUDA headers work for host/device compilations separately. In the
end host and device compilations ended up with different view of
CUDA-provided functions. While it mostly worked, that is not what we
really want. What we want is to have identical view of device-specific
functions in both cases and let function overloading handle name clashes
between host and device functions.

  

This wrapper now always includes CUDA headers exactly the same way during
host and device compilation passes and produces identical preprocessed
content during host and device side compilation for sm_35 GPUs. Device
compilation passes for older GPUs will see a smaller subset of device
functions supported by particular GPU.

  

As a bonus this wrapper works with CUDA 7.5 now.


http://reviews.llvm.org/D13171

Files:
  lib/Driver/ToolChains.cpp
  lib/Headers/CMakeLists.txt
  lib/Headers/cuda_runtime.h
  unittests/ASTMatchers/ASTMatchersTest.h

Index: unittests/ASTMatchers/ASTMatchersTest.h
===
--- unittests/ASTMatchers/ASTMatchersTest.h
+++ unittests/ASTMatchers/ASTMatchersTest.h
@@ -178,6 +178,7 @@
   Args.push_back("-xcuda");
   Args.push_back("-fno-ms-extensions");
   Args.push_back("--cuda-host-only");
+  Args.push_back("-nocudainc");
   Args.push_back(CompileArg);
   if (!runToolOnCodeWithArgs(Factory->create(),
  CudaHeader + Code, Args)) {
Index: lib/Headers/cuda_runtime.h
===
--- /dev/null
+++ lib/Headers/cuda_runtime.h
@@ -0,0 +1,153 @@
+/*=== cuda_runtime.h - CUDA runtime support ===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===---===
+ */
+
+#ifndef __CLANG_CUDA_RUNTIME_H__
+#define __CLANG_CUDA_RUNTIME_H__
+
+#if defined(__PTX__)
+
+// Include some standard headers to avoid CUDA headers including them
+// while some required macros (like __THROW) are in a weird state.
+#include 
+
+// Preserve common macros that will be changed below by us or by CUDA
+// headers.
+#pragma push_macro("__THROW")
+#pragma push_macro("__CUDA_ARCH__")
+
+// WARNING: Preprocessor hacks below are based on specific of
+// implementation of CUDA-7.x headers and are expected to break with
+// any other version of CUDA headers.
+#include "cuda.h"
+#if !defined(CUDA_VERSION)
+#error "cuda.h did not define CUDA_VERSION"
+#elif CUDA_VERSION < 7000 || CUDA_VERSION > 7050
+#error "Unsupported CUDA version!"
+#endif
+
+// Make largest subset of device functions available during host
+// compilation -- SM_35 for the time being.
+#ifndef __CUDA_ARCH__
+#define __CUDA_ARCH__ 350
+#endif
+
+#include "cuda_builtin_vars.h"
+
+// No need for device_launch_parameters.h as cuda_builtin_vars.h above
+// has taken care of builtin variables declared in the file.
+#define __DEVICE_LAUNCH_PARAMETERS_H__
+
+// {math,device}_functions.h only have declarations of the
+// functions. We don't need them as we're going to pull in their
+// definitions from .hpp files.
+#define __DEVICE_FUNCTIONS_H__
+#define __MATH_FUNCTIONS_H__
+
+#undef __CUDACC__
+#define __CUDABE__
+#include "host_config.h"
+#include "host_defines.h"
+#include "driver_types.h"
+#include "common_functions.h"
+
+#undef __CUDABE__
+#define __CUDACC__
+#include_next "cuda_runtime.h"
+
+#undef __CUDACC__
+#define __CUDABE__
+#include "crt/host_runtime.h"
+#include "crt/device_runtime.h"
+
+// We need decls for functions in CUDA's libdevice woth __device__
+// attribute only. Alas they come either as __host__ __device__ or
+// with no attributes at all. To work around that, define __CUDA_RTC__
+// which produces HD variant and undef __host__ 

Re: [PATCH] D13787: [clang-tidy] add check cppcoreguidelines-pro-type-vararg-use

2015-10-20 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment.

Minor comments only.



Comment at: clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp:29
@@ +28,3 @@
+  callExpr(callee(functionDecl(isVariadic(),
+   unless(hasName("__builtin_va_start")
+  .bind("callvararg"),

No need to mention __builtin_va_start anymore.


Comment at: test/clang-tidy/cppcoreguidelines-pro-type-vararg.cpp:31
@@ +30,3 @@
+template 
+void CallFooIfAvailableImpl(T& t, decltype(t.foo())*) {
+  t->foo();

nit: t.foo() here vs t->foo() in the next line.


http://reviews.llvm.org/D13787



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


Re: [clang-tools-extra] r250824 - Apply modernize-use-default to clang-tools-extra.

2015-10-20 Thread David Blaikie via cfe-commits
On Tue, Oct 20, 2015 at 2:24 PM, Tobias Grosser via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On 10/20/2015 02:56 PM, Angel Garcia Gomez via cfe-commits wrote:
>
>> Author: angelgarcia
>> Date: Tue Oct 20 07:56:27 2015
>> New Revision: 250824
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=250824=rev
>> Log:
>> Apply modernize-use-default to clang-tools-extra.
>>
>> Summary: Replace empty bodies of default constructors and destructors
>> with '= default'.
>>
>
> Hi Angel,
>
> this breaks http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3. The
> builder runs gcc 4.7.2.


Ah, I was/am seeing this on the GDB 7.5 buildbot too - but figured it might
be GCC 4.6, because I couldn't reproduce similar behavior in small samples
on GCC 4.7, but it might be that I have GCC 4.7.3 locally, not 4.7.2...

I think I have some ideas on how to fix this while keeping the change, but
probably best to revert first, then try some things once we've got a
reproduction locally to experiment with. (I think maybe Optional and
possibly some other types are missing noexcept on their user-defined dtors,
and GCC 4.old is assuming user defined dtors are noexcept(false), which is
incorrect in C++11)


> This version is clearly not the most recent one, but still belongs to the
> set of gcc versions we currently document
> as supported:
>
>   http://llvm.org/docs/GettingStarted.html#software
>
> Could you please revert this change.
>
> Thank you,
> Tobias
>
> ___
> 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


r250856 - Re-land r250592 without rejecting field refs in unevaluated contexts

2015-10-20 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Tue Oct 20 16:04:13 2015
New Revision: 250856

URL: http://llvm.org/viewvc/llvm-project?rev=250856=rev
Log:
Re-land r250592 without rejecting field refs in unevaluated contexts

This time, I went with the first approach from
http://reviews.llvm.org/D6700, where clang actually attempts to form an
implicit member reference from an UnresolvedLookupExpr. We know that
there are only two possible outcomes at this point, a DeclRefExpr of the
FieldDecl or an error, but its safer to reuse the existing machinery for
this.

Modified:
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/test/SemaTemplate/instantiate-using-decl.cpp

Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=250856=250855=250856=diff
==
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Tue Oct 20 16:04:13 2015
@@ -9127,9 +9127,20 @@ TreeTransform::TransformUnresol
   SourceLocation TemplateKWLoc = Old->getTemplateKeywordLoc();
 
   // If we have neither explicit template arguments, nor the template keyword,
-  // it's a normal declaration name.
-  if (!Old->hasExplicitTemplateArgs() && !TemplateKWLoc.isValid())
+  // it's a normal declaration name or member reference.
+  if (!Old->hasExplicitTemplateArgs() && !TemplateKWLoc.isValid()) {
+NamedDecl *D = R.getAsSingle();
+// In a C++11 unevaluated context, an UnresolvedLookupExpr might refer to 
an
+// instance member. In other contexts, BuildPossibleImplicitMemberExpr will
+// give a good diagnostic.
+if (D && D->isCXXInstanceMember()) {
+  return SemaRef.BuildPossibleImplicitMemberExpr(SS, TemplateKWLoc, R,
+ /*TemplateArgs=*/nullptr,
+ /*Scope=*/nullptr);
+}
+
 return getDerived().RebuildDeclarationNameExpr(SS, R, Old->requiresADL());
+  }
 
   // If we have template arguments, rebuild them, then rebuild the
   // templateid expression.

Modified: cfe/trunk/test/SemaTemplate/instantiate-using-decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-using-decl.cpp?rev=250856=250855=250856=diff
==
--- cfe/trunk/test/SemaTemplate/instantiate-using-decl.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-using-decl.cpp Tue Oct 20 16:04:13 
2015
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify %s
 
 namespace test0 {
   namespace N { }
@@ -104,3 +105,65 @@ namespace PR16936 {
 x.f();
   }
 }
+
+namespace pr21923 {
+template  struct Base {
+  int field;
+  void method();
+};
+template  struct Derived : Base {
+  using Base::field;
+  using Base::method;
+  static void m_fn1() {
+// expected-error@+1 {{invalid use of member 'field' in static member 
function}}
+(void)field;
+// expected-error@+1 {{invalid use of member 'field' in static member 
function}}
+(void)
+// expected-error@+1 {{call to non-static member function without an 
object argument}}
+(void)method;
+// expected-error@+1 {{call to non-static member function without an 
object argument}}
+(void)
+// expected-error@+1 {{call to non-static member function without an 
object argument}}
+method();
+(void)::field;
+(void)::method;
+  }
+#if __cplusplus >= 201103L
+  // These usages are OK in C++11 due to the unevaluated context.
+  enum { TheSize = sizeof(field) };
+  typedef decltype(field) U;
+#else
+  // expected-error@+1 {{invalid use of non-static data member 'field'}}
+  enum { TheSize = sizeof(field) };
+#endif
+};
+
+#if __cplusplus < 201103L
+// C++98 has an extra note for TheSize.
+// expected-note@+2 {{requested here}}
+#endif
+template class Derived; // expected-note {{requested here}}
+
+// This is interesting because we form an UnresolvedLookupExpr in the static
+// function template and an UnresolvedMemberExpr in the instance function
+// template. As a result, we get slightly different behavior.
+struct UnresolvedTemplateNames {
+  template  void maybe_static();
+#if __cplusplus < 201103L
+  // expected-warning@+2 {{default template arguments for a function template 
are a C++11 extension}}
+#endif
+  template  static void maybe_static();
+
+  template 
+  void instance_method() { (void)maybe_static(); }
+  template 
+  static void static_method() {
+// expected-error@+1 {{call to non-static member function without an 
object argument}}
+(void)maybe_static();
+  }
+};
+void force_instantiation(UnresolvedTemplateNames x) {
+  x.instance_method();
+  UnresolvedTemplateNames::static_method(); // expected-note {{requested 
here}}
+}
+} // pr21923


___

Re: [clang-tools-extra] r250824 - Apply modernize-use-default to clang-tools-extra.

2015-10-20 Thread Tobias Grosser via cfe-commits

On 10/20/2015 02:56 PM, Angel Garcia Gomez via cfe-commits wrote:

Author: angelgarcia
Date: Tue Oct 20 07:56:27 2015
New Revision: 250824

URL: http://llvm.org/viewvc/llvm-project?rev=250824=rev
Log:
Apply modernize-use-default to clang-tools-extra.

Summary: Replace empty bodies of default constructors and destructors with '= 
default'.


Hi Angel,

this breaks http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3. The 
builder runs gcc 4.7.2. This version is clearly not the most recent one, 
but still belongs to the set of gcc versions we currently document

as supported:

  http://llvm.org/docs/GettingStarted.html#software

Could you please revert this change.

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


Re: [PATCH] D13263: Addition of __attribute__((pass_object_size)) to Clang

2015-10-20 Thread George Burgess IV via cfe-commits
george.burgess.iv updated this revision to Diff 37935.
george.burgess.iv added a comment.

Rebased


http://reviews.llvm.org/D13263

Files:
  include/clang/AST/Expr.h
  include/clang/AST/Type.h
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Initialization.h
  include/clang/Sema/Overload.h
  include/clang/Sema/Sema.h
  include/clang/Sema/TemplateDeduction.h
  lib/AST/ASTContext.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/MicrosoftMangle.cpp
  lib/AST/Type.cpp
  lib/AST/TypePrinter.cpp
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaInit.cpp
  lib/Sema/SemaOverload.cpp
  lib/Sema/SemaTemplate.cpp
  lib/Sema/SemaType.cpp
  test/CodeGen/pass-object-size.c
  test/Sema/pass-object-size.c
  test/SemaCXX/pass-object-size.cpp

Index: test/SemaCXX/pass-object-size.cpp
===
--- /dev/null
+++ test/SemaCXX/pass-object-size.cpp
@@ -0,0 +1,89 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
+
+namespace simple {
+int Foo(void *const p __attribute__((pass_object_size(0;
+
+int OvlFoo(void *const p __attribute__((pass_object_size(0;
+int OvlFoo(void *const p, int);
+
+struct Statics {
+  static int Foo(void *const p __attribute__((pass_object_size(0;
+  static int OvlFoo(void *const p __attribute__((pass_object_size(0;
+  static int OvlFoo(void *const p __attribute__((pass_object_size(1;
+};
+
+struct Members {
+  int Foo(void *const p __attribute__((pass_object_size(0;
+  int OvlFoo(void *const p __attribute__((pass_object_size(0;
+  int OvlFoo(void *const p, int);
+};
+
+void Decls() {
+  int (*A)(void *) =  //expected-error{{functions with pass_object_size params cannot have their address taken}}
+  int (*B)(void *) = Foo; //expected-error{{functions with pass_object_size params cannot have their address taken}}
+
+  int (*C)(void *) =  //expected-error{{address of overloaded function 'OvlFoo' does not match required type 'int (void *)'}} expected-note@6{{candidate function made ineligible by pass_object_size attributes}} expected-note@7{{candidate function has different number of parameters (expected 1 but has 2)}}
+  int (*D)(void *) = OvlFoo; //expected-error{{address of overloaded function 'OvlFoo' does not match required type 'int (void *)'}} expected-note@6{{candidate function made ineligible by pass_object_size attributes}} expected-note@7{{candidate function has different number of parameters (expected 1 but has 2)}}
+
+  int (*E)(void *) = ::Foo; //expected-error{{functions with pass_object_size params cannot have their address taken}}
+  int (*F)(void *) = ::OvlFoo; //expected-error{{address of overloaded function 'OvlFoo' does not match required type 'int (void *)'}} expected-note@11{{candidate function made ineligible by pass_object_size attributes}} expected-note@12{{candidate function made ineligible by pass_object_size attributes}}
+
+  int (*G)(void *) = ::Foo; //expected-error{{functions with pass_object_size params cannot have their address taken}}
+  int (*H)(void *) = ::OvlFoo; //expected-error{{address of overloaded function 'OvlFoo' does not match required type 'int (void *)'}} expected-note@17{{candidate function made ineligible by pass_object_size attributes}} expected-note@18{{candidate function has different number of parameters (expected 1 but has 2)}}
+}
+
+void Assigns() {
+  int (*A)(void *);
+  A =  //expected-error{{functions with pass_object_size params cannot have their address taken}}
+  A = Foo; //expected-error{{assigning to 'int (*)(void *)' from incompatible type 'int (void *const pass_object_size)': mismatch between parameters with pass_object_size attributes}}
+
+  A =  //expected-error{{assigning to 'int (*)(void *)' from incompatible type ''}} expected-note@6{{candidate function made ineligible by pass_object_size attributes}} expected-note@7{{candidate function has different number of parameters (expected 1 but has 2)}}
+  A = OvlFoo; //expected-error{{assigning to 'int (*)(void *)' from incompatible type ''}} expected-note@6{{candidate function made ineligible by pass_object_size attributes}} expected-note@7{{candidate function has different number of parameters (expected 1 but has 2)}}
+
+  A = ::Foo; //expected-error{{functions with pass_object_size params cannot have their address taken}}
+  A = ::OvlFoo; //expected-error{{assigning to 'int (*)(void *)' from incompatible type ''}} expected-note@11{{candidate function made ineligible by pass_object_size attributes}} expected-note@12{{candidate function made ineligible by pass_object_size attributes}}
+
+  int (Members::*M)(void *);
+  M = ::Foo; //expected-error{{functions with pass_object_size params cannot have their address taken}}
+  M = ::OvlFoo; //expected-error{{assigning to 

Re: [PATCH] D13787: [clang-tidy] add check cppcoreguidelines-pro-type-vararg-use

2015-10-20 Thread Matthias Gehre via cfe-commits
mgehre added a comment.

Thanks for the good review!



Comment at: clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp:26
@@ +25,3 @@
+  Finder->addMatcher(
+  varDecl(hasType(pointsTo(cxxRecordDecl(hasName("__va_list_tag")
+  .bind("va_list"),

sbenza wrote:
> Is there a way to look for the standard type (and not the implementation 
> defined __xxx type name)?
I don't see it in the AST, because the other names are macros. But maybe there 
is some magic I don't know of.


http://reviews.llvm.org/D13787



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


r250866 - Revert r247977, "clang/test/lit.cfg: *-ps4 doesn't have appropriate driver yet. Mark it as "non-clang-driver"."

2015-10-20 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Tue Oct 20 17:36:16 2015
New Revision: 250866

URL: http://llvm.org/viewvc/llvm-project?rev=250866=rev
Log:
Revert r247977, "clang/test/lit.cfg: *-ps4 doesn't have appropriate driver yet. 
Mark it as "non-clang-driver"."

They, "tests requiring clang-driver", should work in trunk since ps4 driver has 
been introduced.

Modified:
cfe/trunk/test/lit.cfg

Modified: cfe/trunk/test/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg?rev=250866=250865=250866=diff
==
--- cfe/trunk/test/lit.cfg (original)
+++ cfe/trunk/test/lit.cfg Tue Oct 20 17:36:16 2015
@@ -414,7 +414,7 @@ if not re.match(r'^x86_64.*-(win32|mingw
 config.available_features.add('LP64')
 
 # [PR12920] "clang-driver" -- set if gcc driver is not used.
-if not re.match(r'.*-(cygwin|ps4)$', config.target_triple):
+if not re.match(r'.*-(cygwin)$', config.target_triple):
 config.available_features.add('clang-driver')
 
 # [PR18856] Depends to remove opened file. On win32, a file could be removed


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


[PATCH] D13897: [AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap.

2015-10-20 Thread Benjamin Kramer via cfe-commits
bkramer created this revision.
bkramer added reviewers: klimek, sbenza.
bkramer added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

Firstly this changes the type of parent map to be keyed on DynTypedNode to
simplify the following changes. This comes with a DenseMapInfo for
DynTypedNode, which is a bit incomplete still and will probably only work
for parentmap right now.

Then the RecursiveASTVisitor in ASTContext is updated and finally
ASTMatchers hasParent and hasAncestor learn about the new functionality.

Now ParentMap is only missing TemplateArgumentLocs and CXXCtorInitializers.

http://reviews.llvm.org/D13897

Files:
  include/clang/AST/ASTContext.h
  include/clang/AST/ASTTypeTraits.h
  include/clang/ASTMatchers/ASTMatchers.h
  include/clang/ASTMatchers/ASTMatchersInternal.h
  lib/AST/ASTContext.cpp
  lib/ASTMatchers/ASTMatchFinder.cpp
  unittests/AST/ASTContextParentMapTest.cpp
  unittests/ASTMatchers/Dynamic/ParserTest.cpp
  unittests/ASTMatchers/Dynamic/RegistryTest.cpp

Index: unittests/ASTMatchers/Dynamic/RegistryTest.cpp
===
--- unittests/ASTMatchers/Dynamic/RegistryTest.cpp
+++ unittests/ASTMatchers/Dynamic/RegistryTest.cpp
@@ -447,8 +447,10 @@
 TEST_F(RegistryTest, Completion) {
   CompVector Comps = getCompletions();
   // Overloaded
-  EXPECT_TRUE(hasCompletion(
-  Comps, "hasParent(", "Matcher hasParent(Matcher)"));
+  EXPECT_TRUE(hasCompletion(Comps, "hasParent(",
+"Matcher "
+"hasParent(Matcher)"));
   // Variadic.
   EXPECT_TRUE(hasCompletion(Comps, "whileStmt(",
 "Matcher whileStmt(Matcher...)"));
@@ -463,8 +465,10 @@
 
   EXPECT_TRUE(hasCompletion(WhileComps, "hasBody(",
 "Matcher hasBody(Matcher)"));
-  EXPECT_TRUE(hasCompletion(WhileComps, "hasParent(",
-"Matcher hasParent(Matcher)"));
+  EXPECT_TRUE(hasCompletion(WhileComps, "hasParent(", "Matcher "
+  "hasParent(Matcher<"
+  "NestedNameSpecifierLoc|"
+  "TypeLoc|Decl|...>)"));
   EXPECT_TRUE(
   hasCompletion(WhileComps, "allOf(", "Matcher allOf(Matcher...)"));
 
Index: unittests/ASTMatchers/Dynamic/ParserTest.cpp
===
--- unittests/ASTMatchers/Dynamic/ParserTest.cpp
+++ unittests/ASTMatchers/Dynamic/ParserTest.cpp
@@ -318,7 +318,8 @@
   Comps[1].MatcherDecl);
 
   EXPECT_EQ("arent(", Comps[2].TypedText);
-  EXPECT_EQ("Matcher hasParent(Matcher)",
+  EXPECT_EQ("Matcher "
+"hasParent(Matcher)",
 Comps[2].MatcherDecl);
 }
 
Index: unittests/AST/ASTContextParentMapTest.cpp
===
--- unittests/AST/ASTContextParentMapTest.cpp
+++ unittests/AST/ASTContextParentMapTest.cpp
@@ -38,6 +38,19 @@
  ifStmt(hasParent(compoundStmt();
 }
 
+TEST(GetParents, ReturnsParentForTypeLoc) {
+  MatchVerifier Verifier;
+  EXPECT_TRUE(
+  Verifier.match("namespace a { class b {}; } void f(a::b) {}",
+ typeLoc(hasParent(typeLoc(hasParent(functionDecl()));
+}
+
+TEST(GetParents, ReturnsParentForNestedNameSpecifierLoc) {
+  MatchVerifier Verifier;
+  EXPECT_TRUE(Verifier.match("namespace a { class b {}; } void f(a::b) {}",
+ nestedNameSpecifierLoc(hasParent(typeLoc();
+}
+
 TEST(GetParents, ReturnsParentInsideTemplateInstantiations) {
   MatchVerifier DeclVerifier;
   EXPECT_TRUE(DeclVerifier.match(
Index: lib/ASTMatchers/ASTMatchFinder.cpp
===
--- lib/ASTMatchers/ASTMatchFinder.cpp
+++ lib/ASTMatchers/ASTMatchFinder.cpp
@@ -621,9 +621,6 @@
 if (Node.get() ==
 ActiveASTContext->getTranslationUnitDecl())
   return false;
-assert(Node.getMemoizationData() &&
-   "Invariant broken: only nodes that support memoization may be "
-   "used in the parent map.");
 
 MatchKey Key;
 Key.MatcherID = Matcher.getID();
@@ -867,7 +864,11 @@
 
 bool MatchASTVisitor::TraverseNestedNameSpecifierLoc(
 NestedNameSpecifierLoc NNS) {
+  if (!NNS)
+return true;
+
   match(NNS);
+
   // We only match the nested name specifier here (as opposed to traversing it)
   // because the traversal is already done in the parallel "Loc"-hierarchy.
   if (NNS.hasQualifier())
Index: lib/AST/ASTContext.cpp
===
--- lib/AST/ASTContext.cpp
+++ lib/AST/ASTContext.cpp
@@ -8678,14 +8678,32 @@
 
 namespace {
 
+/// 

r250831 - [AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap.

2015-10-20 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Tue Oct 20 10:08:46 2015
New Revision: 250831

URL: http://llvm.org/viewvc/llvm-project?rev=250831=rev
Log:
[AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap.

Firstly this changes the type of parent map to be keyed on DynTypedNode to
simplify the following changes. This comes with a DenseMapInfo for
DynTypedNode, which is a bit incomplete still and will probably only work
for parentmap right now.

Then the RecursiveASTVisitor in ASTContext is updated and finally
ASTMatchers hasParent and hasAncestor learn about the new functionality.

Now ParentMap is only missing TemplateArgumentLocs and CXXCtorInitializers.

Differential Revision: http://reviews.llvm.org/D13897

Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/AST/ASTTypeTraits.h
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/ASTMatchers/ASTMatchFinder.cpp
cfe/trunk/unittests/AST/ASTContextParentMapTest.cpp
cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp
cfe/trunk/unittests/ASTMatchers/Dynamic/RegistryTest.cpp

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=250831=250830=250831=diff
==
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Tue Oct 20 10:08:46 2015
@@ -452,7 +452,7 @@ public:
   typedef llvm::SmallVector ParentVector;
 
   /// \brief Maps from a node to its parents.
-  typedef llvm::DenseMap> ParentMap;
 

Modified: cfe/trunk/include/clang/AST/ASTTypeTraits.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTTypeTraits.h?rev=250831=250830=250831=diff
==
--- cfe/trunk/include/clang/AST/ASTTypeTraits.h (original)
+++ cfe/trunk/include/clang/AST/ASTTypeTraits.h Tue Oct 20 10:08:46 2015
@@ -253,10 +253,30 @@ public:
   /// @{
   /// \brief Imposes an order on \c DynTypedNode.
   ///
-  /// Supports comparison of nodes that support memoization.
-  /// FIXME: Implement comparsion for other node types (currently
-  /// only Stmt, Decl, Type and NestedNameSpecifier return memoization data).
+  /// FIXME: Implement comparsion for other node types.
   bool operator<(const DynTypedNode ) const {
+if (!NodeKind.isSame(Other.NodeKind))
+  return NodeKind < Other.NodeKind;
+
+if (ASTNodeKind::getFromNodeKind().isSame(NodeKind)) {
+  auto TLA = getUnchecked();
+  auto TLB = Other.getUnchecked();
+  return std::make_pair(TLA.getType().getAsOpaquePtr(),
+TLA.getOpaqueData()) <
+ std::make_pair(TLB.getType().getAsOpaquePtr(),
+TLB.getOpaqueData());
+}
+
+if (ASTNodeKind::getFromNodeKind().isSame(
+NodeKind)) {
+  auto NNSLA = getUnchecked();
+  auto NNSLB = Other.getUnchecked();
+  return std::make_pair(NNSLA.getNestedNameSpecifier(),
+NNSLA.getOpaqueData()) <
+ std::make_pair(NNSLB.getNestedNameSpecifier(),
+NNSLB.getOpaqueData());
+}
+
 assert(getMemoizationData() && Other.getMemoizationData());
 return getMemoizationData() < Other.getMemoizationData();
   }
@@ -270,6 +290,13 @@ public:
 if (ASTNodeKind::getFromNodeKind().isSame(NodeKind))
   return getUnchecked() == Other.getUnchecked();
 
+if (ASTNodeKind::getFromNodeKind().isSame(NodeKind))
+  return getUnchecked() == Other.getUnchecked();
+
+if 
(ASTNodeKind::getFromNodeKind().isSame(NodeKind))
+  return getUnchecked() ==
+ Other.getUnchecked();
+
 assert(getMemoizationData() && Other.getMemoizationData());
 return getMemoizationData() == Other.getMemoizationData();
   }
@@ -278,6 +305,47 @@ public:
   }
   /// @}
 
+  /// \brief Hooks for using DynTypedNode as a key in a DenseMap.
+  struct DenseMapInfo {
+static inline DynTypedNode getEmptyKey() {
+  DynTypedNode Node;
+  Node.NodeKind = ASTNodeKind::DenseMapInfo::getEmptyKey();
+  return Node;
+}
+static inline DynTypedNode getTombstoneKey() {
+  DynTypedNode Node;
+  Node.NodeKind = ASTNodeKind::DenseMapInfo::getTombstoneKey();
+  return Node;
+}
+static unsigned getHashValue(const DynTypedNode ) {
+  // FIXME: Add hashing support for the remaining types.
+  if (ASTNodeKind::getFromNodeKind().isSame(Val.NodeKind)) {
+auto TL = Val.getUnchecked();
+return llvm::hash_combine(TL.getType().getAsOpaquePtr(),
+  TL.getOpaqueData());
+  }
+
+  if (ASTNodeKind::getFromNodeKind().isSame(
+  Val.NodeKind)) {
+auto NNSL = 

Re: [PATCH] D13897: [AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap.

2015-10-20 Thread Manuel Klimek via cfe-commits
klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.

Yay, another yak shaved \o/


http://reviews.llvm.org/D13897



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


Re: [PATCH] D13640: [clang-tidy] Add new check cppcoreguidelines-pro-bounds-array-to-pointer-decay

2015-10-20 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: 
test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp:13
@@ +12,3 @@
+
+void pointerfun(int* p);
+void arrayfun(int p[]);

> Currently, the diag is
> ```
> diag(MatchedCast->getExprLoc(), "do not (implicitly) convert an array to a 
> pointer");
> ```
> should I make the parenthesis conditional?

The core guideline only says to diagnose for implicit decay, so I think we 
should not diagnose in this case.

Perhaps the wording could be, "do not implicitly decay an array into a pointer; 
consider using gsl::array_view or an explicit decay instead"?


Comment at: 
test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp:18
@@ +17,3 @@
+
+void f()
+{

Formatting


Comment at: 
test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp:41
@@ +40,3 @@
+
+const char* g()
+{

Formatting (may want to just run clang-format over the file).


http://reviews.llvm.org/D13640



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


[PATCH] D13925: Implement __attribute__((internal_linkage))

2015-10-20 Thread Evgeniy Stepanov via cfe-commits
eugenis created this revision.
eugenis added a reviewer: rsmith.
eugenis added subscribers: cfe-commits, EricWF, rnk.
eugenis set the repository for this revision to rL LLVM.

The attrubite is applicable to functions and variables and changes the linkage 
of the subject to internal.

Following the proposal in 
http://lists.llvm.org/pipermail/cfe-dev/2015-October/045580.html


Repository:
  rL LLVM

http://reviews.llvm.org/D13925

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  lib/AST/ASTContext.cpp
  lib/Sema/Sema.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGenCXX/internal_linkage.cpp
  test/Sema/internal_linkage.c
  test/SemaCXX/internal_linkage.cpp

Index: test/SemaCXX/internal_linkage.cpp
===
--- /dev/null
+++ test/SemaCXX/internal_linkage.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int f() __attribute__((internal_linkage));
+class __attribute__((internal_linkage)) A { // expected-warning{{'internal_linkage' attribute only applies to variables and functions}}
+public:
+  int x __attribute__((internal_linkage));  // expected-warning{{'internal_linkage' attribute only applies to variables and functions}}
+  static int y __attribute__((internal_linkage));
+  void f1() __attribute__((internal_linkage));
+  void f2() __attribute__((internal_linkage)) {}
+  static void f3() __attribute__((internal_linkage)) {}
+  A() __attribute__((internal_linkage)) {}
+  ~A() __attribute__((internal_linkage)) {}
+};
+
+int A::y;
+
+void A::f1() {
+}
Index: test/Sema/internal_linkage.c
===
--- /dev/null
+++ test/Sema/internal_linkage.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int var __attribute__((internal_linkage));
+int var2 __attribute__((internal_linkage,common)); // expected-warning{{'internal_linkage' attribute ignored}} \
+   // expected-note{{conflicting attribute is here}}
+int f() __attribute__((internal_linkage));
+struct __attribute__((internal_linkage)) S { // expected-warning{{'internal_linkage' attribute only applies to variables and functions}}
+};
Index: test/CodeGenCXX/internal_linkage.cpp
===
--- /dev/null
+++ test/CodeGenCXX/internal_linkage.cpp
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
+
+__attribute__((internal_linkage)) static void f() {}
+
+class A {
+public:
+  static int y __attribute__((internal_linkage));
+  void f1() __attribute__((internal_linkage));
+  void f2() __attribute__((internal_linkage)) {}
+  void f3();
+  static void f4() __attribute__((internal_linkage)) {}
+  A() __attribute__((internal_linkage)) {}
+  ~A() __attribute__((internal_linkage)) {}
+};
+
+int A::y;
+
+void A::f1() {
+}
+
+void A::f3() __attribute__((internal_linkage)) {
+}
+
+void use() {
+  A a;
+  a.f1();
+  a.f2();
+  a.f3();
+  A::f4();
+  f();
+  int  = A::y;
+}
+
+// CHECK-DAG: @_ZN1A1yE = internal global
+// CHECK-DAG: define internal void @_ZL1fv
+// CHECK-DAG: define internal void @_ZN1AC1Ev
+// CHECK-DAG: define internal void @_ZN1AC2Ev
+// CHECK-DAG: define internal void @_ZN1AD1Ev
+// CHECK-DAG: define internal void @_ZN1AD2Ev
+// CHECK-DAG: define internal void @_ZN1A2f1Ev
+// CHECK-DAG: define internal void @_ZN1A2f2Ev
+// CHECK-DAG: define internal void @_ZN1A2f3Ev
+// CHECK-DAG: define internal void @_ZN1A2f4Ev
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -1573,7 +1573,14 @@
 static void handleCommonAttr(Sema , Decl *D, const AttributeList ) {
   if (S.LangOpts.CPlusPlus) {
 S.Diag(Attr.getLoc(), diag::err_attribute_not_supported_in_lang)
-  << Attr.getName() << AttributeLangSupport::Cpp;
+<< Attr.getName() << AttributeLangSupport::Cpp;
+return;
+  }
+
+  if (InternalLinkageAttr *Internal = D->getAttr()) {
+S.Diag(Attr.getRange().getBegin(), diag::warn_attribute_ignored)
+<< Attr.getName();
+S.Diag(Internal->getLocation(), diag::note_conflicting_attribute);
 return;
   }
 
@@ -4550,6 +4557,20 @@
 Attr.getAttributeSpellingListIndex()));
 }
 
+static void handleInternalLinkageAttr(Sema , Decl *D,
+  const AttributeList ) {
+  if (CommonAttr *Common = D->getAttr()) {
+S.Diag(Attr.getRange().getBegin(), diag::warn_attribute_ignored)
+<< Attr.getName();
+S.Diag(Common->getLocation(), diag::note_conflicting_attribute);
+return;
+  }
+
+  if (!D->hasAttr())
+D->addAttr(::new (S.Context) InternalLinkageAttr(
+Attr.getRange(), S.Context, Attr.getAttributeSpellingListIndex()));
+}
+
 /// Handles semantic checking for features that are common to all attributes,
 /// such as checking whether a 

Re: [PATCH] D12906: [RFC] Bug identification("issue_hash") change for CmpRuns.py

2015-10-20 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

Should this be closed?


http://reviews.llvm.org/D12906



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


Re: [clang-tools-extra] r250824 - Apply modernize-use-default to clang-tools-extra.

2015-10-20 Thread Angel Garcia via cfe-commits
Sorry, I have just seen all this. Thank you for reverting it, David.

On Tue, Oct 20, 2015 at 11:48 PM, David Blaikie  wrote:

> Reverted in r250862
>
> On Tue, Oct 20, 2015 at 2:39 PM, Tobias Grosser  wrote:
>
>> On 10/20/2015 11:37 PM, David Blaikie wrote:
>>
>>>
>>>
>>> On Tue, Oct 20, 2015 at 2:24 PM, Tobias Grosser via cfe-commits
>>> > wrote:
>>>
>>> On 10/20/2015 02:56 PM, Angel Garcia Gomez via cfe-commits wrote:
>>>
>>> Author: angelgarcia
>>> Date: Tue Oct 20 07:56:27 2015
>>> New Revision: 250824
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=250824=rev
>>> Log:
>>> Apply modernize-use-default to clang-tools-extra.
>>>
>>> Summary: Replace empty bodies of default constructors and
>>> destructors with '= default'.
>>>
>>>
>>> Hi Angel,
>>>
>>> this breaks http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3.
>>> The builder runs gcc 4.7.2.
>>>
>>>
>>> Ah, I was/am seeing this on the GDB 7.5 buildbot too - but figured it
>>> might be GCC 4.6, because I couldn't reproduce similar behavior in small
>>> samples on GCC 4.7, but it might be that I have GCC 4.7.3 locally, not
>>> 4.7.2...
>>>
>>> I think I have some ideas on how to fix this while keeping the change,
>>> but probably best to revert first, then try some things once we've got a
>>> reproduction locally to experiment with. (I think maybe Optional and
>>> possibly some other types are missing noexcept on their user-defined
>>> dtors, and GCC 4.old is assuming user defined dtors are noexcept(false),
>>> which is incorrect in C++11)
>>>
>>
>> This seems to be the same issue (or at least a similar issue) to what we
>> had seen in the Polly source. It would be interesting to understand what is
>> going on.
>>
>> Best,
>> Tobias
>>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12358: [Analyzer] Widening loops which do not exit

2015-10-20 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment.

Hi Sean,

Sorry it took me so long to get back to you.



Comment at: include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:266
@@ +265,3 @@
+  /// \sa shouldWidenLoops
+  bool WidenLoops;
+

Is this field used?


Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:1407
@@ +1406,3 @@
+const CFGBlock *Following = getBlockAfterLoop(L.getDst());
+if (Following && nodeBuilder.getContext().Eng.blockWasVisited(Following))
+  return;

What is the purpose of checking whether the block has already been visited by 
some other path?

If I understand correctly, this will stop the analyzer from widening before the 
"last" iteration through the loop and so will result in a sink after that 
iteration. What this means is that we will never explore the code beyond the 
loop in the widened state -- but isn't this the whole point of the widening?

So, for example, in your `variable_bound_exiting_loops_not_widened()` test, 
don't we want the clang_analyzer_eval() statement after the loop to be 
symbolically executed on 4 separate paths? That is, once when i is 0, once when 
i is 1, once when i is 2 and once when i is $conj_i$ + 1 where $conj_i$ is the 
value conjured for i when widening.

Also, in general, analysis of one path should not depend at all on whether 
another path has been explored. This is because we want the analyzer to be free 
choose different strategies about path exploration (e.g., BFS vs. DFS, 
prioritizing some paths over others, etc.) without changing the issues reported 
on along any given path. For this reason, I don't think we necessarily want to 
track and expose `blockWasVisited()` on CoreEngine or use this to determine 
when to permit a sink.




Comment at: lib/StaticAnalyzer/Core/LoopWidening.cpp:98
@@ +97,3 @@
+  RegionAndSymbolInvalidationTraits ITraits;
+  for (int RegionIndex = 0; RegionIndex < NumRegions; ++ RegionIndex) {
+ITraits.setTrait(Regions[RegionIndex],

I get a warning here about comparing a signed int (RegionIndex) to an unsigned 
(NumRegions).

I think you can avoid this and simplify things by using a range-based for loop:
```
  const MemRegion *Regions[] = {
  ...
  };
  RegionAndSymbolInvalidationTraits ITraits;
  for (auto *Region : Regions) {
...
  }
```


http://reviews.llvm.org/D12358



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


Re: [PATCH] D13925: Implement __attribute__((internal_linkage))

2015-10-20 Thread David Majnemer via cfe-commits
majnemer added a subscriber: majnemer.


Comment at: include/clang/Basic/Attr.td:2114
@@ +2113,3 @@
+  let Spellings = [GCC<"internal_linkage">];
+  let Subjects = SubjectList<[Function,Var]>;
+  let Documentation = [InternalLinkageDocs];

Space between `Function` and `Var`.


Comment at: lib/Sema/SemaDeclAttr.cpp:1580-1585
@@ -1577,3 +1579,8 @@
+
+  if (InternalLinkageAttr *Internal = D->getAttr()) {
+S.Diag(Attr.getRange().getBegin(), diag::warn_attribute_ignored)
+<< Attr.getName();
+S.Diag(Internal->getLocation(), diag::note_conflicting_attribute);
 return;
   }
 

Why is this here?  You've already got logic for this in 
`handleInternalLinkageAttr`


Comment at: lib/Sema/SemaDeclAttr.cpp:4563-4564
@@ +4562,4 @@
+  if (CommonAttr *Common = D->getAttr()) {
+S.Diag(Attr.getRange().getBegin(), diag::warn_attribute_ignored)
+<< Attr.getName();
+S.Diag(Common->getLocation(), diag::note_conflicting_attribute);

I'd expect a more serious diagnostic for a mismatch (an error) due to the 
nature of the attribute (namely, it's ABI implications).


Repository:
  rL LLVM

http://reviews.llvm.org/D13925



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


Re: [PATCH] D13704: [Fix] Allow implicit conversions of the address of overloadable functions in C + docs update

2015-10-20 Thread George Burgess IV via cfe-commits
george.burgess.iv updated this revision to Diff 37965.
george.burgess.iv added a comment.

Rebased


http://reviews.llvm.org/D13704

Files:
  include/clang/Basic/AttrDocs.td
  lib/Sema/SemaOverload.cpp
  test/CodeGen/overloadable.c
  test/Sema/overloadable.c

Index: test/Sema/overloadable.c
===
--- test/Sema/overloadable.c
+++ test/Sema/overloadable.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s -Wincompatible-pointer-types
 
 int var __attribute__((overloadable)); // expected-error{{'overloadable' attribute only applies to functions}}
 void params(void) __attribute__((overloadable(12))); // expected-error {{'overloadable' attribute takes no arguments}}
@@ -99,3 +99,24 @@
   unsigned char *c;
   multi_type(c);
 }
+
+// Ensure that we allow C-specific type conversions in C
+void fn_type_conversions() {
+  void foo(void *c) __attribute__((overloadable));
+  void foo(char *c) __attribute__((overloadable));
+  void (*ptr1)(void *) = 
+  void (*ptr2)(char *) = 
+  void (*ambiguous)(int *) =  // expected-error{{initializing 'void (*)(int *)' with an expression of incompatible type ''}} expected-note@105{{candidate function}} expected-note@106{{candidate function}}
+  void *vp_ambiguous =  // expected-error{{initializing 'void *' with an expression of incompatible type ''}} expected-note@105{{candidate function}} expected-note@106{{candidate function}}
+
+  void (*specific1)(int *) = (void (*)(void *)) // expected-warning{{incompatible pointer types initializing 'void (*)(int *)' with an expression of type 'void (*)(void *)'}}
+  void *specific2 = (void (*)(void *))
+
+  void disabled(void *c) __attribute__((overloadable, enable_if(0, "")));
+  void disabled(int *c) __attribute__((overloadable, enable_if(0, "")));
+  void disabled(char *c) __attribute__((overloadable, enable_if(1, "The function name lies.")));
+  // To be clear, these should all point to the last overload of 'disabled'
+  void (*dptr1)(char *c) = 
+  void (*dptr2)(void *c) =  // expected-warning{{incompatible pointer types initializing 'void (*)(void *)' with an expression of type ''}} expected-note@115{{candidate function made ineligible by enable_if}} expected-note@116{{candidate function made ineligible by enable_if}} expected-note@117{{candidate function has type mismatch at 1st parameter (expected 'void *' but has 'char *')}} 
+  void *specific_disabled = 
+}
Index: test/CodeGen/overloadable.c
===
--- test/CodeGen/overloadable.c
+++ test/CodeGen/overloadable.c
@@ -29,3 +29,33 @@
   cdv = f(cdv);
   vv = f(vv);
 }
+
+// Ensuring that we pick the correct function for taking the address of an
+// overload when conversions are involved.
+
+void addrof_many(int *a) __attribute__((overloadable, enable_if(0, "")));
+void addrof_many(void *a) __attribute__((overloadable));
+void addrof_many(char *a) __attribute__((overloadable));
+
+void addrof_single(int *a) __attribute__((overloadable, enable_if(0, "")));
+void addrof_single(char *a) __attribute__((overloadable, enable_if(0, "")));
+void addrof_single(char *a) __attribute__((overloadable));
+
+// CHECK-LABEL: define void @foo
+void foo() {
+  // CHECK: store void (i8*)* @_Z11addrof_manyPc
+  void (*p1)(char *) = _many;
+  // CHECK: store void (i8*)* @_Z11addrof_manyPv
+  void (*p2)(void *) = _many;
+  // CHECK: void (i8*)* @_Z11addrof_manyPc
+  void *vp1 = (void (*)(char *)) & addrof_many;
+  // CHECK: void (i8*)* @_Z11addrof_manyPv
+  void *vp2 = (void (*)(void *)) & addrof_many;
+
+  // CHECK: store void (i8*)* @_Z13addrof_singlePc
+  void (*p3)(char *) = _single;
+  // CHECK: @_Z13addrof_singlePc
+  void (*p4)(int *) = _single;
+  // CHECK: @_Z13addrof_singlePc
+  void *vp3 = _single;
+}
Index: lib/Sema/SemaOverload.cpp
===
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -10010,7 +10010,11 @@
 private:
   // Is A considered a better overload candidate for the desired type than B?
   bool isBetterCandidate(const FunctionDecl *A, const FunctionDecl *B) {
-return hasBetterEnableIfAttrs(S, A, B);
+// If there's more than one candidate and no exact match, then we want to
+// require the user to disambiguate for us
+if (!candidateHasExactlyCorrectType(A))
+  return false;
+return !candidateHasExactlyCorrectType(B) || hasBetterEnableIfAttrs(S, A, B);
   }
 
   // Returns true if we've eliminated any (read: all but one) candidates, false
@@ -10090,15 +10094,20 @@
 Specialization = cast(Specialization->getCanonicalDecl());
 assert(S.isSameOrCompatibleFunctionType(
   Context.getCanonicalType(Specialization->getType()),
-  Context.getCanonicalType(TargetFunctionType)) ||
-   (!S.getLangOpts().CPlusPlus && TargetType->isVoidPointerType()));
+  

r250876 - Use ArrayRef and MutableArrayRef instead of a pointer and size. NFC

2015-10-20 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Tue Oct 20 21:34:10 2015
New Revision: 250876

URL: http://llvm.org/viewvc/llvm-project?rev=250876=rev
Log:
Use ArrayRef and MutableArrayRef instead of a pointer and size. NFC

Modified:
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/lib/Basic/TargetInfo.cpp
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/lib/Sema/SemaStmtAsm.cpp

Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=250876=250875=250876=diff
==
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Tue Oct 20 21:34:10 2015
@@ -648,8 +648,7 @@ public:
   // a constraint is valid and provides information about it.
   // FIXME: These should return a real error instead of just true/false.
   bool validateOutputConstraint(ConstraintInfo ) const;
-  bool validateInputConstraint(ConstraintInfo *OutputConstraints,
-   unsigned NumOutputs,
+  bool validateInputConstraint(MutableArrayRef 
OutputConstraints,
ConstraintInfo ) const;
 
   virtual bool validateOutputSize(StringRef /*Constraint*/,
@@ -673,8 +672,8 @@ public:
 TargetInfo::ConstraintInfo ) const = 0;
 
   bool resolveSymbolicName(const char *,
-   ConstraintInfo *OutputConstraints,
-   unsigned NumOutputs, unsigned ) const;
+   ArrayRef OutputConstraints,
+   unsigned ) const;
 
   // Constraint parm will be left pointing at the last character of
   // the constraint.  In practice, it won't be changed unless the

Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=250876=250875=250876=diff
==
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Tue Oct 20 21:34:10 2015
@@ -510,8 +510,7 @@ bool TargetInfo::validateOutputConstrain
 }
 
 bool TargetInfo::resolveSymbolicName(const char *,
- ConstraintInfo *OutputConstraints,
- unsigned NumOutputs,
+ ArrayRef 
OutputConstraints,
  unsigned ) const {
   assert(*Name == '[' && "Symbolic name did not start with '['");
   Name++;
@@ -526,16 +525,16 @@ bool TargetInfo::resolveSymbolicName(con
 
   std::string SymbolicName(Start, Name - Start);
 
-  for (Index = 0; Index != NumOutputs; ++Index)
+  for (Index = 0; Index != OutputConstraints.size(); ++Index)
 if (SymbolicName == OutputConstraints[Index].getName())
   return true;
 
   return false;
 }
 
-bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints,
- unsigned NumOutputs,
- ConstraintInfo ) const {
+bool TargetInfo::validateInputConstraint(
+  MutableArrayRef 
OutputConstraints,
+  ConstraintInfo ) const {
   const char *Name = Info.ConstraintStr.c_str();
 
   if (!*Name)
@@ -556,7 +555,7 @@ bool TargetInfo::validateInputConstraint
   return false;
 
 // Check if matching constraint is out of bounds.
-if (i >= NumOutputs) return false;
+if (i >= OutputConstraints.size()) return false;
 
 // A number must refer to an output only operand.
 if (OutputConstraints[i].isReadWrite())
@@ -579,7 +578,7 @@ bool TargetInfo::validateInputConstraint
   break;
 case '[': {
   unsigned Index = 0;
-  if (!resolveSymbolicName(Name, OutputConstraints, NumOutputs, Index))
+  if (!resolveSymbolicName(Name, OutputConstraints, Index))
 return false;
 
   // If the constraint is already tied, it must be tied to the

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=250876=250875=250876=diff
==
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Tue Oct 20 21:34:10 2015
@@ -1587,9 +1587,7 @@ SimplifyConstraint(const char *Constrain
   assert(OutCons &&
  "Must pass output names to constraints with a symbolic name");
   unsigned Index;
-  bool result = Target.resolveSymbolicName(Constraint,
-   &(*OutCons)[0],
-   OutCons->size(), Index);
+  bool result = Target.resolveSymbolicName(Constraint, *OutCons, Index);
   assert(result && "Could not resolve symbolic name"); (void)result;
   Result += llvm::utostr(Index);
   break;

Re: [PATCH] D13925: Implement __attribute__((internal_linkage))

2015-10-20 Thread Evgeniy Stepanov via cfe-commits
eugenis added inline comments.


Comment at: lib/Sema/SemaDeclAttr.cpp:1580-1585
@@ -1577,3 +1579,8 @@
+
+  if (InternalLinkageAttr *Internal = D->getAttr()) {
+S.Diag(Attr.getRange().getBegin(), diag::warn_attribute_ignored)
+<< Attr.getName();
+S.Diag(Internal->getLocation(), diag::note_conflicting_attribute);
 return;
   }
 

majnemer wrote:
> Why is this here?  You've already got logic for this in 
> `handleInternalLinkageAttr`
I think because the attributes may appear in different order. See for example 
the cross-checks between AlwaysInlineAttr and OptimizeNoneAttr. I did not test 
this.


Repository:
  rL LLVM

http://reviews.llvm.org/D13925



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


Re: [PATCH] D13643: [Sema] Warn on ternary comparison

2015-10-20 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment.

I tested this on 2199 debian projects.. and got 16 warnings.

  ftp://ftp.se.debian.org/debian/pool/main/t/tf5/tf5_5.0beta8.orig.tar.gz
  expr.c:738:22: warning: comparisons such as 'a < b != c' do not have their 
mathematical meaning [-Wparentheses]
  if (neg0 == neg1 && sum<0 != neg0) {
  ^

I guess it could be intentional. I haven't looked in the real code.

  ftp://ftp.se.debian.org/debian/pool/main/m/medusa/medusa_2.1.1.orig.tar.gz
  cvs.c:111:10: warning: comparisons such as 'a <= b <= c' do not have their 
mathematical meaning [-Wparentheses]
if ( !(0 <= argc <= 3) )
   ^~
  ftp.c:140:10: warning: comparisons such as 'a <= b <= c' do not have their 
mathematical meaning [-Wparentheses]
if ( !(0 <= argc <= 3) )
   ^~
  imap.c:143:10: warning: comparisons such as 'a <= b <= c' do not have their 
mathematical meaning [-Wparentheses]
if ( !(0 <= argc <= 2) )
   ^~
  mysql.c:135:10: warning: comparisons such as 'a <= b <= c' do not have their 
mathematical meaning [-Wparentheses]
if ( !(0 <= argc <= 3) )
   ^~
  nntp.c:110:10: warning: comparisons such as 'a <= b <= c' do not have their 
mathematical meaning [-Wparentheses]
if ( !(0 <= argc <= 3) )
   ^~
  pcanywhere.c:133:10: warning: comparisons such as 'a <= b <= c' do not have 
their mathematical meaning [-Wparentheses]
if ( !(0 <= argc <= 3) )
   ^~
  pop3.c:133:10: warning: comparisons such as 'a <= b <= c' do not have their 
mathematical meaning [-Wparentheses]
if ( !(0 <= argc <= 3) )
   ^~
  rexec.c:95:10: warning: comparisons such as 'a <= b <= c' do not have their 
mathematical meaning [-Wparentheses]
if ( !(0 <= argc <= 3) )
   ^~
  rlogin.c:94:10: warning: comparisons such as 'a <= b <= c' do not have their 
mathematical meaning [-Wparentheses]
if ( !(0 <= argc <= 3) )
   ^~
  rsh.c:96:10: warning: comparisons such as 'a <= b <= c' do not have their 
mathematical meaning [-Wparentheses]
if ( !(0 <= argc <= 3) )
   ^~
  smtp.c:135:10: warning: comparisons such as 'a <= b <= c' do not have their 
mathematical meaning [-Wparentheses]
if ( !(0 <= argc <= 3) )
   ^~
  smtp-vrfy.c:114:10: warning: comparisons such as 'a <= b <= c' do not have 
their mathematical meaning [-Wparentheses]
if ( !(0 <= argc <= 3) )
   ^~
  snmp.c:154:10: warning: comparisons such as 'a <= b <= c' do not have their 
mathematical meaning [-Wparentheses]
if ( !(0 <= argc <= 3) )
   ^~
  telnet.c:143:10: warning: comparisons such as 'a <= b <= c' do not have their 
mathematical meaning [-Wparentheses]
if ( !(0 <= argc <= 3) )
   ^~
  vmauthd.c:109:10: warning: comparisons such as 'a <= b <= c' do not have 
their mathematical meaning [-Wparentheses]
if ( !(0 <= argc <= 3) )
   ^~

these are surely true positives.


http://reviews.llvm.org/D13643



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


[PATCH] D13928: [CodeGen] Attach function attributes to Objective-c and OpenMP functions.

2015-10-20 Thread Akira Hatanaka via cfe-commits
ahatanak created this revision.
ahatanak added reviewers: dexonsmith, echristo.
ahatanak added a subscriber: cfe-commits.

Another patch which fixes a bug in clang where it creates a function but 
doesn't attach function attributes to it.


http://reviews.llvm.org/D13928

Files:
  lib/CodeGen/CGObjC.cpp
  lib/CodeGen/CGOpenMPRuntime.cpp
  test/CodeGenObjCXX/property-object-reference-2.mm
  test/OpenMP/function-attr.cpp

Index: test/OpenMP/function-attr.cpp
===
--- /dev/null
+++ test/OpenMP/function-attr.cpp
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10  -stack-protector 2 -emit-llvm -o - %s | FileCheck %s
+
+// Check that function attributes are added to the OpenMP runtime functions.
+
+template 
+struct S {
+  T f;
+  S(T a) : f(a) {}
+  S() : f() {}
+  operator T() { return T(); }
+  ~S() {}
+};
+
+// CHECK: define internal void @.omp.copyprivate.copy_func(i8*, i8*) [[ATTR0:#[0-9]+]] {
+
+void foo0();
+
+int foo1() {
+  char a;
+
+#pragma omp parallel
+  a = 2;
+#pragma omp single copyprivate(a)
+  foo0();
+
+  return 0;
+}
+
+// CHECK: define internal void @.omp_task_privates_map.({{.*}}) [[ATTR3:#[0-9]+]] {
+// CHECK: define internal i32 @.omp_task_entry.({{.*}}) [[ATTR0]] {
+// CHECK: define internal i32 @.omp_task_destructor.({{.*}}) [[ATTR0]] {
+
+int foo2() {
+  S s_arr[] = {1, 2};
+  S var(3);
+#pragma omp task private(s_arr, var)
+  s_arr[0] = var;
+  return 0;
+}
+
+// CHECK: define internal void @.omp.reduction.reduction_func(i8*, i8*) [[ATTR0]] {
+
+float foo3(int n, float *a, float *b) {
+  int i;
+  float result;
+
+#pragma omp parallel for private(i) reduction(+:result)
+  for (i=0; i < n; i++)
+result = result + (a[i] * b[i]);
+  return result;
+}
+
+// CHECK: attributes [[ATTR0]] = {{{.*}} sspstrong {{.*}}}
+// CHECK: attributes [[ATTR3]] = {{{.*}} sspstrong {{.*}}}
Index: test/CodeGenObjCXX/property-object-reference-2.mm
===
--- test/CodeGenObjCXX/property-object-reference-2.mm
+++ test/CodeGenObjCXX/property-object-reference-2.mm
@@ -29,7 +29,7 @@
   @synthesize MyProperty1 = _cppObject1;
 @end
 
-// CHECK-LABEL: define internal void @__copy_helper_atomic_property_(
+// CHECK-LABEL: define internal void @__copy_helper_atomic_property_(%struct.TCPPObject*, %struct.TCPPObject*) #
 // CHECK: [[TWO:%.*]] = load %struct.TCPPObject*, %struct.TCPPObject** [[ADDR:%.*]], align 8
 // CHECK: [[THREE:%.*]] = load %struct.TCPPObject*, %struct.TCPPObject** [[ADDR1:%.*]], align 8
 // CHECK: [[CALL:%.*]] = call i32 @_Z7DEFAULTv()
@@ -43,7 +43,7 @@
 // CHECK: call void @objc_copyCppObjectAtomic(i8* [[THREE]], i8* [[TWO]], i8* bitcast (void (%struct.TCPPObject*, %struct.TCPPObject*)* @__copy_helper_atomic_property_ to i8*))
 // CHECK: ret void
 
-// CHECK-LABEL: define internal void @__assign_helper_atomic_property_(
+// CHECK-LABEL: define internal void @__assign_helper_atomic_property_(%struct.TCPPObject*, %struct.TCPPObject*) #
 // CHECK: [[TWO:%.*]] = load %struct.TCPPObject*, %struct.TCPPObject** [[ADDR:%.*]], align 8
 // CHECK: [[THREE:%.*]] = load %struct.TCPPObject*, %struct.TCPPObject** [[ADDR1:%.*]], align 8
 // CHECK: [[CALL:%.*]] = call dereferenceable({{[0-9]+}}) %struct.TCPPObject* @_ZN10TCPPObjectaSERKS_(%struct.TCPPObject* [[TWO]], %struct.TCPPObject* dereferenceable({{[0-9]+}}) [[THREE]])
Index: lib/CodeGen/CGOpenMPRuntime.cpp
===
--- lib/CodeGen/CGOpenMPRuntime.cpp
+++ lib/CodeGen/CGOpenMPRuntime.cpp
@@ -1490,7 +1490,7 @@
   auto *Fn = llvm::Function::Create(
   CGM.getTypes().GetFunctionType(CGFI), llvm::GlobalValue::InternalLinkage,
   ".omp.copyprivate.copy_func", ());
-  CGM.SetLLVMFunctionAttributes(/*D=*/nullptr, CGFI, Fn);
+  CGM.SetInternalFunctionAttributes(/*D=*/nullptr, Fn, CGFI);
   CodeGenFunction CGF(CGM);
   CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args);
   // Dest = (void*[n])(LHSArg);
@@ -2048,7 +2048,7 @@
   auto *TaskEntry =
   llvm::Function::Create(TaskEntryTy, llvm::GlobalValue::InternalLinkage,
  ".omp_task_entry.", ());
-  CGM.SetLLVMFunctionAttributes(/*D=*/nullptr, TaskEntryFnInfo, TaskEntry);
+  CGM.SetInternalFunctionAttributes(/*D=*/nullptr, TaskEntry, TaskEntryFnInfo);
   CodeGenFunction CGF(CGM);
   CGF.disableDebugInfo();
   CGF.StartFunction(GlobalDecl(), KmpInt32Ty, TaskEntry, TaskEntryFnInfo, Args);
@@ -2115,7 +2115,8 @@
   auto *DestructorFn =
   llvm::Function::Create(DestructorFnTy, llvm::GlobalValue::InternalLinkage,
  ".omp_task_destructor.", ());
-  CGM.SetLLVMFunctionAttributes(/*D=*/nullptr, DestructorFnInfo, DestructorFn);
+  CGM.SetInternalFunctionAttributes(/*D=*/nullptr, DestructorFn,
+DestructorFnInfo);
   CodeGenFunction CGF(CGM);
   CGF.disableDebugInfo();
   

r250880 - Use std::find instead of a manual loop.

2015-10-20 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Tue Oct 20 23:52:38 2015
New Revision: 250880

URL: http://llvm.org/viewvc/llvm-project?rev=250880=rev
Log:
Use std::find instead of a manual loop.

Modified:
cfe/trunk/lib/Basic/TargetInfo.cpp

Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=250880=250879=250880=diff
==
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Tue Oct 20 23:52:38 2015
@@ -364,10 +364,8 @@ bool TargetInfo::isValidGCCRegisterName(
   }
 
   // Check register names.
-  for (unsigned i = 0; i < Names.size(); i++) {
-if (Name == Names[i])
-  return true;
-  }
+  if (std::find(Names.begin(), Names.end(), Name) != Names.end())
+return true;
 
   // Check any additional names that we have.
   ArrayRef AddlNames = getGCCAddlRegNames();


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


r250881 - Use range-based for loops. NFC.

2015-10-20 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Tue Oct 20 23:52:40 2015
New Revision: 250881

URL: http://llvm.org/viewvc/llvm-project?rev=250881=rev
Log:
Use range-based for loops. NFC.

Modified:
cfe/trunk/lib/Basic/TargetInfo.cpp

Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=250881=250880=250881=diff
==
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Tue Oct 20 23:52:40 2015
@@ -368,27 +368,24 @@ bool TargetInfo::isValidGCCRegisterName(
 return true;
 
   // Check any additional names that we have.
-  ArrayRef AddlNames = getGCCAddlRegNames();
-  for (unsigned i = 0; i < AddlNames.size(); i++)
-for (unsigned j = 0; j < llvm::array_lengthof(AddlNames[i].Names); j++) {
-  if (!AddlNames[i].Names[j])
+  for (const AddlRegName  : getGCCAddlRegNames())
+for (const char *AN : ARN.Names) {
+  if (!AN)
 break;
   // Make sure the register that the additional name is for is within
   // the bounds of the register names from above.
-  if (AddlNames[i].Names[j] == Name && AddlNames[i].RegNum < Names.size())
+  if (AN == Name && ARN.RegNum < Names.size())
 return true;
-  }
+}
 
   // Now check aliases.
-  ArrayRef Aliases = getGCCRegAliases();
-  for (unsigned i = 0; i < Aliases.size(); i++) {
-for (unsigned j = 0 ; j < llvm::array_lengthof(Aliases[i].Aliases); j++) {
-  if (!Aliases[i].Aliases[j])
+  for (const GCCRegAlias  : getGCCRegAliases())
+for (const char *A : GRA.Aliases) {
+  if (!A)
 break;
-  if (Aliases[i].Aliases[j] == Name)
+  if (A == Name)
 return true;
 }
-  }
 
   return false;
 }
@@ -412,27 +409,24 @@ TargetInfo::getNormalizedGCCRegisterName
   }
 
   // Check any additional names that we have.
-  ArrayRef AddlNames = getGCCAddlRegNames();
-  for (unsigned i = 0; i < AddlNames.size(); i++)
-for (unsigned j = 0; j < llvm::array_lengthof(AddlNames[i].Names); j++) {
-  if (!AddlNames[i].Names[j])
+  for (const AddlRegName  : getGCCAddlRegNames())
+for (const char *AN : ARN.Names) {
+  if (!AN)
 break;
   // Make sure the register that the additional name is for is within
   // the bounds of the register names from above.
-  if (AddlNames[i].Names[j] == Name && AddlNames[i].RegNum < Names.size())
+  if (AN == Name && ARN.RegNum < Names.size())
 return Name;
 }
 
   // Now check aliases.
-  ArrayRef Aliases = getGCCRegAliases();
-  for (unsigned i = 0; i < Aliases.size(); i++) {
-for (unsigned j = 0 ; j < llvm::array_lengthof(Aliases[i].Aliases); j++) {
-  if (!Aliases[i].Aliases[j])
+  for (const GCCRegAlias  : getGCCRegAliases())
+for (const char *A : RA.Aliases) {
+  if (!A)
 break;
-  if (Aliases[i].Aliases[j] == Name)
-return Aliases[i].Register;
+  if (A == Name)
+return RA.Register;
 }
-  }
 
   return Name;
 }


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


r250878 - Fix bad indentation.

2015-10-20 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Tue Oct 20 23:52:34 2015
New Revision: 250878

URL: http://llvm.org/viewvc/llvm-project?rev=250878=rev
Log:
Fix bad indentation.

Modified:
cfe/trunk/lib/Basic/TargetInfo.cpp

Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=250878=250877=250878=diff
==
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Tue Oct 20 23:52:34 2015
@@ -352,7 +352,7 @@ bool TargetInfo::isValidGCCRegisterName(
   // Get rid of any register prefix.
   Name = removeGCCRegisterPrefix(Name);
   if (Name.empty())
-  return false;
+return false;
 
   ArrayRef Names = getGCCRegNames();
 


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


r250879 - Parse into an unsigned type instead of a signed type and then checking for positive and casting to unsigned. Since we know the string starts with a digit it couldn't be negative anyway. NFCI

2015-10-20 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Tue Oct 20 23:52:36 2015
New Revision: 250879

URL: http://llvm.org/viewvc/llvm-project?rev=250879=rev
Log:
Parse into an unsigned type instead of a signed type and then checking for 
positive and casting to unsigned. Since we know the string starts with a digit 
it couldn't be negative anyway. NFCI

Modified:
cfe/trunk/lib/Basic/TargetInfo.cpp

Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=250879=250878=250879=diff
==
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Tue Oct 20 23:52:36 2015
@@ -358,9 +358,9 @@ bool TargetInfo::isValidGCCRegisterName(
 
   // If we have a number it maps to an entry in the register name array.
   if (isDigit(Name[0])) {
-int n;
+unsigned n;
 if (!Name.getAsInteger(0, n))
-  return n >= 0 && (unsigned)n < Names.size();
+  return n < Names.size();
   }
 
   // Check register names.
@@ -406,10 +406,9 @@ TargetInfo::getNormalizedGCCRegisterName
 
   // First, check if we have a number.
   if (isDigit(Name[0])) {
-int n;
+unsigned n;
 if (!Name.getAsInteger(0, n)) {
-  assert(n >= 0 && (unsigned)n < Names.size() &&
- "Out of bounds register number!");
+  assert(n < Names.size() && "Out of bounds register number!");
   return Names[n];
 }
   }


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


Re: [PATCH] D13731: [RFC][Analyzer] Supporting function attributes in .model files.

2015-10-20 Thread Anna Zaks via cfe-commits
zaks.anna added inline comments.


Comment at: lib/Analysis/BodyFarm.h:43
@@ +42,3 @@
+  /// \brief Merge the attributes found in model files.
+  /// Note, this adds all attributes found in the model file without any sanity
+  /// checks.

Why do we not have sanity checks? What happens when there is a conflict?


Comment at: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:505
@@ +504,3 @@
+// AST visitor used to merge model attributes.
+class WalkAST : public DataRecursiveASTVisitor {
+  AnalysisDeclContextManager 

This name is too generic.


Comment at: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:541
@@ +540,3 @@
+// If "faux-attributes=true" is given, merge model's attributes.
+AnalysisDeclContextManager  = Mgr->getAnalysisDeclContextManager();
+if (ADCMgr.mergeModelAttributes()) {

Should we walk the entire AST here only to get the info from the few functions 
in the farm? 

The AnalysisConsumer visitor tries to make sure the whole AST is not 
serialized, which is very expensive when dealing with PCH files. (You an find 
comments about it if you search for "PCH".)


Comment at: lib/StaticAnalyzer/Frontend/ModelConsumer.cpp:37
@@ +36,3 @@
+// We are interested in definitions and declarations.
+FunctionDecl *func = llvm::dyn_cast(*I);
+if (func) {

Why func lost constness here?


Comment at: lib/StaticAnalyzer/Frontend/ModelInjector.cpp:49
@@ -43,3 +48,3 @@
   // about file name index? Mangled names may not be suitable for that either.
-  if (Bodies.count(D->getName()) != 0)
+  if (Bodies.count(D->getName()) != 0 || Decls.count(D->getName()) != 0)
 return;

Does ModelInjector::onBodySynthesis return immediately if the model has been 
parsed but the Decl is not in the map?

If that is not the case, wouldn't it be very expensive to call onBodySynthesis 
on every decl, most of which are not modeled? If I understand correctly, we 
would try to parse the model file for every such decl. 



Comment at: test/Analysis/model-attributes.cpp:2
@@ +1,3 @@
+// This is testing the 'faux-attributes' analyzer option.
+// The declaration of 'modelFileHasAttributes' found in 
modelFileHasAttributes.model has 'nonnull' attributes on the 2nd and 3rd 
parameter.
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -analyze 
-analyzer-checker=core -analyzer-config 
faux-attributes=true,model-path=%S/Inputs/Models %s -verify

80 col?


http://reviews.llvm.org/D13731



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


[PATCH] D13893: Roll-back r250822.

2015-10-20 Thread Angel Garcia via cfe-commits
angelgarcia created this revision.
angelgarcia added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

It breaks the build for the ASTMatchers

http://reviews.llvm.org/D13893

Files:
  include/clang/AST/ASTConsumer.h
  include/clang/AST/CanonicalType.h
  include/clang/AST/DeclFriend.h
  include/clang/AST/DeclTemplate.h
  include/clang/AST/Expr.h
  include/clang/AST/ExprCXX.h
  include/clang/AST/Mangle.h
  include/clang/AST/MangleNumberingContext.h
  include/clang/AST/Redeclarable.h
  include/clang/AST/StmtIterator.h
  include/clang/AST/UnresolvedSet.h
  include/clang/AST/VTableBuilder.h
  include/clang/ASTMatchers/ASTMatchersInternal.h
  include/clang/Analysis/Analyses/FormatString.h
  include/clang/Analysis/Analyses/LiveVariables.h
  include/clang/Analysis/Analyses/ReachableCode.h
  include/clang/Analysis/Analyses/ThreadSafetyTraverse.h
  include/clang/Analysis/Analyses/UninitializedValues.h
  include/clang/Analysis/AnalysisContext.h
  include/clang/Analysis/CFG.h
  include/clang/Basic/FileSystemStatCache.h
  include/clang/Basic/IdentifierTable.h
  include/clang/Driver/Job.h
  include/clang/Edit/EditsReceiver.h
  include/clang/Frontend/SerializedDiagnosticReader.h
  include/clang/Frontend/VerifyDiagnosticConsumer.h
  include/clang/Lex/ModuleMap.h
  include/clang/Lex/PTHLexer.h
  include/clang/Lex/PreprocessorLexer.h
  include/clang/Sema/Sema.h
  include/clang/Sema/TypoCorrection.h
  include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
  include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
  include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
  include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
  include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
  include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
  include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
  include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
  include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
  include/clang/StaticAnalyzer/Core/PathSensitive/TaintManager.h
  include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h
  include/clang/Tooling/FileMatchTrie.h
  include/clang/Tooling/Tooling.h
  lib/ARCMigrate/ARCMT.cpp
  lib/ARCMigrate/TransformActions.cpp
  lib/ARCMigrate/Transforms.cpp
  lib/AST/ASTContext.cpp
  lib/AST/ASTImporter.cpp
  lib/AST/DeclBase.cpp
  lib/AST/ExternalASTSource.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/VTableBuilder.cpp
  lib/ASTMatchers/ASTMatchFinder.cpp
  lib/ASTMatchers/Dynamic/Marshallers.h
  lib/ASTMatchers/Dynamic/Parser.cpp
  lib/ASTMatchers/Dynamic/VariantValue.cpp
  lib/Analysis/AnalysisDeclContext.cpp
  lib/Analysis/CFG.cpp
  lib/Analysis/CodeInjector.cpp
  lib/Analysis/Consumed.cpp
  lib/Analysis/FormatString.cpp
  lib/Analysis/ProgramPoint.cpp
  lib/Analysis/ThreadSafety.cpp
  lib/Analysis/UninitializedValues.cpp
  lib/Basic/Diagnostic.cpp
  lib/Basic/FileManager.cpp
  lib/Basic/IdentifierTable.cpp
  lib/Basic/SourceManager.cpp
  lib/Basic/TargetInfo.cpp
  lib/Basic/VirtualFileSystem.cpp
  lib/CodeGen/CGBlocks.cpp
  lib/CodeGen/CGCUDARuntime.cpp
  lib/CodeGen/CGCXXABI.cpp
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGObjC.cpp
  lib/CodeGen/CGOpenCLRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenTBAA.cpp
  lib/CodeGen/TargetInfo.cpp
  lib/Driver/Tool.cpp
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Format/BreakableToken.h
  lib/Format/FormatToken.cpp
  lib/Format/UnwrappedLineFormatter.cpp
  lib/Format/UnwrappedLineParser.cpp
  lib/Format/UnwrappedLineParser.h
  lib/Frontend/ASTUnit.cpp
  lib/Frontend/CacheTokens.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/DependencyFile.cpp
  lib/Frontend/DiagnosticRenderer.cpp
  lib/Frontend/FrontendAction.cpp
  lib/Frontend/MultiplexConsumer.cpp
  lib/Frontend/Rewrite/FixItRewriter.cpp
  lib/Frontend/Rewrite/FrontendActions.cpp
  lib/Frontend/Rewrite/RewriteModernObjC.cpp
  lib/Frontend/Rewrite/RewriteObjC.cpp
  lib/Frontend/SerializedDiagnosticPrinter.cpp
  lib/Frontend/TextDiagnostic.cpp
  lib/Index/CommentToXML.cpp
  lib/Lex/HeaderSearch.cpp
  lib/Lex/PPLexerChange.cpp
  lib/Lex/PTHLexer.cpp
  lib/Lex/Pragma.cpp
  lib/Lex/PreprocessingRecord.cpp
  lib/Lex/Preprocessor.cpp
  lib/Parse/ParseCXXInlineMethods.cpp
  lib/Rewrite/TokenRewriter.cpp
  lib/Sema/AttributeList.cpp
  lib/Sema/CodeCompleteConsumer.cpp
  lib/Sema/MultiplexExternalSemaSource.cpp
  lib/Sema/ScopeInfo.cpp
  lib/Sema/Sema.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/SemaPseudoObject.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTCommon.cpp
  lib/Serialization/ASTReader.cpp
  lib/Serialization/GeneratePCH.cpp
  lib/Serialization/MultiOnDiskHashTable.h
  lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
  lib/StaticAnalyzer/Core/BugReporter.cpp
  lib/StaticAnalyzer/Core/ConstraintManager.cpp
  lib/StaticAnalyzer/Core/CoreEngine.cpp
  lib/StaticAnalyzer/Core/ExplodedGraph.cpp
  

Re: [PATCH] D13893: Roll-back r250822.

2015-10-20 Thread Angel Garcia via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL250827: Roll-back r250822. (authored by angelgarcia).

Changed prior to commit:
  http://reviews.llvm.org/D13893?vs=37875=37878#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13893

Files:
  cfe/trunk/include/clang/AST/ASTConsumer.h
  cfe/trunk/include/clang/AST/CanonicalType.h
  cfe/trunk/include/clang/AST/DeclFriend.h
  cfe/trunk/include/clang/AST/DeclTemplate.h
  cfe/trunk/include/clang/AST/Expr.h
  cfe/trunk/include/clang/AST/ExprCXX.h
  cfe/trunk/include/clang/AST/Mangle.h
  cfe/trunk/include/clang/AST/MangleNumberingContext.h
  cfe/trunk/include/clang/AST/Redeclarable.h
  cfe/trunk/include/clang/AST/StmtIterator.h
  cfe/trunk/include/clang/AST/UnresolvedSet.h
  cfe/trunk/include/clang/AST/VTableBuilder.h
  cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
  cfe/trunk/include/clang/Analysis/Analyses/FormatString.h
  cfe/trunk/include/clang/Analysis/Analyses/LiveVariables.h
  cfe/trunk/include/clang/Analysis/Analyses/ReachableCode.h
  cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTraverse.h
  cfe/trunk/include/clang/Analysis/Analyses/UninitializedValues.h
  cfe/trunk/include/clang/Analysis/AnalysisContext.h
  cfe/trunk/include/clang/Analysis/CFG.h
  cfe/trunk/include/clang/Basic/FileSystemStatCache.h
  cfe/trunk/include/clang/Basic/IdentifierTable.h
  cfe/trunk/include/clang/Driver/Job.h
  cfe/trunk/include/clang/Edit/EditsReceiver.h
  cfe/trunk/include/clang/Frontend/SerializedDiagnosticReader.h
  cfe/trunk/include/clang/Frontend/VerifyDiagnosticConsumer.h
  cfe/trunk/include/clang/Lex/ModuleMap.h
  cfe/trunk/include/clang/Lex/PTHLexer.h
  cfe/trunk/include/clang/Lex/PreprocessorLexer.h
  cfe/trunk/include/clang/Sema/Sema.h
  cfe/trunk/include/clang/Sema/TypoCorrection.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/TaintManager.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h
  cfe/trunk/include/clang/Tooling/FileMatchTrie.h
  cfe/trunk/include/clang/Tooling/Tooling.h
  cfe/trunk/lib/ARCMigrate/ARCMT.cpp
  cfe/trunk/lib/ARCMigrate/TransformActions.cpp
  cfe/trunk/lib/ARCMigrate/Transforms.cpp
  cfe/trunk/lib/AST/ASTContext.cpp
  cfe/trunk/lib/AST/ASTImporter.cpp
  cfe/trunk/lib/AST/DeclBase.cpp
  cfe/trunk/lib/AST/ExternalASTSource.cpp
  cfe/trunk/lib/AST/StmtPrinter.cpp
  cfe/trunk/lib/AST/VTableBuilder.cpp
  cfe/trunk/lib/ASTMatchers/ASTMatchFinder.cpp
  cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h
  cfe/trunk/lib/ASTMatchers/Dynamic/Parser.cpp
  cfe/trunk/lib/ASTMatchers/Dynamic/VariantValue.cpp
  cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp
  cfe/trunk/lib/Analysis/CFG.cpp
  cfe/trunk/lib/Analysis/CodeInjector.cpp
  cfe/trunk/lib/Analysis/Consumed.cpp
  cfe/trunk/lib/Analysis/FormatString.cpp
  cfe/trunk/lib/Analysis/ProgramPoint.cpp
  cfe/trunk/lib/Analysis/ThreadSafety.cpp
  cfe/trunk/lib/Analysis/UninitializedValues.cpp
  cfe/trunk/lib/Basic/Diagnostic.cpp
  cfe/trunk/lib/Basic/FileManager.cpp
  cfe/trunk/lib/Basic/IdentifierTable.cpp
  cfe/trunk/lib/Basic/SourceManager.cpp
  cfe/trunk/lib/Basic/TargetInfo.cpp
  cfe/trunk/lib/Basic/VirtualFileSystem.cpp
  cfe/trunk/lib/CodeGen/CGBlocks.cpp
  cfe/trunk/lib/CodeGen/CGCUDARuntime.cpp
  cfe/trunk/lib/CodeGen/CGCXXABI.cpp
  cfe/trunk/lib/CodeGen/CGCall.cpp
  cfe/trunk/lib/CodeGen/CGObjC.cpp
  cfe/trunk/lib/CodeGen/CGOpenCLRuntime.cpp
  cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h
  cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
  cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp
  cfe/trunk/lib/CodeGen/TargetInfo.cpp
  cfe/trunk/lib/Driver/Tool.cpp
  cfe/trunk/lib/Driver/ToolChain.cpp
  cfe/trunk/lib/Driver/ToolChains.cpp
  cfe/trunk/lib/Format/BreakableToken.h
  cfe/trunk/lib/Format/FormatToken.cpp
  cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp
  cfe/trunk/lib/Format/UnwrappedLineParser.cpp
  cfe/trunk/lib/Format/UnwrappedLineParser.h
  cfe/trunk/lib/Frontend/ASTUnit.cpp
  cfe/trunk/lib/Frontend/CacheTokens.cpp
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/lib/Frontend/DependencyFile.cpp
  cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp
  cfe/trunk/lib/Frontend/FrontendAction.cpp
  cfe/trunk/lib/Frontend/MultiplexConsumer.cpp
  cfe/trunk/lib/Frontend/Rewrite/FixItRewriter.cpp
  cfe/trunk/lib/Frontend/Rewrite/FrontendActions.cpp
  

Re: r250577 - [modules] Allow the error when explicitly loading an incompatible module file

2015-10-20 Thread Brad King via cfe-commits
On 10/20/2015 04:38 AM, Manuel Klimek wrote:
> On Tue, Oct 20, 2015 at 5:52 AM Sean Silva wrote:
>> get cmake to generate clang module map files and add explicit module build 
>> steps?
> 
> I have some experience hacking on cmake, and from my experience I think
> this shouldn't be too hard to get working (mainly work ;)

I agree this shouldn't be too hard on the CMake side.  Manuel, please
come over to the cmake dev list to raise the design discussion.  Then
we can guide your implementation work.  The main design challenges
I foresee are:

1. Deciding how this behavior should be activated for a project by
   its code and/or by the user.

2. Selection of the proper set of headers if it is not exactly the set
   listed in the target for some reason.  Might this ever by more
   granular than a whole library target?

3. Finding the right place during the CMake generation process to add
   the rules for this.

We already detect the Clang compiler version so deciding if it is
new enough to support the feature should not be hard.

Thanks,
-Brad

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


Re: r250577 - [modules] Allow the error when explicitly loading an incompatible module file

2015-10-20 Thread Manuel Klimek via cfe-commits
On Tue, Oct 20, 2015 at 3:38 PM Brad King  wrote:

> On 10/20/2015 04:38 AM, Manuel Klimek wrote:
> > On Tue, Oct 20, 2015 at 5:52 AM Sean Silva wrote:
> >> get cmake to generate clang module map files and add explicit module
> build steps?
> >
> > I have some experience hacking on cmake, and from my experience I think
> > this shouldn't be too hard to get working (mainly work ;)
>
> I agree this shouldn't be too hard on the CMake side.  Manuel, please
> come over to the cmake dev list to raise the design discussion.  Then
> we can guide your implementation work.


I think Sean volunteered :) (but please keep me cc'ed if you start
discussing this on cmake-dev)


>   The main design challenges
> I foresee are:
>
> 1. Deciding how this behavior should be activated for a project by
>its code and/or by the user.
>
> 2. Selection of the proper set of headers if it is not exactly the set
>listed in the target for some reason.  Might this ever by more
>granular than a whole library target?
>

I don't think so.
Main concerns are:
1. we need to be able to say something is a "textual" header; those are
still needed; we can do that by calling them .inc, or by putting something
into cmake to specify textual headers (that's what we do in our build
system)
2. for the "slow rollout" case we use per-header submodules; but that's
more an implementation detail than anything else, I think


>
> 3. Finding the right place during the CMake generation process to add
>the rules for this.
>
> We already detect the Clang compiler version so deciding if it is
> new enough to support the feature should not be hard.
>
> Thanks,
> -Brad
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits