r251182 - clang/module.modulemap: s/Basic/BuiltinsR600.def/Basic/BuiltinsAMDGPU.def/

2015-10-24 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Sat Oct 24 02:16:41 2015
New Revision: 251182

URL: http://llvm.org/viewvc/llvm-project?rev=251182&view=rev
Log:
clang/module.modulemap: s/Basic/BuiltinsR600.def/Basic/BuiltinsAMDGPU.def/

Modified:
cfe/trunk/include/clang/module.modulemap

Modified: cfe/trunk/include/clang/module.modulemap
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/module.modulemap?rev=251182&r1=251181&r2=251182&view=diff
==
--- cfe/trunk/include/clang/module.modulemap (original)
+++ cfe/trunk/include/clang/module.modulemap Sat Oct 24 02:16:41 2015
@@ -25,6 +25,7 @@ module Clang_Basic {
   umbrella "Basic"
 
   textual header "Basic/BuiltinsAArch64.def"
+  textual header "Basic/BuiltinsAMDGPU.def"
   textual header "Basic/BuiltinsARM.def"
   textual header "Basic/Builtins.def"
   textual header "Basic/BuiltinsHexagon.def"
@@ -33,7 +34,6 @@ module Clang_Basic {
   textual header "Basic/BuiltinsNEON.def"
   textual header "Basic/BuiltinsNVPTX.def"
   textual header "Basic/BuiltinsPPC.def"
-  textual header "Basic/BuiltinsR600.def"
   textual header "Basic/BuiltinsSystemZ.def"
   textual header "Basic/BuiltinsWebAssembly.def"
   textual header "Basic/BuiltinsX86.def"


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


Re: [libcxx] r249929 - Split out of .

2015-10-24 Thread Michael Zolotukhin via cfe-commits
Hi Richard,

Is this patch ready for commit, or were you just checking an idea? Our bots are 
still failing to build povray, so we’re really looking forward for some fix:)

Thanks,
Michael

> On Oct 15, 2015, at 6:21 PM, Manman Ren via cfe-commits 
>  wrote:
> 
>> 
>> On Oct 15, 2015, at 1:41 PM, Richard Smith > > wrote:
>> 
>> On Thu, Oct 15, 2015 at 12:03 PM, Manman Ren via cfe-commits 
>> mailto:cfe-commits@lists.llvm.org>> wrote:
>> 
>>> On Oct 15, 2015, at 11:25 AM, Richard Smith >> > wrote:
>>> 
>>> I assume the code in question has a "using namespace std;"?
>>> 
>>> 
>> Yes
>> 
>>> I don't see any way around this other than giving up on trying to fix the 
>>> function signatures here (or maybe adding a Clang feature to let us fix the 
>>> bad signature).
>>> 
>>> 
>> Can you elaborate on how to fix the bad signature by adding a Clang feature? 
>> I want to see how hard it is before giving up on trying to fix the 
>> signatures.
>> 
>> I thought about this a bit more, and we already have a feature that can be 
>> used for this.
>> 
>> Please let me know if the attached patch resolves the issue for you. This 
>> should also fix the wrong overload sets for these functions being provided 
>> by  on Darwin.
> 
> This works on my testing case. Thanks!!
> 
> Manman
> 
>> 
>> 
>> Eric, Marshall: the attached patch adds a macro _LIBCPP_PREFERRED_OVERLOAD 
>> that can be applied to a function to (a) mark it as a separate overload from 
>> any other function with the same signature without the overload, and (b) 
>> instruct the compiler that it's preferred over another function with the 
>> same signature without the attribute. This allows us to replace the libc 
>> function
>> 
>>   char *strchr(const char *, int);
>> 
>> with the C++ overload set:
>> 
>>   const char *strchr(const char *, int);
>>   char *strchr(char *, int);
>> 
>> It only works with Clang, though; for other compilers, we leave the C 
>> library's signature alone (as we used to before my patches landed).
>> 
>> Thanks,
>> Manman
>> 
>> 
>>> On Oct 15, 2015 11:07 AM, "Manman Ren via cfe-commits" 
>>> mailto:cfe-commits@lists.llvm.org>> wrote:
>>> Hi Richard,
>>> 
>>> This is causing a failure when building povray on iOS.
>>> 
>>> Compilation error:
>>> /Users/buildslave/tmp/test-suite-externals/speccpu2006/benchspec/CPU2006/453.povray/src/fileinputoutput.cpp:364:20:
>>>  error: call to 'strrchr' is ambiguous
>>>  const char *p=strrchr(name, '.’);
>>> 
>>> iOS.sdk/usr/include/string.h:87:7: note: candidate function
>>> char*strrchr(const char *, int);
>>>  ^
>>> /Users/buildslave/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:109:46:
>>>  note: candidate function
>>> inline _LIBCPP_INLINE_VISIBILITY const char* strrchr(const char* __s, int 
>>> __c) {return ::strrchr(__s, __c);}
>>> 
>>> It is a little strange to have "char*strrchr(const char *, int);” in 
>>> iOS. But it is already in our SDK.
>>> 
>>> Do you have any suggestion on how to fix this?
>>> 
>>> Thanks,
>>> Manman
>>> 
>>> > On Oct 9, 2015, at 6:25 PM, Richard Smith via cfe-commits 
>>> > mailto:cfe-commits@lists.llvm.org>> wrote:
>>> >
>>> > Author: rsmith
>>> > Date: Fri Oct  9 20:25:31 2015
>>> > New Revision: 249929
>>> >
>>> > URL: http://llvm.org/viewvc/llvm-project?rev=249929&view=rev 
>>> > 
>>> > Log:
>>> > Split  out of .
>>> >
>>> > Also fix the overload set for the five functions whose signatures change 
>>> > in the
>>> > case where we can fix it. This is already covered by existing tests for 
>>> > the
>>> > affected systems.
>>> >
>>> > Added:
>>> >libcxx/trunk/include/string.h
>>> >  - copied, changed from r249736, libcxx/trunk/include/cstring
>>> > Modified:
>>> >libcxx/trunk/include/cstring
>>> >
>>> > Modified: libcxx/trunk/include/cstring
>>> > URL: 
>>> > http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstring?rev=249929&r1=249928&r2=249929&view=diff
>>> >  
>>> > 
>>> > ==
>>> > --- libcxx/trunk/include/cstring (original)
>>> > +++ libcxx/trunk/include/cstring Fri Oct  9 20:25:31 2015
>>> > @@ -78,37 +78,42 @@ using ::strcmp;
>>> > using ::strncmp;
>>> > using ::strcoll;
>>> > using ::strxfrm;
>>> > +using ::strcspn;
>>> > +using ::strspn;
>>> > +#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
>>> > +using ::strtok;
>>> > +#endif
>>> > +using ::memset;
>>> > +using ::strerror;
>>> > +using ::strlen;
>>> >
>>> > -using ::memchr;
>>> > +// MSVCRT, GNU libc and its derivates already have the correct prototype 
>>> > in
>>> > +//  if __cplusplus is defined. This macro can be defined by 
>>> > users if
>>> > +// their C library provides the right signature.
>>> > 

Re: [libcxx] r249929 - Split out of .

2015-10-24 Thread Eric Fiselier via cfe-commits
Hi Michael,

Sorry I'm holding this patch up in review. The fix is quite "novel" and I
want to make sure we get it right. If we can't land it over the weekend
I'll ask Richard to revert while we work on it.

/Eric
On Oct 23, 2015 10:13 PM, "Michael Zolotukhin via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

Hi Richard,

Is this patch ready for commit, or were you just checking an idea? Our bots
are still failing to build povray, so we’re really looking forward for some
fix:)

Thanks,
Michael

On Oct 15, 2015, at 6:21 PM, Manman Ren via cfe-commits <
cfe-commits@lists.llvm.org> wrote:


On Oct 15, 2015, at 1:41 PM, Richard Smith  wrote:

On Thu, Oct 15, 2015 at 12:03 PM, Manman Ren via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

>
> On Oct 15, 2015, at 11:25 AM, Richard Smith  wrote:
>
> I assume the code in question has a "using namespace std;"?
>
> Yes
>
> I don't see any way around this other than giving up on trying to fix the
> function signatures here (or maybe adding a Clang feature to let us fix the
> bad signature).
>
> Can you elaborate on how to fix the bad signature by adding a Clang
> feature? I want to see how hard it is before giving up on trying to fix the
> signatures.
>

I thought about this a bit more, and we already have a feature that can be
used for this.

Please let me know if the attached patch resolves the issue for you. This
should also fix the wrong overload sets for these functions being provided
by  on Darwin.


This works on my testing case. Thanks!!

Manman



Eric, Marshall: the attached patch adds a macro _LIBCPP_PREFERRED_OVERLOAD
that can be applied to a function to (a) mark it as a separate overload
from any other function with the same signature without the overload, and
(b) instruct the compiler that it's preferred over another function with
the same signature without the attribute. This allows us to replace the
libc function

  char *strchr(const char *, int);

with the C++ overload set:

  const char *strchr(const char *, int);
  char *strchr(char *, int);

It only works with Clang, though; for other compilers, we leave the C
library's signature alone (as we used to before my patches landed).

Thanks,
> Manman
>
>
> On Oct 15, 2015 11:07 AM, "Manman Ren via cfe-commits" <
> cfe-commits@lists.llvm.org> wrote:
>
>> Hi Richard,
>>
>> This is causing a failure when building povray on iOS.
>>
>> Compilation error:
>> /Users/buildslave/tmp/test-suite-externals/speccpu2006/benchspec/CPU2006/453.povray/src/fileinputoutput.cpp:364:20:
>> error: call to 'strrchr' is ambiguous
>>  const char *p=strrchr(name, '.’);
>>
>> iOS.sdk/usr/include/string.h:87:7: note: candidate function
>> char*strrchr(const char *, int);
>>  ^
>> /Users/buildslave/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:109:46:
>> note: candidate function
>> inline _LIBCPP_INLINE_VISIBILITY const char* strrchr(const char* __s, int
>> __c) {return ::strrchr(__s, __c);}
>>
>> It is a little strange to have "char*strrchr(const char *, int);” in
>> iOS. But it is already in our SDK.
>>
>> Do you have any suggestion on how to fix this?
>>
>> Thanks,
>> Manman
>>
>> > On Oct 9, 2015, at 6:25 PM, Richard Smith via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>> >
>> > Author: rsmith
>> > Date: Fri Oct  9 20:25:31 2015
>> > New Revision: 249929
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=249929&view=rev
>> > Log:
>> > Split  out of .
>> >
>> > Also fix the overload set for the five functions whose signatures
>> change in the
>> > case where we can fix it. This is already covered by existing tests for
>> the
>> > affected systems.
>> >
>> > Added:
>> >libcxx/trunk/include/string.h
>> >  - copied, changed from r249736, libcxx/trunk/include/cstring
>> > Modified:
>> >libcxx/trunk/include/cstring
>> >
>> > Modified: libcxx/trunk/include/cstring
>> > URL:
>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstring?rev=249929&r1=249928&r2=249929&view=diff
>> >
>> ==
>> > --- libcxx/trunk/include/cstring (original)
>> > +++ libcxx/trunk/include/cstring Fri Oct  9 20:25:31 2015
>> > @@ -78,37 +78,42 @@ using ::strcmp;
>> > using ::strncmp;
>> > using ::strcoll;
>> > using ::strxfrm;
>> > +using ::strcspn;
>> > +using ::strspn;
>> > +#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
>> > +using ::strtok;
>> > +#endif
>> > +using ::memset;
>> > +using ::strerror;
>> > +using ::strlen;
>> >
>> > -using ::memchr;
>> > +// MSVCRT, GNU libc and its derivates already have the correct
>> prototype in
>> > +//  if __cplusplus is defined. This macro can be defined by
>> users if
>> > +// their C library provides the right signature.
>> > +#if defined(__GLIBC__) || defined(_LIBCPP_MSVCRT) || defined(__sun__)
>> || \
>> > +defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
>> > +#define _LIBCPP_STRING_H_HAS_CONST_OVERLOADS
>> > +#endif

Re: [PATCH] D14014: Checker of proper vfork usage

2015-10-24 Thread Aleksei Sidorin via cfe-commits
a.sidorin added a comment.

I put some suggestions in inline comments.



Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:47
@@ +46,3 @@
+
+  bool isChildProcess(const ProgramStateRef State) const;
+

I think it's a good idea to make some functions static and/or move them out of 
class definition.


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:97
@@ +96,3 @@
+
+ASTContext &Ctx = C.getASTContext();
+for (const char **id = ids; *id; ++id)

What about combination of std::transform + std::sort + std::binary_search?


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:136
@@ +135,3 @@
+const DeclStmt *PD = dyn_cast_or_null(P);
+if (!PD)
+  break;

```
if (PD && PD->isSingleDecl()) {
  if (const VarDecl *D = dyn_cast(PD->getSingleDecl())
   return D;
```


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:149
@@ +148,3 @@
+
+  // see if it's an ordinary assignment
+  do {

You can use early return to escape do{}.


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:196
@@ +195,3 @@
+  SVal VforkRetVal = Call.getReturnValue();
+  SymbolRef Sym = VforkRetVal.getAsSymbol();
+  Optional DVal =

Is check for non-concrete value is really required?


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:252
@@ +251,3 @@
+  ProgramStateRef State = C.getState();
+  if (!isChildProcess(State))
+return;

```
if (is...)
  report...
```


Repository:
  rL LLVM

http://reviews.llvm.org/D14014



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


Re: [PATCH] D14014: Checker of proper vfork usage

2015-10-24 Thread Yury Gribov via cfe-commits
ygribov added inline comments.


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:47
@@ +46,3 @@
+
+  bool isChildProcess(const ProgramStateRef State) const;
+

a.sidorin wrote:
> I think it's a good idea to make some functions static and/or move them out 
> of class definition.
Right. Which one is preferred btw?


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:97
@@ +96,3 @@
+
+ASTContext &Ctx = C.getASTContext();
+for (const char **id = ids; *id; ++id)

a.sidorin wrote:
> What about combination of std::transform + std::sort + std::binary_search?
I think I should use SmallSet here as suggested by Devin.


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:149
@@ +148,3 @@
+
+  // see if it's an ordinary assignment
+  do {

a.sidorin wrote:
> You can use early return to escape do{}.
In this particular case - yes. But what's wrong about original do-while-false? 
I thought it's a common idiom...


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:196
@@ +195,3 @@
+  SVal VforkRetVal = Call.getReturnValue();
+  SymbolRef Sym = VforkRetVal.getAsSymbol();
+  Optional DVal =

a.sidorin wrote:
> Is check for non-concrete value is really required?
This may be remains of old code, I'll re-check.


Repository:
  rL LLVM

http://reviews.llvm.org/D14014



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


Re: [PATCH] D14014: Checker of proper vfork usage

2015-10-24 Thread Yury Gribov via cfe-commits
ygribov added inline comments.


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:149
@@ +148,3 @@
+
+  // see if it's an ordinary assignment
+  do {

ygribov wrote:
> a.sidorin wrote:
> > You can use early return to escape do{}.
> In this particular case - yes. But what's wrong about original 
> do-while-false? I thought it's a common idiom...
FYI there are several uses of do-while-false in CSA codebase.


Repository:
  rL LLVM

http://reviews.llvm.org/D14014



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


Re: [PATCH] D14014: Checker of proper vfork usage

2015-10-24 Thread Aleksei Sidorin via cfe-commits
a.sidorin added inline comments.


Comment at: lib/StaticAnalyzer/Checkers/VforkChecker.cpp:47
@@ +46,3 @@
+
+  bool isChildProcess(const ProgramStateRef State) const;
+

ygribov wrote:
> a.sidorin wrote:
> > I think it's a good idea to make some functions static and/or move them out 
> > of class definition.
> Right. Which one is preferred btw?
isChildProcess(), getAssignedVariable() are good candidates since they don't 
use any class member.


Repository:
  rL LLVM

http://reviews.llvm.org/D14014



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


Re: [PATCH] D10016: Refactor: Simplify boolean conditional return statements in lib/Frontend

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood updated this revision to Diff 38309.
LegalizeAdulthood added a comment.

Update to latest


http://reviews.llvm.org/D10016

Files:
  lib/Frontend/VerifyDiagnosticConsumer.cpp

Index: lib/Frontend/VerifyDiagnosticConsumer.cpp
===
--- lib/Frontend/VerifyDiagnosticConsumer.cpp
+++ lib/Frontend/VerifyDiagnosticConsumer.cpp
@@ -186,9 +186,7 @@
   Regex(RegexStr) { }
 
   bool isValid(std::string &Error) override {
-if (Regex.isValid(Error))
-  return true;
-return false;
+return Regex.isValid(Error);
   }
 
   bool match(StringRef S) override {


Index: lib/Frontend/VerifyDiagnosticConsumer.cpp
===
--- lib/Frontend/VerifyDiagnosticConsumer.cpp
+++ lib/Frontend/VerifyDiagnosticConsumer.cpp
@@ -186,9 +186,7 @@
   Regex(RegexStr) { }
 
   bool isValid(std::string &Error) override {
-if (Regex.isValid(Error))
-  return true;
-return false;
+return Regex.isValid(Error);
   }
 
   bool match(StringRef S) override {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10016: Refactor: Simplify boolean conditional return statements in lib/Frontend

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood added a comment.

This changeset needs review; I'm unsure of who to add as explicit reviewers.


http://reviews.llvm.org/D10016



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


Re: [PATCH] D10020: Refactor: Simplify boolean conditional return statements in lib/Serialization

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood updated this revision to Diff 38310.
LegalizeAdulthood added a comment.

Update to latest


http://reviews.llvm.org/D10020

Files:
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTWriter.cpp

Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -3112,14 +3112,10 @@
   /// doesn't check whether the name has macros defined; use 
PublicMacroIterator
   /// to check that.
   bool isInterestingIdentifier(const IdentifierInfo *II, uint64_t MacroOffset) 
{
-if (MacroOffset ||
-II->isPoisoned() ||
-(IsModule ? II->hasRevertedBuiltin() : II->getObjCOrBuiltinID()) ||
-II->hasRevertedTokenIDToIdentifier() ||
-(NeedDecls && II->getFETokenInfo()))
-  return true;
-
-return false;
+return MacroOffset || II->isPoisoned() ||
+   (IsModule ? II->hasRevertedBuiltin() : II->getObjCOrBuiltinID()) ||
+   II->hasRevertedTokenIDToIdentifier() ||
+   (NeedDecls && II->getFETokenInfo());
   }
 
 public:
Index: lib/Serialization/ASTReader.cpp
===
--- lib/Serialization/ASTReader.cpp
+++ lib/Serialization/ASTReader.cpp
@@ -3956,10 +3956,7 @@
 
 case llvm::BitstreamEntry::SubBlock:
   if (Entry.ID == BlockID) {
-if (Cursor.EnterSubBlock(BlockID))
-  return true;
-// Found it!
-return false;
+return Cursor.EnterSubBlock(BlockID);
   }
   
   if (Cursor.SkipBlock())


Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -3112,14 +3112,10 @@
   /// doesn't check whether the name has macros defined; use PublicMacroIterator
   /// to check that.
   bool isInterestingIdentifier(const IdentifierInfo *II, uint64_t MacroOffset) {
-if (MacroOffset ||
-II->isPoisoned() ||
-(IsModule ? II->hasRevertedBuiltin() : II->getObjCOrBuiltinID()) ||
-II->hasRevertedTokenIDToIdentifier() ||
-(NeedDecls && II->getFETokenInfo()))
-  return true;
-
-return false;
+return MacroOffset || II->isPoisoned() ||
+   (IsModule ? II->hasRevertedBuiltin() : II->getObjCOrBuiltinID()) ||
+   II->hasRevertedTokenIDToIdentifier() ||
+   (NeedDecls && II->getFETokenInfo());
   }
 
 public:
Index: lib/Serialization/ASTReader.cpp
===
--- lib/Serialization/ASTReader.cpp
+++ lib/Serialization/ASTReader.cpp
@@ -3956,10 +3956,7 @@
 
 case llvm::BitstreamEntry::SubBlock:
   if (Entry.ID == BlockID) {
-if (Cursor.EnterSubBlock(BlockID))
-  return true;
-// Found it!
-return false;
+return Cursor.EnterSubBlock(BlockID);
   }
   
   if (Cursor.SkipBlock())
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10020: Refactor: Simplify boolean conditional return statements in lib/Serialization

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood added a comment.

This changeset needs review, but I'm unsure of who to add as explicit reviewers.


http://reviews.llvm.org/D10020



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


Re: [PATCH] D10021: Refactor: Simplify boolean conditional return statements in lib/StaticAnalyzer/Checkers

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood updated this revision to Diff 38311.
LegalizeAdulthood added a comment.

Update to latest.
This changeset needs review; I am unsure who to add as specific reviewers.


http://reviews.llvm.org/D10021

Files:
  lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
  lib/StaticAnalyzer/Checkers/CStringChecker.cpp
  lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp
  lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp
  lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
  lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp
  lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
  lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  lib/StaticAnalyzer/Checkers/ObjCContainersASTChecker.cpp
  lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp
  lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp

Index: lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
+++ lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
@@ -235,12 +235,9 @@
 return false;
 
   // Run each of the checks on the conditions
-  if (containsMacro(cond) || containsEnum(cond)
-  || containsStaticLocal(cond) || containsBuiltinOffsetOf(cond)
-  || containsStmt(cond))
-return true;
-
-  return false;
+  return containsMacro(cond) || containsEnum(cond) ||
+ containsStaticLocal(cond) || containsBuiltinOffsetOf(cond) ||
+ containsStmt(cond);
 }
 
 // Returns true if the given CFGBlock is empty
Index: lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp
+++ lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp
@@ -404,10 +404,7 @@
 if (II == NSObjectII)
   break;
   }
-  if (!ID)
-return false;
-
-  return true;
+  return ID != nullptr;
 }
 
 /// \brief Returns true if the location is 'self'.
Index: lib/StaticAnalyzer/Checkers/ObjCContainersASTChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/ObjCContainersASTChecker.cpp
+++ lib/StaticAnalyzer/Checkers/ObjCContainersASTChecker.cpp
@@ -66,9 +66,8 @@
 // The type must be an array/pointer type.
 
 // This could be a null constant, which is allowed.
-if (E->isNullPointerConstant(ASTC, Expr::NPC_ValueDependentIsNull))
-  return true;
-return false;
+return static_cast(
+E->isNullPointerConstant(ASTC, Expr::NPC_ValueDependentIsNull));
   }
 
 public:
Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -1000,12 +1000,9 @@
   // Ex:  [NSData dataWithBytesNoCopy:bytes length:10];
   // (...unless a 'freeWhenDone' parameter is false, but that's checked later.)
   StringRef FirstSlot = Call.getSelector().getNameForSlot(0);
-  if (FirstSlot == "dataWithBytesNoCopy" ||
-  FirstSlot == "initWithBytesNoCopy" ||
-  FirstSlot == "initWithCharactersNoCopy")
-return true;
-
-  return false;
+  return FirstSlot == "dataWithBytesNoCopy" ||
+ FirstSlot == "initWithBytesNoCopy" ||
+ FirstSlot == "initWithCharactersNoCopy";
 }
 
 static Optional getFreeWhenDoneArg(const ObjCMethodCall &Call) {
Index: lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
@@ -201,12 +201,8 @@
 static bool isBadDeallocationArgument(const MemRegion *Arg) {
   if (!Arg)
 return false;
-  if (isa(Arg) ||
-  isa(Arg) ||
-  isa(Arg)) {
-return true;
-  }
-  return false;
+  return isa(Arg) || isa(Arg) ||
+ isa(Arg);
 }
 
 /// Given the address expression, retrieve the value it's pointing to. Assume
@@ -240,11 +236,7 @@
   DefinedOrUnknownSVal NoErr = Builder.evalEQ(State, NoErrVal,
  nonloc::SymbolVal(RetSym));
   ProgramStateRef ErrState = State->assume(NoErr, noError);
-  if (ErrState == State) {
-return true;
-  }
-
-  return false;
+  return ErrState == State;
 }
 
 // Report deallocator mismatch. Remove the region from tracking - reporting a
Index: lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp
+++ lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp
@@ -305,9 +305,7 @@
 const Stmt *Stmt2, bool IgnoreSideEffects) {
 
   if (!Stmt1 || !Stmt2) {
-if (!Stmt1 && !Stmt2)
-  return true;
-return false;
+return !Stmt1 && !Stmt2;
   }
 
   // If Stmt1 & Stmt2 are of different class then they are not
Index: lib/Stati

Re: [PATCH] D10023: Refactor: Simplify boolean conditional return statements in lib/StaticAnalyzer/Frontend

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood updated this revision to Diff 38312.
LegalizeAdulthood added a comment.

Update to latest.
This changeset needs reveiw; I am unsure of who to add as specific reviewers.


http://reviews.llvm.org/D10023

Files:
  lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp

Index: lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
===
--- lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
+++ lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
@@ -83,10 +83,7 @@
 
   // For now, none of the static analyzer API is considered stable.
   // Versions must match exactly.
-  if (strcmp(versionString, CLANG_ANALYZER_API_VERSION_STRING) == 0)
-return true;
-
-  return false;
+  return strcmp(versionString, CLANG_ANALYZER_API_VERSION_STRING) == 0;
 }
 
 void ClangCheckerRegistry::warnIncompatible(DiagnosticsEngine *diags,


Index: lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
===
--- lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
+++ lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
@@ -83,10 +83,7 @@
 
   // For now, none of the static analyzer API is considered stable.
   // Versions must match exactly.
-  if (strcmp(versionString, CLANG_ANALYZER_API_VERSION_STRING) == 0)
-return true;
-
-  return false;
+  return strcmp(versionString, CLANG_ANALYZER_API_VERSION_STRING) == 0;
 }
 
 void ClangCheckerRegistry::warnIncompatible(DiagnosticsEngine *diags,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10025: Refactor: Simplify boolean conditional return statements in clang-apply-replacements

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood added a comment.

I do not have commit access; someone will need to commit this for me.


http://reviews.llvm.org/D10025



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


Re: [PATCH] D10025: Refactor: Simplify boolean conditional return statements in clang-apply-replacements

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood updated this revision to Diff 38313.
LegalizeAdulthood added a comment.

Update to latest


http://reviews.llvm.org/D10025

Files:
  clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp

Index: clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
===
--- clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
+++ clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
@@ -184,10 +184,7 @@
   }
 
   // Ask clang to deduplicate and report conflicts.
-  if (deduplicateAndDetectConflicts(GroupedReplacements, SM))
-return false;
-
-  return true;
+  return !deduplicateAndDetectConflicts(GroupedReplacements, SM);
 }
 
 bool applyReplacements(const FileToReplacementsMap &GroupedReplacements,


Index: clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
===
--- clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
+++ clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
@@ -184,10 +184,7 @@
   }
 
   // Ask clang to deduplicate and report conflicts.
-  if (deduplicateAndDetectConflicts(GroupedReplacements, SM))
-return false;
-
-  return true;
+  return !deduplicateAndDetectConflicts(GroupedReplacements, SM);
 }
 
 bool applyReplacements(const FileToReplacementsMap &GroupedReplacements,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13954: CodeGen: Fix LLVM assertion if Swift and Clang emit Objective-C class reference in same LLVM module

2015-10-24 Thread Slava Pestov via cfe-commits
slavapestov added a subscriber: slavapestov.
slavapestov added a comment.

Unfortunately the asm label attribute doesn’t seem to work in this case, at 
least on Darwin. I get two symbols in the IR, with the asm label having the \01 
prefix from MangleContext::mangleName():

@"\01OBJC_CLASS_$_NSNumber" = common global %struct.art_class* null, align 8
  
@"OBJC_CLASS_$_NSNumber" = external global %struct._class_t

As for the diagnostic, is this what you had in mind?

commit 4d4f15ffc4d6a72357fa4cee8e2197a03afe6b51
Author: Slava Pestov 
Date:   Fri Oct 23 23:57:56 2015 -0700

  CodeGen: More robust handling of type conflicts in GetClassGlobal()

diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 31e98b9..e5ef767 100644

- a/lib/CodeGen/CGObjCMac.cpp

+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -6692,16 +6692,31 @@ CGObjCNonFragileABIMac::GetClassGlobal(const 
std::string &Name,

  llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name);
   

- if (!GV)
- GV = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABITy,
- false, L, nullptr, Name);

+  // If it doesn't exist, create it with the right type.
+  if (!GV) {
+return new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABITy,
+false, L, nullptr, Name);
+  }

  assert(GV->getLinkage() == L);
   

- if (ForDefinition ||
- GV->getValueType() == ObjCTypes.ClassnfABITy)

+  // If it already exists, we might need to bitcast.
+  if (GV->getValueType() == ObjCTypes.ClassnfABITy)

  return GV;
   

+  if (ForDefinition) {
+DiagnosticsEngine &Diags = CGM.getDiags();
+unsigned DiagID = Diags.getCustomDiagID(
+DiagnosticsEngine::Error,
+"global variable %0 already defined with wrong type");
+Diags.Report(SourceLocation(), DiagID) << Name;
+
+// Return a new global in this case, with the right type, since the caller
+// doesn't expect a constexpr
+return new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABITy,
+false, L, nullptr, Name);
+  }
+

  return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.ClassnfABIPtrTy);

}


Repository:
  rL LLVM

http://reviews.llvm.org/D13954



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


Re: [PATCH] D13954: CodeGen: Fix LLVM assertion if Swift and Clang emit Objective-C class reference in same LLVM module

2015-10-24 Thread Slava Pestov via cfe-commits
Unfortunately the asm label attribute doesn’t seem to work in this case, at 
least on Darwin. I get two symbols in the IR, with the asm label having the \01 
prefix from MangleContext::mangleName():

@"\01OBJC_CLASS_$_NSNumber" = common global %struct.art_class* null, align 8
  
@"OBJC_CLASS_$_NSNumber" = external global %struct._class_t 

As for the diagnostic, is this what you had in mind?

commit 4d4f15ffc4d6a72357fa4cee8e2197a03afe6b51
Author: Slava Pestov 
Date:   Fri Oct 23 23:57:56 2015 -0700

CodeGen: More robust handling of type conflicts in GetClassGlobal()

diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 31e98b9..e5ef767 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -6692,16 +6692,31 @@ CGObjCNonFragileABIMac::GetClassGlobal(const 
std::string &Name,
 
   llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name);
 
-  if (!GV)
-GV = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABITy,
-  false, L, nullptr, Name);
+  // If it doesn't exist, create it with the right type.
+  if (!GV) {
+return new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABITy,
+false, L, nullptr, Name);
+  }
 
   assert(GV->getLinkage() == L);
 
-  if (ForDefinition ||
-  GV->getValueType() == ObjCTypes.ClassnfABITy)
+  // If it already exists, we might need to bitcast.
+  if (GV->getValueType() == ObjCTypes.ClassnfABITy)
 return GV;
 
+  if (ForDefinition) {
+DiagnosticsEngine &Diags = CGM.getDiags();
+unsigned DiagID = Diags.getCustomDiagID(
+DiagnosticsEngine::Error,
+"global variable %0 already defined with wrong type");
+Diags.Report(SourceLocation(), DiagID) << Name;
+
+// Return a new global in this case, with the right type, since the caller
+// doesn't expect a constexpr
+return new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABITy,
+false, L, nullptr, Name);
+  }
+
   return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.ClassnfABIPtrTy);
 }
 
> On Oct 21, 2015, at 1:18 PM, John McCall  wrote:
> 
> rjmccall added a comment.
> 
> It just occurred to me that there is a way to test this in Clang with the 
> asm-label extension:
> 
>  int Foo_class asm("OBJC_CLASS_$_Foo");
> 
> Of course, you'll have to actually use it from somewhere, or define it, in 
> order for it to actually show up in the IR and cause a conflict.
> 
> You should probably also test that we do something sane if the caller is 
> making a definition but one already exists.  An error counts as "sane"; just 
> make sure you return a GlobalVariable of the right type.  There's model code 
> for this in GetOrCreateLLVMFunction, although it's okay for the diagnostic 
> here to be worse than that one.
> 
> 
> Repository:
>  rL LLVM
> 
> http://reviews.llvm.org/D13954
> 
> 
> 

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


Getting fully qualified names of random qualtypes

2015-10-24 Thread Sterling Augustine via cfe-commits
As requested on cfe-dev, enclosed is a patch (that needs some
style-related work) to calculate the complete fully qualified name of
arbitrary Qualtypes, including recursively expanding template
parameters and subtypes.

Seems to me like it follows most of the conventions described here:

http://llvm.org/docs/CodingStandards.html

but I'm told it needs more work. Happy to oblige.
Index: include/clang/Tooling/Core/QualTypeNames.h
===
--- include/clang/Tooling/Core/QualTypeNames.h	(revision 0)
+++ include/clang/Tooling/Core/QualTypeNames.h	(working copy)
@@ -0,0 +1,152 @@
+//===--- QualTypeNames.h - Generate Complete QualType Names *- C++ -*-===//
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+// ===--===//
+//
+// \file
+// Functionality to generate the fully-qualified names of QualTypes,
+// including recursively expanding any subtypes and template
+// parameters.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLING_CORE_QUALTYPE_NAMES_H
+#define LLVM_CLANG_TOOLING_CORE_QUALTYPE_NAMES_H
+
+#include "llvm/ADT/SmallSet.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/StringRef.h"
+
+namespace clang {
+class ASTContext;
+class Expr;
+class Decl;
+class DeclContext;
+class DeclarationName;
+class GlobalDecl;
+class FunctionDecl;
+class IntegerLiteral;
+class NamedDecl;
+class NamespaceDecl;
+class NestedNameSpecifier;
+class QualType;
+class Sema;
+class TagDecl;
+class TemplateDecl;
+class Type;
+class TypedefNameDecl;
+
+///\brief Class containing static utility functions analizing ASTNodes or
+/// types.
+namespace Analyze {
+
+///\brief Return true if the class or template is declared directly in the
+/// std namespace (modulo inline namespace).
+///
+///\param[in] decl  - The declaration being analyzed.
+bool IsStdClass(const clang::NamedDecl &decl);
+}
+
+///\brief Class containing static utility functions transforming AST nodes or
+/// types.
+///
+namespace Transform {
+
+///\brief Class containing the information on how to configure the
+/// transformation
+///
+struct Config {
+  typedef llvm::SmallSet SkipCollection;
+  typedef const clang::Type cType;
+  typedef llvm::DenseMap ReplaceCollection;
+
+  SkipCollection m_toSkip;
+  ReplaceCollection m_toReplace;
+
+  ///\brief Returns the number of default argument that should be dropped.
+  /// from the name of the template instances.
+  ///
+  ///\param[in] templateDecl   - The declaration being analyzed.
+  unsigned int DropDefaultArg(clang::TemplateDecl &templateDecl) const;
+
+  bool empty() const { return m_toSkip.size() == 0 && m_toReplace.empty(); }
+};
+
+///\brief Remove one layer of sugar, but only some kinds.
+bool SingleStepPartiallyDesugarType(clang::QualType &QT,
+const clang::ASTContext &C);
+
+///\brief "Desugars" a type while skipping the ones in the set.
+///
+/// Desugars a given type recursively until strips all sugar or until gets a
+/// sugared type, which is to be skipped.
+///\param[in] Ctx - The ASTContext.
+///\param[in] QT - The type to be partially desugared.
+///\param[in] TypeConfig - The set of sugared types which shouldn't be
+///desugared and those that should be replaced.
+///\param[in] fullyQualify - if true insert Elaborated where needed.
+///\returns Partially desugared QualType
+///
+clang::QualType GetPartiallyDesugaredType(const clang::ASTContext &Ctx,
+  clang::QualType QT,
+  const Config &TypeConfig,
+  bool fullyQualify = true);
+}
+
+namespace TypeName {
+///\brief Convert the type into one with fully qualified template
+/// arguments.
+///\param[in] QT - the type for which the fully qualified type will be
+/// returned.
+///\param[in] Ctx - the ASTContext to be used.
+clang::QualType GetFullyQualifiedType(clang::QualType QT,
+  const clang::ASTContext &Ctx);
+
+///\brief Get the fully qualified name for a type. This includes full
+/// qualification of all template parameters etc.
+///
+///\param[in] QT - the type for which the fully qualified name will be
+/// returned.
+///\param[in] Ctx - the ASTContext to be used.
+std::string GetFullyQualifiedName(clang::QualType QT,
+  const clang::ASTContext &Ctx);
+
+///\brief Create a NestedNameSpecifier for Namesp and its enclosing
+/// scopes.
+///
+///\param[in] Ctx - the AST Context to be used.
+///\param[in] Namesp - the NamespaceDecl for which a NestedNameSpecifier
+/// is requested.
+clang::NestedNameSpecifier *
+CreateNestedNameSpecifier(const clang::ASTContext &Ctx,
+  const clang::NamespaceDecl *Namesp);

Re: [libcxx] r249929 - Split out of .

2015-10-24 Thread Michael Zolotukhin via cfe-commits
Hi Eric,

Understood, thanks!

Michael

> On Oct 24, 2015, at 1:18 AM, Eric Fiselier  wrote:
> 
> Hi Michael,
> 
> Sorry I'm holding this patch up in review. The fix is quite "novel" and I 
> want to make sure we get it right. If we can't land it over the weekend I'll 
> ask Richard to revert while we work on it.
> 
> /Eric
> 
> On Oct 23, 2015 10:13 PM, "Michael Zolotukhin via cfe-commits" 
> mailto:cfe-commits@lists.llvm.org>> wrote:
> Hi Richard,
> 
> Is this patch ready for commit, or were you just checking an idea? Our bots 
> are still failing to build povray, so we’re really looking forward for some 
> fix:)
> 
> Thanks,
> Michael
> 
>> On Oct 15, 2015, at 6:21 PM, Manman Ren via cfe-commits 
>> mailto:cfe-commits@lists.llvm.org>> wrote:
>> 
>>> 
>>> On Oct 15, 2015, at 1:41 PM, Richard Smith >> > wrote:
>>> 
>>> On Thu, Oct 15, 2015 at 12:03 PM, Manman Ren via cfe-commits 
>>> mailto:cfe-commits@lists.llvm.org>> wrote:
>>> 
 On Oct 15, 2015, at 11:25 AM, Richard Smith >>> > wrote:
 
 I assume the code in question has a "using namespace std;"?
 
 
>>> Yes
>>> 
 I don't see any way around this other than giving up on trying to fix the 
 function signatures here (or maybe adding a Clang feature to let us fix 
 the bad signature).
 
 
>>> Can you elaborate on how to fix the bad signature by adding a Clang 
>>> feature? I want to see how hard it is before giving up on trying to fix the 
>>> signatures.
>>> 
>>> I thought about this a bit more, and we already have a feature that can be 
>>> used for this.
>>> 
>>> Please let me know if the attached patch resolves the issue for you. This 
>>> should also fix the wrong overload sets for these functions being provided 
>>> by  on Darwin.
>> 
>> This works on my testing case. Thanks!!
>> 
>> Manman
>> 
>>> 
>>> 
>>> Eric, Marshall: the attached patch adds a macro _LIBCPP_PREFERRED_OVERLOAD 
>>> that can be applied to a function to (a) mark it as a separate overload 
>>> from any other function with the same signature without the overload, and 
>>> (b) instruct the compiler that it's preferred over another function with 
>>> the same signature without the attribute. This allows us to replace the 
>>> libc function
>>> 
>>>   char *strchr(const char *, int);
>>> 
>>> with the C++ overload set:
>>> 
>>>   const char *strchr(const char *, int);
>>>   char *strchr(char *, int);
>>> 
>>> It only works with Clang, though; for other compilers, we leave the C 
>>> library's signature alone (as we used to before my patches landed).
>>> 
>>> Thanks,
>>> Manman
>>> 
>>> 
 On Oct 15, 2015 11:07 AM, "Manman Ren via cfe-commits" 
 mailto:cfe-commits@lists.llvm.org>> wrote:
 Hi Richard,
 
 This is causing a failure when building povray on iOS.
 
 Compilation error:
 /Users/buildslave/tmp/test-suite-externals/speccpu2006/benchspec/CPU2006/453.povray/src/fileinputoutput.cpp:364:20:
  error: call to 'strrchr' is ambiguous
  const char *p=strrchr(name, '.’);
 
 iOS.sdk/usr/include/string.h:87:7: note: candidate function
 char*strrchr(const char *, int);
  ^
 /Users/buildslave/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:109:46:
  note: candidate function
 inline _LIBCPP_INLINE_VISIBILITY const char* strrchr(const char* __s, int 
 __c) {return ::strrchr(__s, __c);}
 
 It is a little strange to have "char*strrchr(const char *, int);” in 
 iOS. But it is already in our SDK.
 
 Do you have any suggestion on how to fix this?
 
 Thanks,
 Manman
 
 > On Oct 9, 2015, at 6:25 PM, Richard Smith via cfe-commits 
 > mailto:cfe-commits@lists.llvm.org>> wrote:
 >
 > Author: rsmith
 > Date: Fri Oct  9 20:25:31 2015
 > New Revision: 249929
 >
 > URL: http://llvm.org/viewvc/llvm-project?rev=249929&view=rev 
 > 
 > Log:
 > Split  out of .
 >
 > Also fix the overload set for the five functions whose signatures change 
 > in the
 > case where we can fix it. This is already covered by existing tests for 
 > the
 > affected systems.
 >
 > Added:
 >libcxx/trunk/include/string.h
 >  - copied, changed from r249736, libcxx/trunk/include/cstring
 > Modified:
 >libcxx/trunk/include/cstring
 >
 > Modified: libcxx/trunk/include/cstring
 > URL: 
 > http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstring?rev=249929&r1=249928&r2=249929&view=diff
 >  
 > 
 > ==
 > --- libcxx/trunk/include/cstring (original)
 > +++ libcxx/trunk/include/cstri

Re: [PATCH] D10024: Refactor: Simplify boolean conditional return statements in tools/libclang

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood updated this revision to Diff 38315.
LegalizeAdulthood marked 2 inline comments as done.
LegalizeAdulthood added a comment.

Update to latest.
Update from comments.
I don't have commit access.


http://reviews.llvm.org/D10024

Files:
  tools/libclang/CIndex.cpp
  tools/libclang/Indexing.cpp
  tools/libclang/IndexingContext.cpp

Index: tools/libclang/IndexingContext.cpp
===
--- tools/libclang/IndexingContext.cpp
+++ tools/libclang/IndexingContext.cpp
@@ -804,10 +804,7 @@
   RefFileOccurrence RefOccur(FE, D);
   std::pair::iterator, bool>
   res = RefFileOccurrences.insert(RefOccur);
-  if (!res.second)
-return true; // already in map.
-
-  return false;
+  return !res.second; // already in map
 }
 
 const NamedDecl *IndexingContext::getEntityDecl(const NamedDecl *D) const {
Index: tools/libclang/Indexing.cpp
===
--- tools/libclang/Indexing.cpp
+++ tools/libclang/Indexing.cpp
@@ -669,9 +669,7 @@
 static bool topLevelDeclVisitor(void *context, const Decl *D) {
   IndexingContext &IdxCtx = *static_cast(context);
   IdxCtx.indexTopLevelDecl(D);
-  if (IdxCtx.shouldAbort())
-return false;
-  return true;
+  return !IdxCtx.shouldAbort();
 }
 
 static void indexTranslationUnit(ASTUnit &Unit, IndexingContext &IdxCtx) {
Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -710,11 +710,8 @@
   return true;
 }
   }
-  
-  if (ShouldVisitBody && VisitCXXRecordDecl(D))
-return true;
-  
-  return false;
+
+  return ShouldVisitBody && VisitCXXRecordDecl(D);
 }
 
 bool CursorVisitor::VisitClassTemplatePartialSpecializationDecl(
@@ -939,11 +936,8 @@
   return true;
   }
 
-  if (ND->isThisDeclarationADefinition() &&
-  Visit(MakeCXCursor(ND->getBody(), StmtParent, TU, RegionOfInterest)))
-return true;
-
-  return false;
+  return ND->isThisDeclarationADefinition() &&
+ Visit(MakeCXCursor(ND->getBody(), StmtParent, TU, RegionOfInterest));
 }
 
 template 
@@ -6074,10 +6068,7 @@
 
   ++NextIdx;
   Lex.LexFromRawLexer(Tok);
-  if (Tok.is(tok::eof))
-return true;
-
-  return false;
+  return Tok.is(tok::eof);
 }
 
 static void annotatePreprocessorTokens(CXTranslationUnit TU,


Index: tools/libclang/IndexingContext.cpp
===
--- tools/libclang/IndexingContext.cpp
+++ tools/libclang/IndexingContext.cpp
@@ -804,10 +804,7 @@
   RefFileOccurrence RefOccur(FE, D);
   std::pair::iterator, bool>
   res = RefFileOccurrences.insert(RefOccur);
-  if (!res.second)
-return true; // already in map.
-
-  return false;
+  return !res.second; // already in map
 }
 
 const NamedDecl *IndexingContext::getEntityDecl(const NamedDecl *D) const {
Index: tools/libclang/Indexing.cpp
===
--- tools/libclang/Indexing.cpp
+++ tools/libclang/Indexing.cpp
@@ -669,9 +669,7 @@
 static bool topLevelDeclVisitor(void *context, const Decl *D) {
   IndexingContext &IdxCtx = *static_cast(context);
   IdxCtx.indexTopLevelDecl(D);
-  if (IdxCtx.shouldAbort())
-return false;
-  return true;
+  return !IdxCtx.shouldAbort();
 }
 
 static void indexTranslationUnit(ASTUnit &Unit, IndexingContext &IdxCtx) {
Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -710,11 +710,8 @@
   return true;
 }
   }
-  
-  if (ShouldVisitBody && VisitCXXRecordDecl(D))
-return true;
-  
-  return false;
+
+  return ShouldVisitBody && VisitCXXRecordDecl(D);
 }
 
 bool CursorVisitor::VisitClassTemplatePartialSpecializationDecl(
@@ -939,11 +936,8 @@
   return true;
   }
 
-  if (ND->isThisDeclarationADefinition() &&
-  Visit(MakeCXCursor(ND->getBody(), StmtParent, TU, RegionOfInterest)))
-return true;
-
-  return false;
+  return ND->isThisDeclarationADefinition() &&
+ Visit(MakeCXCursor(ND->getBody(), StmtParent, TU, RegionOfInterest));
 }
 
 template 
@@ -6074,10 +6068,7 @@
 
   ++NextIdx;
   Lex.LexFromRawLexer(Tok);
-  if (Tok.is(tok::eof))
-return true;
-
-  return false;
+  return Tok.is(tok::eof);
 }
 
 static void annotatePreprocessorTokens(CXTranslationUnit TU,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10012: Refactor: Simplify boolean conditional return statements in lib/CodeGen

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood updated this revision to Diff 38317.
LegalizeAdulthood added a comment.

Update to latest.
I do not have commit access.


http://reviews.llvm.org/D10012

Files:
  lib/CodeGen/BranchFolding.cpp
  lib/CodeGen/CodeGenPrepare.cpp
  lib/CodeGen/LiveDebugVariables.cpp
  lib/CodeGen/MachineRegisterInfo.cpp
  lib/CodeGen/PeepholeOptimizer.cpp
  lib/CodeGen/PseudoSourceValue.cpp
  lib/CodeGen/ScheduleDAGInstrs.cpp
  lib/CodeGen/StackProtector.cpp
  lib/CodeGen/TargetInstrInfo.cpp

Index: lib/CodeGen/TargetInstrInfo.cpp
===
--- lib/CodeGen/TargetInstrInfo.cpp
+++ lib/CodeGen/TargetInstrInfo.cpp
@@ -576,10 +576,7 @@
 MI2 = MRI.getUniqueVRegDef(Op2.getReg());
 
   // And they need to be in the trace (otherwise, they won't have a depth).
-  if (MI1 && MI2 && MI1->getParent() == MBB && MI2->getParent() == MBB)
-return true;
-
-  return false;
+  return MI1 && MI2 && MI1->getParent() == MBB && MI2->getParent() == MBB;
 }
 
 bool TargetInstrInfo::hasReassociableSibling(const MachineInstr &Inst,
@@ -600,25 +597,20 @@
   // 2. The previous instruction must have virtual register definitions for its
   //operands in the same basic block as Inst.
   // 3. The previous instruction's result must only be used by Inst.
-  if (MI1->getOpcode() == AssocOpcode && hasReassociableOperands(*MI1, MBB) &&
-  MRI.hasOneNonDBGUse(MI1->getOperand(0).getReg()))
-return true;
-
-  return false;
+  return MI1->getOpcode() == AssocOpcode &&
+ hasReassociableOperands(*MI1, MBB) &&
+ MRI.hasOneNonDBGUse(MI1->getOperand(0).getReg());
 }
 
 // 1. The operation must be associative and commutative.
 // 2. The instruction must have virtual register definitions for its
 //operands in the same basic block.
 // 3. The instruction must have a reassociable sibling.
 bool TargetInstrInfo::isReassociationCandidate(const MachineInstr &Inst,
bool &Commuted) const {
-  if (isAssociativeAndCommutative(Inst) &&
-  hasReassociableOperands(Inst, Inst.getParent()) &&
-  hasReassociableSibling(Inst, Commuted))
-return true;
-
-  return false;
+  return isAssociativeAndCommutative(Inst) &&
+ hasReassociableOperands(Inst, Inst.getParent()) &&
+ hasReassociableSibling(Inst, Commuted);
 }
 
 // The concept of the reassociation pass is that these operations can benefit
@@ -940,10 +932,7 @@
   // modification.
   const TargetLowering &TLI = *MF.getSubtarget().getTargetLowering();
   const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo();
-  if (MI->modifiesRegister(TLI.getStackPointerRegisterToSaveRestore(), TRI))
-return true;
-
-  return false;
+  return MI->modifiesRegister(TLI.getStackPointerRegisterToSaveRestore(), TRI);
 }
 
 // Provide a global flag for disabling the PreRA hazard recognizer that targets
Index: lib/CodeGen/StackProtector.cpp
===
--- lib/CodeGen/StackProtector.cpp
+++ lib/CodeGen/StackProtector.cpp
@@ -465,10 +465,7 @@
 
   // Return if we didn't modify any basic blocks. i.e., there are no return
   // statements in the function.
-  if (!HasPrologue)
-return false;
-
-  return true;
+  return HasPrologue;
 }
 
 /// CreateFailBB - Create a basic block to jump to when the stack protector
Index: lib/CodeGen/ScheduleDAGInstrs.cpp
===
--- lib/CodeGen/ScheduleDAGInstrs.cpp
+++ lib/CodeGen/ScheduleDAGInstrs.cpp
@@ -462,11 +462,9 @@
 /// Return true if MI is an instruction we are unable to reason about
 /// (like a call or something with unmodeled side effects).
 static inline bool isGlobalMemoryObject(AliasAnalysis *AA, MachineInstr *MI) {
-  if (MI->isCall() || MI->hasUnmodeledSideEffects() ||
-  (MI->hasOrderedMemoryRef() &&
-   (!MI->mayLoad() || !MI->isInvariantLoad(AA
-return true;
-  return false;
+  return MI->isCall() || MI->hasUnmodeledSideEffects() ||
+ (MI->hasOrderedMemoryRef() &&
+  (!MI->mayLoad() || !MI->isInvariantLoad(AA)));
 }
 
 // This MI might have either incomplete info, or known to be unsafe
Index: lib/CodeGen/PseudoSourceValue.cpp
===
--- lib/CodeGen/PseudoSourceValue.cpp
+++ lib/CodeGen/PseudoSourceValue.cpp
@@ -50,9 +50,7 @@
 }
 
 bool PseudoSourceValue::mayAlias(const MachineFrameInfo *) const {
-  if (isGOT() || isConstantPool() || isJumpTable())
-return false;
-  return true;
+  return !(isGOT() || isConstantPool() || isJumpTable());
 }
 
 bool FixedStackPseudoSourceValue::isConstant(
Index: lib/CodeGen/PeepholeOptimizer.cpp
===
--- lib/CodeGen/PeepholeOptimizer.cpp
+++ lib/CodeGen/PeepholeOptimizer.cpp
@@ -686,10 +686,7 @@
   }
 
   // If we did not find a more suitable source, there is nothing to optimize.
-  if (CurSrcPair.Reg

Re: [PATCH] D10011: Refactor: Simplify boolean conditional return statements in lib/Basic

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood updated this revision to Diff 38318.
LegalizeAdulthood added a comment.

Update to latest.
I do not have commit access.


http://reviews.llvm.org/D10011

Files:
  lib/Basic/Targets.cpp

Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -2704,22 +2704,22 @@
 
   // Enable popcnt if sse4.2 is enabled and popcnt is not explicitly disabled.
   auto I = Features.find("sse4.2");
-  if (I != Features.end() && I->getValue() == true &&
+  if (I != Features.end() && I->getValue() &&
   std::find(FeaturesVec.begin(), FeaturesVec.end(), "-popcnt") ==
   FeaturesVec.end())
 Features["popcnt"] = true;
 
   // Enable prfchw if 3DNow! is enabled and prfchw is not explicitly disabled.
   I = Features.find("3dnow");
-  if (I != Features.end() && I->getValue() == true &&
+  if (I != Features.end() && I->getValue() &&
   std::find(FeaturesVec.begin(), FeaturesVec.end(), "-prfchw") ==
   FeaturesVec.end())
 Features["prfchw"] = true;
 
   // Additionally, if SSE is enabled and mmx is not explicitly disabled,
   // then enable MMX.
   I = Features.find("sse");
-  if (I != Features.end() && I->getValue() == true &&
+  if (I != Features.end() && I->getValue() &&
   std::find(FeaturesVec.begin(), FeaturesVec.end(), "-mmx") ==
   FeaturesVec.end())
 Features["mmx"] = true;


Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -2704,22 +2704,22 @@
 
   // Enable popcnt if sse4.2 is enabled and popcnt is not explicitly disabled.
   auto I = Features.find("sse4.2");
-  if (I != Features.end() && I->getValue() == true &&
+  if (I != Features.end() && I->getValue() &&
   std::find(FeaturesVec.begin(), FeaturesVec.end(), "-popcnt") ==
   FeaturesVec.end())
 Features["popcnt"] = true;
 
   // Enable prfchw if 3DNow! is enabled and prfchw is not explicitly disabled.
   I = Features.find("3dnow");
-  if (I != Features.end() && I->getValue() == true &&
+  if (I != Features.end() && I->getValue() &&
   std::find(FeaturesVec.begin(), FeaturesVec.end(), "-prfchw") ==
   FeaturesVec.end())
 Features["prfchw"] = true;
 
   // Additionally, if SSE is enabled and mmx is not explicitly disabled,
   // then enable MMX.
   I = Features.find("sse");
-  if (I != Features.end() && I->getValue() == true &&
+  if (I != Features.end() && I->getValue() &&
   std::find(FeaturesVec.begin(), FeaturesVec.end(), "-mmx") ==
   FeaturesVec.end())
 Features["mmx"] = true;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10022: Refactor: Simplify boolean conditional return statements in lib/StaticAnalyzer/Core

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood updated this revision to Diff 38319.
LegalizeAdulthood added a comment.

Update from latest


http://reviews.llvm.org/D10022

Files:
  lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
  lib/StaticAnalyzer/Core/SValBuilder.cpp
  lib/StaticAnalyzer/Core/SymbolManager.cpp

Index: lib/StaticAnalyzer/Core/SymbolManager.cpp
===
--- lib/StaticAnalyzer/Core/SymbolManager.cpp
+++ lib/StaticAnalyzer/Core/SymbolManager.cpp
@@ -493,9 +493,7 @@
   if (LCtx != ELCtx) {
 // If the reaper's location context is a parent of the expression's
 // location context, then the expression value is now "out of scope".
-if (LCtx->isParentOf(ELCtx))
-  return false;
-return true;
+return !LCtx->isParentOf(ELCtx);
   }
 
   // If no statement is provided, everything is this and parent contexts is 
live.
Index: lib/StaticAnalyzer/Core/SValBuilder.cpp
===
--- lib/StaticAnalyzer/Core/SValBuilder.cpp
+++ lib/StaticAnalyzer/Core/SValBuilder.cpp
@@ -394,10 +394,7 @@
   if (ToTy->isVoidType())
 return true;
 
-  if (ToTy != FromTy)
-return false;
-
-  return true;
+  return ToTy == FromTy;
 }
 
 // FIXME: should rewrite according to the cast kind.
Index: lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
===
--- lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
+++ lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
@@ -690,14 +690,11 @@
 return true;
 
   CXXBasePaths Paths(false, false, false);
-  if (RD->lookupInBases(
-  [DeclName](const CXXBaseSpecifier *Specifier, CXXBasePath &Path) {
-return CXXRecordDecl::FindOrdinaryMember(Specifier, Path, 
DeclName);
-  },
-  Paths))
-return true;
-
-  return false;
+  return RD->lookupInBases(
+  [DeclName](const CXXBaseSpecifier *Specifier, CXXBasePath &Path) {
+return CXXRecordDecl::FindOrdinaryMember(Specifier, Path, DeclName);
+  },
+  Paths);
 }
 
 /// Returns true if the given C++ class is a container or iterator.


Index: lib/StaticAnalyzer/Core/SymbolManager.cpp
===
--- lib/StaticAnalyzer/Core/SymbolManager.cpp
+++ lib/StaticAnalyzer/Core/SymbolManager.cpp
@@ -493,9 +493,7 @@
   if (LCtx != ELCtx) {
 // If the reaper's location context is a parent of the expression's
 // location context, then the expression value is now "out of scope".
-if (LCtx->isParentOf(ELCtx))
-  return false;
-return true;
+return !LCtx->isParentOf(ELCtx);
   }
 
   // If no statement is provided, everything is this and parent contexts is live.
Index: lib/StaticAnalyzer/Core/SValBuilder.cpp
===
--- lib/StaticAnalyzer/Core/SValBuilder.cpp
+++ lib/StaticAnalyzer/Core/SValBuilder.cpp
@@ -394,10 +394,7 @@
   if (ToTy->isVoidType())
 return true;
 
-  if (ToTy != FromTy)
-return false;
-
-  return true;
+  return ToTy == FromTy;
 }
 
 // FIXME: should rewrite according to the cast kind.
Index: lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
===
--- lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
+++ lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
@@ -690,14 +690,11 @@
 return true;
 
   CXXBasePaths Paths(false, false, false);
-  if (RD->lookupInBases(
-  [DeclName](const CXXBaseSpecifier *Specifier, CXXBasePath &Path) {
-return CXXRecordDecl::FindOrdinaryMember(Specifier, Path, DeclName);
-  },
-  Paths))
-return true;
-
-  return false;
+  return RD->lookupInBases(
+  [DeclName](const CXXBaseSpecifier *Specifier, CXXBasePath &Path) {
+return CXXRecordDecl::FindOrdinaryMember(Specifier, Path, DeclName);
+  },
+  Paths);
 }
 
 /// Returns true if the given C++ class is a container or iterator.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10022: Refactor: Simplify boolean conditional return statements in lib/StaticAnalyzer/Core

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood added inline comments.


Comment at: lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp:692-693
@@ -691,4 +691,2 @@
 
   CXXBasePaths Paths(false, false, false);
-  if (RD->lookupInBases(
-  [DeclName](const CXXBaseSpecifier *Specifier, CXXBasePath &Path) {

In this case it isn't a simple if-return, if-return, if-return.


http://reviews.llvm.org/D10022



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


Re: [PATCH] D10010: Refactor: Simplify boolean conditional return statements in lib/AST

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood updated this revision to Diff 38321.
LegalizeAdulthood added a comment.

Update from latest.
I do not have commit access.


http://reviews.llvm.org/D10010

Files:
  lib/AST/ASTContext.cpp
  lib/AST/ASTDiagnostic.cpp
  lib/AST/Decl.cpp
  lib/AST/DeclCXX.cpp
  lib/AST/Expr.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/Type.cpp

Index: lib/AST/Type.cpp
===
--- lib/AST/Type.cpp
+++ lib/AST/Type.cpp
@@ -1918,9 +1918,7 @@
 // CXXRecordDecl, use that one.
 RD = RD->getMostRecentDecl();
 // Nothing interesting to do if the inheritance attribute is already set.
-if (RD->hasAttr())
-  return false;
-return true;
+return !RD->hasAttr();
   }
   case ObjCObject:
 return cast(CanonicalType)->getBaseType()
@@ -2311,13 +2309,11 @@
   // Enumerated types are promotable to their compatible integer types
   // (C99 6.3.1.1) a.k.a. its underlying type (C++ [conv.prom]p2).
   if (const EnumType *ET = getAs()){
-if (this->isDependentType() || ET->getDecl()->getPromotionType().isNull()
-|| ET->getDecl()->isScoped())
-  return false;
-
-return true;
+return !(this->isDependentType() ||
+ ET->getDecl()->getPromotionType().isNull() ||
+ ET->getDecl()->isScoped());
   }
-  
+
   return false;
 }
 
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -6962,10 +6962,7 @@
   assert(E->getLHS()->getType()->isIntegralOrEnumerationType() &&
  E->getRHS()->getType()->isIntegralOrEnumerationType());
 
-  if (LHSResult.Failed && !Info.keepEvaluatingAfterFailure())
-return false; // Ignore RHS;
-
-  return true;
+  return !(LHSResult.Failed && !Info.keepEvaluatingAfterFailure());
 }
 
 bool DataRecursiveIntBinOpEvaluator::
Index: lib/AST/Expr.cpp
===
--- lib/AST/Expr.cpp
+++ lib/AST/Expr.cpp
@@ -3429,10 +3429,7 @@
   if (const ArraySubscriptExpr *ASE = dyn_cast(E))
 return ASE->getBase()->getType()->isVectorType();
 
-  if (isa(E))
-return true;
-
-  return false;
+  return isa(E);
 }
 
 bool Expr::refersToGlobalRegisterVar() const {
Index: lib/AST/DeclCXX.cpp
===
--- lib/AST/DeclCXX.cpp
+++ lib/AST/DeclCXX.cpp
@@ -1861,10 +1861,7 @@
   // Is it the same as our our class type?
   CanQualType ClassTy 
 = Context.getCanonicalType(Context.getTagDeclType(getParent()));
-  if (ParamType.getUnqualifiedType() != ClassTy)
-return false;
-  
-  return true;  
+  return ParamType.getUnqualifiedType() == ClassTy;
 }
 
 const CXXConstructorDecl *CXXConstructorDecl::getInheritedConstructor() const {
Index: lib/AST/Decl.cpp
===
--- lib/AST/Decl.cpp
+++ lib/AST/Decl.cpp
@@ -2377,9 +2377,7 @@
 return false;
   }
 
-  if (isa(S) && cast(S)->body_empty())
-return true;
-  return false;
+  return isa(S) && cast(S)->body_empty();
 }
 
 bool FunctionDecl::isDefined(const FunctionDecl *&Definition) const {
@@ -2737,10 +2735,7 @@
   if (Redecl->isImplicit())
 return false;
 
-  if (!Redecl->isInlineSpecified() || Redecl->getStorageClass() == SC_Extern) 
-return true; // Not an inline definition
-
-  return false;
+  return !Redecl->isInlineSpecified() || Redecl->getStorageClass() == SC_Extern;
 }
 
 /// \brief For a function declaration in C or C++, determine whether this
Index: lib/AST/ASTDiagnostic.cpp
===
--- lib/AST/ASTDiagnostic.cpp
+++ lib/AST/ASTDiagnostic.cpp
@@ -1032,11 +1032,7 @@
   return false;
 }
 
-if (!Default->getType()->isReferenceType()) {
-  return true;
-}
-
-return false;
+return !Default->getType()->isReferenceType();
   }
 
   /// DiffNonTypes - Handles any template parameters not handled by DiffTypes
Index: lib/AST/ASTContext.cpp
===
--- lib/AST/ASTContext.cpp
+++ lib/AST/ASTContext.cpp
@@ -6654,15 +6654,12 @@
   // equivalent GCC vector types.
   const VectorType *First = FirstVec->getAs();
   const VectorType *Second = SecondVec->getAs();
-  if (First->getNumElements() == Second->getNumElements() &&
-  hasSameType(First->getElementType(), Second->getElementType()) &&
-  First->getVectorKind() != VectorType::AltiVecPixel &&
-  First->getVectorKind() != VectorType::AltiVecBool &&
-  Second->getVectorKind() != VectorType::AltiVecPixel &&
-  Second->getVectorKind() != VectorType::AltiVecBool)
-return true;
-
-  return false;
+  return First->getNumElements() == Second->getNumElements() &&
+ hasSameType(First->getElementType(), Second->getElementType()) &&
+ First->getVectorKind() != VectorType::AltiVecPixel &&
+ First->getVectorKind() != VectorTyp

Re: [PATCH] D10017: Refactor: Simplify boolean conditional return statements in lib/Lex

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood updated this revision to Diff 38322.
LegalizeAdulthood added a comment.

Update to latest.
I do not have commit access.


http://reviews.llvm.org/D10017

Files:
  lib/Lex/PPDirectives.cpp
  lib/Lex/PPMacroExpansion.cpp

Index: lib/Lex/PPMacroExpansion.cpp
===
--- lib/Lex/PPMacroExpansion.cpp
+++ lib/Lex/PPMacroExpansion.cpp
@@ -597,9 +597,7 @@
   Brackets.pop_back();
 }
   }
-  if (!Brackets.empty())
-return false;
-  return true;
+  return Brackets.empty();
 }
 
 /// GenerateNewArgTokens - Returns true if OldTokens can be converted to a new
Index: lib/Lex/PPDirectives.cpp
===
--- lib/Lex/PPDirectives.cpp
+++ lib/Lex/PPDirectives.cpp
@@ -2045,13 +2045,9 @@
   }
 
   // #define inline
-  if (MacroName.isOneOf(tok::kw_extern, tok::kw_inline, tok::kw_static,
-tok::kw_const) &&
-  MI->getNumTokens() == 0) {
-return true;
-  }
-
-  return false;
+  return MacroName.isOneOf(tok::kw_extern, tok::kw_inline, tok::kw_static,
+   tok::kw_const) &&
+ MI->getNumTokens() == 0;
 }
 
 /// HandleDefineDirective - Implements \#define.  This consumes the entire 
macro


Index: lib/Lex/PPMacroExpansion.cpp
===
--- lib/Lex/PPMacroExpansion.cpp
+++ lib/Lex/PPMacroExpansion.cpp
@@ -597,9 +597,7 @@
   Brackets.pop_back();
 }
   }
-  if (!Brackets.empty())
-return false;
-  return true;
+  return Brackets.empty();
 }
 
 /// GenerateNewArgTokens - Returns true if OldTokens can be converted to a new
Index: lib/Lex/PPDirectives.cpp
===
--- lib/Lex/PPDirectives.cpp
+++ lib/Lex/PPDirectives.cpp
@@ -2045,13 +2045,9 @@
   }
 
   // #define inline
-  if (MacroName.isOneOf(tok::kw_extern, tok::kw_inline, tok::kw_static,
-tok::kw_const) &&
-  MI->getNumTokens() == 0) {
-return true;
-  }
-
-  return false;
+  return MacroName.isOneOf(tok::kw_extern, tok::kw_inline, tok::kw_static,
+   tok::kw_const) &&
+ MI->getNumTokens() == 0;
 }
 
 /// HandleDefineDirective - Implements \#define.  This consumes the entire macro
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10014: Refactor: Simplify boolean conditional return statements in lib/Edit

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood updated this revision to Diff 38323.
LegalizeAdulthood added a comment.

Update from latest.
I do not have commit access.


http://reviews.llvm.org/D10014

Files:
  lib/Edit/RewriteObjCFoundationAPI.cpp

Index: lib/Edit/RewriteObjCFoundationAPI.cpp
===
--- lib/Edit/RewriteObjCFoundationAPI.cpp
+++ lib/Edit/RewriteObjCFoundationAPI.cpp
@@ -888,53 +888,29 @@
 // make it broadly available.
 static bool subscriptOperatorNeedsParens(const Expr *FullExpr) {
   const Expr* Expr = FullExpr->IgnoreImpCasts();
-  if (isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(FullExpr) ||
-  isa(Expr) ||
-  isa(Expr))
-return false;
-
-  return true;
+  return !(isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(FullExpr) ||
+   isa(Expr) || isa(Expr));
 }
 static bool castOperatorNeedsParens(const Expr *FullExpr) {
   const Expr* Expr = FullExpr->IgnoreImpCasts();
-  if (isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(FullExpr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr))
-return false;
-
-  return true;
+  return !(isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(FullExpr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr));
 }
 
 static void objectifyExpr(const Expr *E, Commit &commit) {


Index: lib/Edit/RewriteObjCFoundationAPI.cpp
===
--- lib/Edit/RewriteObjCFoundationAPI.cpp
+++ lib/Edit/RewriteObjCFoundationAPI.cpp
@@ -888,53 +888,29 @@
 // make it broadly available.
 static bool subscriptOperatorNeedsParens(const Expr *FullExpr) {
   const Expr* Expr = FullExpr->IgnoreImpCasts();
-  if (isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(FullExpr) ||
-  isa(Expr) ||
-  isa(Expr))
-return false;
-
-  return true;
+  return !(isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(FullExpr) ||
+   isa(Expr) || isa(Expr));
 }
 static bool castOperatorNeedsParens(const Expr *FullExpr) {
   const Expr* Expr = FullExpr->IgnoreImpCasts();
-  if (isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(FullExpr) ||
-  isa(Expr) ||
-  isa(Expr) ||
-  isa(Expr))
-return false;
-
-  return true;
+  return !(isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr) || isa(FullExpr) ||
+   isa(Expr) || isa(Expr) ||
+   isa(Expr));
 }
 
 static void objectifyExpr(const Expr *E, Commit &commit) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10014: Refactor: Simplify boolean conditional return statements in lib/Edit

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood added a comment.

In http://reviews.llvm.org/D10014#178294, @calabrese wrote:

> I like the idea of all of these changes (this change list and the others), 
> but just a suggestion -- it looks like when the branch of the original 
> condition returns false, as was the case in the original code here, the 
> internal expressions of the check are transformed via De Morgan's laws in the 
> new code. IMO, this transformation sometimes makes things more complicated 
> rather than less, where by "more complicated" I mean that the transformation 
> produces an overall expression that is constructed from a considerably 
> greater number of logical operations. For instance, here it changed a bunch 
> of || expressions into a bunch of && expressions, with each operand 
> individually prefixed with "!". The equivalent without having applied De 
> Morgan's laws would just have left all of the || expressions as-is and added 
> a single ! around the overall expression parenthesized. It would have also 
> looked much more similar to the original code.
>
> My general thought here is that it might make sense when performing this kind 
> of transformation to first see if the translation via De Morgan's laws 
> actually produces an overall expression that has fewer logical 
> subexpressions, otherwise prefer the minimal transformation of a ! around a 
> parenthesized expression.


This should be addressed in the latest diff.


http://reviews.llvm.org/D10014



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


[clang-tools-extra] r251204 - Test commit

2015-10-24 Thread Piotr Dziwinski via cfe-commits
Author: piotrdz
Date: Sat Oct 24 15:11:47 2015
New Revision: 251204

URL: http://llvm.org/viewvc/llvm-project?rev=251204&view=rev
Log:
Test commit

Modified:

clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp?rev=251204&r1=251203&r2=251204&view=diff
==
--- 
clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
 (original)
+++ 
clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
 Sat Oct 24 15:11:47 2015
@@ -66,9 +66,9 @@ bool checkIfFixItHintIsApplicable(
 const ParmVarDecl *SourceParam, const FunctionDecl *OriginalDeclaration) {
   // Assumptions with regard to function declarations/definition:
   //  * If both function declaration and definition are seen, assume that
-  //  definition is most up-to-date, and use it to generate replacements.
+  //definition is most up-to-date, and use it to generate replacements.
   //  * If only function declarations are seen, there is no easy way to tell
-  //  which is up-to-date and which is not, so don't do anything.
+  //which is up-to-date and which is not, so don't do anything.
   // TODO: This may be changed later, but for now it seems the reasonable
   // solution.
   if (!ParameterSourceDeclaration->isThisDeclarationADefinition())


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


Re: [PATCH] D10019: Refactor: Simplify boolean conditional return statements in lib/Sema

2015-10-24 Thread Richard via cfe-commits
LegalizeAdulthood updated this revision to Diff 38324.
LegalizeAdulthood added a comment.

Update from latest.
Update from comments.
I do not have commit access.


http://reviews.llvm.org/D10019

Files:
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaCodeComplete.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaDeclObjC.cpp
  lib/Sema/SemaExceptionSpec.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaFixItUtils.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/SemaOverload.cpp

Index: lib/Sema/SemaOverload.cpp
===
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -214,15 +214,12 @@
   // array-to-pointer or function-to-pointer implicit conversions, so
   // check for their presence as well as checking whether FromType is
   // a pointer.
-  if (getToType(1)->isBooleanType() &&
-  (getFromType()->isPointerType() ||
-   getFromType()->isObjCObjectPointerType() ||
-   getFromType()->isBlockPointerType() ||
-   getFromType()->isNullPtrType() ||
-   First == ICK_Array_To_Pointer || First == ICK_Function_To_Pointer))
-return true;
-
-  return false;
+  return getToType(1)->isBooleanType() &&
+ (getFromType()->isPointerType() ||
+  getFromType()->isObjCObjectPointerType() ||
+  getFromType()->isBlockPointerType() ||
+  getFromType()->isNullPtrType() || First == ICK_Array_To_Pointer ||
+  First == ICK_Function_To_Pointer);
 }
 
 /// isPointerConversionToVoidPointer - Determines whether this
@@ -1884,11 +1881,7 @@
 
   // An rvalue of type bool can be converted to an rvalue of type int,
   // with false becoming zero and true becoming one (C++ 4.5p4).
-  if (FromType->isBooleanType() && To->getKind() == BuiltinType::Int) {
-return true;
-  }
-
-  return false;
+  return FromType->isBooleanType() && To->getKind() == BuiltinType::Int;
 }
 
 /// IsFloatingPointPromotion - Determines whether the conversion from
@@ -2806,11 +2799,8 @@
 static bool isNonTrivialObjCLifetimeConversion(Qualifiers FromQuals,
Qualifiers ToQuals) {
   // Converting anything to const __unsafe_unretained is trivial.
-  if (ToQuals.hasConst() && 
-  ToQuals.getObjCLifetime() == Qualifiers::OCL_ExplicitNone)
-return false;
-
-  return true;
+  return !(ToQuals.hasConst() &&
+   ToQuals.getObjCLifetime() == Qualifiers::OCL_ExplicitNone);
 }
 
 /// IsQualificationConversion - Determines whether the conversion from
Index: lib/Sema/SemaOpenMP.cpp
===
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -6288,9 +6288,7 @@
 return true;
   DSAStackTy::DSAVarData DVarPrivate =
   Stack->hasDSA(VD, isOpenMPPrivate, MatchesAlways(), false);
-  if (DVarPrivate.CKind != OMPC_unknown)
-return true;
-  return false;
+  return DVarPrivate.CKind != OMPC_unknown;
 }
 return false;
   }
Index: lib/Sema/SemaFixItUtils.cpp
===
--- lib/Sema/SemaFixItUtils.cpp
+++ lib/Sema/SemaFixItUtils.cpp
@@ -42,10 +42,8 @@
   const CanQualType FromUnq = From.getUnqualifiedType();
   const CanQualType ToUnq = To.getUnqualifiedType();
 
-  if ((FromUnq == ToUnq || (S.IsDerivedFrom(FromUnq, ToUnq)) ) &&
-  To.isAtLeastAsQualifiedAs(From))
-return true;
-  return false;
+  return (FromUnq == ToUnq || (S.IsDerivedFrom(FromUnq, ToUnq))) &&
+ To.isAtLeastAsQualifiedAs(From);
 }
 
 bool ConversionFixItGenerator::tryToFixConversion(const Expr *FullExpr,
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -2314,11 +2314,9 @@
   return true;
 }
 
-if (CheckAllocationAccess(StartLoc, SourceRange(), Found.getNamingClass(),
-  Matches[0], Diagnose) == AR_inaccessible)
-  return true;
-
-return false;
+return CheckAllocationAccess(StartLoc, SourceRange(),
+ Found.getNamingClass(), Matches[0],
+ Diagnose) == AR_inaccessible;
 
   // We found multiple suitable operators;  complain about the ambiguity.
   } else if (!Matches.empty()) {
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -7716,9 +7716,7 @@
 return !S.getLangOpts().CPlusPlus;
   }
 
-  if (checkArithmeticIncompletePointerType(S, Loc, Operand)) return false;
-
-  return true;
+  return !checkArithmeticIncompletePointerType(S, Loc, Operand);
 }
 
 /// \brief Check the validity of a binary arithmetic operation w.r.t. pointer
@@ -8424,10 +8422,7 @@
 return false;
 
   QualType R = Method->getReturnType();
-  if (!R->isScalarType())
-return false;
-
-  r

Re: [PATCH] D10012: Refactor: Simplify boolean conditional return statements in lib/CodeGen

2015-10-24 Thread Rafael Espíndola via cfe-commits
r251213

On 24 October 2015 at 14:58, Richard  wrote:
> LegalizeAdulthood updated this revision to Diff 38317.
> LegalizeAdulthood added a comment.
>
> Update to latest.
> I do not have commit access.
>
>
> http://reviews.llvm.org/D10012
>
> Files:
>   lib/CodeGen/BranchFolding.cpp
>   lib/CodeGen/CodeGenPrepare.cpp
>   lib/CodeGen/LiveDebugVariables.cpp
>   lib/CodeGen/MachineRegisterInfo.cpp
>   lib/CodeGen/PeepholeOptimizer.cpp
>   lib/CodeGen/PseudoSourceValue.cpp
>   lib/CodeGen/ScheduleDAGInstrs.cpp
>   lib/CodeGen/StackProtector.cpp
>   lib/CodeGen/TargetInstrInfo.cpp
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r251214 - Simplify boolean conditional return statements in lib/Basic.

2015-10-24 Thread Rafael Espindola via cfe-commits
Author: rafael
Date: Sat Oct 24 18:15:31 2015
New Revision: 251214

URL: http://llvm.org/viewvc/llvm-project?rev=251214&view=rev
Log:
Simplify boolean conditional return statements in lib/Basic.

Patch by Richard.

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

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=251214&r1=251213&r2=251214&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat Oct 24 18:15:31 2015
@@ -2704,14 +2704,14 @@ bool X86TargetInfo::initFeatureMap(
 
   // Enable popcnt if sse4.2 is enabled and popcnt is not explicitly disabled.
   auto I = Features.find("sse4.2");
-  if (I != Features.end() && I->getValue() == true &&
+  if (I != Features.end() && I->getValue() &&
   std::find(FeaturesVec.begin(), FeaturesVec.end(), "-popcnt") ==
   FeaturesVec.end())
 Features["popcnt"] = true;
 
   // Enable prfchw if 3DNow! is enabled and prfchw is not explicitly disabled.
   I = Features.find("3dnow");
-  if (I != Features.end() && I->getValue() == true &&
+  if (I != Features.end() && I->getValue() &&
   std::find(FeaturesVec.begin(), FeaturesVec.end(), "-prfchw") ==
   FeaturesVec.end())
 Features["prfchw"] = true;
@@ -2719,7 +2719,7 @@ bool X86TargetInfo::initFeatureMap(
   // Additionally, if SSE is enabled and mmx is not explicitly disabled,
   // then enable MMX.
   I = Features.find("sse");
-  if (I != Features.end() && I->getValue() == true &&
+  if (I != Features.end() && I->getValue() &&
   std::find(FeaturesVec.begin(), FeaturesVec.end(), "-mmx") ==
   FeaturesVec.end())
 Features["mmx"] = true;


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


r251218 - [analyzer] scan-build: Teach ccc-analyzer about -Xclang.

2015-10-24 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Sat Oct 24 20:30:18 2015
New Revision: 251218

URL: http://llvm.org/viewvc/llvm-project?rev=251218&view=rev
Log:
[analyzer] scan-build: Teach ccc-analyzer about -Xclang.

Update ccc-analyzer to forward both -Xclang and its following argument to the
the compiler driver. Previously we were dropping -Xclang and forwarding the
argument on its own if it matched other forwarding criteria. This caused the
argument to be interpreted as a driver rather than a frontend option.

Modified:
cfe/trunk/tools/scan-build/ccc-analyzer

Modified: cfe/trunk/tools/scan-build/ccc-analyzer
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/ccc-analyzer?rev=251218&r1=251217&r2=251218&view=diff
==
--- cfe/trunk/tools/scan-build/ccc-analyzer (original)
+++ cfe/trunk/tools/scan-build/ccc-analyzer Sat Oct 24 20:30:18 2015
@@ -667,6 +667,15 @@ foreach (my $i = 0; $i < scalar(@ARGV);
 next;
   }
 
+  # Handle -Xclang some-arg. Add both arguments to the compiler options.
+  if ($Arg =~ /^-Xclang$/) {
+# FIXME: Check if we are going off the end.
+++$i;
+push @CompileOpts, $Arg;
+push @CompileOpts, $ARGV[$i];
+next;
+  }
+
   if (!($Arg =~ /^-/)) {
 push @Files, $Arg;
 next;


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


[libcxx] r251220 - Update C++ status from Kona

2015-10-24 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Sun Oct 25 01:02:23 2015
New Revision: 251220

URL: http://llvm.org/viewvc/llvm-project?rev=251220&view=rev
Log:
Update C++ status from Kona

Modified:
libcxx/trunk/www/cxx1z_status.html
libcxx/trunk/www/kona.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=251220&r1=251219&r2=251220&view=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Sun Oct 25 01:02:23 2015
@@ -69,6 +69,14 @@
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4508";>N4508LWGshared_mutex
 for C++17LenexaComplete3.7
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4366";>N4366LWGLWG
 2228 missing SFINAE ruleLenexaComplete3.1
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4510";>N4510LWGMinimal
 incomplete type support for standard containers, revision 
4LenexaComplete3.6
+   
+   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0004R1.html";>P0004R1LWGRemove
 Deprecated iostreams aliases.Kona
+   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0006R0.html";>P0006R0LWGAdopt
 Type Traits Variable Templates for 
C++17.Kona
+   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0092R1.html";>P0092R1LWGPolishing
 Kona
+   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0007R1.html";>P0007R1LWGConstant
 View: A proposal for a std::as_const helper function 
template.Kona
+   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0156R0.htm"; 
>P0156R0LWGVariadic lock_guard(rev 
3).Kona
+   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0074R0.html";>P0074R0LWGMaking
 std::owner_less more flexibleKona
+   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0013R1.html";>P0013R1LWGLogical
 type traits rev 2Kona
 
   
 
@@ -138,6 +146,46 @@
http://cplusplus.github.io/LWG/lwg-defects.html#2470";>2470Allocator's
 destroy function should be allowed to fail to 
instantiateLenexaComplete
http://cplusplus.github.io/LWG/lwg-defects.html#2482";>2482[c.strings]
 Table 73 mentions nonexistent 
functionsLenexaComplete
http://cplusplus.github.io/LWG/lwg-defects.html#2488";>2488Placeholders
 should be allowed and encouraged to be 
constexprLenexa
+   
+   http://cplusplus.github.io/LWG/lwg-defects.html#1169";>1169num_get
 not fully compatible with strto*Kona
+   http://cplusplus.github.io/LWG/lwg-defects.html#2072";>2072Unclear
 wording about capacity of temporary 
buffersKonaComplete
+   http://cplusplus.github.io/LWG/lwg-defects.html#2101";>2101Some
 transformation types can produce impossible 
typesKona
+   http://cplusplus.github.io/LWG/lwg-defects.html#2111";>2111Which
 unexpected/terminate handler is called from the 
exception handling runtime?KonaComplete
+   http://cplusplus.github.io/LWG/lwg-defects.html#2119";>2119Missing
 hash specializations for extended integer 
typesKona
+   http://cplusplus.github.io/LWG/lwg-defects.html#2127";>2127Move-construction
 with raw_storage_iteratorKonaPatch Ready
+   http://cplusplus.github.io/LWG/lwg-defects.html#2133";>2133Attitude
 to overloaded comma for iteratorsKonaComplete
+   http://cplusplus.github.io/LWG/lwg-defects.html#2156";>2156Unordered
 containers' reserve(n) reserves for n-1 
elementsKona
+   http://cplusplus.github.io/LWG/lwg-defects.html#2218";>2218Unclear
 how containers use 
allocator_traits::construct()Kona
+   http://cplusplus.github.io/LWG/lwg-defects.html#2219";>2219INVOKE-ing
 a pointer to member with a reference_wrapper as the object 
expressionKona
+   http://cplusplus.github.io/LWG/lwg-defects.html#2224";>2224Ambiguous
 status of access to non-live objectsKona
+   http://cplusplus.github.io/LWG/lwg-defects.html#2234";>2234assert()
 should allow usage in constant expressionsKona
+   http://cplusplus.github.io/LWG/lwg-defects.html#2244";>2244Issue
 on basic_istream::seekgKonaPatch Ready
+   http://cplusplus.github.io/LWG/lwg-defects.html#2250";>2250Follow-up
 On Library Issue 2207Kona
+   http://cplusplus.github.io/LWG/lwg-defects.html#2259";>2259Issues
 in 17.6.5.5 rules for member functionsKonaComplete
+   http://cplusplus.github.io/LWG/lwg-defects.html#2273";>2273regex_match
 ambiguityKona
+   http://cplusplus.github.io/LWG/lwg-defects.html#2336";>2336is_trivially_constructible/is_trivially_assignable
 traits are always falseKona
+   http://cplusplus.github.io/LWG/lwg-defects.html#2353";>2353std::next
 is over-constrainedKona
+   http://cplusplus.github.io/LWG/lwg-defects.html#2367";>2367pair
 and tuple are not correctly implemented for is_constructible 
with no argsKonaPatch Ready
+   http://cplusplus.github.io/LWG/lwg-defects.html#2380";>2380May
  provide long ::abs(long) and long long 
::abs(long long)?