[PATCH] D23641: [ASTMatchers] Fix documentation of is(Un)SignedInteger()

2016-08-18 Thread Visoiu Mistrih Francis via cfe-commits
thegameg created this revision.
thegameg added reviewers: aaron.ballman, courbet.
thegameg added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

The example is using `isInteger()` instead of `signed` / `unsigned` version.

https://reviews.llvm.org/D23641

Files:
  docs/LibASTMatchersReference.html
  include/clang/ASTMatchers/ASTMatchers.h

Index: include/clang/ASTMatchers/ASTMatchers.h
===
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -4161,7 +4161,7 @@
 ///   void b(unsigned long);
 ///   void c(double);
 /// \endcode
-/// functionDecl(hasAnyParameter(hasType(isInteger(
+/// functionDecl(hasAnyParameter(hasType(isUnsignedInteger(
 /// matches "b(unsigned long)", but not "a(int)" and "c(double)".
 AST_MATCHER(QualType, isUnsignedInteger) {
 return Node->isUnsignedIntegerType();
@@ -4175,7 +4175,7 @@
 ///   void b(unsigned long);
 ///   void c(double);
 /// \endcode
-/// functionDecl(hasAnyParameter(hasType(isInteger(
+/// functionDecl(hasAnyParameter(hasType(isSignedInteger(
 /// matches "a(int)", but not "b(unsigned long)" and "c(double)".
 AST_MATCHER(QualType, isSignedInteger) {
 return Node->isSignedIntegerType();
Index: docs/LibASTMatchersReference.html
===
--- docs/LibASTMatchersReference.html
+++ docs/LibASTMatchersReference.html
@@ -3006,7 +3006,7 @@
   void a(int);
   void b(unsigned long);
   void c(double);
-functionDecl(hasAnyParameter(hasType(isInteger(
+functionDecl(hasAnyParameter(hasType(isSignedInteger(
 matches "a(int)", but not "b(unsigned long)" and "c(double)".
 
 
@@ -3018,7 +3018,7 @@
   void a(int);
   void b(unsigned long);
   void c(double);
-functionDecl(hasAnyParameter(hasType(isInteger(
+functionDecl(hasAnyParameter(hasType(isUnsignedInteger(
 matches "b(unsigned long)", but not "a(int)" and "c(double)".
 
 


Index: include/clang/ASTMatchers/ASTMatchers.h
===
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -4161,7 +4161,7 @@
 ///   void b(unsigned long);
 ///   void c(double);
 /// \endcode
-/// functionDecl(hasAnyParameter(hasType(isInteger(
+/// functionDecl(hasAnyParameter(hasType(isUnsignedInteger(
 /// matches "b(unsigned long)", but not "a(int)" and "c(double)".
 AST_MATCHER(QualType, isUnsignedInteger) {
 return Node->isUnsignedIntegerType();
@@ -4175,7 +4175,7 @@
 ///   void b(unsigned long);
 ///   void c(double);
 /// \endcode
-/// functionDecl(hasAnyParameter(hasType(isInteger(
+/// functionDecl(hasAnyParameter(hasType(isSignedInteger(
 /// matches "a(int)", but not "b(unsigned long)" and "c(double)".
 AST_MATCHER(QualType, isSignedInteger) {
 return Node->isSignedIntegerType();
Index: docs/LibASTMatchersReference.html
===
--- docs/LibASTMatchersReference.html
+++ docs/LibASTMatchersReference.html
@@ -3006,7 +3006,7 @@
   void a(int);
   void b(unsigned long);
   void c(double);
-functionDecl(hasAnyParameter(hasType(isInteger(
+functionDecl(hasAnyParameter(hasType(isSignedInteger(
 matches "a(int)", but not "b(unsigned long)" and "c(double)".
 
 
@@ -3018,7 +3018,7 @@
   void a(int);
   void b(unsigned long);
   void c(double);
-functionDecl(hasAnyParameter(hasType(isInteger(
+functionDecl(hasAnyParameter(hasType(isUnsignedInteger(
 matches "b(unsigned long)", but not "a(int)" and "c(double)".
 
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22910: Add support for CXXOperatorCallExpr in Expr::HasSideEffects

2016-08-18 Thread Andi via cfe-commits
Abpostelnicu marked 2 inline comments as done.


Comment at: lib/AST/Expr.cpp:2868
@@ +2867,3 @@
+OverloadedOperatorKind binOp = 
cast(this)->getOperator();
+if (binOp == OO_Equal || (binOp >= OO_PlusEqual && binOp <= OO_PipeEqual)) 
{
+  return true;

rsmith wrote:
> Please don't hard-code the order of OO enumerators like this (and this isn't 
> even correct: you missed `<<=` and `>>=`). 
> 
> Instead, consider extending `BinaryOperator::isAssignmentOp` / 
> `BinaryOperator::getOverloadedOpcode` so you can use them for this.
i was thinking more on doing for this specific case since 
BinaryOperator::isAssignmentOp and BinaryOperator::getOverloadedOpcode only 
accepts binary op codes and CXXOperatorCallExpr incapsulates operators both 
binary and unary


Repository:
  rL LLVM

https://reviews.llvm.org/D22910



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


Re: [PATCH] D22910: Add support for CXXOperatorCallExpr in Expr::HasSideEffects

2016-08-18 Thread Andi via cfe-commits
Abpostelnicu removed rL LLVM as the repository for this revision.
Abpostelnicu updated this revision to Diff 68507.

https://reviews.llvm.org/D22910

Files:
  include/clang/AST/ExprCXX.h
  lib/AST/Expr.cpp

Index: lib/AST/Expr.cpp
===
--- lib/AST/Expr.cpp
+++ lib/AST/Expr.cpp
@@ -2861,8 +2861,16 @@
 // These never have a side-effect.
 return false;
 
+  case CXXOperatorCallExprClass: {
+// If it is an operator call expr it can have side effects when the
+// underlaying operator is of assignment kind.
+// Othrwise fall through the rest of cases.
+OverloadedOperatorKind Op = cast(this)->getOperator();
+if (CXXOperatorCallExpr::isAssignmentOp(Op)) {
+  return true;
+}
+  }
   case CallExprClass:
-  case CXXOperatorCallExprClass:
   case CXXMemberCallExprClass:
   case CUDAKernelCallExprClass:
   case UserDefinedLiteralClass: {
Index: include/clang/AST/ExprCXX.h
===
--- include/clang/AST/ExprCXX.h
+++ include/clang/AST/ExprCXX.h
@@ -106,6 +106,16 @@
   // operations on floating point types.
   bool isFPContractable() const { return FPContractable; }
 
+  // Check to see if a given overloaded operator is of assignment kind
+  static bool isAssignmentOp(OverloadedOperatorKind Opc) {
+return Opc == OO_Equal || Opc == OO_StarEqual ||
+   Opc == OO_SlashEqual || Opc == OO_PercentEqual ||
+   Opc == OO_PlusEqual || Opc == OO_MinusEqual ||
+   Opc == OO_LessLessEqual || Opc == OO_GreaterGreaterEqual ||
+   Opc == OO_AmpEqual || Opc == OO_CaretEqual ||
+   Opc == OO_PipeEqual;
+  }
+  
   friend class ASTStmtReader;
   friend class ASTStmtWriter;
 };


Index: lib/AST/Expr.cpp
===
--- lib/AST/Expr.cpp
+++ lib/AST/Expr.cpp
@@ -2861,8 +2861,16 @@
 // These never have a side-effect.
 return false;
 
+  case CXXOperatorCallExprClass: {
+// If it is an operator call expr it can have side effects when the
+// underlaying operator is of assignment kind.
+// Othrwise fall through the rest of cases.
+OverloadedOperatorKind Op = cast(this)->getOperator();
+if (CXXOperatorCallExpr::isAssignmentOp(Op)) {
+  return true;
+}
+  }
   case CallExprClass:
-  case CXXOperatorCallExprClass:
   case CXXMemberCallExprClass:
   case CUDAKernelCallExprClass:
   case UserDefinedLiteralClass: {
Index: include/clang/AST/ExprCXX.h
===
--- include/clang/AST/ExprCXX.h
+++ include/clang/AST/ExprCXX.h
@@ -106,6 +106,16 @@
   // operations on floating point types.
   bool isFPContractable() const { return FPContractable; }
 
+  // Check to see if a given overloaded operator is of assignment kind
+  static bool isAssignmentOp(OverloadedOperatorKind Opc) {
+return Opc == OO_Equal || Opc == OO_StarEqual ||
+   Opc == OO_SlashEqual || Opc == OO_PercentEqual ||
+   Opc == OO_PlusEqual || Opc == OO_MinusEqual ||
+   Opc == OO_LessLessEqual || Opc == OO_GreaterGreaterEqual ||
+   Opc == OO_AmpEqual || Opc == OO_CaretEqual ||
+   Opc == OO_PipeEqual;
+  }
+  
   friend class ASTStmtReader;
   friend class ASTStmtWriter;
 };
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23651: [clang-rename] improve performance for rename-all

2016-08-18 Thread Kirill Bobyrev via cfe-commits
omtcyfz updated this revision to Diff 68511.
omtcyfz added a comment.

Prevent std::vector from redundant copying.


https://reviews.llvm.org/D23651

Files:
  clang-rename/USRFindingAction.cpp
  clang-rename/USRFindingAction.h
  clang-rename/tool/ClangRename.cpp

Index: clang-rename/tool/ClangRename.cpp
===
--- clang-rename/tool/ClangRename.cpp
+++ clang-rename/tool/ClangRename.cpp
@@ -175,11 +175,11 @@
   }
 
   // Check if NewNames is a valid identifier in C++17.
+  LangOptions Options;
+  Options.CPlusPlus = true;
+  Options.CPlusPlus1z = true;
+  IdentifierTable Table(Options);
   for (const auto  : NewNames) {
-LangOptions Options;
-Options.CPlusPlus = true;
-Options.CPlusPlus1z = true;
-IdentifierTable Table(Options);
 auto NewNameTokKind = Table.get(NewName).getTokenID();
 if (!tok::isAnyIdentifier(NewNameTokKind)) {
   errs() << "ERROR: new name is not a valid identifier in C++17.\n\n";
@@ -203,39 +203,36 @@
 exit(1);
   }
 
-  std::vector USRList;
-  std::vector PrevNames;
   auto Files = OP.getSourcePathList();
   tooling::RefactoringTool Tool(OP.getCompilations(), Files);
+
   unsigned Count = OldNames.size() ? OldNames.size() : SymbolOffsets.size();
+  std::vector SymbolOffsetsVector(Count, 0);
+  std::vector OldNamesVector(Count, "");
   for (unsigned I = 0; I < Count; ++I) {
-unsigned SymbolOffset = SymbolOffsets.empty() ? 0 : SymbolOffsets[I];
-const std::string  = OldNames.empty() ? std::string() : OldNames[I];
-
-// Get the USRs.
-rename::USRFindingAction USRAction(SymbolOffset, OldName);
-
-// Find the USRs.
-Tool.run(tooling::newFrontendActionFactory().get());
-const auto  = USRAction.getUSRs();
-USRList.push_back(USRs);
-const auto  = USRAction.getUSRSpelling();
-PrevNames.push_back(PrevName);
-
-if (PrevName.empty()) {
-  // An error should have already been printed.
-  exit(1);
+if (!SymbolOffsets.empty()) {
+  SymbolOffsetsVector[I] = SymbolOffsets[I];
+}
+if (!OldNames.empty()) {
+  OldNamesVector[I] = OldNames[I];
 }
+  }
 
-if (PrintName) {
-  errs() << "clang-rename: found name: " << PrevName << '\n';
+  rename::USRFindingAction USRAction(SymbolOffsetsVector, OldNamesVector);
+  Tool.run(tooling::newFrontendActionFactory().get());
+  const std::vector  = USRAction.getUSRList();
+  const std::vector  = USRAction.getUSRSpellings();
+  if (PrintName) {
+for (const auto  : PrevNames) {
+  outs() << "clang-rename found name: " << PrevName << '\n';
 }
   }
 
   // Perform the renaming.
   rename::RenamingAction RenameAction(NewNames, PrevNames, USRList,
   Tool.getReplacements(), PrintLocations);
-  auto Factory = tooling::newFrontendActionFactory();
+  std::unique_ptr Factory =
+  tooling::newFrontendActionFactory();
   int ExitCode;
 
   if (Inplace) {
Index: clang-rename/USRFindingAction.h
===
--- clang-rename/USRFindingAction.h
+++ clang-rename/USRFindingAction.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_RENAME_USR_FINDING_ACTION_H_
 
 #include "clang/Frontend/FrontendAction.h"
+#include 
 
 namespace clang {
 class ASTConsumer;
@@ -25,20 +26,19 @@
 namespace rename {
 
 struct USRFindingAction {
-  USRFindingAction(unsigned Offset, const std::string )
-  : SymbolOffset(Offset), OldName(Name) {}
+  USRFindingAction(const std::vector ,
+   const std::vector )
+  : SymbolOffsets(SymbolOffsets), OldNames(OldNames) {}
   std::unique_ptr newASTConsumer();
 
-  // \brief get the spelling of the USR(s) as it would appear in source files.
-  const std::string () { return SpellingName; }
-
-  const std::vector () { return USRs; }
+  const std::vector () { return SpellingNames; }
+  const std::vector () { return USRList; }
 
 private:
-  unsigned SymbolOffset;
-  std::string OldName;
-  std::string SpellingName;
-  std::vector USRs;
+  const std::vector 
+  const std::vector 
+  std::vector SpellingNames;
+  std::vector USRList;
 };
 
 } // namespace rename
Index: clang-rename/USRFindingAction.cpp
===
--- clang-rename/USRFindingAction.cpp
+++ clang-rename/USRFindingAction.cpp
@@ -45,11 +45,10 @@
 // to virtual method.
 class AdditionalUSRFinder : public RecursiveASTVisitor {
 public:
-  explicit AdditionalUSRFinder(const Decl *FoundDecl, ASTContext ,
-   std::vector *USRs)
-  : FoundDecl(FoundDecl), Context(Context), USRs(USRs) {}
+  explicit AdditionalUSRFinder(const Decl *FoundDecl, ASTContext )
+  : FoundDecl(FoundDecl), Context(Context) {}
 
-  void Find() {
+  std::vector Find() {
 // Fill OverriddenMethods and PartialSpecs storages.
 TraverseDecl(Context.getTranslationUnitDecl());
 if (const auto 

Re: [PATCH] D23651: [clang-rename] improve performance for rename-all

2016-08-18 Thread Kirill Bobyrev via cfe-commits
omtcyfz marked an inline comment as done.


Comment at: clang-rename/USRFindingAction.h:38-41
@@ -37,6 +37,6 @@
 private:
-  unsigned SymbolOffset;
-  std::string OldName;
-  std::string SpellingName;
-  std::vector USRs;
+  const std::vector 
+  const std::vector 
+  std::vector SpellingNames;
+  std::vector USRList;
 };

Aw, you're right. Good catch, thanks!


https://reviews.llvm.org/D23651



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


Re: [PATCH] D23492: Make function local tags visible.

2016-08-18 Thread Vassil Vassilev via cfe-commits
v.g.vassilev added inline comments.


Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:3600-3605
@@ -3598,2 +3599,8 @@
   // which definitions should be visible.
+  if (DiagnoseUninstantiableTemplate(PointOfInstantiation, Function,
+Function->getInstantiatedFromMemberFunction(),
+ PatternDecl,
+ const_cast(PatternDecl),
+ TSK, /*Complain*/DefinitionRequired))
+ return;
 

rsmith wrote:
> I think this should be checked before we deal with late-parsed templates -- 
> if the template definition isn't visible, an attempt to instantiate it 
> shouldn't trigger it being parsed.
If I am to sink the diags under the // TODO: this might change behavior. The 
diagnostics may not kick-in properly in case of late template parsing (see 
around line 3594).


https://reviews.llvm.org/D23492



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


Re: [PATCH] D23653: Minor cleanup of SimpleTypoCorrector

2016-08-18 Thread Alexander Shaposhnikov via cfe-commits
alexshap added a comment.

F2283280: Screen Shot 2016-08-18 at 4.29.34 AM.png 



https://reviews.llvm.org/D23653



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


[PATCH] D23653: Minor cleanup of SimpleTypoCorrector

2016-08-18 Thread Alexander Shaposhnikov via cfe-commits
alexshap created this revision.
alexshap added reviewers: gribozavr, bkramer.
alexshap added a subscriber: cfe-commits.
alexshap changed the visibility of this Differential Revision from "Public (No 
Login Required)" to "All Users".

Add the "explicit" specifier to the single-argument constructor of 
SimpleTypoCorrector.
Reorder the fields to remove excessive padding (8 bytes).

https://reviews.llvm.org/D23653

Files:
  lib/AST/CommentSema.cpp

Index: lib/AST/CommentSema.cpp
===
--- lib/AST/CommentSema.cpp
+++ lib/AST/CommentSema.cpp
@@ -950,18 +950,18 @@
 
 namespace {
 class SimpleTypoCorrector {
+  const NamedDecl *BestDecl;
   StringRef Typo;
   const unsigned MaxEditDistance;
-
-  const NamedDecl *BestDecl;
   unsigned BestEditDistance;
   unsigned BestIndex;
   unsigned NextIndex;
 
 public:
-  SimpleTypoCorrector(StringRef Typo) :
-  Typo(Typo), MaxEditDistance((Typo.size() + 2) / 3),
-  BestDecl(nullptr), BestEditDistance(MaxEditDistance + 1),
+  explicit SimpleTypoCorrector(StringRef Typo) :
+  BestDecl(nullptr), Typo(Typo),
+  MaxEditDistance((Typo.size() + 2) / 3), 
+  BestEditDistance(MaxEditDistance + 1),
   BestIndex(0), NextIndex(0)
   { }
 


Index: lib/AST/CommentSema.cpp
===
--- lib/AST/CommentSema.cpp
+++ lib/AST/CommentSema.cpp
@@ -950,18 +950,18 @@
 
 namespace {
 class SimpleTypoCorrector {
+  const NamedDecl *BestDecl;
   StringRef Typo;
   const unsigned MaxEditDistance;
-
-  const NamedDecl *BestDecl;
   unsigned BestEditDistance;
   unsigned BestIndex;
   unsigned NextIndex;
 
 public:
-  SimpleTypoCorrector(StringRef Typo) :
-  Typo(Typo), MaxEditDistance((Typo.size() + 2) / 3),
-  BestDecl(nullptr), BestEditDistance(MaxEditDistance + 1),
+  explicit SimpleTypoCorrector(StringRef Typo) :
+  BestDecl(nullptr), Typo(Typo),
+  MaxEditDistance((Typo.size() + 2) / 3), 
+  BestEditDistance(MaxEditDistance + 1),
   BestIndex(0), NextIndex(0)
   { }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r279051 - [clang-tidy docs] Minor fix

2016-08-18 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Thu Aug 18 06:12:03 2016
New Revision: 279051

URL: http://llvm.org/viewvc/llvm-project?rev=279051=rev
Log:
[clang-tidy docs] Minor fix

Modified:
clang-tools-extra/trunk/docs/clang-tidy/checks/mpi-type-mismatch.rst

Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/mpi-type-mismatch.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/mpi-type-mismatch.rst?rev=279051=279050=279051=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/checks/mpi-type-mismatch.rst 
(original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/mpi-type-mismatch.rst Thu 
Aug 18 06:12:03 2016
@@ -10,7 +10,7 @@ datatypes and null pointer constants are
 
 Example:
 
-.. code:: c++
+.. code-block:: c++
 
   // In this case, the buffer type matches MPI datatype.
   char buf;


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


[clang-tools-extra] r279050 - [clang-tidy docs] Fix formatting.

2016-08-18 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Thu Aug 18 06:10:52 2016
New Revision: 279050

URL: http://llvm.org/viewvc/llvm-project?rev=279050=rev
Log:
[clang-tidy docs] Fix formatting.

Modified:
clang-tools-extra/trunk/docs/clang-tidy/checks/mpi-type-mismatch.rst

Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/mpi-type-mismatch.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/mpi-type-mismatch.rst?rev=279050=279049=279050=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/checks/mpi-type-mismatch.rst 
(original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/mpi-type-mismatch.rst Thu 
Aug 18 06:10:52 2016
@@ -9,6 +9,7 @@ standard (3.1) are verified by this chec
 datatypes and null pointer constants are skipped, in the course of 
verification.
 
 Example:
+
 .. code:: c++
 
   // In this case, the buffer type matches MPI datatype.


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


[clang-tools-extra] r279049 - [clang-tidy docs] Fix build errors on Sphinx 1.4.5

2016-08-18 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Thu Aug 18 06:06:09 2016
New Revision: 279049

URL: http://llvm.org/viewvc/llvm-project?rev=279049=rev
Log:
[clang-tidy docs] Fix build errors on Sphinx 1.4.5

Modified:

clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-assert-side-effect.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-nullptr.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/mpi-buffer-deref.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/readability-braces-around-statements.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/readability-function-size.rst
clang-tools-extra/trunk/docs/clang-tidy/index.rst

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst?rev=279049=279048=279049=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
 (original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
 Thu Aug 18 06:06:09 2016
@@ -8,7 +8,7 @@ This check flags all array subscript exp
 are out of bounds (for ``std::array``). For out-of-bounds checking of static
 arrays, see the clang-diagnostic-array-bounds check.
 
-The check can generate fixes after the option :option:`GslHeader` has been set
+The check can generate fixes after the option `GslHeader` has been set
 to the name of the include file that contains ``gsl::at()``, e.g. 
`"gsl/gsl.h"`.
 
 This rule is part of the "Bounds safety" profile of the C++ Core Guidelines, 
see

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-assert-side-effect.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-assert-side-effect.rst?rev=279049=279048=279049=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-assert-side-effect.rst 
(original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-assert-side-effect.rst 
Thu Aug 18 06:06:09 2016
@@ -11,8 +11,12 @@ builds.
 
 There are two options:
 
-  - :option:`AssertMacros`: A comma-separated list of the names of assert 
macros
-to be checked.
-  - :option:`CheckFunctionCalls`: Whether to treat non-const member and
-non-member functions as they produce side effects. Disabled by default
-because it can increase the number of false positive warnings.
+.. option:: AssertMacros
+
+   A comma-separated list of the names of assert macros to be checked.
+
+.. option:: CheckFunctionCalls
+
+   Whether to treat non-const member and non-member functions as they produce
+   side effects. Disabled by default because it can increase the number of 
false
+   positive warnings.

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst?rev=279049=279048=279049=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
 (original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
 Thu Aug 18 06:06:09 2016
@@ -5,11 +5,29 @@ misc-throw-by-value-catch-by-reference
 
 "cert-err61-cpp" redirects here as an alias for this check.
 
-Finds violations of the rule "Throw by value, catch by reference" presented 
for example in "C++ Coding Standards" by H. Sutter and A. Alexandrescu. This 
check also has the option to find violations of the rule "Throw anonymous 
temporaries" 
(https://www.securecoding.cert.org/confluence/display/cplusplus/ERR09-CPP.+Throw+anonymous+temporaries).
 The option is named :option:`CheckThrowTemporaries` and it's on by default.
+Finds violations of the rule "Throw by value, catch by reference" presented for
+example in "C++ Coding Standards" by H. Sutter and A. Alexandrescu.
 
 Exceptions:
-  * Throwing string literals will not be flagged despite being a pointer. They 
are not susceptible to slicing and the usage of string literals is idomatic.
-  * Catching character pointers (``char``, ``wchar_t``, unicode character 
types) will not be flagged to allow catching sting literals.
-  * Moved named values will not be flagged as not throwing an anonymous 
temporary. In this case we can be sure that the user knows that the object 
can't be accessed outside catch blocks handling the error.
-  * Throwing function 

Re: [PATCH] D15227: [analyzer] Valist checkers.

2016-08-18 Thread Gábor Horváth via cfe-commits
xazax.hun reopened this revision.
xazax.hun added a comment.
This revision is now accepted and ready to land.

It looks like it broke some of the build bots.

Error from the windows build bots:

  error: 'note' diagnostics expected but not seen: 
File 
C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\Analysis\valist-uninitialized.c
 Line 96: va_list 'va' is copied onto itself
File 
C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\Analysis\valist-uninitialized.c
 Line 102: va_list 'va' is copied onto itself
File 
C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\Analysis\valist-uninitialized.c
 Line 108: Initialized va_list 'va' is overwritten by an uninitialized one
  error: 'note' diagnostics seen but not expected: 
Line 96: va_list va' is copied onto itself
Line 102: va_list va' is copied onto itself
Line 108: Initialized va_list va' is overwritten by an uninitialized one
  12 errors generated.

Somehow the beginning single quote is missing from the generated message. It is 
very strange.

Error from other architectures:

  error: 'warning' diagnostics expected but not seen: 
File 
/var/lib/buildbot/slaves/hexagon-build-03/clang-hexagon-elf/llvm/tools/clang/test/Analysis/valist-unterminated.c
 Line 27: Initialized va_list is leaked
File 
/var/lib/buildbot/slaves/hexagon-build-03/clang-hexagon-elf/llvm/tools/clang/test/Analysis/valist-unterminated.c
 Line 39: Initialized va_list is leaked
File 
/var/lib/buildbot/slaves/hexagon-build-03/clang-hexagon-elf/llvm/tools/clang/test/Analysis/valist-unterminated.c
 Line 110: Initialized va_list 'va_array[3]' is leaked
File 
/var/lib/buildbot/slaves/hexagon-build-03/clang-hexagon-elf/llvm/tools/clang/test/Analysis/valist-unterminated.c
 Line 125: Initialized va_list 'mem[0]' is leaked
  error: 'warning' diagnostics seen but not expected: 
File 
/var/lib/buildbot/slaves/hexagon-build-03/clang-hexagon-elf/llvm/tools/clang/test/Analysis/valist-unterminated.c
 Line 33: Initialized va_list 'fst' is leaked
File 
/var/lib/buildbot/slaves/hexagon-build-03/clang-hexagon-elf/llvm/tools/clang/test/Analysis/valist-unterminated.c
 Line 110: Initialized va_list 'va_array' is leaked
File 
/var/lib/buildbot/slaves/hexagon-build-03/clang-hexagon-elf/llvm/tools/clang/test/Analysis/valist-unterminated.c
 Line 125: Initialized va_list 'mem' is leaked
  error: 'note' diagnostics expected but not seen: 
File 
/var/lib/buildbot/slaves/hexagon-build-03/clang-hexagon-elf/llvm/tools/clang/test/Analysis/valist-unterminated.c
 Line 26: Initialized va_list
File 
/var/lib/buildbot/slaves/hexagon-build-03/clang-hexagon-elf/llvm/tools/clang/test/Analysis/valist-unterminated.c
 Line 27: Initialized va_list is leaked
File 
/var/lib/buildbot/slaves/hexagon-build-03/clang-hexagon-elf/llvm/tools/clang/test/Analysis/valist-unterminated.c
 Line 36: Initialized va_list
File 
/var/lib/buildbot/slaves/hexagon-build-03/clang-hexagon-elf/llvm/tools/clang/test/Analysis/valist-unterminated.c
 Line 39: Initialized va_list is leaked
File 
/var/lib/buildbot/slaves/hexagon-build-03/clang-hexagon-elf/llvm/tools/clang/test/Analysis/valist-unterminated.c
 Line 110: Initialized va_list 'va_array[3]' is leaked
File 
/var/lib/buildbot/slaves/hexagon-build-03/clang-hexagon-elf/llvm/tools/clang/test/Analysis/valist-unterminated.c
 Line 125: Initialized va_list 'mem[0]' is leaked
  error: 'note' diagnostics seen but not expected: 
Line 31: Initialized va_list
File 
/var/lib/buildbot/slaves/hexagon-build-03/clang-hexagon-elf/llvm/tools/clang/test/Analysis/valist-unterminated.c
 Line 33: Initialized va_list 'fst' is leaked
File 
/var/lib/buildbot/slaves/hexagon-build-03/clang-hexagon-elf/llvm/tools/clang/test/Analysis/valist-unterminated.c
 Line 110: Initialized va_list 'va_array' is leaked
File 
/var/lib/buildbot/slaves/hexagon-build-03/clang-hexagon-elf/llvm/tools/clang/test/Analysis/valist-unterminated.c
 Line 125: Initialized va_list 'mem' is leaked
  17 errors generated.

I suspect that slightly different AST is generated for those architectures that 
cause the different behavior. I will further investigate those problems.


Repository:
  rL LLVM

https://reviews.llvm.org/D15227



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


Re: [PATCH] D23651: [clang-rename] improve performance for rename-all

2016-08-18 Thread Alexander Shaposhnikov via cfe-commits
alexshap added a subscriber: alexshap.


Comment at: clang-rename/USRFindingAction.h:38
@@ -37,5 +37,3 @@
 private:
-  unsigned SymbolOffset;
-  std::string OldName;
-  std::string SpellingName;
-  std::vector USRs;
+  std::vector SymbolOffsets;
+  std::vector OldNames;

in the constructor SymbolOffsets, OldNames are passed by non-constant reference
but then you make a copy.  


https://reviews.llvm.org/D23651



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


Re: [PATCH] D15332: new clang-tidy checker readability-non-const-parameter

2016-08-18 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 6 inline comments as done.


Comment at: clang-tidy/readability/NonConstParameterCheck.cpp:95-98
@@ +94,6 @@
+const QualType T = VD->getType();
+if (T->isPointerType() && !T->getPointeeType().isConstQualified())
+  markCanNotBeConst(VD->getInit(), true);
+else if (T->isArrayType())
+  markCanNotBeConst(VD->getInit(), true);
+  }

alexfh wrote:
> danielmarjamaki wrote:
> > Prazek wrote:
> > > This looks like it could be in the same if.
> > Yes it could. But would it make the code more or less readable? It wouldn't 
> > be a 1-line condition anymore then.
> I also think that it makes sense to merge the conditions. The problem with 
> the current code is that it is suspicious ("Why is the same action is done in 
> two branches? Is it a bug?"). One line condition vs two lines seems secondary 
> in this case.
ok


Comment at: clang-tidy/readability/NonConstParameterCheck.cpp:103
@@ +102,3 @@
+void NonConstParameterCheck::addParm(const ParmVarDecl *Parm) {
+  // Only add nonconst integer/float pointer parameters.
+  const QualType T = Parm->getType();

alexfh wrote:
> This seems too strict. What about other primitive types? 
I am not sure which type you are talking about. As far as I see we're writing 
warnings about bool,char,short,int,long,long long,float,double,long double,enum 
pointers.

I have intentionally avoided records now to start with. It should be added, but 
we need to be more careful when we do it.



Comment at: test/clang-tidy/readability-non-const-parameter.cpp:210
@@ +209,3 @@
+// CHECK-MESSAGES: :[[@LINE+1]]:27: warning: pointer parameter 'p' can be
+int functionpointer2(int *p)
+{

alexfh wrote:
> Put braces on the previous line, please. A few other instances below.
sorry .. of course I should run clang-format on this.


https://reviews.llvm.org/D15332



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


Re: [PATCH] D23651: [clang-rename] improve performance for rename-all

2016-08-18 Thread Miklos Vajna via cfe-commits
vmiklos added a comment.

I can confirm that with this, the test script from the mail thread shows that 
clang-rename is almost as fast as clang++ as expected. Thanks!


https://reviews.llvm.org/D23651



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


Re: [PATCH] D23651: [clang-rename] improve performance for rename-all

2016-08-18 Thread Kirill Bobyrev via cfe-commits
omtcyfz updated this revision to Diff 68503.
omtcyfz added a comment.

Prevent unnecessary `std::vector` copying. Explicitly write type.


https://reviews.llvm.org/D23651

Files:
  clang-rename/USRFindingAction.cpp
  clang-rename/USRFindingAction.h
  clang-rename/tool/ClangRename.cpp

Index: clang-rename/tool/ClangRename.cpp
===
--- clang-rename/tool/ClangRename.cpp
+++ clang-rename/tool/ClangRename.cpp
@@ -175,11 +175,11 @@
   }
 
   // Check if NewNames is a valid identifier in C++17.
+  LangOptions Options;
+  Options.CPlusPlus = true;
+  Options.CPlusPlus1z = true;
+  IdentifierTable Table(Options);
   for (const auto  : NewNames) {
-LangOptions Options;
-Options.CPlusPlus = true;
-Options.CPlusPlus1z = true;
-IdentifierTable Table(Options);
 auto NewNameTokKind = Table.get(NewName).getTokenID();
 if (!tok::isAnyIdentifier(NewNameTokKind)) {
   errs() << "ERROR: new name is not a valid identifier in C++17.\n\n";
@@ -203,39 +203,36 @@
 exit(1);
   }
 
-  std::vector USRList;
-  std::vector PrevNames;
   auto Files = OP.getSourcePathList();
   tooling::RefactoringTool Tool(OP.getCompilations(), Files);
+
   unsigned Count = OldNames.size() ? OldNames.size() : SymbolOffsets.size();
+  std::vector SymbolOffsetsVector(Count, 0);
+  std::vector OldNamesVector(Count, "");
   for (unsigned I = 0; I < Count; ++I) {
-unsigned SymbolOffset = SymbolOffsets.empty() ? 0 : SymbolOffsets[I];
-const std::string  = OldNames.empty() ? std::string() : OldNames[I];
-
-// Get the USRs.
-rename::USRFindingAction USRAction(SymbolOffset, OldName);
-
-// Find the USRs.
-Tool.run(tooling::newFrontendActionFactory().get());
-const auto  = USRAction.getUSRs();
-USRList.push_back(USRs);
-const auto  = USRAction.getUSRSpelling();
-PrevNames.push_back(PrevName);
-
-if (PrevName.empty()) {
-  // An error should have already been printed.
-  exit(1);
+if (!SymbolOffsets.empty()) {
+  SymbolOffsetsVector[I] = SymbolOffsets[I];
+}
+if (!OldNames.empty()) {
+  OldNamesVector[I] = OldNames[I];
 }
+  }
 
-if (PrintName) {
-  errs() << "clang-rename: found name: " << PrevName << '\n';
+  rename::USRFindingAction USRAction(SymbolOffsetsVector, OldNamesVector);
+  Tool.run(tooling::newFrontendActionFactory().get());
+  const std::vector  = USRAction.getUSRList();
+  const std::vector  = USRAction.getUSRSpellings();
+  if (PrintName) {
+for (const auto  : PrevNames) {
+  outs() << "clang-rename found name: " << PrevName << '\n';
 }
   }
 
   // Perform the renaming.
   rename::RenamingAction RenameAction(NewNames, PrevNames, USRList,
   Tool.getReplacements(), PrintLocations);
-  auto Factory = tooling::newFrontendActionFactory();
+  std::unique_ptr Factory =
+  tooling::newFrontendActionFactory();
   int ExitCode;
 
   if (Inplace) {
Index: clang-rename/USRFindingAction.h
===
--- clang-rename/USRFindingAction.h
+++ clang-rename/USRFindingAction.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_RENAME_USR_FINDING_ACTION_H_
 
 #include "clang/Frontend/FrontendAction.h"
+#include 
 
 namespace clang {
 class ASTConsumer;
@@ -25,20 +26,19 @@
 namespace rename {
 
 struct USRFindingAction {
-  USRFindingAction(unsigned Offset, const std::string )
-  : SymbolOffset(Offset), OldName(Name) {}
+  USRFindingAction(std::vector ,
+   std::vector )
+  : SymbolOffsets(SymbolOffsets), OldNames(OldNames) {}
   std::unique_ptr newASTConsumer();
 
-  // \brief get the spelling of the USR(s) as it would appear in source files.
-  const std::string () { return SpellingName; }
-
-  const std::vector () { return USRs; }
+  const std::vector () { return SpellingNames; }
+  const std::vector () { return USRList; }
 
 private:
-  unsigned SymbolOffset;
-  std::string OldName;
-  std::string SpellingName;
-  std::vector USRs;
+  std::vector SymbolOffsets;
+  std::vector OldNames;
+  std::vector SpellingNames;
+  std::vector USRList;
 };
 
 } // namespace rename
Index: clang-rename/USRFindingAction.cpp
===
--- clang-rename/USRFindingAction.cpp
+++ clang-rename/USRFindingAction.cpp
@@ -45,11 +45,10 @@
 // to virtual method.
 class AdditionalUSRFinder : public RecursiveASTVisitor {
 public:
-  explicit AdditionalUSRFinder(const Decl *FoundDecl, ASTContext ,
-   std::vector *USRs)
-  : FoundDecl(FoundDecl), Context(Context), USRs(USRs) {}
+  explicit AdditionalUSRFinder(const Decl *FoundDecl, ASTContext )
+  : FoundDecl(FoundDecl), Context(Context) {}
 
-  void Find() {
+  std::vector Find() {
 // Fill OverriddenMethods and PartialSpecs storages.
 

[PATCH] D23651: [clang-rename] improve performance for rename-all

2016-08-18 Thread Kirill Bobyrev via cfe-commits
omtcyfz created this revision.
omtcyfz added reviewers: alexfh, vmiklos.
omtcyfz added a subscriber: cfe-commits.

As Miklos Vajna [[ 
http://lists.llvm.org/pipermail/cfe-dev/2016-August/050398.html | noticed ]] 
`clang-rename rename-all` has significant performance problems, which exposed 
the fact that clang-rename parses translation unit **N** times where **N** 
stands for the number of `{offset | old-name} -> new-name` pairs.

This patch prevents clang-rename from parsing translation unit multiple times.

https://reviews.llvm.org/D23651

Files:
  clang-rename/USRFindingAction.cpp
  clang-rename/USRFindingAction.h
  clang-rename/tool/ClangRename.cpp

Index: clang-rename/tool/ClangRename.cpp
===
--- clang-rename/tool/ClangRename.cpp
+++ clang-rename/tool/ClangRename.cpp
@@ -175,11 +175,11 @@
   }
 
   // Check if NewNames is a valid identifier in C++17.
+  LangOptions Options;
+  Options.CPlusPlus = true;
+  Options.CPlusPlus1z = true;
+  IdentifierTable Table(Options);
   for (const auto  : NewNames) {
-LangOptions Options;
-Options.CPlusPlus = true;
-Options.CPlusPlus1z = true;
-IdentifierTable Table(Options);
 auto NewNameTokKind = Table.get(NewName).getTokenID();
 if (!tok::isAnyIdentifier(NewNameTokKind)) {
   errs() << "ERROR: new name is not a valid identifier in C++17.\n\n";
@@ -203,32 +203,28 @@
 exit(1);
   }
 
-  std::vector USRList;
-  std::vector PrevNames;
   auto Files = OP.getSourcePathList();
   tooling::RefactoringTool Tool(OP.getCompilations(), Files);
+
   unsigned Count = OldNames.size() ? OldNames.size() : SymbolOffsets.size();
+  std::vector SymbolOffsetsVector(Count, 0);
+  std::vector OldNamesVector(Count, "");
   for (unsigned I = 0; I < Count; ++I) {
-unsigned SymbolOffset = SymbolOffsets.empty() ? 0 : SymbolOffsets[I];
-const std::string  = OldNames.empty() ? std::string() : OldNames[I];
-
-// Get the USRs.
-rename::USRFindingAction USRAction(SymbolOffset, OldName);
-
-// Find the USRs.
-Tool.run(tooling::newFrontendActionFactory().get());
-const auto  = USRAction.getUSRs();
-USRList.push_back(USRs);
-const auto  = USRAction.getUSRSpelling();
-PrevNames.push_back(PrevName);
-
-if (PrevName.empty()) {
-  // An error should have already been printed.
-  exit(1);
+if (!SymbolOffsets.empty()) {
+  SymbolOffsetsVector[I] = SymbolOffsets[I];
+}
+if (!OldNames.empty()) {
+  OldNamesVector[I] = OldNames[I];
 }
+  }
 
-if (PrintName) {
-  errs() << "clang-rename: found name: " << PrevName << '\n';
+  rename::USRFindingAction USRAction(SymbolOffsetsVector, OldNamesVector);
+  Tool.run(tooling::newFrontendActionFactory().get());
+  std::vector USRList = USRAction.getUSRList();
+  std::vector PrevNames = USRAction.getUSRSpellings();
+  if (PrintName) {
+for (const auto  : PrevNames) {
+  outs() << "clang-rename found name: " << PrevName << '\n';
 }
   }
 
Index: clang-rename/USRFindingAction.h
===
--- clang-rename/USRFindingAction.h
+++ clang-rename/USRFindingAction.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_RENAME_USR_FINDING_ACTION_H_
 
 #include "clang/Frontend/FrontendAction.h"
+#include 
 
 namespace clang {
 class ASTConsumer;
@@ -25,20 +26,19 @@
 namespace rename {
 
 struct USRFindingAction {
-  USRFindingAction(unsigned Offset, const std::string )
-  : SymbolOffset(Offset), OldName(Name) {}
+  USRFindingAction(std::vector ,
+   std::vector )
+  : SymbolOffsets(SymbolOffsets), OldNames(OldNames) {}
   std::unique_ptr newASTConsumer();
 
-  // \brief get the spelling of the USR(s) as it would appear in source files.
-  const std::string () { return SpellingName; }
-
-  const std::vector () { return USRs; }
+  const std::vector () { return SpellingNames; }
+  const std::vector () { return USRList; }
 
 private:
-  unsigned SymbolOffset;
-  std::string OldName;
-  std::string SpellingName;
-  std::vector USRs;
+  std::vector SymbolOffsets;
+  std::vector OldNames;
+  std::vector SpellingNames;
+  std::vector USRList;
 };
 
 } // namespace rename
Index: clang-rename/USRFindingAction.cpp
===
--- clang-rename/USRFindingAction.cpp
+++ clang-rename/USRFindingAction.cpp
@@ -45,11 +45,10 @@
 // to virtual method.
 class AdditionalUSRFinder : public RecursiveASTVisitor {
 public:
-  explicit AdditionalUSRFinder(const Decl *FoundDecl, ASTContext ,
-   std::vector *USRs)
-  : FoundDecl(FoundDecl), Context(Context), USRs(USRs) {}
+  explicit AdditionalUSRFinder(const Decl *FoundDecl, ASTContext )
+  : FoundDecl(FoundDecl), Context(Context) {}
 
-  void Find() {
+  std::vector Find() {
 // Fill OverriddenMethods and PartialSpecs storages.
 

Re: [PATCH] D23528: [OpenMP] Sema and parsing for 'teams distribute simd' pragma

2016-08-18 Thread Diana Picus via cfe-commits
Hi,

I had to revert this (r279045) because it breaks some of our buildbots (e.g.
clang-cmake-aarch64-quick, clang-x86_64-linux-selfhost-modules).

The error is in OpenMP/teams_distribute_simd_ast_print.cpp:
clang:
/home/buildslave/buildslave/clang-cmake-aarch64-quick/llvm/include/llvm/ADT/DenseMap.h:527:
bool llvm::DenseMapBase::LookupBucketFor(const LookupKeyT&, const BucketT*&) const
[with LookupKeyT = clang::Stmt*; DerivedT = llvm::DenseMap;
KeyT = clang::Stmt*; ValueT = long unsigned int;
KeyInfoT = llvm::DenseMapInfo;
BucketT = llvm::detail::DenseMapPair]:

Assertion `!KeyInfoT::isEqual(Val, EmptyKey) && !KeyInfoT::isEqual(Val,
TombstoneKey) &&
"Empty/Tombstone value shouldn't be inserted into map!"' failed.

On 18 August 2016 at 02:21, Phabricator via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL279003: [OpenMP] Sema and parsing for 'teams distribute
> simd’ pragma (authored by kli).
>
> Changed prior to commit:
>   https://reviews.llvm.org/D23528?vs=68216=68448#toc
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D23528
>
> Files:
>   cfe/trunk/include/clang-c/Index.h
>   cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
>   cfe/trunk/include/clang/AST/StmtOpenMP.h
>   cfe/trunk/include/clang/Basic/OpenMPKinds.def
>   cfe/trunk/include/clang/Basic/StmtNodes.td
>   cfe/trunk/include/clang/Sema/Sema.h
>   cfe/trunk/include/clang/Serialization/ASTBitCodes.h
>   cfe/trunk/lib/AST/StmtOpenMP.cpp
>   cfe/trunk/lib/AST/StmtPrinter.cpp
>   cfe/trunk/lib/AST/StmtProfile.cpp
>   cfe/trunk/lib/Basic/OpenMPKinds.cpp
>   cfe/trunk/lib/CodeGen/CGStmt.cpp
>   cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
>   cfe/trunk/lib/CodeGen/CodeGenFunction.h
>   cfe/trunk/lib/Parse/ParseOpenMP.cpp
>   cfe/trunk/lib/Sema/SemaOpenMP.cpp
>   cfe/trunk/lib/Sema/TreeTransform.h
>   cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
>   cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
>   cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
>   cfe/trunk/test/OpenMP/nesting_of_regions.cpp
>   cfe/trunk/test/OpenMP/teams_distribute_simd_aligned_messages.cpp
>   cfe/trunk/test/OpenMP/teams_distribute_simd_ast_print.cpp
>   cfe/trunk/test/OpenMP/teams_distribute_simd_collapse_messages.cpp
>   cfe/trunk/test/OpenMP/teams_distribute_simd_default_messages.cpp
>   cfe/trunk/test/OpenMP/teams_distribute_simd_dist_schedule_messages.cpp
>   cfe/trunk/test/OpenMP/teams_distribute_simd_firstprivate_messages.cpp
>   cfe/trunk/test/OpenMP/teams_distribute_simd_lastprivate_messages.cpp
>   cfe/trunk/test/OpenMP/teams_distribute_simd_linear_messages.cpp
>   cfe/trunk/test/OpenMP/teams_distribute_simd_loop_messages.cpp
>   cfe/trunk/test/OpenMP/teams_distribute_simd_messages.cpp
>   cfe/trunk/test/OpenMP/teams_distribute_simd_num_teams_messages.cpp
>   cfe/trunk/test/OpenMP/teams_distribute_simd_private_messages.cpp
>   cfe/trunk/test/OpenMP/teams_distribute_simd_reduction_messages.cpp
>   cfe/trunk/test/OpenMP/teams_distribute_simd_safelen_messages.cpp
>   cfe/trunk/test/OpenMP/teams_distribute_simd_shared_messages.cpp
>   cfe/trunk/test/OpenMP/teams_distribute_simd_simdlen_messages.cpp
>   cfe/trunk/test/OpenMP/teams_distribute_simd_thread_limit_messages.cpp
>   cfe/trunk/tools/libclang/CIndex.cpp
>   cfe/trunk/tools/libclang/CXCursor.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: [PATCH] D23314: [analyzer] CloneDetector allows comparing clones for suspicious variable pattern errors.

2016-08-18 Thread Vassil Vassilev via cfe-commits
v.g.vassilev accepted this revision.
v.g.vassilev added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D23314



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


r279043 - revert [analyzer] Added valist related checkers.

2016-08-18 Thread Gabor Horvath via cfe-commits
Author: xazax
Date: Thu Aug 18 04:13:37 2016
New Revision: 279043

URL: http://llvm.org/viewvc/llvm-project?rev=279043=rev
Log:
revert [analyzer] Added valist related checkers.

Removed:
cfe/trunk/lib/StaticAnalyzer/Checkers/ValistChecker.cpp
cfe/trunk/test/Analysis/Inputs/system-header-simulator-for-valist.h
cfe/trunk/test/Analysis/valist-uninitialized.c
cfe/trunk/test/Analysis/valist-unterminated.c
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt

Modified: cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td?rev=279043=279042=279043=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td Thu Aug 18 
04:13:37 2016
@@ -43,9 +43,6 @@ def Nullability : Package<"nullability">
 def Cplusplus : Package<"cplusplus">;
 def CplusplusAlpha : Package<"cplusplus">, InPackage, Hidden;
 
-def Valist : Package<"valist">;
-def ValistAlpha : Package<"valist">, InPackage, Hidden;
-
 def DeadCode : Package<"deadcode">;
 def DeadCodeAlpha : Package<"deadcode">, InPackage, Hidden;
 
@@ -270,27 +267,6 @@ def VirtualCallChecker : Checker<"Virtua
 
 } // end: "alpha.cplusplus"
 
-
-//===--===//
-// Valist checkers.
-//===--===//
-
-let ParentPackage = ValistAlpha in {
-
-def UninitializedChecker : Checker<"Uninitialized">,
-  HelpText<"Check for usages of uninitialized (or already released) 
va_lists.">,
-  DescFile<"ValistChecker.cpp">;
-
-def UnterminatedChecker : Checker<"Unterminated">,
-  HelpText<"Check for va_lists which are not released by a va_end call.">,
-  DescFile<"ValistChecker.cpp">;
-
-def CopyToSelfChecker : Checker<"CopyToSelf">,
-  HelpText<"Check for va_lists which are copied onto itself.">,
-  DescFile<"ValistChecker.cpp">;
-
-} // end : "alpha.valist"
-
 
//===--===//
 // Deadcode checkers.
 
//===--===//

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt?rev=279043=279042=279043=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt Thu Aug 18 04:13:37 
2016
@@ -81,7 +81,6 @@ add_clang_library(clangStaticAnalyzerChe
   UnreachableCodeChecker.cpp
   VforkChecker.cpp
   VLASizeChecker.cpp
-  ValistChecker.cpp
   VirtualCallChecker.cpp
 
   DEPENDS

Removed: cfe/trunk/lib/StaticAnalyzer/Checkers/ValistChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/ValistChecker.cpp?rev=279042=auto
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/ValistChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/ValistChecker.cpp (removed)
@@ -1,373 +0,0 @@
-//== ValistChecker.cpp - stdarg.h macro usage checker ---*- C++ 
-*--==//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-//
-// This defines checkers which detect usage of uninitialized va_list values
-// and va_start calls with no matching va_end.
-//
-//===--===//
-
-#include "ClangSACheckers.h"
-#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
-#include "clang/StaticAnalyzer/Core/Checker.h"
-#include "clang/StaticAnalyzer/Core/CheckerManager.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
-
-using namespace clang;
-using namespace ento;
-
-REGISTER_SET_WITH_PROGRAMSTATE(InitializedVALists, const MemRegion *)
-
-namespace {
-typedef SmallVector RegionVector;
-
-class ValistChecker : public Checker {
-  mutable std::unique_ptr BT_leakedvalist, BT_uninitaccess;
-
-  struct VAListAccepter {
-CallDescription Func;
-int VAListPos;
-  };
-  static const SmallVector VAListAccepters;
-  static const CallDescription VaStart, VaEnd, VaCopy;
-
-public:
-  enum CheckKind {
-CK_Uninitialized,
-CK_Unterminated,
-CK_CopyToSelf,
-CK_NumCheckKinds
-  };
-
-  

Re: [PATCH] D21959: [X86] Add xgetbv xsetbv intrinsics

2016-08-18 Thread Guy Blank via cfe-commits
guyblank added a comment.

Still, __XSAVE__ should have been defined when compiling for a target that 
supports the feature.

But anyway, the xsaveintrin.h is quite small so always including it shouldn't 
be an issue.
Are you ok with me removing the #if just for this header file, or would you 
like to wait for Nico?


Repository:
  rL LLVM

https://reviews.llvm.org/D21959



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


r279042 - test commit

2016-08-18 Thread Guy Blank via cfe-commits
Author: guyblank
Date: Thu Aug 18 03:44:33 2016
New Revision: 279042

URL: http://llvm.org/viewvc/llvm-project?rev=279042=rev
Log:
test commit

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=279042=279041=279042=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Aug 18 03:44:33 2016
@@ -806,7 +806,7 @@ public:
 this->SizeType = TargetInfo::UnsignedInt;
 this->PtrDiffType = TargetInfo::SignedInt;
 this->IntPtrType = TargetInfo::SignedInt;
-// RegParmMax is inherited from the underlying architecture
+// RegParmMax is inherited from the underlying architecture.
 this->LongDoubleFormat = ::APFloat::IEEEdouble;
 if (Triple.getArch() == llvm::Triple::arm) {
   // Handled in ARM's setABI().


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


Re: [PATCH] D15227: [analyzer] Valist checkers.

2016-08-18 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279041: [analyzer] Added valist related checkers. (authored 
by xazax).

Changed prior to commit:
  https://reviews.llvm.org/D15227?vs=68157=68497#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D15227

Files:
  cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
  cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt
  cfe/trunk/lib/StaticAnalyzer/Checkers/ValistChecker.cpp
  cfe/trunk/test/Analysis/Inputs/system-header-simulator-for-valist.h
  cfe/trunk/test/Analysis/valist-uninitialized.c
  cfe/trunk/test/Analysis/valist-unterminated.c

Index: cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
===
--- cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
+++ cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
@@ -43,6 +43,9 @@
 def Cplusplus : Package<"cplusplus">;
 def CplusplusAlpha : Package<"cplusplus">, InPackage, Hidden;
 
+def Valist : Package<"valist">;
+def ValistAlpha : Package<"valist">, InPackage, Hidden;
+
 def DeadCode : Package<"deadcode">;
 def DeadCodeAlpha : Package<"deadcode">, InPackage, Hidden;
 
@@ -267,6 +270,27 @@
 
 } // end: "alpha.cplusplus"
 
+
+//===--===//
+// Valist checkers.
+//===--===//
+
+let ParentPackage = ValistAlpha in {
+
+def UninitializedChecker : Checker<"Uninitialized">,
+  HelpText<"Check for usages of uninitialized (or already released) va_lists.">,
+  DescFile<"ValistChecker.cpp">;
+
+def UnterminatedChecker : Checker<"Unterminated">,
+  HelpText<"Check for va_lists which are not released by a va_end call.">,
+  DescFile<"ValistChecker.cpp">;
+
+def CopyToSelfChecker : Checker<"CopyToSelf">,
+  HelpText<"Check for va_lists which are copied onto itself.">,
+  DescFile<"ValistChecker.cpp">;
+
+} // end : "alpha.valist"
+
 //===--===//
 // Deadcode checkers.
 //===--===//
Index: cfe/trunk/test/Analysis/Inputs/system-header-simulator-for-valist.h
===
--- cfe/trunk/test/Analysis/Inputs/system-header-simulator-for-valist.h
+++ cfe/trunk/test/Analysis/Inputs/system-header-simulator-for-valist.h
@@ -0,0 +1,30 @@
+// Like the compiler, the static analyzer treats some functions differently if
+// they come from a system header -- for example, it is assumed that system
+// functions do not arbitrarily free() their parameters, and that some bugs
+// found in system headers cannot be fixed by the user and should be
+// suppressed.
+
+#pragma clang system_header
+
+#ifdef __cplusplus
+#define restrict /*restrict*/
+#endif
+
+typedef __builtin_va_list va_list;
+
+#define va_start(ap, param) __builtin_va_start(ap, param)
+#define va_end(ap)  __builtin_va_end(ap)
+#define va_arg(ap, type)__builtin_va_arg(ap, type)
+#define va_copy(dst, src)   __builtin_va_copy(dst, src)
+
+int vprintf (const char *restrict format, va_list arg);
+
+int vsprintf (char *restrict s, const char *restrict format, va_list arg);
+
+int some_library_function(int n, va_list arg);
+
+// No warning from system header.
+inline void __impl_detail(int fst, ...) {
+  va_list va;
+  (void)va_arg(va, int);
+}
Index: cfe/trunk/test/Analysis/valist-uninitialized.c
===
--- cfe/trunk/test/Analysis/valist-uninitialized.c
+++ cfe/trunk/test/Analysis/valist-uninitialized.c
@@ -0,0 +1,178 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.valist.Uninitialized,alpha.valist.CopyToSelf -analyzer-output=text -analyzer-store=region -verify %s
+
+#include "Inputs/system-header-simulator-for-valist.h"
+
+void f1(int fst, ...) {
+  va_list va;
+  (void)va_arg(va, int); //expected-warning{{va_arg() is called on an uninitialized va_list}} expected-note{{va_arg() is called on an uninitialized va_list}}
+}
+
+int f2(int fst, ...) {
+  va_list va;
+  va_start(va, fst); // expected-note{{Initialized va_list}}
+  va_end(va); // expected-note{{Ended va_list}}
+  return va_arg(va, int); //expected-warning{{va_arg() is called on an uninitialized va_list}} expected-note{{va_arg() is called on an uninitialized va_list}}
+}
+
+void f3(int fst, ...) {
+  va_list va, va2;
+  va_start(va, fst);
+  va_copy(va2, va);
+  va_end(va);
+  (void)va_arg(va2, int);
+  va_end(va2);
+} //no-warning
+
+void f4(int cond, ...) {
+  va_list va;
+  if (cond) { // expected-note{{Assuming 'cond' is 0}} expected-note{{Taking false branch}}
+va_start(va, cond);
+(void)va_arg(va,int);
+  }
+  va_end(va); //expected-warning{{va_end() is called on an uninitialized va_list}} expected-note{{va_end() is called on an uninitialized va_list}}
+}
+
+void 

r279041 - [analyzer] Added valist related checkers.

2016-08-18 Thread Gabor Horvath via cfe-commits
Author: xazax
Date: Thu Aug 18 03:43:26 2016
New Revision: 279041

URL: http://llvm.org/viewvc/llvm-project?rev=279041=rev
Log:
[analyzer] Added valist related checkers.

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

Added:
cfe/trunk/lib/StaticAnalyzer/Checkers/ValistChecker.cpp
cfe/trunk/test/Analysis/Inputs/system-header-simulator-for-valist.h
cfe/trunk/test/Analysis/valist-uninitialized.c
cfe/trunk/test/Analysis/valist-unterminated.c
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt

Modified: cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td?rev=279041=279040=279041=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td Thu Aug 18 
03:43:26 2016
@@ -43,6 +43,9 @@ def Nullability : Package<"nullability">
 def Cplusplus : Package<"cplusplus">;
 def CplusplusAlpha : Package<"cplusplus">, InPackage, Hidden;
 
+def Valist : Package<"valist">;
+def ValistAlpha : Package<"valist">, InPackage, Hidden;
+
 def DeadCode : Package<"deadcode">;
 def DeadCodeAlpha : Package<"deadcode">, InPackage, Hidden;
 
@@ -267,6 +270,27 @@ def VirtualCallChecker : Checker<"Virtua
 
 } // end: "alpha.cplusplus"
 
+
+//===--===//
+// Valist checkers.
+//===--===//
+
+let ParentPackage = ValistAlpha in {
+
+def UninitializedChecker : Checker<"Uninitialized">,
+  HelpText<"Check for usages of uninitialized (or already released) 
va_lists.">,
+  DescFile<"ValistChecker.cpp">;
+
+def UnterminatedChecker : Checker<"Unterminated">,
+  HelpText<"Check for va_lists which are not released by a va_end call.">,
+  DescFile<"ValistChecker.cpp">;
+
+def CopyToSelfChecker : Checker<"CopyToSelf">,
+  HelpText<"Check for va_lists which are copied onto itself.">,
+  DescFile<"ValistChecker.cpp">;
+
+} // end : "alpha.valist"
+
 
//===--===//
 // Deadcode checkers.
 
//===--===//

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt?rev=279041=279040=279041=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt Thu Aug 18 03:43:26 
2016
@@ -81,6 +81,7 @@ add_clang_library(clangStaticAnalyzerChe
   UnreachableCodeChecker.cpp
   VforkChecker.cpp
   VLASizeChecker.cpp
+  ValistChecker.cpp
   VirtualCallChecker.cpp
 
   DEPENDS

Added: cfe/trunk/lib/StaticAnalyzer/Checkers/ValistChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/ValistChecker.cpp?rev=279041=auto
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/ValistChecker.cpp (added)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/ValistChecker.cpp Thu Aug 18 03:43:26 
2016
@@ -0,0 +1,373 @@
+//== ValistChecker.cpp - stdarg.h macro usage checker ---*- C++ 
-*--==//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This defines checkers which detect usage of uninitialized va_list values
+// and va_start calls with no matching va_end.
+//
+//===--===//
+
+#include "ClangSACheckers.h"
+#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
+#include "clang/StaticAnalyzer/Core/Checker.h"
+#include "clang/StaticAnalyzer/Core/CheckerManager.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+
+using namespace clang;
+using namespace ento;
+
+REGISTER_SET_WITH_PROGRAMSTATE(InitializedVALists, const MemRegion *)
+
+namespace {
+typedef SmallVector RegionVector;
+
+class ValistChecker : public Checker {
+  mutable std::unique_ptr BT_leakedvalist, BT_uninitaccess;
+
+  struct VAListAccepter {
+CallDescription Func;
+int VAListPos;
+  };
+  static const SmallVector VAListAccepters;
+  static const CallDescription VaStart, VaEnd, VaCopy;
+
+public:
+  enum CheckKind {
+CK_Uninitialized,
+

Re: [PATCH] D23550: [analyzer] Small cleanups when checkers retrieving statements from exploded nodes.

2016-08-18 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279037: [analyzer] Small cleanups when checkers retrieving 
statements from exploded (authored by xazax).

Changed prior to commit:
  https://reviews.llvm.org/D23550?vs=68166=68492#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23550

Files:
  cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp
  cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
  cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
  cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
  cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp

Index: cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
@@ -325,10 +325,7 @@
   // Retrieve the associated statement.
   const Stmt *S = TrackedNullab->getNullabilitySource();
   if (!S) {
-ProgramPoint ProgLoc = N->getLocation();
-if (Optional SP = ProgLoc.getAs()) {
-  S = SP->getStmt();
-}
+S = PathDiagnosticLocation::getStmt(N);
   }
 
   if (!S)
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2094,12 +2094,7 @@
   const MemRegion *Region = nullptr;
   std::tie(AllocNode, Region) = getAllocationSite(N, Sym, C);
 
-  ProgramPoint P = AllocNode->getLocation();
-  const Stmt *AllocationStmt = nullptr;
-  if (Optional Exit = P.getAs())
-AllocationStmt = Exit->getCalleeContext()->getCallSite();
-  else if (Optional SP = P.getAs())
-AllocationStmt = SP->getStmt();
+  const Stmt *AllocationStmt = PathDiagnosticLocation::getStmt(AllocNode);
   if (AllocationStmt)
 LocUsedForUniqueing = PathDiagnosticLocation::createBegin(AllocationStmt,
   C.getSourceManager(),
@@ -2626,29 +2621,16 @@
   if (!RS)
 return nullptr;
 
-  const Stmt *S = nullptr;
-  const char *Msg = nullptr;
-  StackHintGeneratorForSymbol *StackHint = nullptr;
-
-  // Retrieve the associated statement.
-  ProgramPoint ProgLoc = N->getLocation();
-  if (Optional SP = ProgLoc.getAs()) {
-S = SP->getStmt();
-  } else if (Optional Exit = ProgLoc.getAs()) {
-S = Exit->getCalleeContext()->getCallSite();
-  } else if (Optional Edge = ProgLoc.getAs()) {
-// If an assumption was made on a branch, it should be caught
-// here by looking at the state transition.
-S = Edge->getSrc()->getTerminator();
-  }
-
+  const Stmt *S = PathDiagnosticLocation::getStmt(N);
   if (!S)
 return nullptr;
 
   // FIXME: We will eventually need to handle non-statement-based events
   // (__attribute__((cleanup))).
 
   // Find out if this is an interesting point and what is the kind.
+  const char *Msg = nullptr;
+  StackHintGeneratorForSymbol *StackHint = nullptr;
   if (Mode == Normal) {
 if (isAllocated(RS, RSPrev, S)) {
   Msg = "Memory is allocated";
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
@@ -909,12 +909,7 @@
 return nullptr;
 
   // Retrieve the associated statement.
-  const Stmt *S = nullptr;
-  ProgramPoint ProgLoc = N->getLocation();
-  if (Optional SP = ProgLoc.getAs()) {
-S = SP->getStmt();
-  }
-
+  const Stmt *S = PathDiagnosticLocation::getStmt(N);
   if (!S)
 return nullptr;
 
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp
@@ -107,12 +107,7 @@
 return nullptr;
 
   // Retrieve the associated statement.
-  const Stmt *S = nullptr;
-  ProgramPoint ProgLoc = N->getLocation();
-  if (Optional SP = ProgLoc.getAs()) {
-S = SP->getStmt();
-  }
-
+  const Stmt *S = PathDiagnosticLocation::getStmt(N);
   if (!S)
 return nullptr;
 
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
@@ -2418,12 +2418,7 @@
   // FIXME: This will crash the analyzer if an allocation comes from an
   // implicit call (ex: a destructor call).
   // (Currently there are no such allocations in Cocoa, though.)
-  const Stmt *AllocStmt = nullptr;
-  ProgramPoint P = 

r279037 - [analyzer] Small cleanups when checkers retrieving statements from exploded

2016-08-18 Thread Gabor Horvath via cfe-commits
Author: xazax
Date: Thu Aug 18 02:54:50 2016
New Revision: 279037

URL: http://llvm.org/viewvc/llvm-project?rev=279037=rev
Log:
[analyzer] Small cleanups when checkers retrieving statements from exploded
nodes.

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

Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp?rev=279037=279036=279037=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp Thu Aug 18 
02:54:50 2016
@@ -107,12 +107,7 @@ PathDiagnosticPiece *DynamicTypeChecker:
 return nullptr;
 
   // Retrieve the associated statement.
-  const Stmt *S = nullptr;
-  ProgramPoint ProgLoc = N->getLocation();
-  if (Optional SP = ProgLoc.getAs()) {
-S = SP->getStmt();
-  }
-
+  const Stmt *S = PathDiagnosticLocation::getStmt(N);
   if (!S)
 return nullptr;
 

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp?rev=279037=279036=279037=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp Thu Aug 18 
02:54:50 2016
@@ -909,12 +909,7 @@ PathDiagnosticPiece *DynamicTypePropagat
 return nullptr;
 
   // Retrieve the associated statement.
-  const Stmt *S = nullptr;
-  ProgramPoint ProgLoc = N->getLocation();
-  if (Optional SP = ProgLoc.getAs()) {
-S = SP->getStmt();
-  }
-
+  const Stmt *S = PathDiagnosticLocation::getStmt(N);
   if (!S)
 return nullptr;
 

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp?rev=279037=279036=279037=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp Thu Aug 
18 02:54:50 2016
@@ -524,12 +524,7 @@ MacOSKeychainAPIChecker::generateAllocat
   // allocated, and only report a single path.
   PathDiagnosticLocation LocUsedForUniqueing;
   const ExplodedNode *AllocNode = getAllocationNode(N, AP.first, C);
-  const Stmt *AllocStmt = nullptr;
-  ProgramPoint P = AllocNode->getLocation();
-  if (Optional Exit = P.getAs())
-AllocStmt = Exit->getCalleeContext()->getCallSite();
-  else if (Optional PS = P.getAs())
-AllocStmt = PS->getStmt();
+  const Stmt *AllocStmt = PathDiagnosticLocation::getStmt(AllocNode);
 
   if (AllocStmt)
 LocUsedForUniqueing = PathDiagnosticLocation::createBegin(AllocStmt,

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp?rev=279037=279036=279037=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Thu Aug 18 02:54:50 
2016
@@ -2094,12 +2094,7 @@ void MallocChecker::reportLeak(SymbolRef
   const MemRegion *Region = nullptr;
   std::tie(AllocNode, Region) = getAllocationSite(N, Sym, C);
 
-  ProgramPoint P = AllocNode->getLocation();
-  const Stmt *AllocationStmt = nullptr;
-  if (Optional Exit = P.getAs())
-AllocationStmt = Exit->getCalleeContext()->getCallSite();
-  else if (Optional SP = P.getAs())
-AllocationStmt = SP->getStmt();
+  const Stmt *AllocationStmt = PathDiagnosticLocation::getStmt(AllocNode);
   if (AllocationStmt)
 LocUsedForUniqueing = PathDiagnosticLocation::createBegin(AllocationStmt,
   C.getSourceManager(),
@@ -2626,22 +2621,7 @@ MallocChecker::MallocBugVisitor::VisitNo
   if (!RS)
 return nullptr;
 
-  const Stmt *S = nullptr;
-  const char *Msg = nullptr;
-  StackHintGeneratorForSymbol *StackHint = nullptr;
-
-  // Retrieve the associated statement.
-  ProgramPoint ProgLoc = N->getLocation();
-  if (Optional SP = ProgLoc.getAs()) {
-S = SP->getStmt();
-  } else if (Optional Exit = ProgLoc.getAs()) {
-S = Exit->getCalleeContext()->getCallSite();
-  } else if (Optional 

Re: r279024 - PR28438: Update the information on an identifier with local definitions before

2016-08-18 Thread Vassil Vassilev via cfe-commits

On 18/08/16 03:16, Richard Smith via cfe-commits wrote:

Author: rsmith
Date: Wed Aug 17 20:16:55 2016
New Revision: 279024

URL: http://llvm.org/viewvc/llvm-project?rev=279024=rev
Log:
PR28438: Update the information on an identifier with local definitions before
trying to write out its macro graph, in case we imported a module that added
another module macro between the most recent local definition and the end of
the module.

Added:
 cfe/trunk/test/Modules/Inputs/PR28438/
 cfe/trunk/test/Modules/Inputs/PR28438/a.h
 cfe/trunk/test/Modules/Inputs/PR28438/b1.h
 cfe/trunk/test/Modules/Inputs/PR28438/b2.h
 cfe/trunk/test/Modules/Inputs/PR28438/module.modulemap
 cfe/trunk/test/Modules/pr28438.cpp
Modified:
 cfe/trunk/include/clang/Lex/Preprocessor.h
 cfe/trunk/lib/Lex/Preprocessor.cpp

Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=279024=279023=279024=diff
==
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Wed Aug 17 20:16:55 2016
@@ -398,6 +398,8 @@ class Preprocessor : public RefCountedBa
  
  ModuleMacroInfo *getModuleInfo(Preprocessor ,

 const IdentifierInfo *II) const {
+  if (II->isOutOfDate())
+PP.updateOutOfDateIdentifier(const_cast(*II));
// FIXME: Find a spare bit on IdentifierInfo and store a
//HasModuleMacros flag.
if (!II->hasMacroDefinition() ||
@@ -653,6 +655,8 @@ class Preprocessor : public RefCountedBa
};
DeserializedMacroInfoChain *DeserialMIChainHead;
  
+  void updateOutOfDateIdentifier(IdentifierInfo ) const;

+
  public:
Preprocessor(IntrusiveRefCntPtr PPOpts,
 DiagnosticsEngine , LangOptions ,
@@ -900,6 +904,8 @@ public:
  
/// \brief Get the list of leaf (non-overridden) module macros for a name.

ArrayRef getLeafModuleMacros(const IdentifierInfo *II) const {
+if (II->isOutOfDate())
+  updateOutOfDateIdentifier(const_cast(*II));
  auto I = LeafModuleMacros.find(II);
  if (I != LeafModuleMacros.end())
return I->second;

Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=279024=279023=279024=diff
==
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Wed Aug 17 20:16:55 2016
@@ -618,6 +618,11 @@ static diag::kind getFutureCompatDiagKin
"Keyword not known to come from a newer Standard or proposed Standard");
  }
  
+void Preprocessor::updateOutOfDateIdentifier(IdentifierInfo ) const {

+  assert(II.isOutOfDate() && "not out of date");
+  getExternalSource()->updateOutOfDateIdentifier(II);
+}
+
  /// HandleIdentifier - This callback is invoked when the lexer reads an
  /// identifier.  This callback looks up the identifier in the map and/or
  /// potentially macro expands it or turns it into a named token (like 'for').
@@ -642,7 +647,7 @@ bool Preprocessor::HandleIdentifier(Toke
  if ( == Ident__VA_ARGS__)
CurrentIsPoisoned = Ident__VA_ARGS__->isPoisoned();
  
-ExternalSource->updateOutOfDateIdentifier(II);

+updateOutOfDateIdentifier(II);
  Identifier.setKind(II.getTokenID());
  
  if ( == Ident__VA_ARGS__)


Added: cfe/trunk/test/Modules/Inputs/PR28438/a.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/PR28438/a.h?rev=279024=auto
==
--- cfe/trunk/test/Modules/Inputs/PR28438/a.h (added)
+++ cfe/trunk/test/Modules/Inputs/PR28438/a.h Wed Aug 17 20:16:55 2016
@@ -0,0 +1 @@
+#define FOO

Added: cfe/trunk/test/Modules/Inputs/PR28438/b1.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/PR28438/b1.h?rev=279024=auto
==
--- cfe/trunk/test/Modules/Inputs/PR28438/b1.h (added)
+++ cfe/trunk/test/Modules/Inputs/PR28438/b1.h Wed Aug 17 20:16:55 2016
@@ -0,0 +1,2 @@
+#define FOO
+#include "a.h"

Added: cfe/trunk/test/Modules/Inputs/PR28438/b2.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/PR28438/b2.h?rev=279024=auto
==
 (empty)

Added: cfe/trunk/test/Modules/Inputs/PR28438/module.modulemap
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/PR28438/module.modulemap?rev=279024=auto
==
--- cfe/trunk/test/Modules/Inputs/PR28438/module.modulemap (added)
+++ cfe/trunk/test/Modules/Inputs/PR28438/module.modulemap Wed Aug 17 20:16:55 
2016
@@ -0,0 

Re: [PATCH] D23602: Port tools/clang-format/git-clang-format to work Python beyond 2.7

2016-08-18 Thread Andreas Bergmeier via cfe-commits
abergmeier-dsfishlabs set the repository for this revision to rL LLVM.
abergmeier-dsfishlabs updated this revision to Diff 68488.
abergmeier-dsfishlabs added a comment.

Proper patch of last version (hopefully)


Repository:
  rL LLVM

https://reviews.llvm.org/D23602

Files:
  tools/clang-format/git-clang-format

Index: tools/clang-format/git-clang-format
===
--- tools/clang-format/git-clang-format
+++ tools/clang-format/git-clang-format
@@ -20,9 +20,11 @@
 For further details, run:
 git clang-format -h  
  
-Requires Python 2.7  
+Requires a minimum of Python 2.7 
 """   
 
+from __future__ import print_function
+
 import argparse
 import collections
 import contextlib
@@ -128,15 +130,15 @@
   if opts.verbose >= 1:
 ignored_files.difference_update(changed_lines)
 if ignored_files:
-  print 'Ignoring changes in the following files (wrong extension):'
+  print('Ignoring changes in the following files (wrong extension):')
   for filename in ignored_files:
-print '   ', filename
+print('   ', filename)
 if changed_lines:
-  print 'Running clang-format on the following files:'
+  print('Running clang-format on the following files:')
   for filename in changed_lines:
-print '   ', filename
+print('   ', filename)
   if not changed_lines:
-print 'no modified files to format'
+print('no modified files to format')
 return
   # The computed diff outputs absolute paths, so we must cd before accessing
   # those files.
@@ -146,20 +148,20 @@
binary=opts.binary,
style=opts.style)
   if opts.verbose >= 1:
-print 'old tree:', old_tree
-print 'new tree:', new_tree
+print('old tree:', old_tree)
+print('new tree:', new_tree)
   if old_tree == new_tree:
 if opts.verbose >= 0:
-  print 'clang-format did not modify any files'
+  print('clang-format did not modify any files')
   elif opts.diff:
 print_diff(old_tree, new_tree)
   else:
 changed_files = apply_changes(old_tree, new_tree, force=opts.force,
   patch_mode=opts.patch)
 if (opts.verbose >= 0 and not opts.patch) or opts.verbose >= 1:
-  print 'changed files:'
+  print('changed files:')
   for filename in changed_files:
-print '   ', filename
+print('   ', filename)
 
 
 def load_git_config(non_string_options=None):
@@ -323,7 +325,7 @@
 
   Returns the object ID (SHA-1) of the created tree."""
   def index_info_generator():
-for filename, line_ranges in changed_lines.iteritems():
+for filename, line_ranges in changed_lines.items():
   mode = oct(os.stat(filename).st_mode)
   blob_id = clang_format_to_blob(filename, line_ranges, binary=binary,
  style=style)
@@ -431,10 +433,10 @@
   if not force:
 unstaged_files = run('git', 'diff-files', '--name-status', *changed_files)
 if unstaged_files:
-  print >>sys.stderr, ('The following files would be modified but '
-   'have unstaged changes:')
-  print >>sys.stderr, unstaged_files
-  print >>sys.stderr, 'Please commit, stage, or stash them first.'
+  print(('The following files would be modified but '
+   'have unstaged changes:'), file=sys.stderr)
+  print(unstaged_files, file=sys.stderr)
+  print('Please commit, stage, or stash them first.', file=sys.stderr)
   sys.exit(2)
   if patch_mode:
 # In patch mode, we could just as well create an index from the new tree
@@ -464,20 +466,20 @@
   if p.returncode == 0:
 if stderr:
   if verbose:
-print >>sys.stderr, '`%s` printed to stderr:' % ' '.join(args)
-  print >>sys.stderr, stderr.rstrip()
+print('`%s` printed to stderr:' % ' '.join(args), file=sys.stderr)
+  print(stderr.rstrip(), file=sys.stderr)
 if strip:
   stdout = stdout.rstrip('\r\n')
 return stdout
   if verbose:
-print >>sys.stderr, '`%s` returned %s' % (' '.join(args), p.returncode)
+print('`%s` returned %s' % (' '.join(args), p.returncode), file=sys.stderr)
   if stderr:
-print >>sys.stderr, stderr.rstrip()
+print(stderr.rstrip(), file=sys.stderr)
   sys.exit(2)
 
 
 def die(message):
-  print >>sys.stderr, 'error:', message
+  print('error:', message, file=sys.stderr)
   sys.exit(2)
 
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23602: Port tools/clang-format/git-clang-format to work Python beyond 2.7

2016-08-18 Thread Andreas Bergmeier via cfe-commits
abergmeier-dsfishlabs removed rL LLVM as the repository for this revision.
abergmeier-dsfishlabs updated this revision to Diff 68487.
abergmeier-dsfishlabs added a comment.

Removed unnecessary list conversion.


https://reviews.llvm.org/D23602

Files:
  tools/clang-format/git-clang-format

Index: tools/clang-format/git-clang-format
===
--- tools/clang-format/git-clang-format
+++ tools/clang-format/git-clang-format
@@ -20,9 +20,11 @@
 For further details, run:
 git clang-format -h  
  
-Requires Python 2.7  
+Requires a minimum of Python 2.7 
 """   
 
+from __future__ import print_function
+
 import argparse
 import collections
 import contextlib
@@ -128,15 +130,15 @@
   if opts.verbose >= 1:
 ignored_files.difference_update(changed_lines)
 if ignored_files:
-  print 'Ignoring changes in the following files (wrong extension):'
+  print('Ignoring changes in the following files (wrong extension):')
   for filename in ignored_files:
-print '   ', filename
+print('   ', filename)
 if changed_lines:
-  print 'Running clang-format on the following files:'
+  print('Running clang-format on the following files:')
   for filename in changed_lines:
-print '   ', filename
+print('   ', filename)
   if not changed_lines:
-print 'no modified files to format'
+print('no modified files to format')
 return
   # The computed diff outputs absolute paths, so we must cd before accessing
   # those files.
@@ -146,20 +148,20 @@
binary=opts.binary,
style=opts.style)
   if opts.verbose >= 1:
-print 'old tree:', old_tree
-print 'new tree:', new_tree
+print('old tree:', old_tree)
+print('new tree:', new_tree)
   if old_tree == new_tree:
 if opts.verbose >= 0:
-  print 'clang-format did not modify any files'
+  print('clang-format did not modify any files')
   elif opts.diff:
 print_diff(old_tree, new_tree)
   else:
 changed_files = apply_changes(old_tree, new_tree, force=opts.force,
   patch_mode=opts.patch)
 if (opts.verbose >= 0 and not opts.patch) or opts.verbose >= 1:
-  print 'changed files:'
+  print('changed files:')
   for filename in changed_files:
-print '   ', filename
+print('   ', filename)
 
 
 def load_git_config(non_string_options=None):
@@ -323,7 +325,7 @@
 
   Returns the object ID (SHA-1) of the created tree."""
   def index_info_generator():
-for filename, line_ranges in changed_lines.iteritems():
+for filename, line_ranges in changed_lines.items():
   mode = oct(os.stat(filename).st_mode)
   blob_id = clang_format_to_blob(filename, line_ranges, binary=binary,
  style=style)
@@ -431,10 +433,10 @@
   if not force:
 unstaged_files = run('git', 'diff-files', '--name-status', *changed_files)
 if unstaged_files:
-  print >>sys.stderr, ('The following files would be modified but '
-   'have unstaged changes:')
-  print >>sys.stderr, unstaged_files
-  print >>sys.stderr, 'Please commit, stage, or stash them first.'
+  print(('The following files would be modified but '
+   'have unstaged changes:'), file=sys.stderr)
+  print(unstaged_files, file=sys.stderr)
+  print('Please commit, stage, or stash them first.', file=sys.stderr)
   sys.exit(2)
   if patch_mode:
 # In patch mode, we could just as well create an index from the new tree
@@ -464,20 +466,20 @@
   if p.returncode == 0:
 if stderr:
   if verbose:
-print >>sys.stderr, '`%s` printed to stderr:' % ' '.join(args)
-  print >>sys.stderr, stderr.rstrip()
+print('`%s` printed to stderr:' % ' '.join(args), file=sys.stderr)
+  print(stderr.rstrip(), file=sys.stderr)
 if strip:
   stdout = stdout.rstrip('\r\n')
 return stdout
   if verbose:
-print >>sys.stderr, '`%s` returned %s' % (' '.join(args), p.returncode)
+print('`%s` returned %s' % (' '.join(args), p.returncode), file=sys.stderr)
   if stderr:
-print >>sys.stderr, stderr.rstrip()
+print(stderr.rstrip(), file=sys.stderr)
   sys.exit(2)
 
 
 def die(message):
-  print >>sys.stderr, 'error:', message
+  print('error:', message, file=sys.stderr)
   sys.exit(2)
 
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r279035 - [Driver] Use llvm-config.h, not config.h to unbreak out-of-tree builds

2016-08-18 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Thu Aug 18 01:43:07 2016
New Revision: 279035

URL: http://llvm.org/viewvc/llvm-project?rev=279035=rev
Log:
[Driver] Use llvm-config.h, not config.h to unbreak out-of-tree builds

llvm/Config/config.h has intentionally been excluded from llvm
installations (see: llvm/CMakeLists.txt). Un-break out-of-tree builds
post-r278882 by switching to llvm-config.h, which is exported.

Suggested by Will Dietz!

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

Modified: cfe/trunk/tools/driver/cc1_main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=279035=279034=279035=diff
==
--- cfe/trunk/tools/driver/cc1_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1_main.cpp Thu Aug 18 01:43:07 2016
@@ -25,7 +25,7 @@
 #include "clang/Frontend/Utils.h"
 #include "clang/FrontendTool/Utils.h"
 #include "llvm/ADT/Statistic.h"
-#include "llvm/Config/config.h"
+#include "llvm/Config/llvm-config.h"
 #include "llvm/LinkAllPasses.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/OptTable.h"


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


Re: r278882 - If possible, set the stack rlimit to at least 8MiB on cc1 startup, and work

2016-08-18 Thread Vedant Kumar via cfe-commits
Done in clang/r279035.

thanks,
vedant

> On Aug 17, 2016, at 7:43 AM, Will Dietz via cfe-commits 
>  wrote:
> 
> (Seems to fix the build here, FWIW.  If sounds reasonable can someone commit 
> this? Thanks!)
> 
> ~Will
> 
> On Wed, Aug 17, 2016 at 9:39 AM Will Dietz  wrote:
> This is the first use of "llvm/Config/config.h" in the clang tree, which 
> breaks out-of-tree builds for me (since llvm's config.h isn't installed).
> 
> Would using "llvm/Config/llvm-config.h" suffice instead? I'm trying that 
> now...
> 
> ~Will
> 
> On Wed, Aug 17, 2016 at 8:36 AM Joerg Sonnenberger via cfe-commits 
>  wrote:
> On Wed, Aug 17, 2016 at 01:05:08AM -, Richard Smith via cfe-commits wrote:
> > Author: rsmith
> > Date: Tue Aug 16 20:05:07 2016
> > New Revision: 278882
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=278882=rev
> > Log:
> > If possible, set the stack rlimit to at least 8MiB on cc1 startup, and work
> > around a Linux kernel bug where the actual amount of available stack may be 
> > a
> > *lot* lower than the rlimit.
> 
> Can you please restrict this to Linux? I'm quite opposed to overriding
> system default limits, they exist for a reason.
> 
> Joerg
> ___
> 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

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


Re: [PATCH] D23602: Port tools/clang-format/git-clang-format to work Python beyond 2.7

2016-08-18 Thread Vedant Kumar via cfe-commits
vsk added a subscriber: vsk.


Comment at: tools/clang-format/git-clang-format:303
@@ -300,3 +302,3 @@
   allowed_extensions = frozenset(allowed_extensions)
-  for filename in dictionary.keys():
+  for filename in list(dictionary.keys()):
 base_ext = filename.rsplit('.', 1)

Why is this change needed (i.e: is there a functional difference between a list 
vs. a dict_keys here)?


Repository:
  rL LLVM

https://reviews.llvm.org/D23602



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


r279034 - Remove debugging aids from this test and fix its expectations.

2016-08-18 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Aug 18 01:15:19 2016
New Revision: 279034

URL: http://llvm.org/viewvc/llvm-project?rev=279034=rev
Log:
Remove debugging aids from this test and fix its expectations.

Modified:
cfe/trunk/test/Modules/pr28438.cpp

Modified: cfe/trunk/test/Modules/pr28438.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/pr28438.cpp?rev=279034=279033=279034=diff
==
--- cfe/trunk/test/Modules/pr28438.cpp (original)
+++ cfe/trunk/test/Modules/pr28438.cpp Thu Aug 18 01:15:19 2016
@@ -4,6 +4,4 @@
 #include "a.h"
 #include "b2.h"
 
-#pragma clang __debug macro FOO
-
-FOO // xpected-no-diagnostics
+FOO // expected-no-diagnostics


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


<    1   2