RE: r278483 - This patch implements PR#22821.

2016-10-03 Thread Roger Ferrer Ibanez via cfe-commits
Hi Joerg,

thanks for your comments. I agree that these false positives are annoying.

I submitted a while ago a patch to address those false positives in 
https://reviews.llvm.org/D23657 but it is pending approval.

Kind regards,
Roger

> -Original Message-
> From: Joerg Sonnenberger [mailto:jo...@bec.de]
> Sent: 02 October 2016 07:24
> To: cfe-commits@lists.llvm.org
> Cc: Roger Ferrer Ibanez
> Subject: Re: r278483 - This patch implements PR#22821.
> 
> On Sat, Oct 01, 2016 at 11:28:39PM +0200, Joerg Sonnenberger via cfe-
> commits wrote:
> > On Fri, Aug 12, 2016 at 08:04:13AM -, Roger Ferrer Ibanez via cfe-
> commits wrote:
> > > Author: rogfer01
> > > Date: Fri Aug 12 03:04:13 2016
> > > New Revision: 278483
> > >
> > > URL: http://llvm.org/viewvc/llvm-project?rev=278483&view=rev
> > > Log:
> > > This patch implements PR#22821.
> > >
> > > Taking the address of a packed member is dangerous since the reduced
> > > alignment of the pointee is lost. This can lead to memory alignment
> > > faults in some architectures if the pointer value is dereferenced.
> >
> > This triggers on LVM in a rather obvious false positive:
> >
> > (uintptr_t) &lh->offset_xl
> >
> > Given that one correct use case is to take the address and cast it to
> > void * (or uintptr_t) for use without caring about alignment, the
> > warning clearly needs to be refined.
> 
> Looking more at it, I request this warning to be disabled by default. In
> the current form it is useless and just makes it impossible to use
> packed structures at all. Before reenabling, it should handling:
> (1) Assignment to pointer with reduced alignment
> (2) Casts to pointer with reduced alignment
> (3) Use as function argument with implicit cast like (2).
> 
> at the very least to cover normal use of packed member pointers.
> 
> Joerg

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


[PATCH] D25131: Fix PR 28885: Fix AST Printer output for inheriting constructor using declarations

2016-10-03 Thread Alex Lorenz via cfe-commits
arphaman added a comment.

In https://reviews.llvm.org/D25131#558004, @rsmith wrote:

> Minor comment, otherwise LGTM.


This makes sense, thanks for pointing it out!
I'll update the comment when I commit.


Repository:
  rL LLVM

https://reviews.llvm.org/D25131



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


r283092 - [analyzer] Extend bug reports with extra notes

2016-10-03 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Mon Oct  3 02:58:26 2016
New Revision: 283092

URL: http://llvm.org/viewvc/llvm-project?rev=283092&view=rev
Log:
[analyzer] Extend bug reports with extra notes

These diagnostics are separate from the path-sensitive engine's path notes,
and can be added manually on top of path-sensitive or path-insensitive reports.

The new note diagnostics would appear as note:-diagnostic on console and
as blue bubbles in scan-build. In plist files they currently do not appear,
because format needs to be discussed with plist file users.

The analyzer option "-analyzer-config notes-as-events=true" would convert
notes to normal path notes, and put them at the beginning of the path.
This is a temporary hack to show the new notes in plist files.

A few checkers would be updated in subsequent commits,
including tests for this new feature.

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

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h?rev=283092&r1=283091&r2=283092&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h Mon Oct  3 
02:58:26 2016
@@ -266,6 +266,9 @@ private:
   /// \sa shouldWidenLoops
   Optional WidenLoops;
 
+  /// \sa shouldDisplayNotesAsEvents
+  Optional DisplayNotesAsEvents;
+
   /// A helper function that retrieves option for a given full-qualified
   /// checker name.
   /// Options for checkers can be specified via 'analyzer-config' command-line
@@ -534,6 +537,14 @@ public:
   /// This is controlled by the 'widen-loops' config option.
   bool shouldWidenLoops();
 
+  /// Returns true if the bug reporter should transparently treat extra note
+  /// diagnostic pieces as event diagnostic pieces. Useful when the diagnostic
+  /// consumer doesn't support the extra note pieces.
+  ///
+  /// This is controlled by the 'notes-as-events' option, which defaults
+  /// to false when unset.
+  bool shouldDisplayNotesAsEvents();
+
 public:
   AnalyzerOptions() :
 AnalysisStoreOpt(RegionStoreModel),

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283092&r1=283091&r2=283092&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h Mon 
Oct  3 02:58:26 2016
@@ -66,6 +66,8 @@ public:
   typedef SmallVector, 8> VisitorList;
   typedef VisitorList::iterator visitor_iterator;
   typedef SmallVector ExtraTextList;
+  typedef SmallVector, 4>
+  NoteList;
 
 protected:
   friend class BugReporter;
@@ -82,7 +84,8 @@ protected:
   const ExplodedNode *ErrorNode;
   SmallVector Ranges;
   ExtraTextList ExtraText;
-  
+  NoteList Notes;
+
   typedef llvm::DenseSet Symbols;
   typedef llvm::DenseSet Regions;
 
@@ -177,6 +180,18 @@ public:
   const BugType& getBugType() const { return BT; }
   BugType& getBugType() { return BT; }
 
+  /// \brief True when the report has an execution path associated with it.
+  ///
+  /// A report is said to be path-sensitive if it was thrown against a
+  /// particular exploded node in the path-sensitive analysis graph.
+  /// Path-sensitive reports have their intermediate path diagnostics
+  /// auto-generated, perhaps with the help of checker-defined visitors,
+  /// and may contain extra notes.
+  /// Path-insensitive reports consist only of a single warning message
+  /// in a specific location, and perhaps extra notes.
+  /// Path-sensitive checkers are allowed to throw path-insensitive reports.
+  bool isPathSensitive() const { return ErrorNode != nullptr; }
+
   const ExplodedNode *getErrorNode() const { return ErrorNode; }
 
   StringRef getDescription() const { return Description; }
@@ -245,7 +260,27 @@ public:
   void setDeclWithIssue(const Decl *declWithIssue) {
 DeclWithIssue = declWithIssue;
   }
-  
+
+  /// Add new item to the list of additional notes that need to be attached to
+  /// this path-insen

[PATCH] D25161: [cmake] Install 'clang-cpp' symlink

2016-10-03 Thread Michał Górny via cfe-commits
mgorny closed this revision.
mgorny added a comment.

I'm going to close this manually since it seems that Phabricator commit 
processing is stuck somehow.


https://reviews.llvm.org/D25161



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


r283093 - [analyzer] Add extra notes to ObjCDeallocChecker

2016-10-03 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Mon Oct  3 03:03:51 2016
New Revision: 283093

URL: http://llvm.org/viewvc/llvm-project?rev=283093&view=rev
Log:
[analyzer] Add extra notes to ObjCDeallocChecker

The report is now highlighting instance variables and properties
referenced by the warning message with the help of the
extra notes feature recently introduced in r283092.

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

Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
cfe/trunk/test/Analysis/DeallocMissingRelease.m
cfe/trunk/test/Analysis/PR2978.m
cfe/trunk/test/Analysis/properties.m

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp?rev=283093&r1=283092&r2=283093&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp Mon Oct  3 
03:03:51 2016
@@ -107,6 +107,9 @@ class ObjCDeallocChecker
   std::unique_ptr ExtraReleaseBugType;
   std::unique_ptr MistakenDeallocBugType;
 
+  static constexpr const char *MsgDeclared = "Property is declared here";
+  static constexpr const char *MsgSynthesized = "Property is synthesized here";
+
 public:
   ObjCDeallocChecker();
 
@@ -128,6 +131,9 @@ public:
   void checkEndFunction(CheckerContext &Ctx) const;
 
 private:
+  void addNoteForDecl(std::unique_ptr &BR, StringRef Msg,
+   const Decl *D) const;
+
   void diagnoseMissingReleases(CheckerContext &C) const;
 
   bool diagnoseExtraRelease(SymbolRef ReleasedValue, const ObjCMethodCall &M,
@@ -489,6 +495,18 @@ ProgramStateRef ObjCDeallocChecker::chec
   return State;
 }
 
+/// Add an extra note piece describing a declaration that is important
+/// for understanding the bug report.
+void ObjCDeallocChecker::addNoteForDecl(std::unique_ptr &BR,
+ StringRef Msg,
+ const Decl *D) const {
+  ASTContext &ACtx = D->getASTContext();
+  SourceManager &SM = ACtx.getSourceManager();
+  PathDiagnosticLocation Pos = PathDiagnosticLocation::createBegin(D, SM);
+  if (Pos.isValid() && Pos.asLocation().isValid())
+BR->addNote(Msg, Pos, D->getSourceRange());
+}
+
 /// Report any unreleased instance variables for the current instance being
 /// dealloced.
 void ObjCDeallocChecker::diagnoseMissingReleases(CheckerContext &C) const {
@@ -586,6 +604,9 @@ void ObjCDeallocChecker::diagnoseMissing
 std::unique_ptr BR(
 new BugReport(*MissingReleaseBugType, OS.str(), ErrNode));
 
+addNoteForDecl(BR, MsgDeclared, PropDecl);
+addNoteForDecl(BR, MsgSynthesized, PropImpl);
+
 C.emitReport(std::move(BR));
   }
 
@@ -689,11 +710,12 @@ bool ObjCDeallocChecker::diagnoseExtraRe
  );
 
   const ObjCImplDecl *Container = 
getContainingObjCImpl(C.getLocationContext());
-  OS << "The '" << *PropImpl->getPropertyIvarDecl()
- << "' ivar in '" << *Container;
+  const ObjCIvarDecl *IvarDecl = PropImpl->getPropertyIvarDecl();
+  OS << "The '" << *IvarDecl << "' ivar in '" << *Container;
 
+  bool ReleasedByCIFilterDealloc = isReleasedByCIFilterDealloc(PropImpl);
 
-  if (isReleasedByCIFilterDealloc(PropImpl)) {
+  if (ReleasedByCIFilterDealloc) {
 OS << "' will be released by '-[CIFilter dealloc]' but also released here";
   } else {
 OS << "' was synthesized for ";
@@ -710,6 +732,10 @@ bool ObjCDeallocChecker::diagnoseExtraRe
   new BugReport(*ExtraReleaseBugType, OS.str(), ErrNode));
   BR->addRange(M.getOriginExpr()->getSourceRange());
 
+  addNoteForDecl(BR, MsgDeclared, PropDecl);
+  if (!ReleasedByCIFilterDealloc)
+addNoteForDecl(BR, MsgSynthesized, PropImpl);
+
   C.emitReport(std::move(BR));
 
   return true;

Modified: cfe/trunk/test/Analysis/DeallocMissingRelease.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/DeallocMissingRelease.m?rev=283093&r1=283092&r2=283093&view=diff
==
--- cfe/trunk/test/Analysis/DeallocMissingRelease.m (original)
+++ cfe/trunk/test/Analysis/DeallocMissingRelease.m Mon Oct  3 03:03:51 2016
@@ -80,6 +80,9 @@
 
 @interface MyPropertyClass1 : NSObject
 @property (copy) NSObject *ivar;
+#if NON_ARC
+// expected-note@-2 {{Property is declared here}}
+#endif
 @end
 
 @implementation MyPropertyClass1
@@ -93,6 +96,9 @@
 
 @interface MyPropertyClass2 : NSObject
 @property (retain) NSObject *ivar;
+#if NON_ARC
+// expected-note@-2 {{Property is declared here}}
+#endif
 @end
 
 @implementation MyPropertyClass2
@@ -108,10 +114,16 @@
   NSObject *_ivar;
 }
 @property (retain) NSObject *ivar;
+#if NON_ARC
+// expected-note@-2 {{Property is declared here}}
+#endif
 @end
 
 @implementation MyPropertyClass3
 @synthesize ivar = _ivar;
+#if NON_ARC
+// expected-note@-2 {{Propert

r283094 - [analyzer] Improve CloneChecker diagnostics

2016-10-03 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Mon Oct  3 03:11:50 2016
New Revision: 283094

URL: http://llvm.org/viewvc/llvm-project?rev=283094&view=rev
Log:
[analyzer] Improve CloneChecker diagnostics

Highlight code clones referenced by the warning message with the help of
the extra notes feature recently introduced in r283092.

Change warning text to more clang-ish. Remove suggestions from the copy-paste
error checker diagnostics, because currently our suggestions are strictly 50%
wrong (we do not know which of the two code clones contains the error), and
for that reason we should not sound as if we're actually suggesting this.
Hopefully a better solution would bring them back.

Make sure the suspicious clone pair structure always mentions
the correct variable for the second clone.

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

Added:
cfe/trunk/test/Analysis/copypaste/plist-diagnostics-notes-as-events.cpp
cfe/trunk/test/Analysis/copypaste/plist-diagnostics.cpp
cfe/trunk/test/Analysis/copypaste/text-diagnostics.cpp
Modified:
cfe/trunk/include/clang/Analysis/CloneDetection.h
cfe/trunk/lib/Analysis/CloneDetection.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/CloneChecker.cpp
cfe/trunk/test/Analysis/copypaste/blocks.cpp
cfe/trunk/test/Analysis/copypaste/function-try-block.cpp
cfe/trunk/test/Analysis/copypaste/functions.cpp
cfe/trunk/test/Analysis/copypaste/macro-complexity.cpp
cfe/trunk/test/Analysis/copypaste/macros.cpp
cfe/trunk/test/Analysis/copypaste/objc-methods.m
cfe/trunk/test/Analysis/copypaste/sub-sequences.cpp
cfe/trunk/test/Analysis/copypaste/suspicious-clones.cpp

Modified: cfe/trunk/include/clang/Analysis/CloneDetection.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CloneDetection.h?rev=283094&r1=283093&r2=283094&view=diff
==
--- cfe/trunk/include/clang/Analysis/CloneDetection.h (original)
+++ cfe/trunk/include/clang/Analysis/CloneDetection.h Mon Oct  3 03:11:50 2016
@@ -128,6 +128,10 @@ public:
   /// This method should only be called on a non-empty StmtSequence object.
   SourceLocation getEndLoc() const;
 
+  /// Returns the source range of the whole sequence - from the beginning
+  /// of the first statement to the end of the last statement.
+  SourceRange getSourceRange() const;
+
   bool operator==(const StmtSequence &Other) const {
 return std::tie(S, StartIndex, EndIndex) ==
std::tie(Other.S, Other.StartIndex, Other.EndIndex);
@@ -250,14 +254,14 @@ public:
   /// The variable which referencing in this clone was against the pattern.
   const VarDecl *Variable;
   /// Where the variable was referenced.
-  SourceRange VarRange;
+  const Stmt *Mention;
   /// The variable that should have been referenced to follow the pattern.
   /// If Suggestion is a nullptr then it's not possible to fix the pattern
   /// by referencing a different variable in this clone.
   const VarDecl *Suggestion;
-  SuspiciousCloneInfo(const VarDecl *Variable, SourceRange Range,
+  SuspiciousCloneInfo(const VarDecl *Variable, const Stmt *Mention,
   const VarDecl *Suggestion)
-  : Variable(Variable), VarRange(Range), Suggestion(Suggestion) {}
+  : Variable(Variable), Mention(Mention), Suggestion(Suggestion) {}
   SuspiciousCloneInfo() {}
 };
 /// The first clone in the pair which always has a suggested variable.

Modified: cfe/trunk/lib/Analysis/CloneDetection.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CloneDetection.cpp?rev=283094&r1=283093&r2=283094&view=diff
==
--- cfe/trunk/lib/Analysis/CloneDetection.cpp (original)
+++ cfe/trunk/lib/Analysis/CloneDetection.cpp Mon Oct  3 03:11:50 2016
@@ -82,6 +82,10 @@ SourceLocation StmtSequence::getStartLoc
 
 SourceLocation StmtSequence::getEndLoc() const { return back()->getLocEnd(); }
 
+SourceRange StmtSequence::getSourceRange() const {
+  return SourceRange(getStartLoc(), getEndLoc());
+}
+
 namespace {
 
 /// \brief Analyzes the pattern of the referenced variables in a statement.
@@ -91,11 +95,11 @@ class VariablePattern {
   struct VariableOccurence {
 /// The index of the associated VarDecl in the Variables vector.
 size_t KindID;
-/// The source range in the code where the variable was referenced.
-SourceRange Range;
+/// The statement in the code where the variable was referenced.
+const Stmt *Mention;
 
-VariableOccurence(size_t KindID, SourceRange Range)
-: KindID(KindID), Range(Range) {}
+VariableOccurence(size_t KindID, const Stmt *Mention)
+: KindID(KindID), Mention(Mention) {}
   };
 
   /// All occurences of referenced variables in the order of appearance.
@@ -107,19 +111,19 @@ class VariablePattern {
   /// \brief Adds a new variable referenced to this pat

r283095 - [StaticAnalyzer] Fix UnreachableCode false positives.

2016-10-03 Thread Daniel Marjamaki via cfe-commits
Author: danielmarjamaki
Date: Mon Oct  3 03:28:51 2016
New Revision: 283095

URL: http://llvm.org/viewvc/llvm-project?rev=283095&view=rev
Log:
[StaticAnalyzer] Fix UnreachableCode false positives.

When there is 'do { } while (0);' in the code the ExplodedGraph and 
UnoptimizedCFG did not match.

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


Modified:
cfe/trunk/lib/Analysis/CFG.cpp
cfe/trunk/test/Analysis/unreachable-code-path.c

Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=283095&r1=283094&r2=283095&view=diff
==
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Mon Oct  3 03:28:51 2016
@@ -2983,20 +2983,19 @@ CFGBlock *CFGBuilder::VisitDoStmt(DoStmt
 return nullptr;
 }
 
-if (!KnownVal.isFalse()) {
-  // Add an intermediate block between the BodyBlock and the
-  // ExitConditionBlock to represent the "loop back" transition.  Create an
-  // empty block to represent the transition block for looping back to the
-  // head of the loop.
-  // FIXME: Can we do this more efficiently without adding another block?
-  Block = nullptr;
-  Succ = BodyBlock;
-  CFGBlock *LoopBackBlock = createBlock();
-  LoopBackBlock->setLoopTarget(D);
+// Add an intermediate block between the BodyBlock and the
+// ExitConditionBlock to represent the "loop back" transition.  Create an
+// empty block to represent the transition block for looping back to the
+// head of the loop.
+// FIXME: Can we do this more efficiently without adding another block?
+Block = nullptr;
+Succ = BodyBlock;
+CFGBlock *LoopBackBlock = createBlock();
+LoopBackBlock->setLoopTarget(D);
 
+if (!KnownVal.isFalse())
   // Add the loop body entry as a successor to the condition.
   addSuccessor(ExitConditionBlock, LoopBackBlock);
-}
 else
   addSuccessor(ExitConditionBlock, nullptr);
   }

Modified: cfe/trunk/test/Analysis/unreachable-code-path.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/unreachable-code-path.c?rev=283095&r1=283094&r2=283095&view=diff
==
--- cfe/trunk/test/Analysis/unreachable-code-path.c (original)
+++ cfe/trunk/test/Analysis/unreachable-code-path.c Mon Oct  3 03:28:51 2016
@@ -173,3 +173,13 @@ void varDecl(int X) {
   }
 }
 
+// Ensure that ExplodedGraph and unoptimized CFG match.
+void test12(int x) {
+  switch (x) {
+  case 1:
+break; // not unreachable
+  case 2:
+do { } while (0);
+break;
+  }
+}


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


[PATCH] D24759: [RFC][StaticAnalyser] fix unreachable code false positives when block numbers mismatch

2016-10-03 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki closed this revision.
danielmarjamaki added a comment.

r283095


https://reviews.llvm.org/D24759



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


[PATCH] D24933: Enable configuration files in clang

2016-10-03 Thread Serge Pavlov via cfe-commits
sepavloff updated this revision to Diff 73245.
sepavloff added a comment.

Updated path

The patch is aligned with corresponding changes in llvm repository 
(https://reviews.llvm.org/D24926).
Also support of configuration selection for executables line foo-clang is
added.


https://reviews.llvm.org/D24933

Files:
  include/clang/Driver/Driver.h
  lib/Driver/Driver.cpp
  test/Driver/Inputs/config-1.cfg
  test/Driver/Inputs/config-2.cfg
  test/Driver/config-file.c
  test/Driver/config-file2.c
  tools/driver/driver.cpp

Index: tools/driver/driver.cpp
===
--- tools/driver/driver.cpp
+++ tools/driver/driver.cpp
@@ -305,6 +305,28 @@
   return 1;
 }
 
+// Directories searched for configuration specified by option '--config'.
+static const ArrayRef SearchDirs({ "~/.llvm", "/etc/llvm" });
+
+// Directories searched for default configuration.
+static const ArrayRef DefSearchDirs;
+
+static llvm::cl::SearchResult findConfigFileFromProgramName(
+llvm::SmallVectorImpl &ConfigName, StringRef ProgramName) {
+  ConfigName.clear();
+  StringRef PName = llvm::sys::path::stem(ProgramName);
+  size_t Pos = PName.find("-clang");
+  if (Pos != StringRef::npos) {
+ConfigName.append(PName.begin(), PName.begin() + Pos);
+const StringRef Ext(".cfg");
+ConfigName.append(Ext.begin(), Ext.end());
+std::string CName(ConfigName.begin(), ConfigName.size());
+return llvm::cl::findDefaultCfgFile(ConfigName, DefSearchDirs, ProgramName,
+CName);
+  }
+  return llvm::cl::SearchResult::NotSpecified;
+}
+
 int main(int argc_, const char **argv_) {
   llvm::sys::PrintStackTraceOnErrorSignal(argv_[0]);
   llvm::PrettyStackTraceProgram X(argc_, argv_);
@@ -330,6 +352,47 @@
   llvm::BumpPtrAllocator A;
   llvm::StringSaver Saver(A);
 
+  // Try reading options from configuration file.
+  llvm::SmallString<128> ConfigFile;
+
+  // First try config file specified in command line. It has higher priority
+  // than any other way to specify configuration.
+  auto SRes = llvm::cl::findConfigFileFromArgs(ConfigFile, argv, SearchDirs);
+  if (llvm::cl::checkConfigFileSearchResult(SRes, ConfigFile, SearchDirs,
+ProgName))
+return 1;
+
+  // Environment variable has the next priority. It also specifies config file
+  // explicitly.
+  if (SRes == llvm::cl::SearchResult::NotSpecified) {
+SRes = llvm::cl::findConfigFileFromEnv(ConfigFile, "CLANGCFG");
+if (llvm::cl::checkConfigFileSearchResult(SRes, ConfigFile, SearchDirs,
+  ProgName))
+  return 1;
+  }
+
+  // If config file is not specified explicitly, try determine configuration
+  // implicitly. First try deduce configuration from executable. For instance,
+  // file 'armv7l-clang' applies config file 'armv7l.cfg'.
+  if (SRes == llvm::cl::SearchResult::NotSpecified) {
+SRes = findConfigFileFromProgramName(ConfigFile, ProgName);
+if (llvm::cl::checkConfigFileSearchResult(SRes, ConfigFile, DefSearchDirs,
+  ProgName))
+  return 1;
+  }
+
+  // Finally try to find file 'clang.cfg'.
+  if (SRes == llvm::cl::SearchResult::NotSpecified) {
+SRes = llvm::cl::findDefaultCfgFile(ConfigFile, DefSearchDirs, ProgName,
+"clang.cfg");
+if (llvm::cl::checkConfigFileSearchResult(SRes, ConfigFile, DefSearchDirs,
+  ProgName))
+  return 1;
+  }
+
+  if (SRes == llvm::cl::SearchResult::Successful)
+llvm::cl::readConfigFile(ConfigFile, Saver, argv);
+
   // Parse response files using the GNU syntax, unless we're in CL mode. There
   // are two ways to put clang in CL compatibility mode: argv[0] is either
   // clang-cl or cl, or --driver-mode=cl is on the command line. The normal
@@ -446,6 +509,8 @@
   ProcessWarningOptions(Diags, *DiagOpts, /*ReportDiags=*/false);
 
   Driver TheDriver(Path, llvm::sys::getDefaultTargetTriple(), Diags);
+  if (!ConfigFile.empty())
+TheDriver.setConfigFile(ConfigFile.str());
   SetInstallDir(argv, TheDriver, CanonicalPrefixes);
 
   insertTargetAndModeArgs(TargetAndMode.first, TargetAndMode.second, argv,
Index: test/Driver/config-file2.c
===
--- /dev/null
+++ test/Driver/config-file2.c
@@ -0,0 +1,13 @@
+// Due to ln -sf:
+// REQUIRES: shell
+
+// RUN: mkdir -p %t.cfgtest
+// RUN: PWD=`pwd`
+// RUN: cd %t.cfgtest
+// RUN: ln -sf %clang test123-clang
+// RUN: echo "-ferror-limit=666" > test123.cfg
+// RUN: cd $PWD
+// RUN: %t.cfgtest/test123-clang -v -c %s -o - 2>&1 | FileCheck %s
+
+// CHECK: Configuration file:{{.*}}test123.cfg
+// CHECK: -ferror-limit{{.*}}666
Index: test/Driver/config-file.c
===
--- /dev/null
+++ test/Driver/config-file.c
@@ -0,0 +1,30 @@
+// RUN: %clang --config 

[PATCH] D24933: Enable configuration files in clang

2016-10-03 Thread Serge Pavlov via cfe-commits
sepavloff added inline comments.


> mgorny wrote in driver.cpp:334
> 1. I'm not sure if others would agree with me but I think it would be better 
> to move those default paths straight to LLVM. If others tools are to adopt 
> those configuration files, it would only be reasonable to use the same search 
> paths consistently and not repeat them in every tool.
> 
> 2. I think the `/etc` prefix should be made configurable via CMake options. 
> One case that would benefit from this is Gentoo Prefix where the Gentoo 
> system root is located in a subdirectory of /.

It make sense, as it would establish uniform paths. However CommandLine is 
positioned as general purpose library, which can be used by any tool, not only 
llvm ones, so forcing particular paths seems to be too rigid. Besides, 
discussion in mail list demonstrated very diverse opinions, so I would prefer 
flexible solution.

Notion about configurable paths is definitely worth implementing.

> mgorny wrote in driver.cpp:336
> 1. You need to update this, following your update on 
> https://reviews.llvm.org/D24926.
> 2. I think you need to use `clang.cfg` here.

Updated, thank you.

https://reviews.llvm.org/D24933



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


[PATCH] D24909: fix for not copying fp denormal and trapping options.

2016-10-03 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer added a comment.

Ping


https://reviews.llvm.org/D24909



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


r283096 - [StaticAnalyser] Add test case to ensure that unreachable code is found.

2016-10-03 Thread Daniel Marjamaki via cfe-commits
Author: danielmarjamaki
Date: Mon Oct  3 04:45:35 2016
New Revision: 283096

URL: http://llvm.org/viewvc/llvm-project?rev=283096&view=rev
Log:
[StaticAnalyser] Add test case to ensure that unreachable code is found.

https://reviews.llvm.org/D24905


Modified:
cfe/trunk/test/Analysis/unreachable-code-path.c

Modified: cfe/trunk/test/Analysis/unreachable-code-path.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/unreachable-code-path.c?rev=283096&r1=283095&r2=283096&view=diff
==
--- cfe/trunk/test/Analysis/unreachable-code-path.c (original)
+++ cfe/trunk/test/Analysis/unreachable-code-path.c Mon Oct  3 04:45:35 2016
@@ -161,12 +161,23 @@ void testInlined() {
 
 // Don't warn about unreachable VarDecl.
 void dostuff(int*A);
-void varDecl(int X) {
+void varDecl1(int X) {
   switch (X) {
 int A; // No warning here.
   case 1:
 dostuff(&A);
 break;
+  case 2:
+dostuff(&A);
+break;
+  }
+}
+void varDecl2(int X) {
+  switch (X) {
+int A=1; // expected-warning {{never executed}}
+  case 1:
+dostuff(&A);
+break;
   case 2:
 dostuff(&A);
 break;


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


[PATCH] D24905: Fix unreachable code false positive, vardecl in switch

2016-10-03 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment.

In https://reviews.llvm.org/D24905#557573, @dcoughlin wrote:

> Sorry, missed this patch.
>
> I think it would good to add a test to make sure we do warn when the var decl 
> has an initializer, since that will not be executed.
>
>   void varDecl(int X) {
> switch (X) {
>   int A = 12; // We do want a warning here, since the variable will be 
> uninitialized in C (This is not allowed in C++).
> case 1:
>   ...
>   break;
> }
>   }
>


I added such test case with 283096.


Repository:
  rL LLVM

https://reviews.llvm.org/D24905



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


SV: [PATCH] D24861: [Sema] extend Wshift-op-parentheses so it warns for multiplicative operators

2016-10-03 Thread Daniel Marjamäki via cfe-commits
Hello!

Moving it to a subgroup such as -Wparentheses is fine for me. I will look at 
that when I have time. Do you think this warning has an acceptable output then?

Best regards,
Daniel Marjamäki

..
Daniel Marjamäki Senior Engineer
Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden

Mobile: +46 (0)709 12 42 62
E-mail: daniel.marjam...@evidente.se

www.evidente.se


Från: Richard Trieu [rtr...@google.com]
Skickat: den 1 oktober 2016 00:41
Till: reviews+d24861+public+1ab88c6ac93f5...@reviews.llvm.org
Kopia: Daniel Marjamäki; David Blaikie; jo...@netbsd.org; 
bruno.card...@gmail.com; cfe-commits
Ämne: Re: [PATCH] D24861: [Sema] extend Wshift-op-parentheses so it warns for 
multiplicative operators

Currently, this warning is on by default.  As you said, the results you found 
look intentional in many cases, so there is a high false positive rate.  For on 
by default warnings, we expect a high true positive rate and intend for users 
to not disable the warning.  From my analysis on a separate codebase, I found 
less than 10% true positive rate out of 200 warnings.  One option might be to 
move this warning to a subgroup, which would leave it discoverable from either 
-Wall or -Wparentheses, but not have it on by default.

On Wed, Sep 28, 2016 at 4:09 AM, Daniel Marjamäki 
mailto:daniel.marjam...@evidente.se>> wrote:
danielmarjamaki added a comment.

I updated the patch so it does not warn about 'A * B << C'. It's a simple fix. 
I have not made careful measurements but I guess that the performance penalty 
is acceptable.


https://reviews.llvm.org/D24861




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


[PATCH] D24878: ASTImporter: expressions, pt.2

2016-10-03 Thread Gábor Horváth via cfe-commits
xazax.hun added a comment.

The referenced patch was commited. Could you close/abandon this one?


https://reviews.llvm.org/D24878



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


[libcxxabi] r283100 - [CMake] Fix libc++abi standalone cmake build.

2016-10-03 Thread Logan Chien via cfe-commits
Author: logan
Date: Mon Oct  3 06:08:17 2016
New Revision: 283100

URL: http://llvm.org/viewvc/llvm-project?rev=283100&view=rev
Log:
[CMake] Fix libc++abi standalone cmake build.

The cmake files install directory has been changed to
${prefix}/lib/cmake/llvm since r259821.  Searching cmake modules in
${prefix}/share/llvm/cmake will result in fatal errors.

This commit fixes the out-of-tree build by changing the CMake module
search path to: "$(llvm-config --obj-root)/lib/cmake/llvm"

Modified:
libcxxabi/trunk/CMakeLists.txt

Modified: libcxxabi/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=283100&r1=283099&r2=283100&view=diff
==
--- libcxxabi/trunk/CMakeLists.txt (original)
+++ libcxxabi/trunk/CMakeLists.txt Mon Oct  3 06:08:17 2016
@@ -49,7 +49,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
 set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
 set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
 set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source 
tree")
-set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/share/llvm/cmake")
+set(LLVM_CMAKE_PATH 
"${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
 set(LLVM_LIT_PATH "${LLVM_PATH}/utils/lit/lit.py")
   else()
 message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not 
defined. "


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


[PATCH] D24081: [CMake] Fix libc++abi standalone cmake build.

2016-10-03 Thread Logan Chien via cfe-commits
logan closed this revision.
logan added a comment.

Thanks for reviewing.  Committed as rL283100.


https://reviews.llvm.org/D24081



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


[PATCH] D25003: [libcxxabi] [cmake] Update LLVM_CMAKE_PATH following install layout change

2016-10-03 Thread Michał Górny via cfe-commits
mgorny abandoned this revision.
mgorny added a comment.

Independently fixed in rL283100.


https://reviews.llvm.org/D25003



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


[PATCH] D24084: [CMake] Cleanup libunwind lookup code.

2016-10-03 Thread Logan Chien via cfe-commits
logan added a comment.

Ping.  Any further comments?  Or, should we duplicate `` in multiple 
repositories?


https://reviews.llvm.org/D24084



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


r283102 - Fix PR 28885: Fix AST Printer output for the inherited constructor using

2016-10-03 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Mon Oct  3 07:12:03 2016
New Revision: 283102

URL: http://llvm.org/viewvc/llvm-project?rev=283102&view=rev
Log:
Fix PR 28885: Fix AST Printer output for the inherited constructor using
declarations.

This commit ensures that the correct record type is printed out for the
using declarations that represent C++ inherited constructors.
It fixes a regression introduced in r274049 which changed the name that's
stored in the using declarations that correspond to inherited constructors.

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

Modified:
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp

Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=283102&r1=283101&r2=283102&view=diff
==
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Mon Oct  3 07:12:03 2016
@@ -1346,6 +1346,17 @@ void DeclPrinter::VisitUsingDecl(UsingDe
   if (D->hasTypename())
 Out << "typename ";
   D->getQualifier()->print(Out, Policy);
+
+  // Use the correct record name when the using declaration is used for
+  // inheriting constructors.
+  for (const auto *Shadow : D->shadows()) {
+if (const auto *ConstructorShadow =
+dyn_cast(Shadow)) {
+  assert(Shadow->getDeclContext() == ConstructorShadow->getDeclContext());
+  Out << *ConstructorShadow->getNominatedBaseClass();
+  return;
+}
+  }
   Out << *D;
 }
 

Modified: cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp?rev=283102&r1=283101&r2=283102&view=diff
==
--- cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp Mon Oct  3 07:12:03 2016
@@ -43,6 +43,14 @@ template  const char *ope
 // CHECK: const char *PR23120 = operator""_suffix();
 const char *PR23120 = U"𐐷"_suffix;
 
+// PR28885
+struct A {
+  A();
+};
+struct B : A {
+  using A::A; // CHECK:  using A::A;
+};// CHECK-NEXT: };
+
 // CHECK: ;
 ;
 // CHECK-NOT: ;


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


Re: r283102 - Fix PR 28885: Fix AST Printer output for the inherited constructor using

2016-10-03 Thread Alex L via cfe-commits
On 3 October 2016 at 13:12, Alex Lorenz via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: arphaman
> Date: Mon Oct  3 07:12:03 2016
> New Revision: 283102
>
> URL: http://llvm.org/viewvc/llvm-project?rev=283102&view=rev
> Log:
> Fix PR 28885: Fix AST Printer output for the inherited constructor using
> declarations.
>
> This commit ensures that the correct record type is printed out for the
> using declarations that represent C++ inherited constructors.
> It fixes a regression introduced in r274049 which changed the name that's
> stored in the using declarations that correspond to inherited constructors.
>
> Differential Revision: https://reviews.llvm.org/D25131


This was meant to be D25113, I'll revert and recommit.
Sorry about that,
Alex


>
>
> Modified:
> cfe/trunk/lib/AST/DeclPrinter.cpp
> cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp
>
> Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/
> DeclPrinter.cpp?rev=283102&r1=283101&r2=283102&view=diff
> 
> ==
> --- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
> +++ cfe/trunk/lib/AST/DeclPrinter.cpp Mon Oct  3 07:12:03 2016
> @@ -1346,6 +1346,17 @@ void DeclPrinter::VisitUsingDecl(UsingDe
>if (D->hasTypename())
>  Out << "typename ";
>D->getQualifier()->print(Out, Policy);
> +
> +  // Use the correct record name when the using declaration is used for
> +  // inheriting constructors.
> +  for (const auto *Shadow : D->shadows()) {
> +if (const auto *ConstructorShadow =
> +dyn_cast(Shadow)) {
> +  assert(Shadow->getDeclContext() == ConstructorShadow->
> getDeclContext());
> +  Out << *ConstructorShadow->getNominatedBaseClass();
> +  return;
> +}
> +  }
>Out << *D;
>  }
>
>
> Modified: cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> SemaCXX/cxx11-ast-print.cpp?rev=283102&r1=283101&r2=283102&view=diff
> 
> ==
> --- cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp (original)
> +++ cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp Mon Oct  3 07:12:03 2016
> @@ -43,6 +43,14 @@ template  const char *ope
>  // CHECK: const char *PR23120 = operator""_suffix();
>  const char *PR23120 = U"ð  ·"_suffix;
>
> +// PR28885
> +struct A {
> +  A();
> +};
> +struct B : A {
> +  using A::A; // CHECK:  using A::A;
> +};// CHECK-NEXT: };
> +
>  // CHECK: ;
>  ;
>  // CHECK-NOT: ;
>
>
> ___
> 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


[PATCH] D24339: [clang-tidy] Add check 'readability-redundant-member-init'

2016-10-03 Thread Malcolm Parsons via cfe-commits
malcolm.parsons updated this revision to Diff 73260.
malcolm.parsons added a comment.
Herald added a subscriber: modocache.

Don't warn for trivially default constructable members


https://reviews.llvm.org/D24339

Files:
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/ReadabilityTidyModule.cpp
  clang-tidy/readability/RedundantMemberInitCheck.cpp
  clang-tidy/readability/RedundantMemberInitCheck.h
  clang-tidy/utils/TypeTraits.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/readability-redundant-member-init.rst
  test/clang-tidy/readability-redundant-member-init.cpp

Index: test/clang-tidy/readability-redundant-member-init.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-redundant-member-init.cpp
@@ -0,0 +1,162 @@
+// RUN: %check_clang_tidy %s readability-redundant-member-init %t
+
+struct S {
+  S() = default;
+  S(int i) : i(i) {}
+  int i = 1;
+};
+
+struct T {
+  T(int i = 1) : i(i) {}
+  int i;
+};
+
+struct U {
+  int i;
+};
+
+// Initializer calls default constructor
+struct F1 {
+  F1() : f() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'f' is redundant [readability-redundant-member-init]
+  // CHECK-FIXES: F1() {}
+  S f;
+};
+
+// Initializer calls default constructor with default argument
+struct F2 {
+  F2() : f() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'f' is redundant [readability-redundant-member-init]
+  // CHECK-FIXES: F2() {}
+  T f;
+};
+
+// Multiple redundant initializers for same constructor
+struct F3 {
+  F3() : f(), g(1), h() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'f' is redundant [readability-redundant-member-init]
+  // CHECK-MESSAGES: :[[@LINE-2]]:21: warning: initializer for member 'h' is redundant [readability-redundant-member-init]
+  // CHECK-FIXES: F3() : g(1) {}
+  S f, g, h;
+};
+
+// Templated class independent type
+template 
+struct F4 {
+  F4() : f() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'f' is redundant [readability-redundant-member-init]
+  // CHECK-FIXES: F4() {}
+  S f;
+};
+F4 f4i;
+F4 f4s;
+
+// Base class
+struct F5 : S {
+  F5() : S() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for base class 'S' is redundant [readability-redundant-member-init]
+  // CHECK-FIXES: F5() {}
+};
+
+// Constructor call requires cleanup
+struct Cleanup {
+  ~Cleanup() {}
+};
+
+struct UsesCleanup {
+  UsesCleanup(const Cleanup &c = Cleanup()) {}
+};
+
+struct F6 {
+  F6() : uc() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'uc' is redundant [readability-redundant-member-init]
+  // CHECK-FIXES: F6() {}
+  UsesCleanup uc;
+};
+
+// Initializer not written
+struct NF1 {
+  NF1() {}
+  S f;
+};
+
+// Initializer doesn't call default constructor
+struct NF2 {
+  NF2() : f(1) {}
+  S f;
+};
+
+// Initializer calls default constructor without using default argument
+struct NF3 {
+  NF3() : f(1) {}
+  T f;
+};
+
+// Initializer calls default constructor without using default argument
+struct NF4 {
+  NF4() : f(2) {}
+  T f;
+};
+
+// Initializer is zero-initialization
+struct NF5 {
+  NF5() : i() {}
+  int i;
+};
+
+// Initializer is direct-initialization
+struct NF6 {
+  NF6() : i(1) {}
+  int i;
+};
+
+// Initializer is aggregate initialization of struct
+struct NF7 {
+  NF7() : f{} {}
+  U f;
+};
+
+// Initializer is zero-initialization of struct
+struct NF7b {
+  NF7b() : f() {}
+  U f;
+};
+
+// Initializer is aggregate initialization of array
+struct NF8 {
+  NF8() : f{} {}
+  int f[2];
+};
+
+struct NF9 {
+  NF9() : f{} {}
+  S f[2];
+};
+
+// Initializing member of union
+union NF10 {
+  NF10() : s() {}
+  int i;
+  S s;
+};
+
+// Templated class dependent type
+template 
+struct NF11 {
+  NF11() : f() {}
+  V f;
+};
+NF11 nf11i;
+NF11 nf11s;
+
+// Delegating constructor
+class NF12 {
+  NF12() = default;
+  NF12(int) : NF12() {}
+};
+
+// Const member
+struct NF13 {
+  NF13() : f() {}
+  const S f;
+};
Index: docs/clang-tidy/checks/readability-redundant-member-init.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/readability-redundant-member-init.rst
@@ -0,0 +1,20 @@
+.. title:: clang-tidy - readability-redundant-member-init
+
+readability-redundant-member-init
+=
+
+Finds member initializations that are unnecessary because the same default
+constructor would be called if they were not present.
+
+Example:
+
+.. code-block:: c++
+
+  // Explicitly initializing the member s is unnecessary.
+  class Foo {
+  public:
+Foo() : s() {}
+
+  private:
+std::string s;
+  };
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -133,6 +133,7 @@
readability-

r283104 - Revert r283102 (Typo in the phabricator link)

2016-10-03 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Mon Oct  3 07:17:56 2016
New Revision: 283104

URL: http://llvm.org/viewvc/llvm-project?rev=283104&view=rev
Log:
Revert r283102 (Typo in the phabricator link)

Modified:
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp

Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=283104&r1=283103&r2=283104&view=diff
==
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Mon Oct  3 07:17:56 2016
@@ -1346,17 +1346,6 @@ void DeclPrinter::VisitUsingDecl(UsingDe
   if (D->hasTypename())
 Out << "typename ";
   D->getQualifier()->print(Out, Policy);
-
-  // Use the correct record name when the using declaration is used for
-  // inheriting constructors.
-  for (const auto *Shadow : D->shadows()) {
-if (const auto *ConstructorShadow =
-dyn_cast(Shadow)) {
-  assert(Shadow->getDeclContext() == ConstructorShadow->getDeclContext());
-  Out << *ConstructorShadow->getNominatedBaseClass();
-  return;
-}
-  }
   Out << *D;
 }
 

Modified: cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp?rev=283104&r1=283103&r2=283104&view=diff
==
--- cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp Mon Oct  3 07:17:56 2016
@@ -43,14 +43,6 @@ template  const char *ope
 // CHECK: const char *PR23120 = operator""_suffix();
 const char *PR23120 = U"𐐷"_suffix;
 
-// PR28885
-struct A {
-  A();
-};
-struct B : A {
-  using A::A; // CHECK:  using A::A;
-};// CHECK-NEXT: };
-
 // CHECK: ;
 ;
 // CHECK-NOT: ;


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


r283105 - Fix PR 28885: Fix AST Printer output for the inherited constructor using

2016-10-03 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Mon Oct  3 07:22:17 2016
New Revision: 283105

URL: http://llvm.org/viewvc/llvm-project?rev=283105&view=rev
Log:
Fix PR 28885: Fix AST Printer output for the inherited constructor using
declarations.

This commit ensures that the correct record type is printed out for the
using declarations that represent C++ inherited constructors.
It fixes a regression introduced in r274049 which changed the name that's
stored in the using declarations that correspond to inherited constructors.

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

Modified:
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp

Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=283105&r1=283104&r2=283105&view=diff
==
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Mon Oct  3 07:22:17 2016
@@ -1346,6 +1346,17 @@ void DeclPrinter::VisitUsingDecl(UsingDe
   if (D->hasTypename())
 Out << "typename ";
   D->getQualifier()->print(Out, Policy);
+
+  // Use the correct record name when the using declaration is used for
+  // inheriting constructors.
+  for (const auto *Shadow : D->shadows()) {
+if (const auto *ConstructorShadow =
+dyn_cast(Shadow)) {
+  assert(Shadow->getDeclContext() == ConstructorShadow->getDeclContext());
+  Out << *ConstructorShadow->getNominatedBaseClass();
+  return;
+}
+  }
   Out << *D;
 }
 

Modified: cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp?rev=283105&r1=283104&r2=283105&view=diff
==
--- cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp Mon Oct  3 07:22:17 2016
@@ -43,6 +43,14 @@ template  const char *ope
 // CHECK: const char *PR23120 = operator""_suffix();
 const char *PR23120 = U"𐐷"_suffix;
 
+// PR28885
+struct A {
+  A();
+};
+struct B : A {
+  using A::A; // CHECK:  using A::A;
+};// CHECK-NEXT: };
+
 // CHECK: ;
 ;
 // CHECK-NOT: ;


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


[PATCH] D24807: [Serialization] ArrayTypeTraitExpr: serialize sub-expression to avoid keeping it undefined

2016-10-03 Thread Aleksei Sidorin via cfe-commits
a.sidorin abandoned this revision.
a.sidorin added a comment.

Merged into https://reviews.llvm.org/D14326 and committed.


https://reviews.llvm.org/D24807



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


Re: r283102 - Fix PR 28885: Fix AST Printer output for the inherited constructor using

2016-10-03 Thread Alex L via cfe-commits
On 3 October 2016 at 13:23, Alex L  wrote:

>
>
> On 3 October 2016 at 13:12, Alex Lorenz via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: arphaman
>> Date: Mon Oct  3 07:12:03 2016
>> New Revision: 283102
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=283102&view=rev
>> Log:
>> Fix PR 28885: Fix AST Printer output for the inherited constructor using
>> declarations.
>>
>> This commit ensures that the correct record type is printed out for the
>> using declarations that represent C++ inherited constructors.
>> It fixes a regression introduced in r274049 which changed the name that's
>> stored in the using declarations that correspond to inherited
>> constructors.
>>
>> Differential Revision: https://reviews.llvm.org/D25131
>
>
> This was meant to be D25113, I'll revert and recommit.
> Sorry about that,
> Alex
>
>


I ended up looking at the wrong tab, and though that this was meant to be
D25113 (another one my phabricator diff), but the original link is correct.
I re-committed with the right link.
Sorry about all the noise (I just had a bad morning),
Alex



>
>>
>> Modified:
>> cfe/trunk/lib/AST/DeclPrinter.cpp
>> cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp
>>
>> Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPr
>> inter.cpp?rev=283102&r1=283101&r2=283102&view=diff
>> 
>> ==
>> --- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
>> +++ cfe/trunk/lib/AST/DeclPrinter.cpp Mon Oct  3 07:12:03 2016
>> @@ -1346,6 +1346,17 @@ void DeclPrinter::VisitUsingDecl(UsingDe
>>if (D->hasTypename())
>>  Out << "typename ";
>>D->getQualifier()->print(Out, Policy);
>> +
>> +  // Use the correct record name when the using declaration is used for
>> +  // inheriting constructors.
>> +  for (const auto *Shadow : D->shadows()) {
>> +if (const auto *ConstructorShadow =
>> +dyn_cast(Shadow)) {
>> +  assert(Shadow->getDeclContext() == ConstructorShadow->getDeclCont
>> ext());
>> +  Out << *ConstructorShadow->getNominatedBaseClass();
>> +  return;
>> +}
>> +  }
>>Out << *D;
>>  }
>>
>>
>> Modified: cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/
>> cxx11-ast-print.cpp?rev=283102&r1=283101&r2=283102&view=diff
>> 
>> ==
>> --- cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp (original)
>> +++ cfe/trunk/test/SemaCXX/cxx11-ast-print.cpp Mon Oct  3 07:12:03 2016
>> @@ -43,6 +43,14 @@ template  const char *ope
>>  // CHECK: const char *PR23120 = operator""_suffix();
>>  const char *PR23120 = U"ð  ·"_suffix;
>>
>> +// PR28885
>> +struct A {
>> +  A();
>> +};
>> +struct B : A {
>> +  using A::A; // CHECK:  using A::A;
>> +};// CHECK-NEXT: };
>> +
>>  // CHECK: ;
>>  ;
>>  // CHECK-NOT: ;
>>
>>
>> ___
>> 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


[PATCH] D24907: NFC: separate file for fp denormal regression tests

2016-10-03 Thread Hal Finkel via cfe-commits
hfinkel accepted this revision.
hfinkel added a reviewer: hfinkel.
hfinkel added a comment.
This revision is now accepted and ready to land.

This LGTM, although I find "fast-math.c" much easier to read than 
"denormalfpmode.c". How about naming it "denormal-fp-math.c" to match the 
option name?


https://reviews.llvm.org/D24907



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


r283106 - Wdocumentation fix

2016-10-03 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Mon Oct  3 07:37:08 2016
New Revision: 283106

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

Modified:
cfe/trunk/lib/Analysis/CloneDetection.cpp

Modified: cfe/trunk/lib/Analysis/CloneDetection.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CloneDetection.cpp?rev=283106&r1=283105&r2=283106&view=diff
==
--- cfe/trunk/lib/Analysis/CloneDetection.cpp (original)
+++ cfe/trunk/lib/Analysis/CloneDetection.cpp Mon Oct  3 07:37:08 2016
@@ -110,7 +110,7 @@ class VariablePattern {
 
   /// \brief Adds a new variable referenced to this pattern.
   /// \param VarDecl The declaration of the variable that is referenced.
-  /// \param Range The SourceRange where this variable is referenced.
+  /// \param Mention The statement in the code where the variable was 
referenced.
   void addVariableOccurence(const VarDecl *VarDecl, const Stmt *Mention) {
 // First check if we already reference this variable
 for (size_t KindIndex = 0; KindIndex < Variables.size(); ++KindIndex) {


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


[PATCH] D24907: NFC: separate file for fp denormal regression tests

2016-10-03 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer added a comment.

Yes, excellent, I will rename it to denormal-fp-math.c and commit. Thanks for 
reviewing!


https://reviews.llvm.org/D24907



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


[PATCH] D24799: [XRay] Check in Clang whether XRay supports the target when -fxray-instrument is passed

2016-10-03 Thread Serge Rogatch via cfe-commits
rSerge added a comment.

@dberris ,  could you deliver this patch to mainline? Or do we need approval 
from more reviewers?


https://reviews.llvm.org/D24799



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


[PATCH] D24715: [OpenCL] Block captured variables in dynamic parallelism - OpenCL 2.0

2016-10-03 Thread bekket mcclane via cfe-commits
mshockwave removed a reviewer: bader.
mshockwave updated this revision to Diff 73254.
mshockwave added a comment.

@Anastasia
Sorry for late responding, I'd just attach a new version of patch that fixes 
block function use cases as normal lambda functions. But testing code is not 
included in this revision, we're still working on it.

About the questions you asked in the previous comment, I'm going to explain 
them from another aspect: How will one implement __enqueue_kernel_XXX? It might 
be classified into two categories:

1. Library implementation like libclc/libclcxx written in OpenCL-C
2. Implement builtins directly in compiler.

If we choose the first one, which most of people would do regarding its 
simplicity and flexibility, and we want to fetch captured variables inside the 
implementation of __enqueue_kernel_XXX, the possible approach would be:

  void* block_as_voidptr = (void*)arg_child_kernel;
  block_literal_ty *block = (block_literal_ty*)block_as_voidptr;
  block->capA;
  block->capB;

This seems promise, but what exactly `block_literal_ty` looks like? We all know 
that `block_literal_ty` would look similar to:

  typedef struct {
/*
* Fields of block header. 
* e.g. isa, block_descriptor...
*/
  
int capA;
int capB;
...
  } block_literal_ty;

But since we're discussing a static type language, the definition of this 
struct must be known. However, the EXACT appearence of `block_literal_ty` would 
vary among programs, or even functions. That's the thing cap_copy_helper want 
to aid.

Of course there is another library approach: Keep the child kernel's 
invoke_function prototype untouched, pass block_literal variable(in void 
pointer type) as its first function argument. Since instructions for extracting 
captured variables had been generated during the codegen of invoke_function 
body. Also, we don't need to tackle any captured variables inside 
__enqueue_kernel_XXX. 
However, the OpenCL spec says that global address space is the only address 
space shared between parent and child kernel; and the block_literal variable 
itself, is allocated as private(stack) variable in parent kernel. So we need to 
copy the block_literal variable(not its pointer) into some global space. 
Nevertheless, OpenCL doesn't allow dynamic-sized memory in global space, so we 
need to define a block of static size memory, perhaps array, in our library 
implementation. Here is the place might require global memory management since 
static size implies potential risk of running out pre-allocated space.

Regarding the improvement proposed by us which "flatten" captured variables 
into invoke_function argument list and block_literal pointer wouldn't be passed 
as first argument(to invoke_function) anymore. The reason why it doesn't 
require global memory management is that we can retrieve captured variables 
with cap_num field and cap_copy_helper routine INSIDE __enqueue_kernel_XXX and 
passed those captures as arguments to child kernel, rather than saving 
block_literal variable globally and postpone the retrieving actions until 
invoke_function, the child kernel body.


https://reviews.llvm.org/D24715

Files:
  lib/CodeGen/CGBlocks.cpp
  lib/CodeGen/CGBlocks.h
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.h

Index: lib/CodeGen/CodeGenModule.h
===
--- lib/CodeGen/CodeGenModule.h
+++ lib/CodeGen/CodeGenModule.h
@@ -464,6 +464,7 @@
 
   llvm::Type *BlockDescriptorType = nullptr;
   llvm::Type *GenericBlockLiteralType = nullptr;
+  llvm::Type *GenericOCLBlockLiteralType = nullptr;
 
   struct {
 int GlobalUniqueCount;
@@ -768,6 +769,8 @@
   /// The type of a generic block literal.
   llvm::Type *getGenericBlockLiteralType();
 
+  llvm::Type *getGenericOCLBlockLiteralType();
+
   /// Gets the address of a block which requires no captures.
   llvm::Constant *GetAddrOfGlobalBlock(const BlockExpr *BE, const char *);
   
Index: lib/CodeGen/CodeGenFunction.h
===
--- lib/CodeGen/CodeGenFunction.h
+++ lib/CodeGen/CodeGenFunction.h
@@ -288,6 +288,7 @@
 
   const CodeGen::CGBlockInfo *BlockInfo;
   llvm::Value *BlockPointer;
+  bool IsOCLChildKernelInvoke;
 
   llvm::DenseMap LambdaCaptureFields;
   FieldDecl *LambdaThisCaptureField;
@@ -1341,8 +1342,12 @@
 const DeclMapTy &ldm,
 bool IsLambdaConversionToBlock);
 
+  llvm::Constant* GenerateBlockFunctionWrapper(const CGBlockInfo &blockInfo,
+   const llvm::Function *invokeFunc);
+
   llvm::Constant *GenerateCopyHelperFunction(const CGBlockInfo &blockInfo);
   llvm::Constant *GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo);
+  llvm::Constant *GenerateOCLCapturesCopyFunction(const CGBlockInfo &blockInfo);
   llvm::Constant 

[PATCH] D24909: fix for not copying fp denormal and trapping options.

2016-10-03 Thread Hal Finkel via cfe-commits
hfinkel added a comment.

I'm fine with setting these for consistency, but I don't understand why our 
failure to do this would cause problems. If you look in lib/CodeGen/CGCall.cpp 
and you'll see:

  if (!CodeGenOpts.FPDenormalMode.empty())
FuncAttrs.addAttribute("denormal-fp-math",
   CodeGenOpts.FPDenormalMode);
  
  FuncAttrs.addAttribute("no-trapping-math",
 llvm::toStringRef(CodeGenOpts.NoTrappingMath));
  FuncAttrs.addAttribute("no-infs-fp-math",

and the code in TargetMachine::resetTargetOptions in Target/TargetMachine.cpp 
has this:

  RESET_OPTION(NoTrappingFPMath, "no-trapping-math");
  
  StringRef Denormal =
F.getFnAttribute("denormal-fp-math").getValueAsString();
  if (Denormal == "ieee")
Options.FPDenormalType = FPDenormal::IEEE;
  else if (Denormal == "preserve-sign")
Options.FPDenormalType = FPDenormal::PreserveSign;
  else if (Denormal == "positive-zero")
Options.FPDenormalType = FPDenormal::PositiveZero;

so this should all work regardless.

Also, please post your patches with full context. Please see 
http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface 
for instructions.


https://reviews.llvm.org/D24909



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


r283109 - This adds a separate file for the fp denormal regression tests. NFC.

2016-10-03 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Mon Oct  3 08:12:20 2016
New Revision: 283109

URL: http://llvm.org/viewvc/llvm-project?rev=283109&view=rev
Log:
This adds a separate file for the fp denormal regression tests. NFC.

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

Modified:
cfe/trunk/test/Driver/fast-math.c

Modified: cfe/trunk/test/Driver/fast-math.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fast-math.c?rev=283109&r1=283108&r2=283109&view=diff
==
--- cfe/trunk/test/Driver/fast-math.c (original)
+++ cfe/trunk/test/Driver/fast-math.c Mon Oct  3 08:12:20 2016
@@ -234,13 +234,4 @@
 //
 // RUN: %clang -### -ftrapping-math -fno-trapping-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-TRAPPING-MATH %s
-// RUN: %clang -### -fdenormal-fp-math=ieee -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-IEEE %s
-// RUN: %clang -### -fdenormal-fp-math=preserve-sign -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PS %s
-// RUN: %clang -### -fdenormal-fp-math=positive-zero -c %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PZ %s
 // CHECK-NO-TRAPPING-MATH: "-fno-trapping-math"
-// CHECK-FP-DENORMAL-IEEE: "-fdenormal-fp-math=ieee"
-// CHECK-FP-DENORMAL-PS: "-fdenormal-fp-math=preserve-sign"
-// CHECK-FP-DENORMAL-PZ: "-fdenormal-fp-math=positive-zero"


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


r283110 - This adds a separate file for the fp denormal regression tests. NFC.

2016-10-03 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Mon Oct  3 08:13:50 2016
New Revision: 283110

URL: http://llvm.org/viewvc/llvm-project?rev=283110&view=rev
Log:
This adds a separate file for the fp denormal regression tests. NFC.
I forgot to svn add the new file in my previous commit.


Added:
cfe/trunk/test/Driver/denormal-fp-math.c

Added: cfe/trunk/test/Driver/denormal-fp-math.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/denormal-fp-math.c?rev=283110&view=auto
==
--- cfe/trunk/test/Driver/denormal-fp-math.c (added)
+++ cfe/trunk/test/Driver/denormal-fp-math.c Mon Oct  3 08:13:50 2016
@@ -0,0 +1,9 @@
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s
+// RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo 
-v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s
+
+// CHECK-IEEE: "-fdenormal-fp-math=ieee"
+// CHECK-PS: "-fdenormal-fp-math=preserve-sign"
+// CHECK-PZ: "-fdenormal-fp-math=positive-zero"
+// CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo'


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


RE: [llvm-dev] Upgrading phabricator

2016-10-03 Thread Sjoerd Meijer via cfe-commits
Hi,

I just committed to Clang and noticed that the corresponding Phabricator ticket 
does not get automatically closed (I have "Differential Revision:" in my commit 
message and believe I didn't make a typo).
Is it just me, or is this is broken after the upgrade? For committing to LLVM 
this still seems to work.

Cheers,
Sjoerd.


-Original Message-
From: llvm-dev [mailto:llvm-dev-boun...@lists.llvm.org] On Behalf Of Alex 
Bradbury via llvm-dev
Sent: 30 September 2016 15:45
To: Eric Liu
Cc: llvm-dev; Clang Dev; Eric Liu via llvm-commits; cfe-commits
Subject: Re: [llvm-dev] Upgrading phabricator

On 30 September 2016 at 14:21, Eric Liu via llvm-commits 
 wrote:
> Thanks for the feedback Aaron! :)
>
> I've disabled it. I think the annoying part really is the status (e.g.
> Request, Closed etc) in the tag, and I am wondering if a tag with just
> line numbers like "(N Loc)" would be better. But I'm not really sure
> about the trade-off here.

I'd suggest that [PATCH] is a waste of screen real estate too - the `Dn:` 
prefix makes it obvious. I do appreciate there's an argument for having it for 
consistency with people who post patches directly to llvm-commits.

Alex
___
LLVM Developers mailing list
llvm-...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [llvm-dev] Upgrading phabricator

2016-10-03 Thread Michał Górny via cfe-commits
On Mon, 3 Oct 2016 13:47:08 +
Sjoerd Meijer via cfe-commits  wrote:

> I just committed to Clang and noticed that the corresponding Phabricator 
> ticket does not get automatically closed (I have "Differential Revision:" in 
> my commit message and believe I didn't make a typo).
> Is it just me, or is this is broken after the upgrade? For committing to LLVM 
> this still seems to work.

Just to clarify, it seems that Phabricator stopped processing
(receiving?) new commits one or two days ago. However, it used to work
after the upgrade, so that's probably unrelated.

-- 
Best regards,
Michał Górny



pgpDCvljLQbKn.pgp
Description: OpenPGP digital signature
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r283112 - List tentatively ready issues for Issaquah

2016-10-03 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Oct  3 09:23:04 2016
New Revision: 283112

URL: http://llvm.org/viewvc/llvm-project?rev=283112&view=rev
Log:
List tentatively ready issues for Issaquah

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=283112&r1=283111&r2=283112&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Mon Oct  3 09:23:04 2016
@@ -59,79 +59,153 @@
   
Issue #Issue 
NameMeetingStatus
 
-   http://wg21.link/LWG2181";>2181Exceptions 
from seed sequence operationsOulu
-   http://wg21.link/LWG2309";>2309mutex::lock() should not throw 
device_or_resource_busyOuluComplete
-   http://wg21.link/LWG2310";>2310Public 
exposition only member in std::arrayOuluPatch Ready
-   http://wg21.link/LWG2328";>2328Rvalue 
stream extraction should use perfect forwardingOulu
-   http://wg21.link/LWG2393";>2393std::function's Callable 
definition is brokenOulu
-   http://wg21.link/LWG2426";>2426Issue about 
compare_exchangeOulu
-   http://wg21.link/LWG2436";>2436Comparators 
for associative containers should always be 
CopyConstructibleOuluPatch Ready
-   http://wg21.link/LWG2441";>2441Exact-width 
atomic typedefs should be providedOuluPatch Ready
-   http://wg21.link/LWG2451";>2451[fund.ts.v2] optional 
should 'forward' T's implicit conversionsOulu
-   http://wg21.link/LWG2509";>2509[fund.ts.v2] any_cast doesn't 
work with rvalue reference targets and cannot move with a value 
targetOulu
-   http://wg21.link/LWG2516";>2516[fund.ts.v2] Public 
"exposition only" members in observer_ptrOulu
-   http://wg21.link/LWG2542";>2542Missing 
const requirements for associative containersOulu
-   http://wg21.link/LWG2549";>2549Tuple 
EXPLICIT constructor templates that take tuple parameters end up taking 
references to temporaries and will create dangling 
referencesOulu
-   http://wg21.link/LWG2550";>2550Wording of 
unordered container's clear() method 
complexityOuluComplete
-   http://wg21.link/LWG2551";>2551[fund.ts.v2] "Exception 
safety" cleanup in library fundamentals 
requiredOuluComplete
-   http://wg21.link/LWG2555";>2555[fund.ts.v2] No handling for 
over-aligned types in optionalOuluComplete
-   http://wg21.link/LWG2573";>2573[fund.ts.v2] 
std::hash> does not work for 
arraysOulu
-   http://wg21.link/LWG2596";>2596vector::data() should use 
addressofOuluPatch Ready
-   http://wg21.link/LWG2667";>2667path::root_directory() 
description is confusingOulu
-   http://wg21.link/LWG2669";>2669recursive_directory_iterator 
effects refers to non-existent functionsOulu
-   http://wg21.link/LWG2670";>2670system_complete refers to 
undefined variable 'base'Oulu
-   http://wg21.link/LWG2671";>2671Errors in 
CopyOulu
-   http://wg21.link/LWG2673";>2673status() 
effects cannot be implemented as specifiedOulu
-   http://wg21.link/LWG2674";>2674Bidirectional iterator 
requirement on path::iterator is very expensiveOulu
-   http://wg21.link/LWG2683";>2683filesystem::copy() says "no 
effects"Oulu
-   http://wg21.link/LWG2684";>2684priority_queue lacking 
comparator typedefOuluPatch Ready
-   http://wg21.link/LWG2685";>2685shared_ptr 
deleters must not not throw on move 
constructionOuluComplete
-   http://wg21.link/LWG2688";>2688clamp 
misses preconditions and has extraneous condition on 
resultOuluPatch Ready
-   http://wg21.link/LWG2689";>2689Parallel 
versions of std::copy and std::move shouldn't be in 
orderOulu
-   http://wg21.link/LWG2698";>2698Effect of 
assign() on 
iterators/pointers/referencesOuluComplete
-   http://wg21.link/LWG2706";>2706Error 
reporting for recursive_directory_iterator::pop() is 
under-specifiedOulu
-   http://wg21.link/LWG2707";>2707path 
construction and assignment should have "string_type&&" 
overloadsOulu
-   http://wg21.link/LWG2710";>2710"Effects: 
Equivalent to ..." doesn't count "Synchronization:" as determined 
semanticsOuluComplete
+http://wg21.link/LWG2062";>2062Effect 
contradictions w/o no-throw guarantee of std::function 
swapsIssaquah
+http://wg21.link/LWG2166";>2166Heap 
property underspecified?Issaquah
+http://wg21.link/LWG2221";>2221No 
formatted output operator for nullptrIssaquah
+http://wg21.link/LWG2223";>2223shrink_to_fit effect on 
iterator validityIssaquah
+http://wg21.link/LWG2261";>2261Are 
containers required to use their 'pointer' type 
internally?Issaquah
+http://wg21.link/LWG2358";>2358Apparently-bogus definition of 
is_empty type traitIssaquah
+http://wg21.link/LWG2394";>2394locale::name specification 
unclear - what is implementation-defined?Issaquah
+http://wg21.link/LWG2460";>2460LWG issue 
2408 and value categorie

[libcxx] r283113 - Change titie of page from Oulu to Issaquah

2016-10-03 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Oct  3 09:24:21 2016
New Revision: 283113

URL: http://llvm.org/viewvc/llvm-project?rev=283113&view=rev
Log:
Change titie of page from Oulu to Issaquah

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=283113&r1=283112&r2=283113&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Mon Oct  3 09:24:21 2016
@@ -32,11 +32,11 @@
 
 
   
-  libc++ Oulu Status
+  libc++ Issaquah Status
   
 
   This is a temporary page; please check the c++1z status http://libcxx.llvm.org/cxx1z_status.html";>here
-  This page shows the status of the papers and issues that are expected to 
be adopted in Oulu.
+  This page shows the status of the papers and issues that are expected to 
be adopted in Issaquah.
 
   The groups that have contributed papers:
   


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


r283114 - [OpenCL] Fix bug in __builtin_astype causing invalid LLVM cast instructions

2016-10-03 Thread Yaxun Liu via cfe-commits
Author: yaxunl
Date: Mon Oct  3 09:41:50 2016
New Revision: 283114

URL: http://llvm.org/viewvc/llvm-project?rev=283114&view=rev
Log:
[OpenCL] Fix bug in __builtin_astype causing invalid LLVM cast instructions

__builtin_astype is used to cast OpenCL opaque types to other types, as such, 
it needs to be able to handle casting from and to pointer types correctly.

Current it cannot handle 1) casting between pointers of different addr spaces 
2) casting between pointer type and non-pointer types.

This patch fixes that.

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

Modified:
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/test/CodeGenOpenCL/as_type.cl

Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=283114&r1=283113&r2=283114&view=diff
==
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Mon Oct  3 09:41:50 2016
@@ -3407,6 +3407,52 @@ static Value *ConvertVec3AndVec4(CGBuild
   return Builder.CreateShuffleVector(Src, UnV, Mask);
 }
 
+// Create cast instructions for converting LLVM value \p Src to LLVM type \p
+// DstTy. \p Src has the same size as \p DstTy. Both are single value types
+// but could be scalar or vectors of different lengths, and either can be
+// pointer.
+// There are 4 cases:
+// 1. non-pointer -> non-pointer  : needs 1 bitcast
+// 2. pointer -> pointer  : needs 1 bitcast or addrspacecast
+// 3. pointer -> non-pointer
+//   a) pointer -> intptr_t   : needs 1 ptrtoint
+//   b) pointer -> non-intptr_t   : needs 1 ptrtoint then 1 bitcast
+// 4. non-pointer -> pointer
+//   a) intptr_t -> pointer   : needs 1 inttoptr
+//   b) non-intptr_t -> pointer   : needs 1 bitcast then 1 inttoptr
+// Note: for cases 3b and 4b two casts are required since LLVM casts do not
+// allow casting directly between pointer types and non-integer non-pointer
+// types.
+static Value *createCastsForTypeOfSameSize(CGBuilderTy &Builder,
+   const llvm::DataLayout &DL,
+   Value *Src, llvm::Type *DstTy,
+   StringRef Name = "") {
+  auto SrcTy = Src->getType();
+
+  // Case 1.
+  if (!SrcTy->isPointerTy() && !DstTy->isPointerTy())
+return Builder.CreateBitCast(Src, DstTy, Name);
+
+  // Case 2.
+  if (SrcTy->isPointerTy() && DstTy->isPointerTy())
+return Builder.CreatePointerBitCastOrAddrSpaceCast(Src, DstTy, Name);
+
+  // Case 3.
+  if (SrcTy->isPointerTy() && !DstTy->isPointerTy()) {
+// Case 3b.
+if (!DstTy->isIntegerTy())
+  Src = Builder.CreatePtrToInt(Src, DL.getIntPtrType(SrcTy));
+// Cases 3a and 3b.
+return Builder.CreateBitOrPointerCast(Src, DstTy, Name);
+  }
+
+  // Case 4b.
+  if (!SrcTy->isIntegerTy())
+Src = Builder.CreateBitCast(Src, DL.getIntPtrType(DstTy));
+  // Cases 4a and 4b.
+  return Builder.CreateIntToPtr(Src, DstTy, Name);
+}
+
 Value *ScalarExprEmitter::VisitAsTypeExpr(AsTypeExpr *E) {
   Value *Src  = CGF.EmitScalarExpr(E->getSrcExpr());
   llvm::Type *DstTy = ConvertType(E->getType());
@@ -3421,7 +3467,8 @@ Value *ScalarExprEmitter::VisitAsTypeExp
   // vector to get a vec4, then a bitcast if the target type is different.
   if (NumElementsSrc == 3 && NumElementsDst != 3) {
 Src = ConvertVec3AndVec4(Builder, CGF, Src, 4);
-Src = Builder.CreateBitCast(Src, DstTy);
+Src = createCastsForTypeOfSameSize(Builder, CGF.CGM.getDataLayout(), Src,
+   DstTy);
 Src->setName("astype");
 return Src;
   }
@@ -3431,13 +3478,15 @@ Value *ScalarExprEmitter::VisitAsTypeExp
   // get a vec3.
   if (NumElementsSrc != 3 && NumElementsDst == 3) {
 auto Vec4Ty = llvm::VectorType::get(DstTy->getVectorElementType(), 4);
-Src = Builder.CreateBitCast(Src, Vec4Ty);
+Src = createCastsForTypeOfSameSize(Builder, CGF.CGM.getDataLayout(), Src,
+   Vec4Ty);
 Src = ConvertVec3AndVec4(Builder, CGF, Src, 3);
 Src->setName("astype");
 return Src;
   }
 
-  return Builder.CreateBitCast(Src, DstTy, "astype");
+  return Src = createCastsForTypeOfSameSize(Builder, CGF.CGM.getDataLayout(),
+Src, DstTy, "astype");
 }
 
 Value *ScalarExprEmitter::VisitAtomicExpr(AtomicExpr *E) {

Modified: cfe/trunk/test/CodeGenOpenCL/as_type.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/as_type.cl?rev=283114&r1=283113&r2=283114&view=diff
==
--- cfe/trunk/test/CodeGenOpenCL/as_type.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/as_type.cl Mon Oct  3 09:41:50 2016
@@ -66,3 +66,42 @@ char3 f7(char3 x) {
 int3 f8(char16 x) {
   return __builtin_astype(x, int3);
 }
+
+//CHECK: define spir_func i32 addrspace(

[PATCH] D24461: CodeGen: Cast llvm.flt.rounds result to match __builtin_flt_rounds

2016-10-03 Thread Edward Jones via cfe-commits
edward-jones added a comment.

Ping.


https://reviews.llvm.org/D24461



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


Re: r283063 - Alias must point to a definition

2016-10-03 Thread Aditya K via cfe-commits
Thanks for poining that out. I have updated the test case, please see if that 
works.


http://llvm.org/viewvc/llvm-project?view=revision&revision=283085



-Aditya



From: Yaron Keren 
Sent: Sunday, October 2, 2016 11:32 AM
To: Aditya Kumar
Cc: cfe-commits
Subject: Re: r283063 - Alias must point to a definition

The mangling is different when targeting MSVC ABI, see failure at

http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/29889/steps/test_all/logs/Clang%20%3A%3A%20CodeGenCXX__alias-available-externally.cpp

maybe   -triple x86_64-pc-linux  ?

2016-10-02 6:06 GMT+03:00 Aditya Kumar via cfe-commits 
mailto:cfe-commits@lists.llvm.org>>:
Author: hiraditya
Date: Sat Oct  1 22:06:36 2016
New Revision: 283063

URL: http://llvm.org/viewvc/llvm-project?rev=283063&view=rev
Log:
Alias must point to a definition

Reapplying the patch after modifying the test case.

Inlining the destructor caused the compiler to generate bad IR which failed the 
Verifier in the backend.
https://llvm.org/bugs/show_bug.cgi?id=30341

This patch disables alias to available_externally definitions.

Reviewers: eugenis, rsmith

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

Added:
cfe/trunk/test/CodeGenCXX/alias-available-externally.cpp
Modified:
cfe/trunk/lib/CodeGen/CGCXX.cpp

Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=283063&r1=283062&r2=283063&view=diff
==
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Sat Oct  1 22:06:36 2016
@@ -134,6 +134,11 @@ bool CodeGenModule::TryEmitDefinitionAsA
   llvm::GlobalValue::LinkageTypes TargetLinkage =
   getFunctionLinkage(TargetDecl);

+  // available_externally definitions aren't real definitions, so we cannot
+  // create an alias to one.
+  if (TargetLinkage == llvm::GlobalValue::AvailableExternallyLinkage)
+return true;
+
   // Check if we have it already.
   StringRef MangledName = getMangledName(AliasDecl);
   llvm::GlobalValue *Entry = GetGlobalValue(MangledName);
@@ -156,14 +161,7 @@ bool CodeGenModule::TryEmitDefinitionAsA

   // Instead of creating as alias to a linkonce_odr, replace all of the uses
   // of the aliasee.
-  if (llvm::GlobalValue::isDiscardableIfUnused(Linkage) &&
- (TargetLinkage != llvm::GlobalValue::AvailableExternallyLinkage ||
-  !TargetDecl.getDecl()->hasAttr())) {
-// FIXME: An extern template instantiation will create functions with
-// linkage "AvailableExternally". In libc++, some classes also define
-// members with attribute "AlwaysInline" and expect no reference to
-// be generated. It is desirable to reenable this optimisation after
-// corresponding LLVM changes.
+  if (llvm::GlobalValue::isDiscardableIfUnused(Linkage)) {
 addReplacement(MangledName, Aliasee);
 return false;
   }

Added: cfe/trunk/test/CodeGenCXX/alias-available-externally.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/alias-available-externally.cpp?rev=283063&view=auto
==
--- cfe/trunk/test/CodeGenCXX/alias-available-externally.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/alias-available-externally.cpp Sat Oct  1 
22:06:36 2016
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -O1 -std=c++11 -emit-llvm -disable-llvm-passes -o - %s | 
FileCheck %s
+// Clang should not generate alias to available_externally definitions.
+// Check that the destructor of Foo is defined.
+// The destructors have different return type for different targets.
+// CHECK: define linkonce_odr {{.*}} @_ZN3FooD2Ev
+template 
+struct String {
+  String() {}
+  ~String();
+};
+
+template 
+inline __attribute__((visibility("hidden"), always_inline))
+String::~String() {}
+
+extern template struct String;
+
+struct Foo : public String { Foo() { String s; } };
+
+Foo f;


___
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


[PATCH] D25190: [ThinLTO doc] Fix typo

2016-10-03 Thread Davide Italiano via cfe-commits
davide created this revision.
davide added reviewers: mehdi_amini, tejohnson.
davide added a subscriber: cfe-commits.

This looks like an obvious typo to me, but I don't know the whole ThinLTO 
story, so.


https://reviews.llvm.org/D25190

Files:
  clang/docs/ThinLTO.rst


Index: clang/docs/ThinLTO.rst
===
--- clang/docs/ThinLTO.rst
+++ clang/docs/ThinLTO.rst
@@ -140,7 +140,7 @@
   * ``-DCMAKE_C_COMPILER=/path/to/host/clang``
   * ``-DCMAKE_CXX_COMPILER=/path/to/host/clang++``
   * ``-DCMAKE_RANLIB=/path/to/host/llvm-ranlib``
-  * ``-DCMAKE_AR=/path/to/host/llvm-nm``
+  * ``-DCMAKE_AR=/path/to/host/llvm-ar``

 #. To use additional linker arguments for controlling the backend
parallelism_ or enabling incremental_ builds of the bootstrap compiler,


Index: clang/docs/ThinLTO.rst
===
--- clang/docs/ThinLTO.rst
+++ clang/docs/ThinLTO.rst
@@ -140,7 +140,7 @@
   * ``-DCMAKE_C_COMPILER=/path/to/host/clang``
   * ``-DCMAKE_CXX_COMPILER=/path/to/host/clang++``
   * ``-DCMAKE_RANLIB=/path/to/host/llvm-ranlib``
-  * ``-DCMAKE_AR=/path/to/host/llvm-nm``
+  * ``-DCMAKE_AR=/path/to/host/llvm-ar``

 #. To use additional linker arguments for controlling the backend
parallelism_ or enabling incremental_ builds of the bootstrap compiler,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r283116 - [ARC] Ignore qualifiers in copy-restore expressions

2016-10-03 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Mon Oct  3 10:29:22 2016
New Revision: 283116

URL: http://llvm.org/viewvc/llvm-project?rev=283116&view=rev
Log:
[ARC] Ignore qualifiers in copy-restore expressions

When ARC is enabled, an ObjCIndirectCopyRestoreExpr models the passing
of a function argument s.t:

  * The argument is copied into a temporary,
  * The temporary is passed into the function, and
  * After the function call completes, the temporary is move-assigned
back to the original location of the argument.

The argument type and the parameter type must agree "except possibly in
qualification". This commit weakens an assertion in EmitCallArg() to
actually reflect that.

Added:
cfe/trunk/test/CodeGenObjC/unqual-copy-restore.m
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=283116&r1=283115&r2=283116&view=diff
==
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Mon Oct  3 10:29:22 2016
@@ -3269,7 +3269,7 @@ void CodeGenFunction::EmitCallArg(CallAr
   if (const ObjCIndirectCopyRestoreExpr *CRE
 = dyn_cast(E)) {
 assert(getLangOpts().ObjCAutoRefCount);
-assert(getContext().hasSameType(E->getType(), type));
+assert(getContext().hasSameUnqualifiedType(E->getType(), type));
 return emitWritebackArg(*this, args, CRE);
   }
 

Added: cfe/trunk/test/CodeGenObjC/unqual-copy-restore.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/unqual-copy-restore.m?rev=283116&view=auto
==
--- cfe/trunk/test/CodeGenObjC/unqual-copy-restore.m (added)
+++ cfe/trunk/test/CodeGenObjC/unqual-copy-restore.m Mon Oct  3 10:29:22 2016
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -fobjc-arc -S -emit-llvm -o /dev/null
+
+// rdar://problem/28488427 - Don't crash if the argument type and the parameter
+// type in an indirect copy restore expression have different qualification.
+@protocol P1
+@end
+
+typedef int handler(id *const p);
+
+int main() {
+  id i1 = 0;
+  handler *func = 0;
+  return func(&i1);
+}


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


[PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced

2016-10-03 Thread Reid Kleckner via cfe-commits
rnk added inline comments.


> CGDebugInfo.cpp:47
>  
> +namespace {
> +template 

LLVM prefers `static` to anonymous namespaces 
http://llvm.org/docs/CodingStandards.html#anonymous-namespaces

> CGDebugInfo.cpp:48
> +namespace {
> +template 
> +uint64_t GetTypeAlignIfRequired(Type Ty, const ASTContext &Ctx) {

Instead of templating, have a `const Type*` overload and a QualType overload 
like getTypeInfo does:

  /// \brief Get the size and alignment of the specified complete type in bits.
  TypeInfo getTypeInfo(const Type *T) const;
  TypeInfo getTypeInfo(QualType T) const { return getTypeInfo(T.getTypePtr()); }

> CGDebugInfo.cpp:49
> +template 
> +uint64_t GetTypeAlignIfRequired(Type Ty, const ASTContext &Ctx) {
> +  auto TI = Ctx.getTypeInfo(Ty);

LLVM style uses a leading lower case for method names: 
http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly

> CGDebugInfo.cpp:53
> +: 0;
> +}
> +uint64_t GetDeclAlignIfRequired(const Decl *D, const ASTContext &Ctx) {

Please add a blank line between top level decls

https://reviews.llvm.org/D24426



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


[PATCH] D24909: fix for not copying fp denormal and trapping options.

2016-10-03 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer added a comment.

Hi Hal, 
Thanks for reviewing and you're right: this should work. We actually have 
actually some downstream (aarch64) build attribute selection code that would 
work better with this change. Are you okay with committing this change?
Cheers,
Sjoerd.


https://reviews.llvm.org/D24909



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


[PATCH] D24909: fix for not copying fp denormal and trapping options.

2016-10-03 Thread Hal Finkel via cfe-commits
hfinkel added a comment.

In https://reviews.llvm.org/D24909#559110, @SjoerdMeijer wrote:

> Hi Hal, 
>  Thanks for reviewing and you're right: this should work. We actually have 
> actually some downstream (aarch64) build attribute selection code that would 
> work better with this change. Are you okay with committing this change?
>  Cheers,
>  Sjoerd.


Can you explain what you mean? What does this code do?

My general impression is that we're planning to rip out this code entirely and 
reply only on setting the functions attributes. @echristo, am I right about 
this?


https://reviews.llvm.org/D24909



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


[PATCH] D25166: [CUDA] Mark device functions as nounwind.

2016-10-03 Thread Reid Kleckner via cfe-commits
rnk added a comment.

It feels like the right thing is to disable EH in device side compilation, but 
obviously that won't work because it would reject try/throw in host code. I 
think instead of doing that, we should make sure that CUDA diagnoses try / 
catch / throw in device functions, and then do what you've done here.

Also, take a look at CodeGenFunction::getInvokeDestImpl(). I think you should 
add some checks in there to return nullptr if we're doing a device-side CUDA 
compilation. That's a much more direct way to ensure we never generate invokes 
on the device side.



> SemaDecl.cpp:12082
> +(getLangOpts().CUDAIsDevice && T == CFT_HostDevice))
> +  FD->addAttr(NoThrowAttr::CreateImplicit(Context, FD->getLocation()));
> +  }

Can we use a `noexcept` exception specification instead of this GCC attribute?

https://reviews.llvm.org/D25166



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


[libcxx] r283118 - [lit] Allow more file extensions for test cases.

2016-10-03 Thread Logan Chien via cfe-commits
Author: logan
Date: Mon Oct  3 11:00:22 2016
New Revision: 283118

URL: http://llvm.org/viewvc/llvm-project?rev=283118&view=rev
Log:
[lit] Allow more file extensions for test cases.

This commit splits the file extensions before determining the test
format.  This allows libc++abi to add assembly-based test cases.

Modified:
libcxx/trunk/test/libcxx/test/format.py

Modified: libcxx/trunk/test/libcxx/test/format.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/format.py?rev=283118&r1=283117&r2=283118&view=diff
==
--- libcxx/trunk/test/libcxx/test/format.py (original)
+++ libcxx/trunk/test/libcxx/test/format.py Mon Oct  3 11:00:22 2016
@@ -65,9 +65,11 @@ class LibcxxTestFormat(object):
 
 def _execute(self, test, lit_config):
 name = test.path_in_suite[-1]
-is_sh_test = name.endswith('.sh.cpp')
+name_root, name_ext = os.path.splitext(name)
+is_sh_test = name_root.endswith('.sh')
 is_pass_test = name.endswith('.pass.cpp')
 is_fail_test = name.endswith('.fail.cpp')
+assert is_sh_test or name_ext == '.cpp', 'non-cpp file must be sh test'
 
 if test.config.unsupported:
 return (lit.Test.UNSUPPORTED,


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


[PATCH] D25190: [ThinLTO doc] Fix typo

2016-10-03 Thread Mehdi AMINI via cfe-commits
mehdi_amini accepted this revision.
mehdi_amini added a comment.
This revision is now accepted and ready to land.

Good catch indeed!


https://reviews.llvm.org/D25190



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


[PATCH] D24087: [lit] Allow more file extensions for test cases.

2016-10-03 Thread Logan Chien via cfe-commits
logan closed this revision.
logan added a comment.

Thanks for reviewing.  Committed as rL283118 with the suggested change 
regarding to `is_sh_test` assertion.


https://reviews.llvm.org/D24087



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


[PATCH] D24082: [CMake] Fix libc++abi arm build w/o libunwind.

2016-10-03 Thread Logan Chien via cfe-commits
logan added a comment.

Ping?  Any other comments?


https://reviews.llvm.org/D24082



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


[PATCH] D25166: [CUDA] Mark device functions as nounwind.

2016-10-03 Thread Justin Lebar via cfe-commits
jlebar added a comment.

In https://reviews.llvm.org/D25166#559117, @rnk wrote:

> It feels like the right thing is to disable EH in device side compilation, 
> but obviously that won't work because it would reject try/throw in host code.


Exactly.

> I think instead of doing that, we should make sure that CUDA diagnoses try / 
> catch / throw in device functions, > and then do what you've done here.

Disallowing try/throw is https://reviews.llvm.org/D25036.

> Also, take a look at CodeGenFunction::getInvokeDestImpl(). I think you should 
> add some checks in there to return nullptr if we're doing a device-side CUDA 
> compilation. That's a much more direct way to ensure we never generate 
> invokes on the device side.

Hm...if we did this but didn't mark functions as "this never throws", would 
that really take care of everything?  For example, if we were to call an 
external function which is itself not marked as noexcept, llvm wouldn't be able 
to infer that we don't throw.

Are you saying we should do both?  I'm happy to do that, but I am not sure, if 
we keep the nounwind attribute in, whether it's possible to write a testcase.

> Can we use a noexcept exception specification instead of this GCC attribute?

I have no attachment to this specific attribute, but wouldn't adding noexcept 
change the semantics of the program (because traits can detect whether or not 
noexcept is present)?


https://reviews.llvm.org/D25166



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


[PATCH] D24571: [CUDA] Disallow overloading destructors.

2016-10-03 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a reviewer: rnk.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm



> SemaOverload.cpp:1131
>  
>if (getLangOpts().CUDA && ConsiderCudaAttrs) {
>  CUDAFunctionTarget NewTarget = IdentifyCUDATarget(New),

I feel like we should exit early on destructors here, before we do any target 
checks. The assert also feels kind of trivial because we only come into this 
overload machinery if looking up New's DeclarationName found Old.

https://reviews.llvm.org/D24571



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


[PATCH] D24991: Inline hot functions in libcxx shared_ptr implementation.

2016-10-03 Thread Kevin Hu via cfe-commits
hxy9243 updated this revision to Diff 73293.
hxy9243 added a comment.

Addresses comments from @halyavin, rename "atomic_support.h" to 
"__atomic_support" to avoid collisions with application headers.


Repository:
  rL LLVM

https://reviews.llvm.org/D24991

Files:
  libcxx/include/__atomic_support
  libcxx/include/memory
  libcxx/src/include/atomic_support.h
  libcxx/src/memory.cpp
  libcxx/src/mutex.cpp

Index: libcxx/src/mutex.cpp
===
--- libcxx/src/mutex.cpp
+++ libcxx/src/mutex.cpp
@@ -12,7 +12,7 @@
 #include "limits"
 #include "system_error"
 #include "cassert"
-#include "include/atomic_support.h"
+#include "__atomic_support"
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 #ifndef _LIBCPP_HAS_NO_THREADS
Index: libcxx/src/memory.cpp
===
--- libcxx/src/memory.cpp
+++ libcxx/src/memory.cpp
@@ -13,85 +13,17 @@
 #include "mutex"
 #include "thread"
 #endif
-#include "include/atomic_support.h"
+#include "__atomic_support"
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-namespace
-{
-
-// NOTE: Relaxed and acq/rel atomics (for increment and decrement respectively)
-// should be sufficient for thread safety.
-// See https://llvm.org/bugs/show_bug.cgi?id=22803
-template 
-inline T
-increment(T& t) _NOEXCEPT
-{
-return __libcpp_atomic_add(&t, 1, _AO_Relaxed);
-}
-
-template 
-inline T
-decrement(T& t) _NOEXCEPT
-{
-return __libcpp_atomic_add(&t, -1, _AO_Acq_Rel);
-}
-
-}  // namespace
-
 const allocator_arg_t allocator_arg = allocator_arg_t();
 
 bad_weak_ptr::~bad_weak_ptr() _NOEXCEPT {}
 
-const char*
-bad_weak_ptr::what() const _NOEXCEPT
-{
-return "bad_weak_ptr";
-}
+__shared_count::~__shared_count() {}
 
-__shared_count::~__shared_count()
-{
-}
-
-void
-__shared_count::__add_shared() _NOEXCEPT
-{
-increment(__shared_owners_);
-}
-
-bool
-__shared_count::__release_shared() _NOEXCEPT
-{
-if (decrement(__shared_owners_) == -1)
-{
-__on_zero_shared();
-return true;
-}
-return false;
-}
-
-__shared_weak_count::~__shared_weak_count()
-{
-}
-
-void
-__shared_weak_count::__add_shared() _NOEXCEPT
-{
-__shared_count::__add_shared();
-}
-
-void
-__shared_weak_count::__add_weak() _NOEXCEPT
-{
-increment(__shared_weak_owners_);
-}
-
-void
-__shared_weak_count::__release_shared() _NOEXCEPT
-{
-if (__shared_count::__release_shared())
-__release_weak();
-}
+__shared_weak_count::~__shared_weak_count() {}
 
 void
 __shared_weak_count::__release_weak() _NOEXCEPT
Index: libcxx/src/include/atomic_support.h
===
--- libcxx/src/include/atomic_support.h
+++ /dev/null
@@ -1,158 +0,0 @@
-//===--===
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===--===
-
-#ifndef ATOMIC_SUPPORT_H
-#define ATOMIC_SUPPORT_H
-
-#include "__config"
-#include "memory" // for __libcpp_relaxed_load
-
-#if defined(__clang__) && __has_builtin(__atomic_load_n) \
-   && __has_builtin(__atomic_store_n)\
-   && __has_builtin(__atomic_add_fetch)  \
-   && __has_builtin(__atomic_compare_exchange_n) \
-   && defined(__ATOMIC_RELAXED)  \
-   && defined(__ATOMIC_CONSUME)  \
-   && defined(__ATOMIC_ACQUIRE)  \
-   && defined(__ATOMIC_RELEASE)  \
-   && defined(__ATOMIC_ACQ_REL)  \
-   && defined(__ATOMIC_SEQ_CST)
-#   define _LIBCPP_HAS_ATOMIC_BUILTINS
-#elif !defined(__clang__) && defined(_GNUC_VER) && _GNUC_VER >= 407
-#   define _LIBCPP_HAS_ATOMIC_BUILTINS
-#endif
-
-#if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS)
-# if defined(_MSC_VER) && !defined(__clang__)
-_LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported")
-# else
-#   warning Building libc++ without __atomic builtins is unsupported
-# endif
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace {
-
-#if defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS)
-
-enum __libcpp_atomic_order {
-_AO_Relaxed = __ATOMIC_RELAXED,
-_AO_Consume = __ATOMIC_CONSUME,
-_AO_Acquire = __ATOMIC_ACQUIRE,
-_AO_Release = __ATOMIC_RELEASE,
-_AO_Acq_Rel = __ATOMIC_ACQ_REL,
-_AO_Seq = __ATOMIC_SEQ_CST
-};
-
-template 
-inline _LIBCPP_INLINE_VISIBILITY
-void __libcpp_atomic_store(_ValueType* __dest, _FromType __val,
-   int __order = _AO_Seq)
-{
-__atomic_store_n(__dest, __val, __order);
-}
-
-templ

[PATCH] D25150: [CUDA] Allow static variables in __host__ __device__ functions, so long as they're never codegen'ed for device.

2016-10-03 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm


https://reviews.llvm.org/D25150



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


[PATCH] D25143: [CUDA] Disallow __shared__ variables in host functions.

2016-10-03 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm


https://reviews.llvm.org/D25143



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


[PATCH] D25068: [coroutines] Switch to using std::experimental namespace per P0057R5

2016-10-03 Thread Gor Nishanov via cfe-commits
GorNishanov requested changes to this revision.
GorNishanov added a comment.
This revision now requires changes to proceed.





> coroutines.cpp:1
>  // RUN: %clang_cc1 -std=c++14 -fcoroutines -verify %s
>  

Change to -fcoroutines-ts

https://reviews.llvm.org/D25068



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


[PATCH] D24571: [CUDA] Disallow overloading destructors.

2016-10-03 Thread Justin Lebar via cfe-commits
jlebar added inline comments.


> rnk wrote in SemaOverload.cpp:1131
> I feel like we should exit early on destructors here, before we do any target 
> checks. The assert also feels kind of trivial because we only come into this 
> overload machinery if looking up New's DeclarationName found Old.

Will do when I check this in.  Thank you for the review!

https://reviews.llvm.org/D24571



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


r283120 - [CUDA] Disallow overloading destructors.

2016-10-03 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Mon Oct  3 11:48:23 2016
New Revision: 283120

URL: http://llvm.org/viewvc/llvm-project?rev=283120&view=rev
Log:
[CUDA] Disallow overloading destructors.

Summary:
We'd attempted to allow this, but turns out we were doing a very bad
job.  :)

Making this work properly would be a giant change in clang.  For
example, we'd need to make CXXRecordDecl::getDestructor()
context-sensitive, because the destructor you end up with depends on
where you're calling it from.

For now (and hopefully for ever), just disallow overloading of
destructors in CUDA.

Reviewers: rsmith

Subscribers: cfe-commits, tra

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

Added:
cfe/trunk/test/SemaCUDA/no-destructor-overload.cu
Removed:
cfe/trunk/test/SemaCUDA/call-overloaded-destructor.cu
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/CodeGenCUDA/function-overload.cu
cfe/trunk/test/SemaCUDA/function-overload.cu

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=283120&r1=283119&r2=283120&view=diff
==
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Mon Oct  3 11:48:23 2016
@@ -1129,6 +1129,11 @@ bool Sema::IsOverload(FunctionDecl *New,
   }
 
   if (getLangOpts().CUDA && ConsiderCudaAttrs) {
+// Don't allow overloading of destructors.  (In theory we could, but it
+// would be a giant change to clang.)
+if (isa(New))
+  return false;
+
 CUDAFunctionTarget NewTarget = IdentifyCUDATarget(New),
OldTarget = IdentifyCUDATarget(Old);
 if (NewTarget == CFT_InvalidTarget || NewTarget == CFT_Global)

Modified: cfe/trunk/test/CodeGenCUDA/function-overload.cu
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCUDA/function-overload.cu?rev=283120&r1=283119&r2=283120&view=diff
==
--- cfe/trunk/test/CodeGenCUDA/function-overload.cu (original)
+++ cfe/trunk/test/CodeGenCUDA/function-overload.cu Mon Oct  3 11:48:23 2016
@@ -16,8 +16,6 @@ int x;
 struct s_cd_dh {
   __host__ s_cd_dh() { x = 11; }
   __device__ s_cd_dh() { x = 12; }
-  __host__ ~s_cd_dh() { x = 21; }
-  __device__ ~s_cd_dh() { x = 22; }
 };
 
 struct s_cd_hd {
@@ -38,7 +36,6 @@ void wrapper() {
   // CHECK-BOTH: call void @_ZN7s_cd_hdC1Ev
 
   // CHECK-BOTH: call void @_ZN7s_cd_hdD1Ev(
-  // CHECK-BOTH: call void @_ZN7s_cd_dhD1Ev(
 }
 // CHECK-BOTH: ret void
 
@@ -56,8 +53,3 @@ void wrapper() {
 // CHECK-BOTH: define linkonce_odr void @_ZN7s_cd_hdD2Ev(
 // CHECK-BOTH: store i32 32,
 // CHECK-BOTH: ret void
-
-// CHECK-BOTH: define linkonce_odr void @_ZN7s_cd_dhD2Ev(
-// CHECK-HOST:   store i32 21,
-// CHECK-DEVICE: store i32 22,
-// CHECK-BOTH: ret void

Removed: cfe/trunk/test/SemaCUDA/call-overloaded-destructor.cu
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCUDA/call-overloaded-destructor.cu?rev=283119&view=auto
==
--- cfe/trunk/test/SemaCUDA/call-overloaded-destructor.cu (original)
+++ cfe/trunk/test/SemaCUDA/call-overloaded-destructor.cu (removed)
@@ -1,17 +0,0 @@
-// expected-no-diagnostics
-
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s
-// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fsyntax-only -fcuda-is-device 
-verify %s
-
-#include "Inputs/cuda.h"
-
-struct S {
-  __host__ ~S() {}
-  __device__ ~S() {}
-};
-
-__host__ __device__ void test() {
-  S s;
-  // This should not crash clang.
-  s.~S();
-}

Modified: cfe/trunk/test/SemaCUDA/function-overload.cu
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCUDA/function-overload.cu?rev=283120&r1=283119&r2=283120&view=diff
==
--- cfe/trunk/test/SemaCUDA/function-overload.cu (original)
+++ cfe/trunk/test/SemaCUDA/function-overload.cu Mon Oct  3 11:48:23 2016
@@ -210,44 +210,11 @@ struct d_h {
   __host__ ~d_h() {} // expected-error {{destructor cannot be redeclared}}
 };
 
-// H/D overloading is OK
-struct d_dh {
-  __device__ ~d_dh() {}
-  __host__ ~d_dh() {}
-};
-
 // HD is OK
 struct d_hd {
   __host__ __device__ ~d_hd() {}
 };
 
-// Mixing H/D and HD is not allowed.
-struct d_dhhd {
-  __device__ ~d_dhhd() {}
-  __host__ ~d_dhhd() {} // expected-note {{previous declaration is here}}
-  __host__ __device__ ~d_dhhd() {} // expected-error {{destructor cannot be 
redeclared}}
-};
-
-struct d_hhd {
-  __host__ ~d_hhd() {} // expected-note {{previous declaration is here}}
-  __host__ __device__ ~d_hhd() {} // expected-error {{destructor cannot be 
redeclared}}
-};
-
-struct d_hdh {
-  __host__ __device__ ~d_hdh() {} // expected-note {{previous declaration is 
here}}
-  __host__ ~d_hdh() {} // expected-error {{destructor cannot be redeclar

r283121 - [CUDA] Clean up some comments in Sema::IsOverload. NFC

2016-10-03 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Mon Oct  3 11:48:27 2016
New Revision: 283121

URL: http://llvm.org/viewvc/llvm-project?rev=283121&view=rev
Log:
[CUDA] Clean up some comments in Sema::IsOverload.  NFC

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

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=283121&r1=283120&r2=283121&view=diff
==
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Mon Oct  3 11:48:27 2016
@@ -1141,17 +1141,17 @@ bool Sema::IsOverload(FunctionDecl *New,
 
 assert((OldTarget != CFT_InvalidTarget) && "Unexpected invalid target.");
 
-// Don't allow mixing of HD with other kinds. This guarantees that
-// we have only one viable function with this signature on any
-// side of CUDA compilation .
-// __global__ functions can't be overloaded based on attribute
-// difference because, like HD, they also exist on both sides.
+// Don't allow HD and global functions to overload other functions with the
+// same signature.  We allow overloading based on CUDA attributes so that
+// functions can have different implementations on the host and device, but
+// HD/global functions "exist" in some sense on both the host and device, 
so
+// should have the same implementation on both sides.
 if ((NewTarget == CFT_HostDevice) || (OldTarget == CFT_HostDevice) ||
 (NewTarget == CFT_Global) || (OldTarget == CFT_Global))
   return false;
 
-// Allow overloading of functions with same signature, but
-// different CUDA target attributes.
+// Allow overloading of functions with same signature and different CUDA
+// target attributes.
 return NewTarget != OldTarget;
   }
 


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


[PATCH] D24516: [Driver][Diagnostics] Make 'show option names' default for driver warnings

2016-10-03 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a comment.

Ping!


https://reviews.llvm.org/D24516



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


[libcxx] r283124 - Mark a couple issues as done (2742 and 2760)

2016-10-03 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Oct  3 12:35:08 2016
New Revision: 283124

URL: http://llvm.org/viewvc/llvm-project?rev=283124&view=rev
Log:
Mark a couple issues as done (2742 and 2760)

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=283124&r1=283123&r2=283124&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Mon Oct  3 12:35:08 2016
@@ -111,7 +111,7 @@
 http://wg21.link/LWG2738";>2738is_constructible with void 
typesIssaquah
 http://wg21.link/LWG2739";>2739Issue with 
time_point non-member subtraction with an unsigned 
durationIssaquah
 http://wg21.link/LWG2740";>2740constexpr 
optional::operator->Issaquah
-http://wg21.link/LWG2742";>2742Inconsistent string interface 
taking string_viewIssaquah
+http://wg21.link/LWG2742";>2742Inconsistent string interface 
taking string_viewIssaquahPatch Ready
 http://wg21.link/LWG2744";>2744any's 
in_place constructorsIssaquah
 http://wg21.link/LWG2745";>2745[fund.ts.v2] Implementability 
of LWG 2451Issaquah
 http://wg21.link/LWG2747";>2747Possibly 
redundant std::move in [alg.foreach]Issaquah
@@ -124,7 +124,7 @@
 http://wg21.link/LWG2755";>2755§[string.view.io] uses 
non-existent basic_string_view::to_string 
functionIssaquah
 http://wg21.link/LWG2756";>2756C++ WP 
optional should 'forward' T's implicit 
conversionsIssaquah
 http://wg21.link/LWG2759";>2759gcd / lcm 
and bool for the WPIssaquah
-http://wg21.link/LWG2760";>2760non-const 
basic_string::data should not invalidate 
iteratorsIssaquah
+http://wg21.link/LWG2760";>2760non-const 
basic_string::data should not invalidate 
iteratorsIssaquahNothing to do
 http://wg21.link/LWG2765";>2765Did LWG 
1123 go too far?Issaquah
 http://wg21.link/LWG2767";>2767not_fn 
call_wrapper can form invalid typesIssaquah
 http://wg21.link/LWG2768";>2768any_cast 
and move semanticsIssaquah
@@ -185,7 +185,7 @@
 2738 - 
 2739 - 
 2740 - 
-2742 - 
+2742 - Patch and tests ready
 2744 - 
 2745 - 
 2747 - 
@@ -198,7 +198,7 @@
 2755 - 
 2756 - 
 2759 - 
-2760 - 
+2760 - This is just wording cleanup; no code or test changes needed.
 2765 - 
 2767 - 
 2768 - 


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


[PATCH] D25199: [ubsan] Sanitize deleted pointers

2016-10-03 Thread Matt Gingell via cfe-commits
gingell created this revision.
gingell added reviewers: cfe-commits, kcc.

This patch adds a "value-after-delete" sanitizer, which will
invalidate the value of a pointer passed in a delete expression.

For instance, when -fsanitize=value-after-delete is passed:

int *foo = new int;
delete foo;
// foo == 0xDEADBEEFDEADBEEF

This is intended to help catch some use-after-free problems by 
ensuring access through a deleted pointer fails immediately on 
an address should be obviously suspicious when inspected in the
debugger. The expectation is immediately invalidating dangling
pointers can help uncover latent bugs that might otherwise cause
more subtle problems further down the line.


https://reviews.llvm.org/D25199

Files:
  docs/UndefinedBehaviorSanitizer.rst
  include/clang/Basic/Sanitizers.def
  include/clang/Driver/Options.td
  lib/CodeGen/CGExprScalar.cpp
  test/CodeGenCXX/sanitize-value-after-delete.cpp
  test/Driver/fsanitize.c

Index: test/Driver/fsanitize.c
===
--- test/Driver/fsanitize.c
+++ test/Driver/fsanitize.c
@@ -3,27 +3,27 @@
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-undefined-trap-on-error %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP
 // RUN: %clang -target x86_64-linux-gnu -fsanitize-undefined-trap-on-error -fsanitize=undefined-trap %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP
-// CHECK-UNDEFINED-TRAP: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute|function),?){18}"}}
-// CHECK-UNDEFINED-TRAP: "-fsanitize-trap=alignment,array-bounds,bool,enum,float-cast-overflow,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,null,object-size,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound"
-// CHECK-UNDEFINED-TRAP2: "-fsanitize-trap=alignment,array-bounds,bool,enum,float-cast-overflow,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,null,object-size,return,returns-nonnull-attribute,shift-base,shift-exponent,unreachable,vla-bound"
+// CHECK-UNDEFINED-TRAP: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|value-after-delete|vla-bound|alignment|null|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute|function),?){19}"}}
+// CHECK-UNDEFINED-TRAP: "-fsanitize-trap=alignment,array-bounds,bool,enum,float-cast-overflow,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,null,object-size,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,value-after-delete,vla-bound"
+// CHECK-UNDEFINED-TRAP2: "-fsanitize-trap=alignment,array-bounds,bool,enum,float-cast-overflow,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,null,object-size,return,returns-nonnull-attribute,shift-base,shift-exponent,unreachable,value-after-delete,vla-bound"
 
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED
-// CHECK-UNDEFINED: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|function|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|vptr|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){19}"}}
+// CHECK-UNDEFINED: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|function|shift-base|shift-exponent|unreachable|return|value-after-delete|vla-bound|alignment|null|vptr|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){20}"}}
 
 // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-DARWIN
-// CHECK-UNDEFINED-DARWIN: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){17}"}}
+// CHECK-UNDEFINED-DARWIN: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|value-after-delete|vla-bound|alignment|null|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){18}"}}
 
 // RUN: %clang -target i386-unknown-openbsd -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-OPENBSD
-//

[PATCH] D23765: Fix for clang PR 29087

2016-10-03 Thread Taewook Oh via cfe-commits
twoh added a comment.

ping


https://reviews.llvm.org/D23765



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


[PATCH] D24644: Pass -ffunction-sections/-fdata-sections along to gold-plugin

2016-10-03 Thread Peter Collingbourne via cfe-commits
pcc added a comment.

> Are you suggesting having them enabled unconditionally in both gold-plugin 
> and gold? That will require changes to both llvm and binutils, and the latter 
> will have effects for other compilers.

I mean in the gold plugin only. There would not need to be any changes to gold 
because it does not take these parameters directly.

> What about -Wl,-gc-sections, isn't that also needed to make effective use of 
> these options?

Not necessarily, PR22999 would happen with or without gc-sections.


https://reviews.llvm.org/D24644



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


[PATCH] D25139: [CUDA] Add Sema::CUDADiagBuilder and Sema::CUDADiagIfDeviceCode().

2016-10-03 Thread Reid Kleckner via cfe-commits
rnk added inline comments.


> Sema.h:9210
> +  /// Emit no diagnostics.
> +  NOP,
> +  /// Emit the diagnostic immediately (i.e., behave like Sema::Diag()).

LLVM has a different enum naming convention: 
http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly

> Sema.h:9238
> +///
> +///   if (CUDADiagBuilder(...) << foo << bar)
> +/// return ExprError();

I'm concerned that this usage pattern isn't going to be efficient because you 
build the complete diagnostic before calling the bool conversion operator to 
determine that it doesn't need to be emitted. I think you want to construct 
something more like:

  if (isCUDADeviceCode())
CUDADiag(...) << ...;

Otherwise you are going to construct and destruct a large number of diagnostics 
about language features that are forbidden in device code, but are legal in 
host code, and 99% of the TU is going to be host code that uses these illegal 
features.

> Sema.h:9258
> +  : Loc(Loc), PD(PartialDiagnostic::NullDiagnostic()), Fn(Fn) {
> +// We have to do this odd dance to create our PartialDiagnostic 
> (first
> +// creating a NullDiagnostic(), then calling Reset()) because we want

Remind me why we need to do this? Which arena is this stuff allocated in and 
where would I go to read more about it? My thought is that, if we don't 
construct very many of these, we should just allocate them in the usual 
ASTContext arena and let them live forever. It would be more consistent with 
our usual way of doing things.

https://reviews.llvm.org/D25139



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


[PATCH] D25166: [CUDA] Mark device functions as nounwind.

2016-10-03 Thread Reid Kleckner via cfe-commits
rnk added a comment.

In https://reviews.llvm.org/D25166#559168, @jlebar wrote:

> > Also, take a look at CodeGenFunction::getInvokeDestImpl(). I think you 
> > should add some checks in there to return nullptr if we're doing a 
> > device-side CUDA compilation. That's a much more direct way to ensure we 
> > never generate invokes on the device side.
>
> Hm...if we did this but didn't mark functions as "this never throws", would 
> that really take care of everything?  For example, if we were to call an 
> external function which is itself not marked as noexcept, llvm wouldn't be 
> able to infer that we don't throw.
>
> Are you saying we should do both?  I'm happy to do that, but I am not sure, 
> if we keep the nounwind attribute in, whether it's possible to write a 
> testcase.


I think you want both: you want all device CUDA function definitions (and 
declarations!) to be marked nounwind to help the optimizer, but you also want 
to directly make sure clang codegen knows that exceptions are turned off on the 
device side by changing getInvokeDestImpl. It's essentially the key place we 
check LangOpts.Exceptions, so if we can't turn that off, then we probably want 
to inject our CUDA device checks there.

>> Can we use a noexcept exception specification instead of this GCC attribute?
> 
> I have no attachment to this specific attribute, but wouldn't adding noexcept 
> change the semantics of the program (because traits can detect whether or not 
> noexcept is present)?

Hm, yeah, that's no good because then you'll have host vs. device conflicts in 
those traits. This should probably be a CodeGen-only change anyway, so you 
might as well add nounwind to function declarations in CGCall.cpp.


https://reviews.llvm.org/D25166



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


[PATCH] D25199: [ubsan] Sanitize deleted pointers

2016-10-03 Thread Vedant Kumar via cfe-commits
vsk added a comment.

It looks like programs which trip -fsanitize-value-after-delete will just crash 
without further reporting, which isn't in keeping with the way other ubsan 
checks are implemented.

IMO, address sanitizer is better-equipped to diagnose this issue.


https://reviews.llvm.org/D25199



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


Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-10-03 Thread Serge Pavlov via cfe-commits
Ping.

Thanks,
--Serge

2016-09-16 23:17 GMT+07:00 Serge Pavlov :

> Ping.
>
> Thanks,
> --Serge
>
> 2016-09-08 20:43 GMT+07:00 Serge Pavlov :
>
>> Any feedback?
>>
>> Thanks,
>> --Serge
>>
>> 2016-09-02 13:11 GMT+07:00 Serge Pavlov :
>>
>>> sepavloff updated this revision to Diff 70134.
>>> sepavloff marked an inline comment as done.
>>> sepavloff added a comment.
>>>
>>> Updated patch
>>>
>>> Rewrite the condition in shouldLinkDependentDeclWithPrevious in more
>>> compact form.
>>>
>>>
>>> https://reviews.llvm.org/D16989
>>>
>>> Files:
>>>   include/clang/Sema/Sema.h
>>>   lib/Sema/SemaDecl.cpp
>>>   lib/Sema/SemaDeclCXX.cpp
>>>   test/SemaCXX/PR25848.cpp
>>>   test/SemaCXX/friend2.cpp
>>>   test/SemaCXX/function-redecl-2.cpp
>>>
>>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25204: Register Calling Convention, Clang changes

2016-10-03 Thread Erich Keane via cfe-commits
erichkeane created this revision.
erichkeane added reviewers: oren_ben_simhon, cfe-commits.
erichkeane set the repository for this revision to rL LLVM.

The Register Calling Convention (RegCall) was introduced by Intel to optimize 
parameter transfer on function call.
This calling convention ensures that as many values as possible are passed or 
returned in registers.

The following review presents the basic additions to the Clang Front-end in 
order to support RegCall in X86.

See https://reviews.llvm.org/D25022 for CodeGen changes


Repository:
  rL LLVM

https://reviews.llvm.org/D25204

Files:
  include/clang-c/Index.h
  include/clang/AST/Type.h
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/Specifiers.h
  include/clang/Basic/TokenKinds.def
  lib/AST/Expr.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/Mangle.cpp
  lib/AST/MicrosoftMangle.cpp
  lib/AST/Type.cpp
  lib/AST/TypePrinter.cpp
  lib/Basic/Targets.cpp
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/TargetInfo.cpp
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseTentative.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaType.cpp
  test/CodeGen/regcall.c
  test/CodeGenCXX/regcall.cpp
  tools/libclang/CXType.cpp

Index: lib/Parse/ParseDecl.cpp
===
--- lib/Parse/ParseDecl.cpp
+++ lib/Parse/ParseDecl.cpp
@@ -605,6 +605,7 @@
 case tok::kw___fastcall:
 case tok::kw___stdcall:
 case tok::kw___thiscall:
+case tok::kw___regcall:
 case tok::kw___cdecl:
 case tok::kw___vectorcall:
 case tok::kw___ptr64:
@@ -3137,6 +3138,7 @@
 case tok::kw___stdcall:
 case tok::kw___fastcall:
 case tok::kw___thiscall:
+case tok::kw___regcall:
 case tok::kw___vectorcall:
   ParseMicrosoftTypeAttributes(DS.getAttributes());
   continue;
@@ -4454,6 +4456,7 @@
   case tok::kw___stdcall:
   case tok::kw___fastcall:
   case tok::kw___thiscall:
+  case tok::kw___regcall:
   case tok::kw___vectorcall:
   case tok::kw___w64:
   case tok::kw___ptr64:
@@ -4638,6 +4641,7 @@
   case tok::kw___stdcall:
   case tok::kw___fastcall:
   case tok::kw___thiscall:
+  case tok::kw___regcall:
   case tok::kw___vectorcall:
   case tok::kw___w64:
   case tok::kw___sptr:
@@ -4876,6 +4880,7 @@
 case tok::kw___stdcall:
 case tok::kw___fastcall:
 case tok::kw___thiscall:
+case tok::kw___regcall:
 case tok::kw___vectorcall:
   if (AttrReqs & AR_DeclspecAttributesParsed) {
 ParseMicrosoftTypeAttributes(DS.getAttributes());
Index: lib/Parse/ParseTentative.cpp
===
--- lib/Parse/ParseTentative.cpp
+++ lib/Parse/ParseTentative.cpp
@@ -909,7 +909,7 @@
   // '(' abstract-declarator ')'
   if (Tok.isOneOf(tok::kw___attribute, tok::kw___declspec, tok::kw___cdecl,
   tok::kw___stdcall, tok::kw___fastcall, tok::kw___thiscall,
-  tok::kw___vectorcall))
+  tok::kw___regcall, tok::kw___vectorcall))
 return TPResult::True; // attributes indicate declaration
   TPResult TPR = TryParseDeclarator(mayBeAbstract, mayHaveIdentifier);
   if (TPR != TPResult::Ambiguous)
@@ -1058,6 +1058,7 @@
   case tok::kw___stdcall:
   case tok::kw___fastcall:
   case tok::kw___thiscall:
+  case tok::kw___regcall:
   case tok::kw___vectorcall:
   case tok::kw___unaligned:
   case tok::kw___vector:
@@ -1351,6 +1352,7 @@
   case tok::kw___stdcall:
   case tok::kw___fastcall:
   case tok::kw___thiscall:
+  case tok::kw___regcall:
   case tok::kw___vectorcall:
   case tok::kw___w64:
   case tok::kw___sptr:
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -683,7 +683,15 @@
   } else {
 IdentifierInfo *II = ND->getIdentifier();
 assert(II && "Attempt to mangle unnamed decl.");
-Str = II->getName();
+const FunctionDecl *FD = dyn_cast(ND);
+
+if (FD && FD->getType()->castAs()->getCallConv() == CC_X86RegCall) {
+  llvm::raw_svector_ostream Out(Buffer);
+  Out << "__regcall3__" << II->getName();
+  Str = Out.str();
+} else {
+  Str = II->getName();
+}
   }
 
   // Keep the first result in the case of a mangling collision.
Index: lib/CodeGen/CGCall.cpp
===
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -48,6 +48,7 @@
   default: return llvm::CallingConv::C;
   case CC_X86StdCall: return llvm::CallingConv::X86_StdCall;
   case CC_X86FastCall: return llvm::CallingConv::X86_FastCall;
+  case CC_X86RegCall: return llvm::CallingConv::X86_RegCall;
   case CC_X86ThisCall: return llvm::CallingConv::X86_ThisCall;
   case CC_X86_64Win64: return llvm::CallingConv::X86_64_Win64;
   case CC_X86_64SysV: return llvm::CallingConv::X

Re: r283063 - Alias must point to a definition

2016-10-03 Thread Yaron Keren via cfe-commits
yes, it works, thanks!

2016-10-03 18:19 GMT+03:00 Aditya K :

> Thanks for poining that out. I have updated the test case, please see if
> that works.
>
>
> http://llvm.org/viewvc/llvm-project?view=revision&revision=283085
>
>
>
> -Aditya
>
>
> --
> *From:* Yaron Keren 
> *Sent:* Sunday, October 2, 2016 11:32 AM
> *To:* Aditya Kumar
> *Cc:* cfe-commits
> *Subject:* Re: r283063 - Alias must point to a definition
>
> The mangling is different when targeting MSVC ABI, see failure at
>
> http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/
> builds/29889/steps/test_all/logs/Clang%20%3A%3A%
> 20CodeGenCXX__alias-available-externally.cpp
>
> maybe   -triple x86_64-pc-linux  ?
>
> 2016-10-02 6:06 GMT+03:00 Aditya Kumar via cfe-commits <
> cfe-commits@lists.llvm.org>:
>
>> Author: hiraditya
>> Date: Sat Oct  1 22:06:36 2016
>> New Revision: 283063
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=283063&view=rev
>> Log:
>> Alias must point to a definition
>>
>> Reapplying the patch after modifying the test case.
>>
>> Inlining the destructor caused the compiler to generate bad IR which
>> failed the Verifier in the backend.
>> https://llvm.org/bugs/show_bug.cgi?id=30341
>>
>> This patch disables alias to available_externally definitions.
>>
>> Reviewers: eugenis, rsmith
>>
>> Differential Revision: https://reviews.llvm.org/D24682
>>
>> Added:
>> cfe/trunk/test/CodeGenCXX/alias-available-externally.cpp
>> Modified:
>> cfe/trunk/lib/CodeGen/CGCXX.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CG
>> CXX.cpp?rev=283063&r1=283062&r2=283063&view=diff
>> 
>> ==
>> --- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGCXX.cpp Sat Oct  1 22:06:36 2016
>> @@ -134,6 +134,11 @@ bool CodeGenModule::TryEmitDefinitionAsA
>>llvm::GlobalValue::LinkageTypes TargetLinkage =
>>getFunctionLinkage(TargetDecl);
>>
>> +  // available_externally definitions aren't real definitions, so we
>> cannot
>> +  // create an alias to one.
>> +  if (TargetLinkage == llvm::GlobalValue::AvailableExternallyLinkage)
>> +return true;
>> +
>>// Check if we have it already.
>>StringRef MangledName = getMangledName(AliasDecl);
>>llvm::GlobalValue *Entry = GetGlobalValue(MangledName);
>> @@ -156,14 +161,7 @@ bool CodeGenModule::TryEmitDefinitionAsA
>>
>>// Instead of creating as alias to a linkonce_odr, replace all of the
>> uses
>>// of the aliasee.
>> -  if (llvm::GlobalValue::isDiscardableIfUnused(Linkage) &&
>> - (TargetLinkage != llvm::GlobalValue::AvailableExternallyLinkage ||
>> -  !TargetDecl.getDecl()->hasAttr())) {
>> -// FIXME: An extern template instantiation will create functions with
>> -// linkage "AvailableExternally". In libc++, some classes also define
>> -// members with attribute "AlwaysInline" and expect no reference to
>> -// be generated. It is desirable to reenable this optimisation after
>> -// corresponding LLVM changes.
>> +  if (llvm::GlobalValue::isDiscardableIfUnused(Linkage)) {
>>  addReplacement(MangledName, Aliasee);
>>  return false;
>>}
>>
>> Added: cfe/trunk/test/CodeGenCXX/alias-available-externally.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCX
>> X/alias-available-externally.cpp?rev=283063&view=auto
>> 
>> ==
>> --- cfe/trunk/test/CodeGenCXX/alias-available-externally.cpp (added)
>> +++ cfe/trunk/test/CodeGenCXX/alias-available-externally.cpp Sat Oct  1
>> 22:06:36 2016
>> @@ -0,0 +1,20 @@
>> +// RUN: %clang_cc1 -O1 -std=c++11 -emit-llvm -disable-llvm-passes -o -
>> %s | FileCheck %s
>> +// Clang should not generate alias to available_externally definitions.
>> +// Check that the destructor of Foo is defined.
>> +// The destructors have different return type for different targets.
>> +// CHECK: define linkonce_odr {{.*}} @_ZN3FooD2Ev
>> +template 
>> +struct String {
>> +  String() {}
>> +  ~String();
>> +};
>> +
>> +template 
>> +inline __attribute__((visibility("hidden"), always_inline))
>> +String::~String() {}
>> +
>> +extern template struct String;
>> +
>> +struct Foo : public String { Foo() { String s; } };
>> +
>> +Foo f;
>>
>>
>> ___
>> 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


[PATCH] D25068: [coroutines] Switch to using std::experimental namespace per P0057R5

2016-10-03 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
rsmith added inline comments.


> Sema.h:720-723
> +  /// \brief The C++ "std::experimental" namespace, where the experimental 
> parts
> +  /// of the standard library resides.
> +  NamespaceDecl *StdExperimentalNamespace;
> +

This is in the middle of a block of implicitly-declared library entities 
(std::bad_alloc, std::align_val_t). Please reorder it after these and rename it 
to include the word Cache.

https://reviews.llvm.org/D25068



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


[PATCH] D24373: [coroutines] Adding builtins for coroutine intrinsics and backendutil support.

2016-10-03 Thread Richard Smith via cfe-commits
rsmith added inline comments.


> LanguageExtensions.rst:1886
> +  bool __builtin_coro_done(void *addr);
> +  void __builtin_coro_promise(void *addr, int alignment, bool from_promise)
> +

Return type here is `void*`, not `void`.

> LanguageExtensions.rst:1916
> +
> +Other coroutine builtins are either for the internal clang use or for the use
> +during development of the coroutine feature. See `Coroutines in LLVM

Remove both "the"s here.

> O2-coro.c:1
> +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcoroutines-ts 
> -emit-llvm %s -o - -O3 | FileCheck %s
> +#include "Inputs/coro.h"

Please do not test the output of LLVM optimization in a clang unit test. It 
seems fine to just remove this test, you have the relevant coverage elsewhere.

> coro-builtins.c:5
> +void f() {
> +  // CHECK: %0 = call token @llvm.coro.id(i32 32, i8* null, i8* null, i8* 
> null)
> +  __builtin_coro_id(32, 0, 0, 0);

Use a pattern here rather than hardcoding `%0`; it's not reasonable to assume 
that this will always be the first instruction in the function.

Please also pass actual arguments here so we can test they're passed to the 
correct parameter.

https://reviews.llvm.org/D24373



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


r283131 - Factor out a diagnostic kind enum for use in two %select expressions

2016-10-03 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Mon Oct  3 13:34:23 2016
New Revision: 283131

URL: http://llvm.org/viewvc/llvm-project?rev=283131&view=rev
Log:
Factor out a diagnostic kind enum for use in two %select expressions

NFC

Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/TreeTransform.h

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=283131&r1=283130&r2=283131&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Mon Oct  3 13:34:23 2016
@@ -1970,6 +1970,21 @@ public:
   Decl *BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS,
RecordDecl *Record);
 
+  /// Common ways to introduce type names without a tag for use in diagnostics.
+  /// Keep in sync with err_tag_reference_non_tag.
+  enum NonTagKind {
+NTK_Unknown,
+NTK_Typedef,
+NTK_TypeAlias,
+NTK_Template,
+NTK_TypeAliasTemplate,
+NTK_TemplateTemplateArgument,
+  };
+
+  /// Given a non-tag type declaration, returns an enum useful for indicating
+  /// what kind of non-tag type this is.
+  NonTagKind getNonTagTypeDeclKind(const Decl *D);
+
   bool isAcceptableTagRedeclaration(const TagDecl *Previous,
 TagTypeKind NewTag, bool isDefinition,
 SourceLocation NewTagLoc,

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=283131&r1=283130&r2=283131&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Oct  3 13:34:23 2016
@@ -12243,6 +12243,20 @@ static bool isClassCompatTagKind(TagType
   return Tag == TTK_Struct || Tag == TTK_Class || Tag == TTK_Interface;
 }
 
+Sema::NonTagKind Sema::getNonTagTypeDeclKind(const Decl *PrevDecl) {
+  if (isa(PrevDecl))
+return NTK_Typedef;
+  else if (isa(PrevDecl))
+return NTK_TypeAlias;
+  else if (isa(PrevDecl))
+return NTK_Template;
+  else if (isa(PrevDecl))
+return NTK_TypeAliasTemplate;
+  else if (isa(PrevDecl))
+return NTK_TemplateTemplateArgument;
+  return NTK_Unknown;
+}
+
 /// \brief Determine whether a tag with a given kind is acceptable
 /// as a redeclaration of the given tag declaration.
 ///
@@ -13023,11 +13037,8 @@ Decl *Sema::ActOnTag(Scope *S, unsigned
   // (non-redeclaration) lookup.
   if ((TUK == TUK_Reference || TUK == TUK_Friend) &&
   !Previous.isForRedeclaration()) {
-unsigned Kind = 0;
-if (isa(PrevDecl)) Kind = 1;
-else if (isa(PrevDecl)) Kind = 2;
-else if (isa(PrevDecl)) Kind = 3;
-Diag(NameLoc, diag::err_tag_reference_non_tag) << Kind;
+NonTagKind NTK = getNonTagTypeDeclKind(PrevDecl);
+Diag(NameLoc, diag::err_tag_reference_non_tag) << NTK;
 Diag(PrevDecl->getLocation(), diag::note_declared_at);
 Invalid = true;
 
@@ -13038,11 +13049,8 @@ Decl *Sema::ActOnTag(Scope *S, unsigned
 
   // Diagnose implicit declarations introduced by elaborated types.
   } else if (TUK == TUK_Reference || TUK == TUK_Friend) {
-unsigned Kind = 0;
-if (isa(PrevDecl)) Kind = 1;
-else if (isa(PrevDecl)) Kind = 2;
-else if (isa(PrevDecl)) Kind = 3;
-Diag(NameLoc, diag::err_tag_reference_conflict) << Kind;
+NonTagKind NTK = getNonTagTypeDeclKind(PrevDecl);
+Diag(NameLoc, diag::err_tag_reference_conflict) << NTK;
 Diag(PrevDecl->getLocation(), diag::note_previous_decl) << PrevDecl;
 Invalid = true;
 

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=283131&r1=283130&r2=283131&view=diff
==
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Mon Oct  3 13:34:23 2016
@@ -2468,7 +2468,7 @@ TypeResult Sema::ActOnTagTemplateIdType(
 //   If the identifier resolves to a typedef-name or the simple-template-id
 //   resolves to an alias template specialization, the
 //   elaborated-type-specifier is ill-formed.
-Diag(TemplateLoc, diag::err_tag_reference_non_tag) << 4;
+Diag(TemplateLoc, diag::err_tag_reference_non_tag) << 
NTK_TypeAliasTemplate;
 Diag(TAT->getLocation(), diag::note_declared_at);
   }
   
@@ -7438,14 +7438,8 @@ Sema::ActOnExplicitInstantiation(Scope *
   ClassTemplateDecl *ClassTemplate = dyn_cast(TD);
 
   if (!ClassTemplate) {
-unsigned ErrorKind = 0;
-if (isa(TD)) {
-  ErrorKind = 4;
-} else if (isa(TD)) {
-  ErrorKind = 5;
-}
-
-Diag(TemplateNameLoc, diag::err_tag_reference

[PATCH] D22057: Prevent devirtualization of calls to un-instantiated functions.

2016-10-03 Thread Sunil Srivastava via cfe-commits
Sunil_Srivastava added a comment.

Ping


https://reviews.llvm.org/D22057



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


Re: r283092 - [analyzer] Extend bug reports with extra notes

2016-10-03 Thread Vitaly Buka via cfe-commits
This patch breaks Windows:
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/29769/

On Mon, Oct 3, 2016 at 1:07 AM Artem Dergachev via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: dergachev
> Date: Mon Oct  3 02:58:26 2016
> New Revision: 283092
>
> URL: http://llvm.org/viewvc/llvm-project?rev=283092&view=rev
> Log:
> [analyzer] Extend bug reports with extra notes
>
> These diagnostics are separate from the path-sensitive engine's path notes,
> and can be added manually on top of path-sensitive or path-insensitive
> reports.
>
> The new note diagnostics would appear as note:-diagnostic on console and
> as blue bubbles in scan-build. In plist files they currently do not appear,
> because format needs to be discussed with plist file users.
>
> The analyzer option "-analyzer-config notes-as-events=true" would convert
> notes to normal path notes, and put them at the beginning of the path.
> This is a temporary hack to show the new notes in plist files.
>
> A few checkers would be updated in subsequent commits,
> including tests for this new feature.
>
> Differential Revision: https://reviews.llvm.org/D24278
>
> Modified:
> cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
> cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
>
> cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
> cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
> cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
> cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
> cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
> cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
> cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
> cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
>
> Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h?rev=283092&r1=283091&r2=283092&view=diff
>
> ==
> --- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
> (original)
> +++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h Mon Oct
> 3 02:58:26 2016
> @@ -266,6 +266,9 @@ private:
>/// \sa shouldWidenLoops
>Optional WidenLoops;
>
> +  /// \sa shouldDisplayNotesAsEvents
> +  Optional DisplayNotesAsEvents;
> +
>/// A helper function that retrieves option for a given full-qualified
>/// checker name.
>/// Options for checkers can be specified via 'analyzer-config'
> command-line
> @@ -534,6 +537,14 @@ public:
>/// This is controlled by the 'widen-loops' config option.
>bool shouldWidenLoops();
>
> +  /// Returns true if the bug reporter should transparently treat extra
> note
> +  /// diagnostic pieces as event diagnostic pieces. Useful when the
> diagnostic
> +  /// consumer doesn't support the extra note pieces.
> +  ///
> +  /// This is controlled by the 'notes-as-events' option, which defaults
> +  /// to false when unset.
> +  bool shouldDisplayNotesAsEvents();
> +
>  public:
>AnalyzerOptions() :
>  AnalysisStoreOpt(RegionStoreModel),
>
> Modified:
> cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283092&r1=283091&r2=283092&view=diff
>
> ==
> --- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
> (original)
> +++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
> Mon Oct  3 02:58:26 2016
> @@ -66,6 +66,8 @@ public:
>typedef SmallVector, 8> VisitorList;
>typedef VisitorList::iterator visitor_iterator;
>typedef SmallVector ExtraTextList;
> +  typedef SmallVector,
> 4>
> +  NoteList;
>
>  protected:
>friend class BugReporter;
> @@ -82,7 +84,8 @@ protected:
>const ExplodedNode *ErrorNode;
>SmallVector Ranges;
>ExtraTextList ExtraText;
> -
> +  NoteList Notes;
> +
>typedef llvm::DenseSet Symbols;
>typedef llvm::DenseSet Regions;
>
> @@ -177,6 +180,18 @@ public:
>const BugType& getBugType() const { return BT; }
>BugType& getBugType() { return BT; }
>
> +  /// \brief True when the report has an execution path associated with
> it.
> +  ///
> +  /// A report is said to be path-sensitive if it was thrown against a
> +  /// particular exploded node in the path-sensitive analysis graph.
> +  /// Path-sensitive reports have their intermediate path diagnostics
> +  /// auto-generated, perhaps with the help of checker-defined visitors,
> +  /// and may contain extra notes.
> +  /// Path-insensitive reports consist only of a single warning message
> +  /// in a specific location, and perhaps extra notes.
> +  /// Path-sensitive checkers are allowed to throw path-insensitive
> reports.
> +  bool isPathSen

[PATCH] D25139: [CUDA] Add Sema::CUDADiagBuilder and Sema::CUDADiagIfDeviceCode().

2016-10-03 Thread Justin Lebar via cfe-commits
jlebar updated this revision to Diff 73315.
jlebar marked an inline comment as done.
jlebar added a comment.

Address review comments, and rebase atop https://reviews.llvm.org/D24573.


https://reviews.llvm.org/D25139

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaCUDA.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/SemaCUDA/exceptions-host-device.cu
  clang/test/SemaCUDA/exceptions.cu

Index: clang/test/SemaCUDA/exceptions.cu
===
--- clang/test/SemaCUDA/exceptions.cu
+++ clang/test/SemaCUDA/exceptions.cu
@@ -9,13 +9,13 @@
 }
 __device__ void device() {
   throw NULL;
-  // expected-error@-1 {{cannot use 'throw' in __device__ function 'device'}}
+  // expected-error@-1 {{cannot use 'throw' in __device__ function}}
   try {} catch(void*) {}
-  // expected-error@-1 {{cannot use 'try' in __device__ function 'device'}}
+  // expected-error@-1 {{cannot use 'try' in __device__ function}}
 }
 __global__ void kernel() {
   throw NULL;
-  // expected-error@-1 {{cannot use 'throw' in __global__ function 'kernel'}}
+  // expected-error@-1 {{cannot use 'throw' in __global__ function}}
   try {} catch(void*) {}
-  // expected-error@-1 {{cannot use 'try' in __global__ function 'kernel'}}
+  // expected-error@-1 {{cannot use 'try' in __global__ function}}
 }
Index: clang/test/SemaCUDA/exceptions-host-device.cu
===
--- clang/test/SemaCUDA/exceptions-host-device.cu
+++ clang/test/SemaCUDA/exceptions-host-device.cu
@@ -14,8 +14,8 @@
   throw NULL;
   try {} catch(void*) {}
 #ifndef HOST
-  // expected-error@-3 {{cannot use 'throw' in __host__ __device__ function 'hd1'}}
-  // expected-error@-3 {{cannot use 'try' in __host__ __device__ function 'hd1'}}
+  // expected-error@-3 {{cannot use 'throw' in __host__ __device__ function}}
+  // expected-error@-3 {{cannot use 'try' in __host__ __device__ function}}
 #endif
 }
 
@@ -31,8 +31,8 @@
   throw NULL;
   try {} catch(void*) {}
 #ifndef HOST
-  // expected-error@-3 {{cannot use 'throw' in __host__ __device__ function 'hd3'}}
-  // expected-error@-3 {{cannot use 'try' in __host__ __device__ function 'hd3'}}
+  // expected-error@-3 {{cannot use 'throw' in __host__ __device__ function}}
+  // expected-error@-3 {{cannot use 'try' in __host__ __device__ function}}
 #endif
 }
 __device__ void call_hd3() { hd3(); }
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -2249,8 +2249,8 @@
 return QualType();
   }
   // CUDA device code doesn't support VLAs.
-  if (getLangOpts().CUDA && T->isVariableArrayType() && !CheckCUDAVLA(Loc))
-return QualType();
+  if (getLangOpts().CUDA && T->isVariableArrayType())
+CUDADiagIfDeviceCode(Loc, diag::err_cuda_vla) << CurrentCUDATarget();
 
   // If this is not C99, extwarn about VLA's and C99 array size modifiers.
   if (!getLangOpts().C99) {
Index: clang/lib/Sema/SemaStmt.cpp
===
--- clang/lib/Sema/SemaStmt.cpp
+++ clang/lib/Sema/SemaStmt.cpp
@@ -3646,7 +3646,8 @@
 
   // Exceptions aren't allowed in CUDA device code.
   if (getLangOpts().CUDA)
-CheckCUDAExceptionExpr(TryLoc, "try");
+CUDADiagIfDeviceCode(TryLoc, diag::err_cuda_device_exceptions)
+<< "try" << CurrentCUDATarget();
 
   if (getCurScope() && getCurScope()->isOpenMPSimdDirectiveScope())
 Diag(TryLoc, diag::err_omp_simd_region_cannot_use_stmt) << "try";
Index: clang/lib/Sema/SemaExprCXX.cpp
===
--- clang/lib/Sema/SemaExprCXX.cpp
+++ clang/lib/Sema/SemaExprCXX.cpp
@@ -685,7 +685,8 @@
 
   // Exceptions aren't allowed in CUDA device code.
   if (getLangOpts().CUDA)
-CheckCUDAExceptionExpr(OpLoc, "throw");
+CUDADiagIfDeviceCode(OpLoc, diag::err_cuda_device_exceptions)
+<< "throw" << CurrentCUDATarget();
 
   if (getCurScope() && getCurScope()->isOpenMPSimdDirectiveScope())
 Diag(OpLoc, diag::err_omp_simd_region_cannot_use_stmt) << "throw";
Index: clang/lib/Sema/SemaCUDA.cpp
===
--- clang/lib/Sema/SemaCUDA.cpp
+++ clang/lib/Sema/SemaCUDA.cpp
@@ -42,6 +42,10 @@
 
 /// IdentifyCUDATarget - Determine the CUDA compilation target for this function
 Sema::CUDAFunctionTarget Sema::IdentifyCUDATarget(const FunctionDecl *D) {
+  // Code that lives outside a function is run on the host.
+  if (D == nullptr)
+return CFT_Host;
+
   if (D->hasAttr())
 return CFT_InvalidTarget;
 
@@ -95,9 +99,8 @@
 Sema::IdentifyCUDAPreference(const FunctionDecl *Caller,
  const FunctionDecl *Callee) {
   assert(Callee && "Callee must be valid.");
+  CUDAFunctionTarget CallerTar

[PATCH] D25139: [CUDA] Add Sema::CUDADiagBuilder and Sema::CUDADiagIfDeviceCode().

2016-10-03 Thread Justin Lebar via cfe-commits
jlebar added inline comments.


> rnk wrote in Sema.h:9238
> I'm concerned that this usage pattern isn't going to be efficient because you 
> build the complete diagnostic before calling the bool conversion operator to 
> determine that it doesn't need to be emitted. I think you want to construct 
> something more like:
> 
>   if (isCUDADeviceCode())
> CUDADiag(...) << ...;
> 
> Otherwise you are going to construct and destruct a large number of 
> diagnostics about language features that are forbidden in device code, but 
> are legal in host code, and 99% of the TU is going to be host code that uses 
> these illegal features.

I think the comment is misleading -- I tried to update it to resolve this 
misunderstanding.  Does it make more sense now?

> rnk wrote in Sema.h:9258
> Remind me why we need to do this? Which arena is this stuff allocated in and 
> where would I go to read more about it? My thought is that, if we don't 
> construct very many of these, we should just allocate them in the usual 
> ASTContext arena and let them live forever. It would be more consistent with 
> our usual way of doing things.

These diagnostics live until the end of codegen, and so are destroyed after the 
ASTContext.

I am becoming increasingly displeased with emitting these errors during 
codegen.  In particular, it makes it annoying to write tests.  You cannot test 
deferred and immediate errors in the same test, because if you have any 
immediate errors, we never codegen, so we never emit the deferred ones.  This 
will also be a suboptimal user experience.

The only serious alternative mooted thus far is emitting the deferred errors 
when a function is marked used.  But this is going to emit deferred errors if 
e.g. two inline host+device functions have mutual recursion but are otherwise 
never touched (so don't need to be codegen'ed).  I am not sure if this will be 
OK or not, but I need to look at it.

If we move the errors to being emitted earlier, we won't need to do this dance.

https://reviews.llvm.org/D25139



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


[PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced

2016-10-03 Thread Victor Leschuk via cfe-commits
vleschuk updated this revision to Diff 73318.
vleschuk added a comment.

Fix code style:

- Two overloaded methods instead of 1 template
- lower-case-headed method names
- static methods instead of anon namespace
- extra new line between methods


https://reviews.llvm.org/D24426

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  test/CodeGen/debug-info-packed-struct.c
  test/CodeGen/debug-info-vector.c
  test/CodeGenCXX/debug-info-calling-conventions.cpp
  test/CodeGenCXX/debug-info-enum-class.cpp
  test/CodeGenCXX/debug-info-indirect-field-decl.cpp
  test/CodeGenCXX/debug-info-ms-bitfields.cpp
  test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp
  test/CodeGenCXX/debug-info-rvalue-ref.cpp
  test/CodeGenCXX/debug-info-template-quals.cpp
  test/CodeGenCXX/debug-info-template.cpp
  test/CodeGenCXX/debug-info-union.cpp
  test/CodeGenCXX/debug-info-uuid.cpp
  test/CodeGenCXX/debug-info-vla.cpp
  test/CodeGenCXX/debug-info-zero-length-arrays.cpp
  test/CodeGenCXX/debug-info.cpp
  test/CodeGenCXX/debug-lambda-this.cpp
  test/CodeGenObjC/block-byref-debuginfo.m
  test/CodeGenObjC/debug-info-block-type.m
  test/CodeGenObjC/debug-info-ivars-extension.m
  test/CodeGenObjC/debug-info-ivars-private.m
  test/CodeGenObjC/debug-info-ivars.m
  test/CodeGenObjCXX/debug-info-cyclic.mm

Index: test/CodeGenObjCXX/debug-info-cyclic.mm
===
--- test/CodeGenObjCXX/debug-info-cyclic.mm
+++ test/CodeGenObjCXX/debug-info-cyclic.mm
@@ -3,7 +3,7 @@
 struct B {
 // CHECK: ![[B:[0-9]+]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "B"
 // CHECK-SAME: line: [[@LINE-2]],
-// CHECK-SAME: size: 8, align: 8,
+// CHECK-SAME: size: 8,
 // CHECK-NOT:  offset:
 // CHECK-NOT:  DIFlagFwdDecl
 // CHECK-SAME: elements: ![[BMEMBERS:[0-9]+]]
Index: test/CodeGenObjC/debug-info-ivars.m
===
--- test/CodeGenObjC/debug-info-ivars.m
+++ test/CodeGenObjC/debug-info-ivars.m
@@ -21,24 +21,24 @@
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i"
 // CHECK-SAME:   line: 10
 // CHECK-SAME:   baseType: ![[INT:[0-9]+]]
-// CHECK-SAME:   size: 32, align: 32,
+// CHECK-SAME:   size: 32,
 // CHECK-NOT:offset:
 // CHECK-SAME:   flags: DIFlagProtected
 // CHECK: ![[INT]] = !DIBasicType(name: "int"
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_1"
 // CHECK-SAME:   line: 11
 // CHECK-SAME:   baseType: ![[UNSIGNED:[0-9]+]]
-// CHECK-SAME:   size: 9, align: 32,
+// CHECK-SAME:   size: 9,
 // CHECK-NOT:offset:
 // CHECK-SAME:   flags: DIFlagProtected
 // CHECK: ![[UNSIGNED]] = !DIBasicType(name: "unsigned int"
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_2"
 // CHECK-SAME:   line: 12
 // CHECK-SAME:   baseType: ![[UNSIGNED]]
-// CHECK-SAME:   size: 9, align: 32, offset: 1,
+// CHECK-SAME:   size: 9, offset: 1,
 // CHECK-SAME:   flags: DIFlagProtected
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_3"
 // CHECK-SAME:   line: 14
 // CHECK-SAME:   baseType: ![[UNSIGNED]]
-// CHECK-SAME:   size: 9, align: 32, offset: 3,
+// CHECK-SAME:   size: 9, offset: 3,
 // CHECK-SAME:   flags: DIFlagProtected
Index: test/CodeGenObjC/debug-info-ivars-private.m
===
--- test/CodeGenObjC/debug-info-ivars-private.m
+++ test/CodeGenObjC/debug-info-ivars-private.m
@@ -35,13 +35,13 @@
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "foo"
 // CHECK-SAME:   line: 14
 // CHECK-SAME:   baseType: ![[INT:[0-9]+]]
-// CHECK-SAME:   size: 32, align: 32,
+// CHECK-SAME:   size: 32,
 // CHECK-NOT:offset:
 // CHECK-SAME:   flags: DIFlagProtected
 // CHECK: ![[INT]] = !DIBasicType(name: "int"
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "bar"
 // CHECK-SAME:   line: 27
 // CHECK-SAME:   baseType: ![[INT:[0-9]+]]
-// CHECK-SAME:   size: 32, align: 32,
+// CHECK-SAME:   size: 32,
 // CHECK-NOT:offset:
 // CHECK-SAME:   flags: DIFlagPrivate
Index: test/CodeGenObjC/debug-info-ivars-extension.m
===
--- test/CodeGenObjC/debug-info-ivars-extension.m
+++ test/CodeGenObjC/debug-info-ivars-extension.m
@@ -30,7 +30,7 @@
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "a"
 // CHECK-SAME:   line: 7
 // CHECK-SAME:   baseType: ![[INT:[0-9]+]]
-// CHECK-SAME:   size: 32, align: 32
+// CHECK-SAME:   size: 32
 // CHECK-NOT:offset:
 // CHECK-SAME:   flags: DIFlagPublic
 // CHECK: ![[INT]] = !DIBasi

[PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced

2016-10-03 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a reviewer: rnk.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm



> CGDebugInfo.cpp:54-56
> +  auto TI = Ctx.getTypeInfo(Ty);
> +  return TI.AlignIsRequired ? Ctx.toCharUnitsFromBits(TI.Align).getQuantity()
> +: 0;

Don't duplicate, just delegate to the Type * overload:

  return getTypeAlignIfRequired(Ty.getTypePtr(), Ctx);

https://reviews.llvm.org/D24426



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


[PATCH] D25206: [Parser] Correct typo after lambda capture initializer is parsed

2016-10-03 Thread Akira Hatanaka via cfe-commits
ahatanak created this revision.
ahatanak added a reviewer: rsmith.
ahatanak added a subscriber: cfe-commits.

This fixes PR30566.

The assertion is triggered when RecordLayoutBuilder tries to compute the size 
of a field (for capture "name" in the test case) whose type hasn't been 
deduced. This fixes the bug by correcting the typo of the capture initializer 
after the initializer is parsed and before setting the expression for the 
annotation token.

rdar://problem/23380132


https://reviews.llvm.org/D25206

Files:
  lib/Parse/ParseExprCXX.cpp
  test/SemaCXX/lambda-expressions.cpp


Index: test/SemaCXX/lambda-expressions.cpp
===
--- test/SemaCXX/lambda-expressions.cpp
+++ test/SemaCXX/lambda-expressions.cpp
@@ -525,3 +525,17 @@
   decltype(a)::D b;
 }
 }
+
+namespace PR30566 {
+int name1; // expected-note {{'name1' declared here}}
+
+struct S1 {
+  template
+  S1(T t) { s = sizeof(t); }
+  int s;
+};
+
+void foo1() {
+  auto s1 = S1{[name=name]() {}}; // expected-error {{use of undeclared 
identifier 'name'; did you mean 'name1'?}}
+}
+}
Index: lib/Parse/ParseExprCXX.cpp
===
--- lib/Parse/ParseExprCXX.cpp
+++ lib/Parse/ParseExprCXX.cpp
@@ -948,6 +948,7 @@
   SourceLocation StartLoc = Tok.getLocation();
   InMessageExpressionRAIIObject MaybeInMessageExpression(*this, true);
   Init = ParseInitializer();
+  Init = Actions.CorrectDelayedTyposInExpr(Init.get());
 
   if (Tok.getLocation() != StartLoc) {
 // Back out the lexing of the token after the initializer.


Index: test/SemaCXX/lambda-expressions.cpp
===
--- test/SemaCXX/lambda-expressions.cpp
+++ test/SemaCXX/lambda-expressions.cpp
@@ -525,3 +525,17 @@
   decltype(a)::D b;
 }
 }
+
+namespace PR30566 {
+int name1; // expected-note {{'name1' declared here}}
+
+struct S1 {
+  template
+  S1(T t) { s = sizeof(t); }
+  int s;
+};
+
+void foo1() {
+  auto s1 = S1{[name=name]() {}}; // expected-error {{use of undeclared identifier 'name'; did you mean 'name1'?}}
+}
+}
Index: lib/Parse/ParseExprCXX.cpp
===
--- lib/Parse/ParseExprCXX.cpp
+++ lib/Parse/ParseExprCXX.cpp
@@ -948,6 +948,7 @@
   SourceLocation StartLoc = Tok.getLocation();
   InMessageExpressionRAIIObject MaybeInMessageExpression(*this, true);
   Init = ParseInitializer();
+  Init = Actions.CorrectDelayedTyposInExpr(Init.get());
 
   if (Tok.getLocation() != StartLoc) {
 // Back out the lexing of the token after the initializer.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r283092 - [analyzer] Extend bug reports with extra notes

2016-10-03 Thread Artem Dergachev via cfe-commits

> fatal error C1001: An internal error has occurred in the compiler.

Ouch. So i managed to *crash* the microsoft compiler with my code?

Could you please somehow have a look if this is reproducible? If it's 
reproducible or hard-to-check-if-reproducible then i'd revert.


I don't think i can debug this, as i don't have windows, and i have no 
guesses from looking at the code.


Also, should i have received an email for this failure? Cause i haven't 
received an email for this failure. Hope there aren't more failures.




03/10/2016 21:46, Vitaly Buka via cfe-commits пишет:
This patch breaks Windows: 
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/29769/


On Mon, Oct 3, 2016 at 1:07 AM Artem Dergachev via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:


Author: dergachev
Date: Mon Oct  3 02:58:26 2016
New Revision: 283092

URL: http://llvm.org/viewvc/llvm-project?rev=283092&view=rev
Log:
[analyzer] Extend bug reports with extra notes

These diagnostics are separate from the path-sensitive engine's
path notes,
and can be added manually on top of path-sensitive or
path-insensitive reports.

The new note diagnostics would appear as note:-diagnostic on
console and
as blue bubbles in scan-build. In plist files they currently do
not appear,
because format needs to be discussed with plist file users.

The analyzer option "-analyzer-config notes-as-events=true" would
convert
notes to normal path notes, and put them at the beginning of the path.
This is a temporary hack to show the new notes in plist files.

A few checkers would be updated in subsequent commits,
including tests for this new feature.

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

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
URL:

http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h?rev=283092&r1=283091&r2=283092&view=diff

==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
Mon Oct  3 02:58:26 2016
@@ -266,6 +266,9 @@ private:
   /// \sa shouldWidenLoops
   Optional WidenLoops;

+  /// \sa shouldDisplayNotesAsEvents
+  Optional DisplayNotesAsEvents;
+
   /// A helper function that retrieves option for a given
full-qualified
   /// checker name.
   /// Options for checkers can be specified via 'analyzer-config'
command-line
@@ -534,6 +537,14 @@ public:
   /// This is controlled by the 'widen-loops' config option.
   bool shouldWidenLoops();

+  /// Returns true if the bug reporter should transparently treat
extra note
+  /// diagnostic pieces as event diagnostic pieces. Useful when
the diagnostic
+  /// consumer doesn't support the extra note pieces.
+  ///
+  /// This is controlled by the 'notes-as-events' option, which
defaults
+  /// to false when unset.
+  bool shouldDisplayNotesAsEvents();
+
 public:
   AnalyzerOptions() :
 AnalysisStoreOpt(RegionStoreModel),

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL:

http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283092&r1=283091&r2=283092&view=diff

==
---
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
(original)
+++
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
Mon Oct  3 02:58:26 2016
@@ -66,6 +66,8 @@ public:
   typedef SmallVector, 8>
VisitorList;
   typedef VisitorList::iterator visitor_iterator;
   typedef SmallVector ExtraTextList;
+  typedef
SmallVector, 4>
+  NoteList;

 protected:
   friend class BugReporter;
@@ -82,7 +84,8 @@ protected:
   const ExplodedNode *ErrorNode;
   SmallVector Ranges;
   ExtraTextList ExtraText;
-
+  NoteList Notes;
+
   typedef llvm::DenseSet Symbols;
   typedef llvm::DenseSet Region

[PATCH] D25207: Added more comments to tooling::Replacements.

2016-10-03 Thread Eric Liu via cfe-commits
ioeric created this revision.
ioeric added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

Also test phabricator commit processing.


https://reviews.llvm.org/D25207

Files:
  include/clang/Tooling/Core/Replacement.h


Index: include/clang/Tooling/Core/Replacement.h
===
--- include/clang/Tooling/Core/Replacement.h
+++ include/clang/Tooling/Core/Replacement.h
@@ -176,6 +176,8 @@
   ///   - are insertions at the same offset and applying them in either order
   /// has the same effect, i.e. X + Y = Y + X when inserting X and Y
   /// respectively.
+  ///   - are identical replacements, i.e. applying the same replacement twice
+  /// is equivalent to applying it once.
   /// Examples:
   /// 1. Replacement A(0, 0, "a") and B(0, 0, "aa") are order-independent since
   ///applying them in either order gives replacement (0, 0, "aaa").
@@ -186,6 +188,8 @@
   ///since applying them in either order gives (0, 2, "123").
   /// 3. Replacement A(0, 3, "123") and B(2, 3, "321") are order-independent
   ///since either order gives (0, 5, "12321").
+  /// 4. Replacement A(0, 3, "ab") and B(0, 3, "ab") are order-independent 
since
+  ///applying the same replacement twice is equivalent to applying it once.
   /// Replacements with offset UINT_MAX are special - we do not detect 
conflicts
   /// for such replacements since users may add them intentionally as a special
   /// category of replacements.


Index: include/clang/Tooling/Core/Replacement.h
===
--- include/clang/Tooling/Core/Replacement.h
+++ include/clang/Tooling/Core/Replacement.h
@@ -176,6 +176,8 @@
   ///   - are insertions at the same offset and applying them in either order
   /// has the same effect, i.e. X + Y = Y + X when inserting X and Y
   /// respectively.
+  ///   - are identical replacements, i.e. applying the same replacement twice
+  /// is equivalent to applying it once.
   /// Examples:
   /// 1. Replacement A(0, 0, "a") and B(0, 0, "aa") are order-independent since
   ///applying them in either order gives replacement (0, 0, "aaa").
@@ -186,6 +188,8 @@
   ///since applying them in either order gives (0, 2, "123").
   /// 3. Replacement A(0, 3, "123") and B(2, 3, "321") are order-independent
   ///since either order gives (0, 5, "12321").
+  /// 4. Replacement A(0, 3, "ab") and B(0, 3, "ab") are order-independent since
+  ///applying the same replacement twice is equivalent to applying it once.
   /// Replacements with offset UINT_MAX are special - we do not detect conflicts
   /// for such replacements since users may add them intentionally as a special
   /// category of replacements.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25207: Added more comments to tooling::Replacements.

2016-10-03 Thread Eric Liu via cfe-commits
ioeric accepted this revision.
ioeric added a reviewer: ioeric.
ioeric added a comment.
This revision is now accepted and ready to land.

Since this patch only introduces new comments, I'll commit it for now to also 
test phabricator's commit processing.


https://reviews.llvm.org/D25207



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


r283135 - Added more comments to tooling::Replacements.

2016-10-03 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Mon Oct  3 14:14:30 2016
New Revision: 283135

URL: http://llvm.org/viewvc/llvm-project?rev=283135&view=rev
Log:
Added more comments to tooling::Replacements.

Summary: Also test phabricator commit processing.

Subscribers: klimek, cfe-commits

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

Modified:
cfe/trunk/include/clang/Tooling/Core/Replacement.h

Modified: cfe/trunk/include/clang/Tooling/Core/Replacement.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Core/Replacement.h?rev=283135&r1=283134&r2=283135&view=diff
==
--- cfe/trunk/include/clang/Tooling/Core/Replacement.h (original)
+++ cfe/trunk/include/clang/Tooling/Core/Replacement.h Mon Oct  3 14:14:30 2016
@@ -176,6 +176,8 @@ class Replacements {
   ///   - are insertions at the same offset and applying them in either order
   /// has the same effect, i.e. X + Y = Y + X when inserting X and Y
   /// respectively.
+  ///   - are identical replacements, i.e. applying the same replacement twice
+  /// is equivalent to applying it once.
   /// Examples:
   /// 1. Replacement A(0, 0, "a") and B(0, 0, "aa") are order-independent since
   ///applying them in either order gives replacement (0, 0, "aaa").
@@ -186,6 +188,8 @@ class Replacements {
   ///since applying them in either order gives (0, 2, "123").
   /// 3. Replacement A(0, 3, "123") and B(2, 3, "321") are order-independent
   ///since either order gives (0, 5, "12321").
+  /// 4. Replacement A(0, 3, "ab") and B(0, 3, "ab") are order-independent 
since
+  ///applying the same replacement twice is equivalent to applying it once.
   /// Replacements with offset UINT_MAX are special - we do not detect 
conflicts
   /// for such replacements since users may add them intentionally as a special
   /// category of replacements.


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


[PATCH] D25208: [libc++] Make _LIBCPP_TYPE_VIS export members

2016-10-03 Thread Shoaib Meenai via cfe-commits
smeenai created this revision.
smeenai added reviewers: compnerd, EricWF, mclow.lists.
smeenai added a subscriber: cfe-commits.

Most classes annotated with _LIBCPP_TYPE_VIS need to have at least some
of their members exported, otherwise we have a lot of link errors when
linking against a libc++ built with hidden visibility. This also makes
_LIBCPP_TYPE_VIS be consistent across platforms, since on Windows it
already exports members.


https://reviews.llvm.org/D25208

Files:
  docs/DesignDocs/VisibilityMacros.rst
  include/__config


Index: include/__config
===
--- include/__config
+++ include/__config
@@ -560,15 +560,15 @@
 #endif
 
 #ifndef _LIBCPP_TYPE_VIS
-#  if __has_attribute(__type_visibility__)
-#define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
-#  else
-#define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
-#  endif
+#define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
 #endif
 
 #ifndef _LIBCPP_TYPE_VIS_ONLY
-# define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS
+#  if __has_attribute(__type_visibility__)
+#define _LIBCPP_TYPE_VIS_ONLY __attribute__ 
((__type_visibility__("default")))
+#  else
+#define _LIBCPP_TYPE_VIS_ONLY __attribute__ ((__visibility__("default")))
+#  endif
 #endif
 
 #ifndef _LIBCPP_FUNC_VIS_ONLY
Index: docs/DesignDocs/VisibilityMacros.rst
===
--- docs/DesignDocs/VisibilityMacros.rst
+++ docs/DesignDocs/VisibilityMacros.rst
@@ -29,17 +29,17 @@
   A synonym for `_LIBCPP_INLINE_VISIBILITY`
 
 **_LIBCPP_TYPE_VIS**
+  Mark a type's typeinfo, vtable and members as having default visibility.
+  This attribute cannot be used on class templates.
+
+**_LIBCPP_TYPE_VIS_ONLY**
   Mark a type's typeinfo and vtable as having default visibility.
-  `_LIBCPP_TYPE_VIS`. This macro has no effect on the visibility of the
-  type's member functions. This attribute cannot be used on class templates.
+  This macro has no effect on the visibility of the type's member functions.
 
   **GCC Behavior**: GCC does not support Clang's `type_visibility(...)`
   attribute. With GCC the `visibility(...)` attribute is used and member
   functions are affected.
 
-**_LIBCPP_TYPE_VIS_ONLY**
-  The same as `_LIBCPP_TYPE_VIS` except that it may be applied to templates.
-
   **Windows Behavior**: DLLs do not support dllimport/export on class 
templates.
   The macro has an empty definition on this platform.
 


Index: include/__config
===
--- include/__config
+++ include/__config
@@ -560,15 +560,15 @@
 #endif
 
 #ifndef _LIBCPP_TYPE_VIS
-#  if __has_attribute(__type_visibility__)
-#define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
-#  else
-#define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
-#  endif
+#define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
 #endif
 
 #ifndef _LIBCPP_TYPE_VIS_ONLY
-# define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS
+#  if __has_attribute(__type_visibility__)
+#define _LIBCPP_TYPE_VIS_ONLY __attribute__ ((__type_visibility__("default")))
+#  else
+#define _LIBCPP_TYPE_VIS_ONLY __attribute__ ((__visibility__("default")))
+#  endif
 #endif
 
 #ifndef _LIBCPP_FUNC_VIS_ONLY
Index: docs/DesignDocs/VisibilityMacros.rst
===
--- docs/DesignDocs/VisibilityMacros.rst
+++ docs/DesignDocs/VisibilityMacros.rst
@@ -29,17 +29,17 @@
   A synonym for `_LIBCPP_INLINE_VISIBILITY`
 
 **_LIBCPP_TYPE_VIS**
+  Mark a type's typeinfo, vtable and members as having default visibility.
+  This attribute cannot be used on class templates.
+
+**_LIBCPP_TYPE_VIS_ONLY**
   Mark a type's typeinfo and vtable as having default visibility.
-  `_LIBCPP_TYPE_VIS`. This macro has no effect on the visibility of the
-  type's member functions. This attribute cannot be used on class templates.
+  This macro has no effect on the visibility of the type's member functions.
 
   **GCC Behavior**: GCC does not support Clang's `type_visibility(...)`
   attribute. With GCC the `visibility(...)` attribute is used and member
   functions are affected.
 
-**_LIBCPP_TYPE_VIS_ONLY**
-  The same as `_LIBCPP_TYPE_VIS` except that it may be applied to templates.
-
   **Windows Behavior**: DLLs do not support dllimport/export on class templates.
   The macro has an empty definition on this platform.
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D4687: MS ABI: Downgrade inheritance model mismatches to a warning sometimes

2016-10-03 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment.

Looks like patch was not committed.


https://reviews.llvm.org/D4687



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


[PATCH] D24999: [Sema] Only relax array-at-end-of-object checks in __builtin_object_size when -fno-strict-aliasing is given.

2016-10-03 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment.

Just want to give you a heads up that I was going to abandon the patch that 
adds support for attribute "flexible_array" (https://reviews.llvm.org/D21453) 
after r281277, but I'll probably need the attribute after all if we are going 
to make the changes in this patch.


https://reviews.llvm.org/D24999



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


[PATCH] D24693: [CodeGen] Don't emit lifetime intrinsics for some local variables

2016-10-03 Thread Richard Smith via cfe-commits
rsmith added a comment.

I'm concerned about the complexity of this approach; it's hard for me to be 
confident that `BuildScopeInformation` is correct and will remain correct in 
the presence of future changes to the AST, and if it's not, we'll potentially 
silently miscompile.

A simpler but less precise approach would be to disable lifetime markers for 
all variables for which it is possible to jump into their scope (that is, in 
C++, variables of suitably-trivial types with no explicit initializer, and in 
C, variables of non-variably-modified type) whose scopes contain any kind of 
label. I'd have a lot more confidence that such an approach would be -- and 
would remain -- correct.

I'd also like to see some tests for `indirectbr`s (computed goto) since they're 
the case where we would have the most trouble producing the correct set of 
lifetime markers.

On the other hand, for ASan's purposes, we really want a precise set of markers 
here. If we can determine the set of variables brought into scope by each 
goto/computed goto/switch branch that we emit, we can split the edge or (for an 
unsplittable edge) insert a conditional branch into the destination block to 
call the lifetime start intrinsic. This would require CodeGen to track the set 
of live variables and store it for each such branch and branch target so that 
we can refer to it when fixing up the relevant edge, but that doesn't seem 
prohibitively expensive, and it would avoid any cost in the common case of a 
function containing no branches and no branch targets.


https://reviews.llvm.org/D24693



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


[PATCH] D4362: Fix for Bug 19480 -- Adding a test case.

2016-10-03 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko closed this revision.
Eugene.Zelenko added a comment.

Committed in https://reviews.llvm.org/rL213987.


https://reviews.llvm.org/D4362



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


[PATCH] D25139: [CUDA] Add Sema::CUDADiagBuilder and Sema::CUDADiagIfDeviceCode().

2016-10-03 Thread Reid Kleckner via cfe-commits
rnk added inline comments.


> jlebar wrote in Sema.h:9258
> These diagnostics live until the end of codegen, and so are destroyed after 
> the ASTContext.
> 
> I am becoming increasingly displeased with emitting these errors during 
> codegen.  In particular, it makes it annoying to write tests.  You cannot 
> test deferred and immediate errors in the same test, because if you have any 
> immediate errors, we never codegen, so we never emit the deferred ones.  This 
> will also be a suboptimal user experience.
> 
> The only serious alternative mooted thus far is emitting the deferred errors 
> when a function is marked used.  But this is going to emit deferred errors if 
> e.g. two inline host+device functions have mutual recursion but are otherwise 
> never touched (so don't need to be codegen'ed).  I am not sure if this will 
> be OK or not, but I need to look at it.
> 
> If we move the errors to being emitted earlier, we won't need to do this 
> dance.

The ASTContext should outlive IRgen, since the AST is allocated in its arena. 
Is there a separate diagnostic memory pool that I don't know about?

https://reviews.llvm.org/D25139



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


[PATCH] D24669: {Sema] Gcc compatibility of vector shift.

2016-10-03 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


> vbyakovlcl wrote in DiagnosticGroups.td:522
> Gcc prints error messages
> 
> t.c:21:13: error: invalid operands to binary << (have vector_int8 and 
> vector_short8)
> 
>   vi8 = vi8 << vs8;
> 
> I could not find a flag controlling this error.

I would not add this as a diagnostic group, but instead use an ad-hoc group on 
the diagnostic itself. I don't think this is going to see very many diagnostics 
covered by the same group, but if that turns out to be the case, we can switch 
then.

> vbyakovlcl wrote in DiagnosticSemaKinds.td:2306
> The question is: would we like to have the feature as a clang extension?

I'm not the best one to answer that question, but we typically avoid adding new 
off-by-default diagnostics. Since GCC prints this as an error message and this 
patch is for GCC compatibility, it seems weird to me to add this as an 
off-by-default warning.

Repository:
  rL LLVM

https://reviews.llvm.org/D24669



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


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

2016-10-03 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

This patch is missing tests for the new functionality.



> aaron.ballman wrote in ExprCXX.h:109
> Missing the full stop at the end of the sentence.

It looks like this comment has not been handled yet.

> ExprCXX.h:120
> +  // Check to see if a given overloaded operator is of increment kind
> +  static bool isIncrementOp(OverloadedOperatorKind Opc) {
> +return Opc == OO_PlusPlus;

I'm not certain that `isIncrementOp` or `isDecrementOp` are useful predicate 
functions. I would test these conditions inside of Expr.cpp directly.

https://reviews.llvm.org/D22910



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


r283141 - [analyzer] A blind attempt to fix a buildbot after r283092.

2016-10-03 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Mon Oct  3 15:12:12 2016
New Revision: 283141

URL: http://llvm.org/viewvc/llvm-project?rev=283141&view=rev
Log:
[analyzer] A blind attempt to fix a buildbot after r283092.

The msvc compiler seems to crash compiling the BugReport class.

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283141&r1=283140&r2=283141&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h Mon 
Oct  3 15:12:12 2016
@@ -66,7 +66,7 @@ public:
   typedef SmallVector, 8> VisitorList;
   typedef VisitorList::iterator visitor_iterator;
   typedef SmallVector ExtraTextList;
-  typedef SmallVector, 4>
+  typedef std::vector>
   NoteList;
 
 protected:


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


[PATCH] D24965: [clang-tidy] Fix cppcoreguidelines-pro-type-member-init false negatives

2016-10-03 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


> ProTypeMemberInitCheck.cpp:307
> + Result.Nodes.getNodeAs("record")) {
> +assert(Record->hasDefaultConstructor());
> +checkMissingMemberInitializer(*Result.Context, Record, nullptr);

Please add an explanatory string literal to the assert (that way, if it 
triggers, some more information is immediately available).

> ProTypeMemberInitCheck.cpp:372
>// Do not propose fixes in macros since we cannot place them correctly.
> -  if (Ctor->getLocStart().isMacroID())
> +  if (Ctor && Ctor->getLocStart().isMacroID())
>  return;

Should also update the comment.

> cppcoreguidelines-pro-type-member-init.cpp:401
> +  // CHECK-FIXES: int F{};
> +};

Can you also add a test like:

  template 
  struct S {
T Val;
virtual ~S() = default;
  };
  
  template struct S;

https://reviews.llvm.org/D24965



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


Re: r283092 - [analyzer] Extend bug reports with extra notes

2016-10-03 Thread Vitaly Buka via cfe-commits
I will look into this and get back to you.

On Mon, Oct 3, 2016 at 12:12 PM Artem Dergachev  wrote:

> > fatal error C1001: An internal error has occurred in the compiler.
>
> Ouch. So i managed to *crash* the microsoft compiler with my code?
>
> Could you please somehow have a look if this is reproducible? If it's
> reproducible or hard-to-check-if-reproducible then i'd revert.
>
> I don't think i can debug this, as i don't have windows, and i have no
> guesses from looking at the code.
>
> Also, should i have received an email for this failure? Cause i haven't
> received an email for this failure. Hope there aren't more failures.
>
>
>
> 03/10/2016 21:46, Vitaly Buka via cfe-commits пишет:
>
> This patch breaks Windows:
> http://lab.llvm.org:8011/builders/sanitizer-windows/builds/29769/
>
> On Mon, Oct 3, 2016 at 1:07 AM Artem Dergachev via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: dergachev
> Date: Mon Oct  3 02:58:26 2016
> New Revision: 283092
>
> URL: http://llvm.org/viewvc/llvm-project?rev=283092&view=rev
> Log:
> [analyzer] Extend bug reports with extra notes
>
> These diagnostics are separate from the path-sensitive engine's path notes,
> and can be added manually on top of path-sensitive or path-insensitive
> reports.
>
> The new note diagnostics would appear as note:-diagnostic on console and
> as blue bubbles in scan-build. In plist files they currently do not appear,
> because format needs to be discussed with plist file users.
>
> The analyzer option "-analyzer-config notes-as-events=true" would convert
> notes to normal path notes, and put them at the beginning of the path.
> This is a temporary hack to show the new notes in plist files.
>
> A few checkers would be updated in subsequent commits,
> including tests for this new feature.
>
> Differential Revision: https://reviews.llvm.org/D24278
>
> Modified:
> cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
> cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
>
> cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
> cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
> cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
> cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
> cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
> cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
> cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
> cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
>
> Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h?rev=283092&r1=283091&r2=283092&view=diff
>
> ==
> --- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
> (original)
> +++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h Mon Oct
> 3 02:58:26 2016
> @@ -266,6 +266,9 @@ private:
>/// \sa shouldWidenLoops
>Optional WidenLoops;
>
> +  /// \sa shouldDisplayNotesAsEvents
> +  Optional DisplayNotesAsEvents;
> +
>/// A helper function that retrieves option for a given full-qualified
>/// checker name.
>/// Options for checkers can be specified via 'analyzer-config'
> command-line
> @@ -534,6 +537,14 @@ public:
>/// This is controlled by the 'widen-loops' config option.
>bool shouldWidenLoops();
>
> +  /// Returns true if the bug reporter should transparently treat extra
> note
> +  /// diagnostic pieces as event diagnostic pieces. Useful when the
> diagnostic
> +  /// consumer doesn't support the extra note pieces.
> +  ///
> +  /// This is controlled by the 'notes-as-events' option, which defaults
> +  /// to false when unset.
> +  bool shouldDisplayNotesAsEvents();
> +
>  public:
>AnalyzerOptions() :
>  AnalysisStoreOpt(RegionStoreModel),
>
> Modified:
> cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283092&r1=283091&r2=283092&view=diff
>
> ==
> --- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
> (original)
> +++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
> Mon Oct  3 02:58:26 2016
> @@ -66,6 +66,8 @@ public:
>typedef SmallVector, 8> VisitorList;
>typedef VisitorList::iterator visitor_iterator;
>typedef SmallVector ExtraTextList;
> +  typedef SmallVector,
> 4>
> +  NoteList;
>
>  protected:
>friend class BugReporter;
> @@ -82,7 +84,8 @@ protected:
>const ExplodedNode *ErrorNode;
>SmallVector Ranges;
>ExtraTextList ExtraText;
> -
> +  NoteList Notes;
> +
>typedef llvm::DenseSet Symbols;
>typedef llvm::DenseSet Regions;
>
> @@ -177,6 +180,18 @@ public:
>const BugType& getBugType() const { r

[PATCH] D3922: Take into account PrintingPolicy::SuppressUnwrittenScope in NamedDecl::printQualifiedName.

2016-10-03 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko closed this revision.
Eugene.Zelenko added a comment.

Committed in https://reviews.llvm.org/rL209924.


https://reviews.llvm.org/D3922



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


Re: r283141 - [analyzer] A blind attempt to fix a buildbot after r283092.

2016-10-03 Thread Hal Finkel via cfe-commits
- Original Message -
> From: "Artem Dergachev via cfe-commits" 
> To: cfe-commits@lists.llvm.org
> Sent: Monday, October 3, 2016 3:12:13 PM
> Subject: r283141 - [analyzer] A blind attempt to fix a buildbot after r283092.
> 
> Author: dergachev
> Date: Mon Oct  3 15:12:12 2016
> New Revision: 283141
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=283141&view=rev
> Log:
> [analyzer] A blind attempt to fix a buildbot after r283092.
> 
> The msvc compiler seems to crash compiling the BugReport class.

When you commit a work-around like this, please add a comment explaining what's 
going on. In this case, that we're using std::vector here instead of 
SmallVector because using SmallVector causes an ICE in MSVC version whatever 
(at optimization level whatever).

 -Hal

> 
> Modified:
> cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
> 
> Modified:
> cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283141&r1=283140&r2=283141&view=diff
> ==
> ---
> cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
> (original)
> +++
> cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
> Mon Oct  3 15:12:12 2016
> @@ -66,7 +66,7 @@ public:
>typedef SmallVector, 8>
>VisitorList;
>typedef VisitorList::iterator visitor_iterator;
>typedef SmallVector ExtraTextList;
> -  typedef
> SmallVector, 4>
> +  typedef
> std::vector>
>NoteList;
>  
>  protected:
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> 

-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r283092 - [analyzer] Extend bug reports with extra notes

2016-10-03 Thread Artem Dergachev via cfe-commits
I also made a quick blind guess at r283141 
(http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20161003/172390.html)


Thanks a lot for trying to help, sorry for causing problems.


03/10/2016 23:26, Vitaly Buka пишет:

I will look into this and get back to you.

On Mon, Oct 3, 2016 at 12:12 PM Artem Dergachev <mailto:noqnoq...@gmail.com>> wrote:


> fatal error C1001: An internal error has occurred in the compiler.

Ouch. So i managed to *crash* the microsoft compiler with my code?

Could you please somehow have a look if this is reproducible? If
it's reproducible or hard-to-check-if-reproducible then i'd revert.

I don't think i can debug this, as i don't have windows, and i
have no guesses from looking at the code.

Also, should i have received an email for this failure? Cause i
haven't received an email for this failure. Hope there aren't more
failures.



03/10/2016 21:46, Vitaly Buka via cfe-commits пишет:

This patch breaks Windows:
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/29769/

On Mon, Oct 3, 2016 at 1:07 AM Artem Dergachev via cfe-commits
mailto:cfe-commits@lists.llvm.org>>
wrote:

Author: dergachev
Date: Mon Oct  3 02:58:26 2016
New Revision: 283092

URL: http://llvm.org/viewvc/llvm-project?rev=283092&view=rev
Log:
[analyzer] Extend bug reports with extra notes

These diagnostics are separate from the path-sensitive
engine's path notes,
and can be added manually on top of path-sensitive or
path-insensitive reports.

The new note diagnostics would appear as note:-diagnostic on
console and
as blue bubbles in scan-build. In plist files they currently
do not appear,
because format needs to be discussed with plist file users.

The analyzer option "-analyzer-config notes-as-events=true"
would convert
notes to normal path notes, and put them at the beginning of
the path.
This is a temporary hack to show the new notes in plist files.

A few checkers would be updated in subsequent commits,
including tests for this new feature.

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

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
URL:

http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h?rev=283092&r1=283091&r2=283092&view=diff

==
---
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
(original)
+++
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
Mon Oct  3 02:58:26 2016
@@ -266,6 +266,9 @@ private:
   /// \sa shouldWidenLoops
   Optional WidenLoops;

+  /// \sa shouldDisplayNotesAsEvents
+  Optional DisplayNotesAsEvents;
+
   /// A helper function that retrieves option for a given
full-qualified
   /// checker name.
   /// Options for checkers can be specified via
'analyzer-config' command-line
@@ -534,6 +537,14 @@ public:
   /// This is controlled by the 'widen-loops' config option.
   bool shouldWidenLoops();

+  /// Returns true if the bug reporter should transparently
treat extra note
+  /// diagnostic pieces as event diagnostic pieces. Useful
when the diagnostic
+  /// consumer doesn't support the extra note pieces.
+  ///
+  /// This is controlled by the 'notes-as-events' option,
which defaults
+  /// to false when unset.
+  bool shouldDisplayNotesAsEvents();
+
 public:
   AnalyzerOptions() :
 AnalysisStoreOpt(RegionStoreModel),

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL:

http://llvm.org/viewvc/llvm-proj

[PATCH] D25024: [clang-tidy] Add check for detecting declarations with multiple names

2016-10-03 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


> CppCoreGuidelinesTidyModule.cpp:40
> +CheckFactories.registerCheck(
> +"cppcoreguidelines-one-name-per-declaration");
>  CheckFactories.registerCheck(

Can you also register this check under the name `cert-dcl04-c` as well? It fits 
the behavior of that recommendation too (aside from the exceptions in the 
recommendation, but those can be handled later). This will also require adding 
a .rst file for that check name and having it redirect appropriately.

https://www.securecoding.cert.org/confluence/display/c/DCL04-C.+Do+not+declare+more+than+one+variable+per+declaration

> OneNamePerDeclarationCheck.cpp:27
> +void OneNamePerDeclarationCheck::check(const MatchFinder::MatchResult 
> &Result) {
> +  // FIXME: Also provide diagnostics splitting the declarations. E.g.
> +  //

s/diagnostics/fixit ?

> OneNamePerDeclarationCheck.cpp:38
> +  diag(MultipleNameDeclaration->getStartLoc(),
> +   "Do not declare multiple names per declaration");
> +}

Diagnostics do not start with a capital letter. Also, this diagnostic is not 
really accurate. Consider `void f(int x, int y);` -- that's a single 
declaration, but it declares multiple names. Perhaps: `do not declare more than 
one variable per declaration` since this should really be focusing on variable 
declarations rather than parameters, template parameter lists, etc

> cppcoreguidelines-one-name-per-declaration.cpp:16
> +  return 0;
> +}

Please add tests that show the exceptions in the C++ Core Guidelines are 
properly handled. Also, I'd like to see tests with other named declarations, 
such as typedefs, template parameter lists, for loop initializers, etc.

https://reviews.llvm.org/D25024



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


  1   2   >