[PATCH] D31382: [XRay][clang] Remove dependency on libatomic for XRay builds

2017-03-26 Thread Dean Michael Berris via Phabricator via cfe-commits
dberris created this revision.

This change depends on https://reviews.llvm.org/D31381 where we change the 
implementation to use
sanitizer_common provided atomic operations library.

Fixes http://llvm.org/PR32274.


https://reviews.llvm.org/D31382

Files:
  lib/Driver/ToolChains/Gnu.cpp


Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -346,7 +346,6 @@
   CmdArgs.push_back("-lpthread");
   CmdArgs.push_back("-lrt");
   CmdArgs.push_back("-lm");
-  CmdArgs.push_back("-latomic");
 
   if (TC.getTriple().getOS() != llvm::Triple::FreeBSD)
 CmdArgs.push_back("-ldl");


Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -346,7 +346,6 @@
   CmdArgs.push_back("-lpthread");
   CmdArgs.push_back("-lrt");
   CmdArgs.push_back("-lm");
-  CmdArgs.push_back("-latomic");
 
   if (TC.getTriple().getOS() != llvm::Triple::FreeBSD)
 CmdArgs.push_back("-ldl");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D23418: [analyzer] Added a reusable constraint system to the CloneDetector

2017-03-26 Thread Leslie Zhai via Phabricator via cfe-commits
xiangzhai added a comment.

Hi Raphael,

Thanks for your awesome job!

I have read about the slide 
 of "LLVM: 
built-in scalable code clone detection based on semantic analysis", and sent 
email to Shamil for asking "Is Code clone detection in LLVM compiler 
infrastructure available?" he replied me that the implementation (in LLVM IR 
layer?) is unavailable - close source. so I pay more attention to your 
implementation without LLVM IR, but I am really really really care about:

1. Performance. I use `scan-build -k -v -enable-checker 
alpha.clone.CloneChecker` to static analysis K3B , 
it almost spend **one hour**! optimization plan?
2. False Positive. I use Coverity scan K3B 
 to compare with CloneDetector, there 
is **NO** false positive when detecting Copy-paste issue by setting **pattern** 
to ignore Qt Meta-Object Compiler  and other 
auto-generated source files. perhaps CloneChecker is able to learn this way to 
low false positive?

Thanks again for your great job!

Regards,
Leslie Zhai


https://reviews.llvm.org/D23418



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


[PATCH] D28462: clang-format: Add new style option AlignConsecutiveMacros

2017-03-26 Thread Erik Nyquist via Phabricator via cfe-commits
enyquist updated this revision to Diff 93092.
enyquist added a comment.

Option implemented completely in WhitespaceManager.cpp, so no overhead if the 
option isn't used. Also some minor style fixes.


Repository:
  rL LLVM

https://reviews.llvm.org/D28462

Files:
  docs/ClangFormatStyleOptions.rst
  include/clang/Format/Format.h
  lib/Format/Format.cpp
  lib/Format/WhitespaceManager.cpp
  lib/Format/WhitespaceManager.h
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -7518,8 +7518,78 @@
   verifyFormat("a or_eq 8;", Spaces);
 }
 
+TEST_F(FormatTest, AlignConsecutiveMacros) {
+  FormatStyle Alignment = getLLVMStyle();
+  Alignment.AlignConsecutiveAssignments = true;
+  Alignment.AlignConsecutiveDeclarations = true;
+  Alignment.AlignConsecutiveMacros = false;
+
+  verifyFormat("#define a 3\n"
+   "#define  4\n"
+   "#define ccc (5)",
+   Alignment);
+
+  verifyFormat("#define f(x) (x * x)\n"
+   "#define fff(x, y, z) (x * y + z)\n"
+   "#define (x, y) (x - y)",
+   Alignment);
+
+  verifyFormat("#define foo(x, y) (x + y)\n"
+   "#define bar (5, 6)(2 + 2)",
+   Alignment);
+
+  verifyFormat("#define a 3\n"
+   "#define  4\n"
+   "#define ccc (5)\n"
+   "#define f(x) (x * x)\n"
+   "#define fff(x, y, z) (x * y + z)\n"
+   "#define (x, y) (x - y)",
+   Alignment);
+
+  Alignment.AlignConsecutiveMacros = true;
+  verifyFormat("#define a3\n"
+   "#define  4\n"
+   "#define ccc  (5)",
+   Alignment);
+
+  verifyFormat("#define f(x) (x * x)\n"
+   "#define fff(x, y, z) (x * y + z)\n"
+   "#define (x, y)   (x - y)",
+   Alignment);
+
+  verifyFormat("#define foo(x, y) (x + y)\n"
+   "#define bar   (5, 6)(2 + 2)",
+   Alignment);
+
+  verifyFormat("#define a3\n"
+   "#define  4\n"
+   "#define ccc  (5)\n"
+   "#define f(x) (x * x)\n"
+   "#define fff(x, y, z) (x * y + z)\n"
+   "#define (x, y)   (x - y)",
+   Alignment);
+
+  verifyFormat("#define a 5\n"
+   "#define foo(x, y) (x + y)\n"
+   "#define CCC   (6)\n"
+   "auto lambda = []() {\n"
+   "  auto  ii = 0;\n"
+   "  float j  = 0;\n"
+   "  return 0;\n"
+   "};\n"
+   "int   i  = 0;\n"
+   "float i2 = 0;\n"
+   "auto  v  = type{\n"
+   "i = 1,   //\n"
+   "(i = 2), //\n"
+   "i = 3//\n"
+   "};",
+   Alignment);
+}
+
 TEST_F(FormatTest, AlignConsecutiveAssignments) {
   FormatStyle Alignment = getLLVMStyle();
+  Alignment.AlignConsecutiveMacros = true;
   Alignment.AlignConsecutiveAssignments = false;
   verifyFormat("int a = 5;\n"
"int oneTwoThree = 123;",
@@ -7660,7 +7730,10 @@
"int j = 2;",
Alignment);
 
-  verifyFormat("auto lambda = []() {\n"
+  verifyFormat("#define a 5\n"
+   "#define foo(x, y) (x + y)\n"
+   "#define CCC   (6)\n"
+   "auto lambda = []() {\n"
"  auto i = 0;\n"
"  return 0;\n"
"};\n"
@@ -7702,6 +7775,7 @@
 
 TEST_F(FormatTest, AlignConsecutiveDeclarations) {
   FormatStyle Alignment = getLLVMStyle();
+  Alignment.AlignConsecutiveMacros = true;
   Alignment.AlignConsecutiveDeclarations = false;
   verifyFormat("float const a = 5;\n"
"int oneTwoThree = 123;",
@@ -7933,7 +8007,10 @@
Alignment);
 
   Alignment.AlignConsecutiveAssignments = true;
-  verifyFormat("auto lambda = []() {\n"
+  verifyFormat("#define a 5\n"
+   "#define foo(x, y) (x + y)\n"
+   "#define CCC   (6)\n"
+   "auto lambda = []() {\n"
"  auto  ii = 0;\n"
"  float j  = 0;\n"
"  return 0;\n"
@@ -8659,6 +8736,7 @@
   CHECK_PARSE_BOOL(AlignEscapedNewlinesLeft);
   CHECK_PARSE_BOOL(AlignOperands);
   CHECK_PARSE_BOOL(AlignTrailingComments);
+  CHECK_PARSE_BOOL(AlignConsecutiveMacros);
   CHECK_PARSE_BOOL(AlignConsecutiveAssignments);
   CHECK_PARSE_BOOL(AlignConsecutiveDeclarations);
   CHECK_PARSE_BOOL(AllowAllParametersOfDeclarationOnNextLine);
Index: lib/Format/WhitespaceManager.h
===
--- lib/Format/WhitespaceManager.h
+++ lib/Format/WhitespaceManager.h
@@ -165,6 +165,9 @@
   /// \c EscapedNewlineColumn for the first tokens or token parts in a line.
   void 

[PATCH] D30909: [Analyzer] Finish taint propagation to derived symbols of tainted regions

2017-03-26 Thread Vlad Tsyrklevich via Phabricator via cfe-commits
vlad.tsyrklevich added inline comments.



Comment at: lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp:494
+  SymbolManager  = C.getSymbolManager();
+  return SM.getDerivedSymbol(Sym, LCV.getRegion());
 }

NoQ wrote:
> I'd think about this a bit more and come back.
> 
> I need to understand how come that constructing a symbol manually is the 
> right thing to do; that doesn't happen very often, but it seems correct here.
Indeed it is odd. The best justification I could come up with: LCVs are meant 
to be optimizations, their 'purpose' is to expose an SVal that hides SymbolRef 
values so that we can have a split store. We don't have to copy all of a 
compound values SymbolRef mappings because LCVs are kept distinct. Hence to 
set/query/constrain region values you use SVals so that RegionStore can 
differentiate between LCVs and SymbolRef backed SVals for the two different 
stores it contains.

The taint interface however requires you taint a SymbolRef, not an SVal. If we 
wanted, instead of doing this logic here, we could change getPointedToSymbol() 
to return an SVal and update usages of it accordingly since that value is only 
passed on to ProgramState.isTainted()/ProgramState.addTaint() anyway. Then we 
could update addTaint/isTainted to perform this logic, hiding it from the 
checker.

This still requires manually constructing a symbol, now it's just performed in 
the analyzer instead of in a checker. Not sure if that addresses the issue you 
were considering, but the idea that we need to 'undo' the LCV optimization 
hiding the SymbolRef to have a value to taint seems somewhat convincing to me. 
What do you think?



Comment at: test/Analysis/taint-generic.c:210
+  read(sock, , sizeof(tainted.st));
+  __builtin_memcpy(buffer, tainted.buf, tainted.st[0].length); // 
expected-warning {{Untrusted data is used to specify the buffer size}}
 }

NoQ wrote:
> Are we already supporting the case when we're tainting some elements of an 
> array but not all of them, and this works as expected? Could we add such 
> tests (regardless of whether we already handle them)?
It does work in that case. If you taint element X of region Y the current logic 
will be conservative and only mark element X as tainted, not X-i or X+i. This 
is also true for element 0, so if a programmer passes [0] but reads 
sizeof(array) bytes it will not correctly mark that. This is also a short 
coming of the invalidation code so I don't think there's much to do until 
there's more general support for dealing with region extents.


https://reviews.llvm.org/D30909



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


[PATCH] D30909: [Analyzer] Finish taint propagation to derived symbols of tainted regions

2017-03-26 Thread Vlad Tsyrklevich via Phabricator via cfe-commits
vlad.tsyrklevich updated this revision to Diff 93091.
vlad.tsyrklevich marked 2 inline comments as done.
vlad.tsyrklevich added a comment.

Respond to Artem's comments.


https://reviews.llvm.org/D30909

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
  include/clang/StaticAnalyzer/Core/PathSensitive/TaintManager.h
  lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
  lib/StaticAnalyzer/Core/ProgramState.cpp
  lib/StaticAnalyzer/Core/RegionStore.cpp
  test/Analysis/taint-generic.c

Index: test/Analysis/taint-generic.c
===
--- test/Analysis/taint-generic.c
+++ test/Analysis/taint-generic.c
@@ -192,20 +192,41 @@
 
 void testStructArray() {
   struct {
-char buf[16];
-struct {
-  int length;
-} st[1];
-  } tainted;
+int length;
+  } tainted[4];
 
-  char buffer[16];
+  char dstbuf[16], srcbuf[16];
   int sock;
 
   sock = socket(AF_INET, SOCK_STREAM, 0);
-  read(sock, [0], sizeof(tainted.buf));
-  read(sock, [0], sizeof(tainted.st));
-  // FIXME: tainted.st[0].length should be marked tainted
-  __builtin_memcpy(buffer, tainted.buf, tainted.st[0].length); // no-warning
+  __builtin_memset(srcbuf, 0, sizeof(srcbuf));
+
+  read(sock, [0], sizeof(tainted));
+  __builtin_memcpy(dstbuf, srcbuf, tainted[0].length); // expected-warning {{Untrusted data is used to specify the buffer size}}
+
+  __builtin_memset(, 0, sizeof(tainted));
+  read(sock, , sizeof(tainted));
+  __builtin_memcpy(dstbuf, srcbuf, tainted[0].length); // expected-warning {{Untrusted data is used to specify the buffer size}}
+
+  __builtin_memset(, 0, sizeof(tainted));
+  // If we taint element 1, we should not raise an alert on taint for element 0 or element 2
+  read(sock, [1], sizeof(tainted));
+  __builtin_memcpy(dstbuf, srcbuf, tainted[0].length); // no-warning
+  __builtin_memcpy(dstbuf, srcbuf, tainted[2].length); // no-warning
+}
+
+void testUnion() {
+  union {
+int x;
+char y[4];
+  } tainted;
+
+  char buffer[4];
+
+  int sock = socket(AF_INET, SOCK_STREAM, 0);
+  read(sock, , sizeof(tainted.y));
+  // FIXME: overlapping regions aren't detected by isTainted yet
+  __builtin_memcpy(buffer, tainted.y, tainted.x);
 }
 
 int testDivByZero() {
Index: lib/StaticAnalyzer/Core/RegionStore.cpp
===
--- lib/StaticAnalyzer/Core/RegionStore.cpp
+++ lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -496,7 +496,10 @@
 
   Optional getDefaultBinding(Store S, const MemRegion *R) override {
 RegionBindingsRef B = getRegionBindings(S);
-return B.getDefaultBinding(R);
+// Default bindings are always applied over a base region so look up the
+// base region's default binding, otherwise the lookup will fail when R
+// is at an offset from R->getBaseRegion().
+return B.getDefaultBinding(R->getBaseRegion());
   }
 
   SVal getBinding(RegionBindingsConstRef B, Loc L, QualType T = QualType());
Index: lib/StaticAnalyzer/Core/ProgramState.cpp
===
--- lib/StaticAnalyzer/Core/ProgramState.cpp
+++ lib/StaticAnalyzer/Core/ProgramState.cpp
@@ -671,6 +671,19 @@
 
   ProgramStateRef NewState = set(Sym, Kind);
   assert(NewState);
+
+  if (const SymbolDerived *SD = dyn_cast(Sym)) {
+TaintedSymRegionsRef SymRegions(0, TSRFactory.getTreeFactory());
+
+if (const TaintedSymRegionsRef *SavedRegions =
+  get(SD->getParentSymbol()))
+  SymRegions = *SavedRegions;
+
+SymRegions = SymRegions.add(SD->getRegion());
+NewState = NewState->set(SD->getParentSymbol(), SymRegions);
+assert(NewState);
+  }
+
   return NewState;
 }
 
@@ -723,15 +736,34 @@
 const TaintTagType *Tag = get(*SI);
 Tainted = (Tag && *Tag == Kind);
 
-// If this is a SymbolDerived with a tainted parent, it's also tainted.
-if (const SymbolDerived *SD = dyn_cast(*SI))
+if (const SymbolDerived *SD = dyn_cast(*SI)) {
+  // If this is a SymbolDerived with a tainted parent, it's also tainted.
   Tainted = Tainted || isTainted(SD->getParentSymbol(), Kind);
 
+  // If this is a SymbolDerived with the same parent symbol as another
+  // tainted SymbolDerived and a region that's a sub-region of that tainted
+  // symbol, it's also tainted.
+  if (const TaintedSymRegionsRef *SymRegions =
+get(SD->getParentSymbol())) {
+const TypedValueRegion *R = SD->getRegion();
+for (TaintedSymRegionsRef::iterator I = SymRegions->begin(),
+E = SymRegions->end();
+ I != E; ++I) {
+  // FIXME: The logic to identify tainted regions could be more
+  // complete. For example, this would not currently identify
+  // overlapping fields in a union as tainted. To identify this we can
+  // check for overlapping/nested byte offsets.
+  if (R == *I || R->isSubRegionOf(*I))
+return 

[PATCH] D31378: [PCH] Attach instance's dependency collectors to PCH external AST sources.

2017-03-26 Thread Graydon Hoare via Phabricator via cfe-commits
graydon created this revision.

When a PCH is included via -include-pch, clang should treat the
current TU as dependent on the sourcefile that the PCH was generated from.

This is currently _partly_ accomplished by InitializePreprocessor calling
AddImplicitIncludePCH to synthesize an implicit #include of the sourcefile,
into the preprocessor's Predefines buffer.

For FrontendActions such as PreprocessOnlyAction (which is, curiously, what the
driver winds up running one of in response to a plain clang -M) this is
sufficient: the preprocessor cranks over its Predefines and emits a dependency
reference to the initial sourcefile.

For other FrontendActions (for example -emit-obj or -fsyntax-only) the
Predefines buffer is reset to the suggested predefines buffer from the PCH, so
the dependency edge is lost. The result is that clang emits a .d file in those
cases that lacks a reference to the .h file responsible for the input (and in
Swift's case, our .swiftdeps file winds up not including a reference to the
source file for a PCH bridging header.)

This patch fixes the problem by taking a different tack: ignoring the
Predefines buffer (which seems a bit like a hack anyways) and directly
attaching the CompilerInstance's DependencyCollectors (and legacy
DependencyFileGenerator) to the ASTReader for the external AST.

This approach is similar to the one chosen in earlier consultation with Bruno
and Ben, and I think it's the least-bad solution, given several options.


https://reviews.llvm.org/D31378

Files:
  include/clang/Frontend/CompilerInstance.h
  lib/Frontend/CompilerInstance.cpp
  test/PCH/emit-dependencies.c


Index: test/PCH/emit-dependencies.c
===
--- /dev/null
+++ test/PCH/emit-dependencies.c
@@ -0,0 +1,9 @@
+// RUN: rm -f %t.pch
+// RUN: %clang_cc1 -emit-pch -o %t.pch %S/Inputs/chain-decls1.h
+// RUN: %clang_cc1 -include-pch %t.pch -fsyntax-only -MT %s.o -dependency-file 
- %s | FileCheck %s
+// CHECK: Inputs/chain-decls1.h
+
+int main() {
+  f();
+  return 0;
+}
Index: lib/Frontend/CompilerInstance.cpp
===
--- lib/Frontend/CompilerInstance.cpp
+++ lib/Frontend/CompilerInstance.cpp
@@ -497,6 +497,8 @@
   AllowPCHWithCompilerErrors, getPreprocessor(), getASTContext(),
   getPCHContainerReader(),
   getFrontendOpts().ModuleFileExtensions,
+  TheDependencyFileGenerator.get(),
+  DependencyCollectors,
   DeserializationListener,
   OwnDeserializationListener, Preamble,
   getFrontendOpts().UseGlobalModuleIndex);
@@ -507,6 +509,8 @@
 bool AllowPCHWithCompilerErrors, Preprocessor , ASTContext ,
 const PCHContainerReader ,
 ArrayRef Extensions,
+DependencyFileGenerator *DependencyFile,
+ArrayRef DependencyCollectors,
 void *DeserializationListener, bool OwnDeserializationListener,
 bool Preamble, bool UseGlobalModuleIndex) {
   HeaderSearchOptions  = PP.getHeaderSearchInfo().getHeaderSearchOpts();
@@ -524,6 +528,12 @@
   Reader->setDeserializationListener(
   static_cast(DeserializationListener),
   /*TakeOwnership=*/OwnDeserializationListener);
+
+  if (DependencyFile)
+DependencyFile->AttachToASTReader(*Reader);
+  for (auto  : DependencyCollectors)
+Listener->attachToASTReader(*Reader);
+
   switch (Reader->ReadAST(Path,
   Preamble ? serialization::MK_Preamble
: serialization::MK_PCH,
Index: include/clang/Frontend/CompilerInstance.h
===
--- include/clang/Frontend/CompilerInstance.h
+++ include/clang/Frontend/CompilerInstance.h
@@ -662,6 +662,8 @@
   bool AllowPCHWithCompilerErrors, Preprocessor , ASTContext ,
   const PCHContainerReader ,
   ArrayRef Extensions,
+  DependencyFileGenerator *DependencyFile,
+  ArrayRef DependencyCollectors,
   void *DeserializationListener, bool OwnDeserializationListener,
   bool Preamble, bool UseGlobalModuleIndex);
 


Index: test/PCH/emit-dependencies.c
===
--- /dev/null
+++ test/PCH/emit-dependencies.c
@@ -0,0 +1,9 @@
+// RUN: rm -f %t.pch
+// RUN: %clang_cc1 -emit-pch -o %t.pch %S/Inputs/chain-decls1.h
+// RUN: %clang_cc1 -include-pch %t.pch -fsyntax-only -MT %s.o -dependency-file - %s | FileCheck %s
+// CHECK: Inputs/chain-decls1.h
+
+int main() {
+  f();
+  return 0;
+}
Index: lib/Frontend/CompilerInstance.cpp
===
--- lib/Frontend/CompilerInstance.cpp
+++ lib/Frontend/CompilerInstance.cpp
@@ -497,6 +497,8 @@
   AllowPCHWithCompilerErrors, getPreprocessor(), getASTContext(),
   getPCHContainerReader(),
   getFrontendOpts().ModuleFileExtensions,
+  TheDependencyFileGenerator.get(),
+  DependencyCollectors,
 

r298824 - Revert r298742 "[ODRHash] Add error messages for mismatched parameters in methods."

2017-03-26 Thread Vassil Vassilev via cfe-commits
Author: vvassilev
Date: Sun Mar 26 16:39:16 2017
New Revision: 298824

URL: http://llvm.org/viewvc/llvm-project?rev=298824=rev
Log:
Revert r298742 "[ODRHash] Add error messages for mismatched parameters in 
methods."

I failed to revert this in r298816.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
cfe/trunk/lib/AST/ODRHash.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/test/Modules/odr_hash.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td?rev=298824=298823=298824=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td Sun Mar 26 
16:39:16 2017
@@ -146,12 +146,7 @@ def err_module_odr_violation_mismatch_de
   "method %4 is %select{not static|static}5|"
   "method %4 is %select{not volatile|volatile}5|"
   "method %4 is %select{not const|const}5|"
-  "method %4 is %select{not inline|inline}5|"
-  "method %4 that has %5 parameter%s5|"
-  "method %4 with %ordinal5 parameter of type %6|"
-  "method %4 with %ordinal5 parameter named %6|"
-  "method %4 with %ordinal5 parameter with %select{no |}6default argument|"
-  "method %4 with %ordinal5 parameter with default argument}3">;
+  "method %4 is %select{not inline|inline}5}3">;
 
 def note_module_odr_violation_mismatch_decl_diff : Note<"but in '%0' found "
   "%select{"
@@ -171,12 +166,7 @@ def note_module_odr_violation_mismatch_d
   "method %2 is %select{not static|static}3|"
   "method %2 is %select{not volatile|volatile}3|"
   "method %2 is %select{not const|const}3|"
-  "method %2 is %select{not inline|inline}3|"
-  "method %2 that has %3 parameter%s3|"
-  "method %2 with %ordinal3 parameter of type %4|"
-  "method %2 with %ordinal3 parameter named %4|"
-  "method %2 with %ordinal3 parameter with %select{no |}4default argument|"
-  "method %2 with %ordinal3 parameter with different default argument}1">;
+  "method %2 is %select{not inline|inline}3}1">;
 
 def warn_module_uses_date_time : Warning<
   "%select{precompiled header|module}0 uses __DATE__ or __TIME__">,

Modified: cfe/trunk/lib/AST/ODRHash.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ODRHash.cpp?rev=298824=298823=298824=diff
==
--- cfe/trunk/lib/AST/ODRHash.cpp (original)
+++ cfe/trunk/lib/AST/ODRHash.cpp Sun Mar 26 16:39:16 2017
@@ -169,11 +169,6 @@ public:
 Inherited::VisitValueDecl(D);
   }
 
-  void VisitParmVarDecl(const ParmVarDecl *D) {
-AddStmt(D->getDefaultArg());
-Inherited::VisitParmVarDecl(D);
-  }
-
   void VisitAccessSpecDecl(const AccessSpecDecl *D) {
 ID.AddInteger(D->getAccess());
 Inherited::VisitAccessSpecDecl(D);
@@ -207,12 +202,6 @@ public:
 Hash.AddBoolean(D->isPure());
 Hash.AddBoolean(D->isDeletedAsWritten());
 
-ID.AddInteger(D->param_size());
-
-for (auto *Param : D->parameters()) {
-  Hash.AddSubDecl(Param);
-}
-
 Inherited::VisitFunctionDecl(D);
   }
 
@@ -326,10 +315,6 @@ public:
 }
   }
 
-  void AddQualType(QualType T) {
-Hash.AddQualType(T);
-  }
-
   void Visit(const Type *T) {
 ID.AddInteger(T->getTypeClass());
 Inherited::Visit(T);
@@ -342,50 +327,6 @@ public:
 VisitType(T);
   }
 
-  void VisitFunctionType(const FunctionType *T) {
-AddQualType(T->getReturnType());
-T->getExtInfo().Profile(ID);
-Hash.AddBoolean(T->isConst());
-Hash.AddBoolean(T->isVolatile());
-Hash.AddBoolean(T->isRestrict());
-VisitType(T);
-  }
-
-  void VisitFunctionNoProtoType(const FunctionNoProtoType *T) {
-VisitFunctionType(T);
-  }
-
-  void VisitFunctionProtoType(const FunctionProtoType *T) {
-ID.AddInteger(T->getNumParams());
-for (auto ParamType : T->getParamTypes())
-  AddQualType(ParamType);
-
-const auto  = T->getExtProtoInfo();
-ID.AddInteger(epi.Variadic);
-ID.AddInteger(epi.TypeQuals);
-ID.AddInteger(epi.RefQualifier);
-ID.AddInteger(epi.ExceptionSpec.Type);
-
-if (epi.ExceptionSpec.Type == EST_Dynamic) {
-  for (QualType Ex : epi.ExceptionSpec.Exceptions)
-AddQualType(Ex);
-} else if (epi.ExceptionSpec.Type == EST_ComputedNoexcept &&
-   epi.ExceptionSpec.NoexceptExpr) {
-  AddStmt(epi.ExceptionSpec.NoexceptExpr);
-} else if (epi.ExceptionSpec.Type == EST_Uninstantiated ||
-   epi.ExceptionSpec.Type == EST_Unevaluated) {
-  AddDecl(epi.ExceptionSpec.SourceDecl->getCanonicalDecl());
-}
-if (epi.ExtParameterInfos) {
-  for (unsigned i = 0; i != T->getNumParams(); ++i)
-ID.AddInteger(epi.ExtParameterInfos[i].getOpaqueValue());
-}
-epi.ExtInfo.Profile(ID);
-Hash.AddBoolean(epi.HasTrailingReturn);
-
-VisitFunctionType(T);
-  

r298816 - Revert 298754 and 298742.

2017-03-26 Thread Vassil Vassilev via cfe-commits
Author: vvassilev
Date: Sun Mar 26 13:32:53 2017
New Revision: 298816

URL: http://llvm.org/viewvc/llvm-project?rev=298816=rev
Log:
Revert 298754 and 298742.

They broke llvm modules builds and our internal modules infrastructure.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
cfe/trunk/lib/AST/ODRHash.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/test/Modules/odr_hash.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td?rev=298816=298815=298816=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td Sun Mar 26 
13:32:53 2017
@@ -148,7 +148,7 @@ def err_module_odr_violation_mismatch_de
   "method %4 is %select{not const|const}5|"
   "method %4 is %select{not inline|inline}5|"
   "method %4 that has %5 parameter%s5|"
-  "method %4 with %ordinal5 parameter of type %6%select{| decayed from %8}7|"
+  "method %4 with %ordinal5 parameter of type %6|"
   "method %4 with %ordinal5 parameter named %6|"
   "method %4 with %ordinal5 parameter with %select{no |}6default argument|"
   "method %4 with %ordinal5 parameter with default argument}3">;
@@ -173,7 +173,7 @@ def note_module_odr_violation_mismatch_d
   "method %2 is %select{not const|const}3|"
   "method %2 is %select{not inline|inline}3|"
   "method %2 that has %3 parameter%s3|"
-  "method %2 with %ordinal3 parameter of type %4%select{| decayed from %6}5|"
+  "method %2 with %ordinal3 parameter of type %4|"
   "method %2 with %ordinal3 parameter named %4|"
   "method %2 with %ordinal3 parameter with %select{no |}4default argument|"
   "method %2 with %ordinal3 parameter with different default argument}1">;

Modified: cfe/trunk/lib/AST/ODRHash.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ODRHash.cpp?rev=298816=298815=298816=diff
==
--- cfe/trunk/lib/AST/ODRHash.cpp (original)
+++ cfe/trunk/lib/AST/ODRHash.cpp Sun Mar 26 13:32:53 2017
@@ -330,10 +330,6 @@ public:
 Hash.AddQualType(T);
   }
 
-  void VisitQualifiers(Qualifiers Quals) {
-ID.AddInteger(Quals.getAsOpaqueValue());
-  }
-
   void Visit(const Type *T) {
 ID.AddInteger(T->getTypeClass());
 Inherited::Visit(T);
@@ -341,43 +337,6 @@ public:
 
   void VisitType(const Type *T) {}
 
-  void VisitAdjustedType(const AdjustedType *T) {
-AddQualType(T->getOriginalType());
-AddQualType(T->getAdjustedType());
-VisitType(T);
-  }
-
-  void VisitDecayedType(const DecayedType *T) {
-AddQualType(T->getDecayedType());
-AddQualType(T->getPointeeType());
-VisitAdjustedType(T);
-  }
-
-  void VisitArrayType(const ArrayType *T) {
-AddQualType(T->getElementType());
-ID.AddInteger(T->getSizeModifier());
-VisitQualifiers(T->getIndexTypeQualifiers());
-VisitType(T);
-  }
-  void VisitConstantArrayType(const ConstantArrayType *T) {
-T->getSize().Profile(ID);
-VisitArrayType(T);
-  }
-
-  void VisitDependentSizedArrayType(const DependentSizedArrayType *T) {
-AddStmt(T->getSizeExpr());
-VisitArrayType(T);
-  }
-
-  void VisitIncompleteArrayType(const IncompleteArrayType *T) {
-VisitArrayType(T);
-  }
-
-  void VisitVariableArrayType(const VariableArrayType *T) {
-AddStmt(T->getSizeExpr());
-VisitArrayType(T);
-  }
-
   void VisitBuiltinType(const BuiltinType *T) {
 ID.AddInteger(T->getKind());
 VisitType(T);

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=298816=298815=298816=diff
==
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Sun Mar 26 13:32:53 2017
@@ -9586,33 +9586,13 @@ void ASTReader::diagnoseOdrViolations()
 for (unsigned I = 0; I < FirstNumParameters; ++I) {
   const ParmVarDecl *FirstParam = FirstMethod->getParamDecl(I);
   const ParmVarDecl *SecondParam = SecondMethod->getParamDecl(I);
-
-  QualType FirstParamType = FirstParam->getType();
-  QualType SecondParamType = SecondParam->getType();
-  if (FirstParamType != SecondParamType) {
-if (const DecayedType *ParamDecayedType =
-FirstParamType->getAs()) {
-  ODRDiagError(FirstMethod->getLocation(),
-   FirstMethod->getSourceRange(), MethodParameterType)
-  << FirstName << (I + 1) << FirstParamType << true
-  << ParamDecayedType->getOriginalType();
-} else {
-  ODRDiagError(FirstMethod->getLocation(),
-   

Re: [PATCH] D30760: Record command lines in objects built by clang, Clang part

2017-03-26 Thread Eric Christopher via cfe-commits
Sounds good to me.

On Sun, Mar 26, 2017, 9:40 AM David Blaikie  wrote:

> Yeah, I don't know/mind either way - I think there's a tidy simplicity to
> including exactly what the user wrote on the command line, so don't mind if
> it's not removed, but can see the argument to omit it. I'd probably leave
> it in for simplicity.
>
> On Fri, Mar 24, 2017 at 5:48 PM Eric Christopher via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Not sure, that's why I asked. Is it useful? Is it one of those things we
> want to remove since it'll be common among all of the TUs that want the
> text?
>
> On Fri, Mar 24, 2017 at 3:43 PM Zhizhou Yang via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Sure I can add some more tests here.
>
> For -grecord-gcc-switches itself, I think maybe we could keep it in
> recording, since it is also one of the options from command line?
>
> On Fri, Mar 24, 2017 at 2:54 PM, Eric Christopher via Phabricator <
> revi...@reviews.llvm.org> wrote:
>
> echristo added inline comments.
>
>
> 
> Comment at: test/Driver/debug-options.c:201-202
>  //
> +// GRECORD: "-dwarf-debug-flags"
> +// GRECORD: -### -c -grecord-gcc-switches
> +//
> 
> This seems a little light on the testing, would you mind adding some more
> interesting lines here? (Also, -grecord-gcc-switches seems like an option
> we might want to ignore for this?)
>
>
> https://reviews.llvm.org/D30760
>
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D30760: Record command lines in objects built by clang, Clang part

2017-03-26 Thread David Blaikie via cfe-commits
Yeah, I don't know/mind either way - I think there's a tidy simplicity to
including exactly what the user wrote on the command line, so don't mind if
it's not removed, but can see the argument to omit it. I'd probably leave
it in for simplicity.

On Fri, Mar 24, 2017 at 5:48 PM Eric Christopher via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Not sure, that's why I asked. Is it useful? Is it one of those things we
> want to remove since it'll be common among all of the TUs that want the
> text?
>
> On Fri, Mar 24, 2017 at 3:43 PM Zhizhou Yang via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Sure I can add some more tests here.
>
> For -grecord-gcc-switches itself, I think maybe we could keep it in
> recording, since it is also one of the options from command line?
>
> On Fri, Mar 24, 2017 at 2:54 PM, Eric Christopher via Phabricator <
> revi...@reviews.llvm.org> wrote:
>
> echristo added inline comments.
>
>
> 
> Comment at: test/Driver/debug-options.c:201-202
>  //
> +// GRECORD: "-dwarf-debug-flags"
> +// GRECORD: -### -c -grecord-gcc-switches
> +//
> 
> This seems a little light on the testing, would you mind adding some more
> interesting lines here? (Also, -grecord-gcc-switches seems like an option
> we might want to ignore for this?)
>
>
> https://reviews.llvm.org/D30760
>
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31375: Add docs for libunwind

2017-03-26 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs updated this revision to Diff 93075.

https://reviews.llvm.org/D31375

Files:
  CMakeLists.txt
  docs/BuildingLibunwind.rst
  docs/CMakeLists.txt
  docs/README.txt
  docs/conf.py
  docs/index.rst

Index: docs/index.rst
===
--- docs/index.rst
+++ docs/index.rst
@@ -0,0 +1,101 @@
+.. _index:
+
+===
+libunwind LLVM Unwinder
+===
+
+Overview
+
+
+libunwind is an implementation of the interface defined by the HP libunwind
+project. It was contributed by Apple as a way to enable clang++ to port to
+platforms that do not have a system unwinder. It is intended to be a small and
+fast implementation of the ABI, leaving off some features of HP's libunwind
+that never materialized (e.g. remote unwinding).
+
+The unwinder has two levels of API. The high level APIs are the `_Unwind_*`
+functions which implement functionality required by `__cxa_*` exception
+funcionts. The low level APIs are the `unw_*` functions which are an interface
+defined by the old HP libunwind project.
+
+Getting Started with libunwind
+--
+
+.. toctree::
+   :maxdepth: 2
+
+   BuildingLibunwind
+
+Current Status
+--
+
+libunwind is a production-quality unwinder, with platform support for DWARF
+unwind info, SjLj, and ARM EHABI.
+
+The low level libunwind API was designed to work either in-process (aka local)
+or to operate on another process (aka remote), but only the local path has been
+implemented. Remote unwinding remains as future work.
+
+Platform and Compiler Support
+-
+
+libunwind is known to work on the following platforms:
+
+   
+OS   Arch CompilersUnwind Info
+   
+Mac OS X i386, x86_64 Clang, GCC   DWARF CFI
+iOS  ARM  ClangSjLj
+Linuxi386, x86_64 Clang, GCC   DWARF CFI
+LinuxARM  Clang, GCC   EHABI
+Bare Metal   ARM  Clang, GCC   EHABI
+NetBSD   x86_64   Clang, GCC   DWARF CFI
+   
+
+The following minimum compiler versions are strongly recommended.
+
+* Clang 3.5 and above
+* GCC 4.7 and above.
+
+Anything older *may* work.
+
+Notes and Known Issues
+--
+
+* TODO
+
+Getting Involved
+
+
+First please review our `Developer's Policy `__
+and `Getting started with LLVM `__.
+
+**Bug Reports**
+
+If you think you've found a bug in libunwind, please report it using
+the `LLVM Bugzilla`_. If you're not sure, you
+can post a message to the `cfe-dev mailing list`_ or on IRC.
+Please include "libunwind" in your subject.
+
+**Patches**
+
+If you want to contribute a patch to libunwind, the best place for that is
+`Phabricator `_. Please include [libunwind] in the subject and
+add `cfe-commits` as a subscriber. Also make sure you are subscribed to the
+`cfe-commits mailing list `_.
+
+**Discussion and Questions**
+
+Send discussions and questions to the
+`cfe-dev mailing list `_.
+Please include [libunwind] in the subject.
+
+
+Quick Links
+===
+* `LLVM Homepage `_
+* `LLVM Bugzilla `_
+* `cfe-commits Mailing List`_
+* `cfe-dev Mailing List`_
+* `Browse libunwind -- SVN `_
+* `Browse libunwind -- ViewVC `_
Index: docs/conf.py
===
--- docs/conf.py
+++ docs/conf.py
@@ -0,0 +1,251 @@
+# -*- coding: utf-8 -*-
+#
+# libunwind documentation build configuration file.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+
+# -- General configuration -
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 

[PATCH] D31375: Add docs for libunwind

2017-03-26 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs added a comment.

In https://reviews.llvm.org/D31375#710891, @compnerd wrote:

> What happens when you try building it in tree?


The docs-libunwind-html target is missing, and the docs don't get built.




Comment at: docs/index.rst:82
+
+If you want to contribute a patch to libc++, the best place for that is
+`Phabricator `_. Please include 
[libunwind] in the subject and

compnerd wrote:
> ITYM libunwind :)
doh


https://reviews.llvm.org/D31375



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


[PATCH] D31375: Add docs for libunwind

2017-03-26 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd added a comment.

What happens when you try building it in tree?




Comment at: docs/index.rst:82
+
+If you want to contribute a patch to libc++, the best place for that is
+`Phabricator `_. Please include 
[libunwind] in the subject and

ITYM libunwind :)


https://reviews.llvm.org/D31375



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


Re: [PATCH] Use the correct ObjC++ personality

2017-03-26 Thread Jonathan Roelofs via cfe-commits



On 3/26/17 10:13 AM, Jonathan Schleifer via cfe-commits wrote:

Use the correct EH personality for ObjC++ code.

Previously, it would just always use the ObjC DWARF personality, even with SjLj 
or SEH exceptions.

diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp
index 228efec51b..ca1535182e 100644
--- a/lib/CodeGen/CGException.cpp
+++ b/lib/CodeGen/CGException.cpp
@@ -180,8 +180,8 @@ static const EHPersonality (const 
llvm::Triple ,
  // The GCC runtime's personality function inherently doesn't support
  // mixed EH.  Use the C++ personality just to avoid returning null.
  case ObjCRuntime::GCC:
-  case ObjCRuntime::ObjFW: // XXX: this will change soon
-return EHPersonality::GNU_ObjC;
+  case ObjCRuntime::ObjFW:
+return getObjCPersonality(T, L);
  case ObjCRuntime::GNUstep:
return EHPersonality::GNU_ObjCXX;
  }



Testcase?

Jon


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



--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] Use the correct ObjC++ personality

2017-03-26 Thread Jonathan Schleifer via cfe-commits
Use the correct EH personality for ObjC++ code.

Previously, it would just always use the ObjC DWARF personality, even with SjLj 
or SEH exceptions.

diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp
index 228efec51b..ca1535182e 100644
--- a/lib/CodeGen/CGException.cpp
+++ b/lib/CodeGen/CGException.cpp
@@ -180,8 +180,8 @@ static const EHPersonality (const 
llvm::Triple ,
  // The GCC runtime's personality function inherently doesn't support
  // mixed EH.  Use the C++ personality just to avoid returning null.
  case ObjCRuntime::GCC:
-  case ObjCRuntime::ObjFW: // XXX: this will change soon
-return EHPersonality::GNU_ObjC;
+  case ObjCRuntime::ObjFW:
+return getObjCPersonality(T, L);
  case ObjCRuntime::GNUstep:
return EHPersonality::GNU_ObjCXX;
  }

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


[PATCH] D31375: Add docs for libunwind

2017-03-26 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs updated this revision to Diff 93074.

https://reviews.llvm.org/D31375

Files:
  CMakeLists.txt
  docs/BuildingLibunwind.rst
  docs/CMakeLists.txt
  docs/README.txt
  docs/conf.py
  docs/index.rst

Index: docs/index.rst
===
--- docs/index.rst
+++ docs/index.rst
@@ -0,0 +1,101 @@
+.. _index:
+
+===
+libunwind LLVM Unwinder
+===
+
+Overview
+
+
+libunwind is an implementation of the interface defined by the HP libunwind
+project. It was contributed by Apple as a way to enable clang++ to port to
+platforms that do not have a system unwinder. It is intended to be a small and
+fast implementation of the ABI, leaving off some features of HP's libunwind
+that never materialized (e.g. remote unwinding).
+
+The unwinder has two levels of API. The high level APIs are the `_Unwind_*`
+functions which implement functionality required by `__cxa_*` exception
+funcionts. The low level APIs are the `unw_*` functions which are an interface
+defined by the old HP libunwind project.
+
+Getting Started with libunwind
+--
+
+.. toctree::
+   :maxdepth: 2
+
+   BuildingLibunwind
+
+Current Status
+--
+
+libunwind is a production-quality unwinder, with platform support for DWARF
+unwind info, SjLj, and ARM EHABI.
+
+The low level libunwind API was designed to work either in-process (aka local)
+or to operate on another process (aka remote), but only the local path has been
+implemented. Remote unwinding remains as future work.
+
+Platform and Compiler Support
+-
+
+libunwind is known to work on the following platforms:
+
+   
+OS   Arch CompilersUnwind Info
+   
+Mac OS X i386, x86_64 Clang, GCC   DWARF CFI
+iOS  ARM  ClangSjLj
+Linuxi386, x86_64 Clang, GCC   DWARF CFI
+LinuxARM  Clang, GCC   EHABI
+Bare Metal   ARM  Clang, GCC   EHABI
+NetBSD   x86_64   Clang, GCC   DWARF CFI
+   
+
+The following minimum compiler versions are strongly recommended.
+
+* Clang 3.5 and above
+* GCC 4.7 and above.
+
+Anything older *may* work.
+
+Notes and Known Issues
+--
+
+* TODO
+
+Getting Involved
+
+
+First please review our `Developer's Policy `__
+and `Getting started with LLVM `__.
+
+**Bug Reports**
+
+If you think you've found a bug in libunwind, please report it using
+the `LLVM Bugzilla`_. If you're not sure, you
+can post a message to the `cfe-dev mailing list`_ or on IRC.
+Please include "libunwind" in your subject.
+
+**Patches**
+
+If you want to contribute a patch to libc++, the best place for that is
+`Phabricator `_. Please include [libunwind] in the subject and
+add `cfe-commits` as a subscriber. Also make sure you are subscribed to the
+`cfe-commits mailing list `_.
+
+**Discussion and Questions**
+
+Send discussions and questions to the
+`cfe-dev mailing list `_.
+Please include [libunwind] in the subject.
+
+
+Quick Links
+===
+* `LLVM Homepage `_
+* `LLVM Bugzilla `_
+* `cfe-commits Mailing List`_
+* `cfe-dev Mailing List`_
+* `Browse libunwind -- SVN `_
+* `Browse libunwind -- ViewVC `_
Index: docs/conf.py
===
--- docs/conf.py
+++ docs/conf.py
@@ -0,0 +1,251 @@
+# -*- coding: utf-8 -*-
+#
+# libunwind documentation build configuration file.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+
+# -- General configuration -
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') 

[PATCH] D31375: Add docs for libunwind

2017-03-26 Thread Kamil Rytarowski via Phabricator via cfe-commits
krytarowski added inline comments.



Comment at: docs/index.rst:51
+LinuxARM  Clang, GCC   EHABI
+Bare Metal   ARM  Clang, GCC   EHABI
+   

NetBSD amd64 Clang, GCC confirmed


https://reviews.llvm.org/D31375



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


[PATCH] D31375: Add docs for libunwind

2017-03-26 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs created this revision.
Herald added a subscriber: mgorny.

I'm still iffy about the build goop for this. I started mostly cargo-culting 
the stuff from libcxx, but couldn't get that to work. What's in the patch seems 
to work for the standalone build, but does not work for in tree builds (and I 
have no idea why).

Comments / corrections / feedback would be much appreciated.


https://reviews.llvm.org/D31375

Files:
  CMakeLists.txt
  docs/BuildingLibunwind.rst
  docs/CMakeLists.txt
  docs/README.txt
  docs/conf.py
  docs/index.rst

Index: docs/index.rst
===
--- docs/index.rst
+++ docs/index.rst
@@ -0,0 +1,100 @@
+.. _index:
+
+===
+libunwind LLVM Unwinder
+===
+
+Overview
+
+
+libunwind is an implementation of the interface defined by the HP libunwind
+project. It was contributed by Apple as a way to enable clang++ to port to
+platforms that do not have a system unwinder. It is intended to be a small and
+fast implementation of the ABI, leaving off some features of HP's libunwind
+that never materialized (e.g. remote unwinding).
+
+The unwinder has two levels of API. The high level APIs are the `_Unwind_*`
+functions which implement functionality required by `__cxa_*` exception
+funcionts. The low level APIs are the `unw_*` functions which are an interface
+defined by the old HP libunwind project.
+
+Getting Started with libunwind
+--
+
+.. toctree::
+   :maxdepth: 2
+
+   BuildingLibunwind
+
+Current Status
+--
+
+libunwind is a production-quality unwinder, with platform support for DWARF
+unwind info, SjLj, and ARM EHABI.
+
+The low level libunwind API was designed to work either in-process (aka local)
+or to operate on another process (aka remote), but only the local path has been
+implemented. Remote unwinding remains as future work.
+
+Platform and Compiler Support
+-
+
+libunwind is known to work on the following platforms:
+
+   
+OS   Arch CompilersUnwind Info
+   
+Mac OS X i386, x86_64 Clang, GCC   DWARF CFI
+iOS  ARM  ClangSjLj
+Linuxi386, x86_64 Clang, GCC   DWARF CFI
+LinuxARM  Clang, GCC   EHABI
+Bare Metal   ARM  Clang, GCC   EHABI
+   
+
+The following minimum compiler versions are strongly recommended.
+
+* Clang 3.5 and above
+* GCC 4.7 and above.
+
+Anything older *may* work.
+
+Notes and Known Issues
+--
+
+* TODO
+
+Getting Involved
+
+
+First please review our `Developer's Policy `__
+and `Getting started with LLVM `__.
+
+**Bug Reports**
+
+If you think you've found a bug in libunwind, please report it using
+the `LLVM Bugzilla`_. If you're not sure, you
+can post a message to the `cfe-dev mailing list`_ or on IRC.
+Please include "libunwind" in your subject.
+
+**Patches**
+
+If you want to contribute a patch to libc++, the best place for that is
+`Phabricator `_. Please include [libunwind] in the subject and
+add `cfe-commits` as a subscriber. Also make sure you are subscribed to the
+`cfe-commits mailing list `_.
+
+**Discussion and Questions**
+
+Send discussions and questions to the
+`cfe-dev mailing list `_.
+Please include [libunwind] in the subject.
+
+
+Quick Links
+===
+* `LLVM Homepage `_
+* `LLVM Bugzilla `_
+* `cfe-commits Mailing List`_
+* `cfe-dev Mailing List`_
+* `Browse libunwind -- SVN `_
+* `Browse libunwind -- ViewVC `_
Index: docs/conf.py
===
--- docs/conf.py
+++ docs/conf.py
@@ -0,0 +1,251 @@
+# -*- coding: utf-8 -*-
+#
+# libunwind documentation build configuration file.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+
+# -- General 

[PATCH] D29599: Clang Changes for alloc_align

2017-03-26 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: include/clang/Basic/Attr.td:1224
+def AllocAlign : InheritableAttr {
+  let Spellings = [ GCC<"alloc_align"> ];
+  let Subjects = SubjectList<[Function]>;

Extra spaces in the declaration that do not match the style of the rest of the 
file (same happens below).



Comment at: include/clang/Basic/Attr.td:1225
+  let Spellings = [ GCC<"alloc_align"> ];
+  let Subjects = SubjectList<[Function]>;
+  let Args = [ IntArgument<"ParamIndex"> ];

Is this subject line correct, or should it be using `HasFunctionProto` instead? 
How does GCC handle something like `void *blah() 
__attribute__((alloc_align(1)));` in C code?



Comment at: include/clang/Basic/AttrDocs.td:252
+declaration to specify that the return value of the function (which must be a
+pointer type) has an alignment specified by the indicated parameter, starting
+with 1.

I would split the "starting with 1" off into its own (full) sentence for 
clarity purposes. Also, please spell out one instead of 1.

You may also want to clarify how member functions do/do not impact this index.



Comment at: include/clang/Basic/AttrDocs.td:256
+.. code-block:: c++
+  // The returned pointer has the alignment specified by the first parameter
+  void *a(size_t align) __attribute__((alloc_align(1)));

I think you need a newline above this code block to not trigger sphinx 
diagnostics.



Comment at: lib/CodeGen/CGCall.cpp:4374
+} else if (const auto *AA = TargetDecl->getAttr()) {
+  llvm::Value *ParamVal = IRCallArgs[AA->getParamIndex() - 1];
+  EmitAlignmentAssumption(Ret.getScalarVal(), ParamVal);

Instead of hoping all of the callers of `getParamIndex()` will remember that 
this is a weird one-based thing, why not give the semantic attribute the 
correct index when attaching the attribute to the declaration?



Comment at: lib/CodeGen/CGCall.cpp:4377
 }
+
   }

Spurious newline should be removed.



Comment at: lib/Sema/SemaDeclAttr.cpp:222
+/// \brief A helper function to provide Attribute Location for the Attr types
+/// AND the AttributeList
+template  static typename

Missing a full stop at the end of the comment.



Comment at: lib/Sema/SemaDeclAttr.cpp:223
+/// AND the AttributeList
+template  static typename
+std::enable_if::value, 
SourceLocation>::type

s/class/typename (same below).

Also, add some newlines between the function definitions and run the patch 
through clang-format (pointers and references are bound to the wrong thing and 
the formatting seems a bit off).



Comment at: lib/Sema/SemaDeclAttr.cpp:232
+/// \brief A helper function to provide Attribute Name for the Attr types
+/// AND the AttributeList
+template  static typename

Missing a full stop at the end of the comment.



Comment at: lib/Sema/SemaDeclAttr.cpp:775
 }
-
+//
 /// \brief Checks to be sure that the given parameter number is inbounds, and 
is

Should be removed.



Comment at: lib/Sema/SemaDeclAttr.cpp:793
   const ParmVarDecl *Param = FD->getParamDecl(Idx);
+  if (AllowDependentType && Param->getType()->isDependentType()) {
+return true;

Can elide the braces.



Comment at: lib/Sema/SemaDeclAttr.cpp:805
 
+/// \brief Checks to be sure that the given parameter number is inbounds, and 
is
+/// an some integral type. Will emit appropriate diagnostics if this returns

s/inbounds/in bounds



Comment at: lib/Sema/SemaDeclAttr.cpp:806
+/// \brief Checks to be sure that the given parameter number is inbounds, and 
is
+/// an some integral type. Will emit appropriate diagnostics if this returns
+/// false.

Remove the "some".



Comment at: lib/Sema/SemaDeclAttr.cpp:1599
+  int IndexVal;
+  if (!checkPositiveIntArgument(*this, TmpAttr, ParamExpr, IndexVal,
+/*Index=*/1))

It seems strange to me that you check that it's a positive integer argument 
before checking the param is an integer type.

Why not use `checkFunctionOrMethodParameterIndex()`?



Comment at: test/Sema/alloc-align-attr.c:5
+void test_void_alloc_align(void) __attribute__((alloc_align(1))); // 
expected-warning {{'alloc_align' attribute only applies to return values that 
are pointers}}
+int test_int_alloc_align(void) __attribute__((alloc_align(1))); // 
expected-warning {{'alloc_align' attribute only applies to return values that 
are pointers}}
+void *test_ptr_alloc_align(int a) __attribute__((alloc_align(1))); // 
no-warning

This test doesn't really add value.



Comment at: 

[PATCH] D24886: Add [[clang::suppress(rule, ...)]] attribute

2017-03-26 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


https://reviews.llvm.org/D24886



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


[PATCH] D30809: [coroutines] Add codegen for await and yield expressions

2017-03-26 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov closed this revision.
GorNishanov added a comment.

Commit: r298784


https://reviews.llvm.org/D30809



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


Re: r298742 - [ODRHash] Add error messages for mismatched parameters in methods.

2017-03-26 Thread Vassil Vassilev via cfe-commits

Hi,

  This seems broke quite a lot of code, similarly to this: 
http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules-2/builds/5727/steps/compile.llvm.stage2/logs/stdio 
and also 
http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules/builds/4162


  Could we back that out as it broke our internal infrastructure, too.

Cheers, Vassil
On 24/03/17 22:17, Richard Trieu via cfe-commits wrote:

Author: rtrieu
Date: Fri Mar 24 16:17:48 2017
New Revision: 298742

URL: http://llvm.org/viewvc/llvm-project?rev=298742=rev
Log:
[ODRHash] Add error messages for mismatched parameters in methods.

Modified:
 cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
 cfe/trunk/lib/AST/ODRHash.cpp
 cfe/trunk/lib/Serialization/ASTReader.cpp
 cfe/trunk/test/Modules/odr_hash.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td?rev=298742=298741=298742=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td Fri Mar 24 
16:17:48 2017
@@ -146,7 +146,12 @@ def err_module_odr_violation_mismatch_de
"method %4 is %select{not static|static}5|"
"method %4 is %select{not volatile|volatile}5|"
"method %4 is %select{not const|const}5|"
-  "method %4 is %select{not inline|inline}5}3">;
+  "method %4 is %select{not inline|inline}5|"
+  "method %4 that has %5 parameter%s5|"
+  "method %4 with %ordinal5 parameter of type %6|"
+  "method %4 with %ordinal5 parameter named %6|"
+  "method %4 with %ordinal5 parameter with %select{no |}6default argument|"
+  "method %4 with %ordinal5 parameter with default argument}3">;
  
  def note_module_odr_violation_mismatch_decl_diff : Note<"but in '%0' found "

"%select{"
@@ -166,7 +171,12 @@ def note_module_odr_violation_mismatch_d
"method %2 is %select{not static|static}3|"
"method %2 is %select{not volatile|volatile}3|"
"method %2 is %select{not const|const}3|"
-  "method %2 is %select{not inline|inline}3}1">;
+  "method %2 is %select{not inline|inline}3|"
+  "method %2 that has %3 parameter%s3|"
+  "method %2 with %ordinal3 parameter of type %4|"
+  "method %2 with %ordinal3 parameter named %4|"
+  "method %2 with %ordinal3 parameter with %select{no |}4default argument|"
+  "method %2 with %ordinal3 parameter with different default argument}1">;
  
  def warn_module_uses_date_time : Warning<

"%select{precompiled header|module}0 uses __DATE__ or __TIME__">,

Modified: cfe/trunk/lib/AST/ODRHash.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ODRHash.cpp?rev=298742=298741=298742=diff
==
--- cfe/trunk/lib/AST/ODRHash.cpp (original)
+++ cfe/trunk/lib/AST/ODRHash.cpp Fri Mar 24 16:17:48 2017
@@ -169,6 +169,11 @@ public:
  Inherited::VisitValueDecl(D);
}
  
+  void VisitParmVarDecl(const ParmVarDecl *D) {

+AddStmt(D->getDefaultArg());
+Inherited::VisitParmVarDecl(D);
+  }
+
void VisitAccessSpecDecl(const AccessSpecDecl *D) {
  ID.AddInteger(D->getAccess());
  Inherited::VisitAccessSpecDecl(D);
@@ -202,6 +207,12 @@ public:
  Hash.AddBoolean(D->isPure());
  Hash.AddBoolean(D->isDeletedAsWritten());
  
+ID.AddInteger(D->param_size());

+
+for (auto *Param : D->parameters()) {
+  Hash.AddSubDecl(Param);
+}
+
  Inherited::VisitFunctionDecl(D);
}
  
@@ -315,6 +326,10 @@ public:

  }
}
  
+  void AddQualType(QualType T) {

+Hash.AddQualType(T);
+  }
+
void Visit(const Type *T) {
  ID.AddInteger(T->getTypeClass());
  Inherited::Visit(T);
@@ -327,6 +342,50 @@ public:
  VisitType(T);
}
  
+  void VisitFunctionType(const FunctionType *T) {

+AddQualType(T->getReturnType());
+T->getExtInfo().Profile(ID);
+Hash.AddBoolean(T->isConst());
+Hash.AddBoolean(T->isVolatile());
+Hash.AddBoolean(T->isRestrict());
+VisitType(T);
+  }
+
+  void VisitFunctionNoProtoType(const FunctionNoProtoType *T) {
+VisitFunctionType(T);
+  }
+
+  void VisitFunctionProtoType(const FunctionProtoType *T) {
+ID.AddInteger(T->getNumParams());
+for (auto ParamType : T->getParamTypes())
+  AddQualType(ParamType);
+
+const auto  = T->getExtProtoInfo();
+ID.AddInteger(epi.Variadic);
+ID.AddInteger(epi.TypeQuals);
+ID.AddInteger(epi.RefQualifier);
+ID.AddInteger(epi.ExceptionSpec.Type);
+
+if (epi.ExceptionSpec.Type == EST_Dynamic) {
+  for (QualType Ex : epi.ExceptionSpec.Exceptions)
+AddQualType(Ex);
+} else if (epi.ExceptionSpec.Type == EST_ComputedNoexcept &&
+   epi.ExceptionSpec.NoexceptExpr) {
+  AddStmt(epi.ExceptionSpec.NoexceptExpr);
+} else if (epi.ExceptionSpec.Type ==