Re: [PATCH] D22220: [clang-tidy] Add check 'misc-move-forwarding-reference'

2016-08-26 Thread Martin Böhme via cfe-commits
mboehme marked an inline comment as done.
mboehme added a comment.

Any more comments here?


https://reviews.llvm.org/D0



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


Re: [PATCH] D23840: New options -fexceptions-fp-math and -fdenormal-fp-math

2016-08-26 Thread James Molloy via cfe-commits
jmolloy added a comment.

Hi Sjoerd,

These make sense - we currently lack any way to inform the backend of the 
user's FP strictness requirements for exceptions and denormals which forces us 
to be conservative in the backend build attribute generation.

Your new -fno-exceptions-fp-math appears to be the same as GCC's 
"-ftrapping-math" which we already implement in the Driver. In fact, it looks 
like this code never passes -ftrapping-math through to CC1; it only uses it to 
determine if -menable-unsafe-fpmath should be set.

Therefore I think passing -ftrapping-math through to CC1 is the right thing 
here.

It seems to me that GCC doesn't have an equivalent flag to -fdenormal-fp-math, 
so inventing a flag sounds like the right thing to do. This patch should 
provide a docs patch for 
http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation , which 
is generated from docs/UsersManual.rst.

Cheers,

James


https://reviews.llvm.org/D23840



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


[PATCH] D23914: [OpenCL] Make is_valid_event overloadable.

2016-08-26 Thread Tyurin, Evgeniy via cfe-commits
etyurin created this revision.
etyurin added reviewers: yaxunl, bader.
etyurin added subscribers: cfe-commits, Anastasia.

Make is_valid_event overloadable like other built-ins.

https://reviews.llvm.org/D23914

Files:
  lib/Headers/opencl-c.h

Index: lib/Headers/opencl-c.h
===
--- lib/Headers/opencl-c.h
+++ lib/Headers/opencl-c.h
@@ -16733,7 +16733,7 @@
 
 void __ovld set_user_event_status(clk_event_t e, int state);
 
-bool is_valid_event (clk_event_t event);
+bool __ovld is_valid_event (clk_event_t event);
 
 void __ovld capture_event_profiling_info(clk_event_t, clk_profiling_info, 
__global void* value);
 


Index: lib/Headers/opencl-c.h
===
--- lib/Headers/opencl-c.h
+++ lib/Headers/opencl-c.h
@@ -16733,7 +16733,7 @@
 
 void __ovld set_user_event_status(clk_event_t e, int state);
 
-bool is_valid_event (clk_event_t event);
+bool __ovld is_valid_event (clk_event_t event);
 
 void __ovld capture_event_profiling_info(clk_event_t, clk_profiling_info, __global void* value);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D23915: [OpenCL] Remove access qualifiers on images in arg info metadata.

2016-08-26 Thread Tyurin, Evgeniy via cfe-commits
etyurin created this revision.
etyurin added reviewers: Anastasia, bader, yaxunl.
etyurin added a subscriber: cfe-commits.

Remove access qualifiers on images in arg info metadata:
 * kernel_arg_type
 * kernel_arg_base_type

Image access qualifiers are inseparable from type in clang implementation,
but OpenCL spec provides a special query to get access qualifier
via clGetKernelArgInfo with CL_KERNEL_ARG_ACCESS_QUALIFIER.

Besides that OpenCL conformance test_api get_kernel_arg_info expects
image types without access qualifier.

https://reviews.llvm.org/D23915

Files:
  lib/CodeGen/CodeGenFunction.cpp
  test/CodeGenOpenCL/kernel-arg-info.cl

Index: test/CodeGenOpenCL/kernel-arg-info.cl
===
--- test/CodeGenOpenCL/kernel-arg-info.cl
+++ test/CodeGenOpenCL/kernel-arg-info.cl
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple spir-unknown-unknown -cl-kernel-arg-info | FileCheck %s -check-prefix ARGINFO
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -o - -triple spir-unknown-unknown -cl-kernel-arg-info | FileCheck %s -check-prefix ARGINFO
 
 kernel void foo(__global int * restrict X, const int Y, 
 volatile int anotherArg, __constant float * restrict Z) {
@@ -14,7 +14,7 @@
 // CHECK-NOT: !kernel_arg_name
 // ARGINFO: !kernel_arg_name ![[MD15:[0-9]+]]
 
-kernel void foo2(read_only image1d_t img1, image2d_t img2, write_only image2d_array_t img3) {
+kernel void foo2(read_only image1d_t img1, image2d_t img2, write_only image2d_array_t img3, read_write image1d_t img4) {
 }
 // CHECK: define spir_kernel void @foo2{{[^!]+}}
 // CHECK: !kernel_arg_addr_space ![[MD21:[0-9]+]]
@@ -65,11 +65,11 @@
 // CHECK: ![[MD13]] = !{!"int*", !"int", !"int", !"float*"}
 // CHECK: ![[MD14]] = !{!"restrict", !"const", !"volatile", !"restrict const"}
 // ARGINFO: ![[MD15]] = !{!"X", !"Y", !"anotherArg", !"Z"}
-// CHECK: ![[MD21]] = !{i32 1, i32 1, i32 1}
-// CHECK: ![[MD22]] = !{!"read_only", !"read_only", !"write_only"}
-// CHECK: ![[MD23]] = !{!"__read_only image1d_t", !"__read_only image2d_t", !"__write_only image2d_array_t"}
-// CHECK: ![[MD24]] = !{!"", !"", !""}
-// ARGINFO: ![[MD25]] = !{!"img1", !"img2", !"img3"}
+// CHECK: ![[MD21]] = !{i32 1, i32 1, i32 1, i32 1}
+// CHECK: ![[MD22]] = !{!"read_only", !"read_only", !"write_only", !"read_write"}
+// CHECK: ![[MD23]] = !{!"image1d_t", !"image2d_t", !"image2d_array_t", !"image1d_t"}
+// CHECK: ![[MD24]] = !{!"", !"", !"", !""}
+// ARGINFO: ![[MD25]] = !{!"img1", !"img2", !"img3", !"img4"}
 // CHECK: ![[MD31]] = !{i32 1}
 // CHECK: ![[MD32]] = !{!"none"}
 // CHECK: ![[MD33]] = !{!"half*"}
@@ -82,7 +82,7 @@
 // CHECK: ![[MD45]] = !{!"", !""}
 // ARGINFO: ![[MD46]] = !{!"X", !"Y"}
 // CHECK: ![[MD51]] = !{!"read_only", !"write_only"}
-// CHECK: ![[MD52]] = !{!"myImage", !"__write_only image1d_t"}
-// CHECK: ![[MD53]] = !{!"__read_only image1d_t", !"__write_only image1d_t"}
+// CHECK: ![[MD52]] = !{!"myImage", !"image1d_t"}
+// CHECK: ![[MD53]] = !{!"image1d_t", !"image1d_t"}
 // ARGINFO: ![[MD54]] = !{!"img1", !"img2"}
 
Index: lib/CodeGen/CodeGenFunction.cpp
===
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -436,6 +436,26 @@
   EmitNounwindRuntimeCall(MCountFn);
 }
 
+static void removeImageAccessQualifier(std::string& tyName) {
+  std::string roQual("__read_only");
+  std::string::size_type roPos = tyName.find(roQual);
+  if (roPos != std::string::npos)
+// "+ 1" for the space after access qualifier.
+tyName.erase(roPos, roQual.size() + 1);
+  else {
+std::string woQual("__write_only");
+std::string::size_type woPos = tyName.find(woQual);
+if (woPos != std::string::npos)
+  tyName.erase(woPos, woQual.size() + 1);
+else {
+  std::string rwQual("__read_write");
+  std::string::size_type rwPos = tyName.find(rwQual);
+  if (rwPos != std::string::npos)
+tyName.erase(rwPos, rwQual.size() + 1);
+}
+  }
+}
+
 // OpenCL v1.2 s5.6.4.6 allows the compiler to store kernel argument
 // information in the program executable. The argument information stored
 // includes the argument name, its type, the address and access qualifiers used.
@@ -532,8 +552,6 @@
   if (ty.isCanonical() && pos != std::string::npos)
 typeName.erase(pos+1, 8);
 
-  argTypeNames.push_back(llvm::MDString::get(Context, typeName));
-
   std::string baseTypeName;
   if (isPipe)
 baseTypeName = ty.getCanonicalType()->getAs()
@@ -543,6 +561,17 @@
 baseTypeName =
   ty.getUnqualifiedType().getCanonicalType().getAsString(Policy);
 
+  // Remove access qualifiers on images
+  // (as they are inseparable from type in clang implementation,
+  // but OpenCL spec pr

Re: [PATCH] D23767: DebugInfo: use llvm::DIFlagsUnderlying type for debug info flags

2016-08-26 Thread Victor via cfe-commits
vleschuk retitled this revision from "DebugInfo: use llvm::di_flags_t for debug 
info flags" to "DebugInfo: use llvm::DIFlagsUnderlying type for debug info 
flags".
vleschuk updated the summary for this revision.
vleschuk updated this revision to Diff 69332.
vleschuk added a comment.

Chnaged typedef name according to naming convention.


https://reviews.llvm.org/D23767

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h

Index: lib/CodeGen/CGDebugInfo.h
===
--- lib/CodeGen/CGDebugInfo.h
+++ lib/CodeGen/CGDebugInfo.h
@@ -517,7 +517,7 @@
 StringRef &Name, StringRef &LinkageName,
 llvm::DIScope *&FDContext,
 llvm::DINodeArray &TParamsArray,
-unsigned &Flags);
+llvm::DIFlagsUnderlying &Flags);
 
   /// Collect various properties of a VarDecl.
   void collectVarDeclProps(const VarDecl *VD, llvm::DIFile *&Unit,
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -787,7 +787,7 @@
   Elements = DBuilder.getOrCreateArray(EltTys);
   EltTys.clear();
 
-  unsigned Flags = llvm::DINode::FlagAppleBlock;
+  llvm::DIFlagsUnderlying Flags = llvm::DINode::FlagAppleBlock;
   unsigned LineNo = 0;
 
   auto *EltTy =
@@ -924,7 +924,7 @@
 /// Convert an AccessSpecifier into the corresponding DINode flag.
 /// As an optimization, return 0 if the access specifier equals the
 /// default for the containing type.
-static unsigned getAccessFlag(AccessSpecifier Access, const RecordDecl *RD) {
+static llvm::DIFlagsUnderlying getAccessFlag(AccessSpecifier Access, const RecordDecl *RD) {
   AccessSpecifier Default = clang::AS_none;
   if (RD && RD->isClass())
 Default = clang::AS_private;
@@ -968,7 +968,7 @@
   uint64_t StorageOffsetInBits =
   CGM.getContext().toBits(BitFieldInfo.StorageOffset);
   uint64_t OffsetInBits = StorageOffsetInBits + BitFieldInfo.Offset;
-  unsigned Flags = getAccessFlag(BitFieldDecl->getAccess(), RD);
+  llvm::DIFlagsUnderlying Flags = getAccessFlag(BitFieldDecl->getAccess(), RD);
   return DBuilder.createBitFieldMemberType(
   RecordTy, Name, File, Line, SizeInBits, AlignInBits, OffsetInBits,
   StorageOffsetInBits, Flags, DebugType);
@@ -993,7 +993,7 @@
 AlignInBits = TI.Align;
   }
 
-  unsigned flags = getAccessFlag(AS, RD);
+  llvm::DIFlagsUnderlying flags = getAccessFlag(AS, RD);
   return DBuilder.createMemberType(scope, name, file, line, SizeInBits,
AlignInBits, offsetInBits, flags, debugType);
 }
@@ -1060,7 +1060,7 @@
 }
   }
 
-  unsigned Flags = getAccessFlag(Var->getAccess(), RD);
+  llvm::DIFlagsUnderlying Flags = getAccessFlag(Var->getAccess(), RD);
   llvm::DIDerivedType *GV = DBuilder.createStaticMemberType(
   RecordTy, VName, VUnit, LineNumber, VTy, Flags, C);
   StaticDataMemberCache[Var->getCanonicalDecl()].reset(GV);
@@ -1203,7 +1203,7 @@
 
   llvm::DITypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(Elts);
 
-  unsigned Flags = 0;
+  llvm::DIFlagsUnderlying Flags = 0;
   if (Func->getExtProtoInfo().RefQualifier == RQ_LValue)
 Flags |= llvm::DINode::FlagLValueReference;
   if (Func->getExtProtoInfo().RefQualifier == RQ_RValue)
@@ -1254,7 +1254,7 @@
   llvm::DIType *ContainingType = nullptr;
   unsigned Virtuality = 0;
   unsigned VIndex = 0;
-  unsigned Flags = 0;
+  llvm::DIFlagsUnderlying Flags = 0;
   int ThisAdjustment = 0;
 
   if (Method->isVirtual()) {
@@ -1367,7 +1367,7 @@
   llvm::DIType *RecordTy) {
   const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD);
   for (const auto &BI : RD->bases()) {
-unsigned BFlags = 0;
+llvm::DIFlagsUnderlying BFlags = 0;
 uint64_t BaseOffset;
 
 const auto *Base =
@@ -1918,7 +1918,7 @@
   uint64_t Size = CGM.getContext().getTypeSize(Ty);
   uint64_t Align = CGM.getContext().getTypeAlign(Ty);
 
-  unsigned Flags = 0;
+  llvm::DIFlagsUnderlying Flags = 0;
   if (ID->getImplementation())
 Flags |= llvm::DINode::FlagObjcClassComplete;
 
@@ -2026,7 +2026,7 @@
   FieldOffset = RL.getFieldOffset(FieldNo);
 }
 
-unsigned Flags = 0;
+llvm::DIFlagsUnderlying Flags = 0;
 if (Field->getAccessControl() == ObjCIvarDecl::Protected)
   Flags = llvm::DINode::FlagProtected;
 else if (Field->getAccessControl() == ObjCIvarDecl::Private)
@@ -2157,7 +2157,7 @@
 
 llvm::DIType *CGDebugInfo::CreateType(const MemberPointerType *Ty,
   llvm::DIFile *U) {
-  unsigned Flags = 0;
+  llvm::DIFlagsUnderlying Flags = 0;
   uint64_t Size = 0;
 
   if (!Ty->isIncompleteType()) {
@@ -2633,7 +2633,7 @@
StringRef &LinkageName,
llvm::DIScope *&

Re: [PATCH] D23914: [OpenCL] Make is_valid_event overloadable.

2016-08-26 Thread Alexey Bader via cfe-commits
bader accepted this revision.
bader added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D23914



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


Re: [PATCH] D23915: [OpenCL] Remove access qualifiers on images in arg info metadata.

2016-08-26 Thread Alexey Bader via cfe-commits
bader accepted this revision.
bader added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D23915



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


[clang-tools-extra] r279814 - [clang-tidy] Some tweaks on header guard checks.

2016-08-26 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Fri Aug 26 06:15:38 2016
New Revision: 279814

URL: http://llvm.org/viewvc/llvm-project?rev=279814&view=rev
Log:
[clang-tidy] Some tweaks on header guard checks.

* Implement missing storeOption interfaces.
* Remove unnecessary parameter copy in isHeaderFileExtension.
* Fix doc style.

Modified:
clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.cpp
clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.h
clang-tools-extra/trunk/clang-tidy/utils/HeaderFileExtensionsUtils.cpp
clang-tools-extra/trunk/clang-tidy/utils/HeaderFileExtensionsUtils.h
clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-header-guard.rst

Modified: clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.cpp?rev=279814&r1=279813&r2=279814&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.cpp Fri Aug 26 
06:15:38 2016
@@ -13,6 +13,19 @@ namespace clang {
 namespace tidy {
 namespace llvm {
 
+LLVMHeaderGuardCheck::LLVMHeaderGuardCheck(StringRef Name,
+   ClangTidyContext* Context)
+: HeaderGuardCheck(Name, Context),
+  RawStringHeaderFileExtensions(
+  Options.getLocalOrGlobal("HeaderFileExtensions", ",h,hh,hpp,hxx")) {
+  utils::parseHeaderFileExtensions(RawStringHeaderFileExtensions,
+   HeaderFileExtensions, ',');
+}
+
+void LLVMHeaderGuardCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
+  Options.store(Opts, "HeaderFileExtensions", RawStringHeaderFileExtensions);
+}
+
 bool LLVMHeaderGuardCheck::shouldFixHeaderGuard(StringRef FileName) {
   return utils::isHeaderFileExtension(FileName, HeaderFileExtensions);
 }

Modified: clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.h?rev=279814&r1=279813&r2=279814&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.h Fri Aug 26 
06:15:38 2016
@@ -27,13 +27,9 @@ namespace llvm {
 /// empty string between "," if there are other filename extensions.
 class LLVMHeaderGuardCheck : public utils::HeaderGuardCheck {
 public:
-  LLVMHeaderGuardCheck(StringRef Name, ClangTidyContext *Context)
-  : HeaderGuardCheck(Name, Context),
-RawStringHeaderFileExtensions(
-Options.getLocalOrGlobal("HeaderFileExtensions", ",h,hh,hpp,hxx")) 
{
-utils::parseHeaderFileExtensions(RawStringHeaderFileExtensions,
- HeaderFileExtensions, ',');
-  }
+  LLVMHeaderGuardCheck(StringRef Name, ClangTidyContext *Context);
+
+  void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
   bool shouldSuggestEndifComment(StringRef Filename) override { return false; }
   bool shouldFixHeaderGuard(StringRef Filename) override;
   std::string getHeaderGuard(StringRef Filename, StringRef OldGuard) override;

Modified: clang-tools-extra/trunk/clang-tidy/utils/HeaderFileExtensionsUtils.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/HeaderFileExtensionsUtils.cpp?rev=279814&r1=279813&r2=279814&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/utils/HeaderFileExtensionsUtils.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/utils/HeaderFileExtensionsUtils.cpp Fri 
Aug 26 06:15:38 2016
@@ -19,28 +19,24 @@ bool isExpansionLocInHeaderFile(
 SourceLocation Loc, const SourceManager &SM,
 const HeaderFileExtensionsSet &HeaderFileExtensions) {
   SourceLocation ExpansionLoc = SM.getExpansionLoc(Loc);
-  StringRef FileExtension =
-  llvm::sys::path::extension(SM.getFilename(ExpansionLoc));
-  return HeaderFileExtensions.count(FileExtension.substr(1)) > 0;
+  return isHeaderFileExtension(SM.getFilename(ExpansionLoc),
+   HeaderFileExtensions);
 }
 
 bool isPresumedLocInHeaderFile(
 SourceLocation Loc, SourceManager &SM,
 const HeaderFileExtensionsSet &HeaderFileExtensions) {
   PresumedLoc PresumedLocation = SM.getPresumedLoc(Loc);
-  StringRef FileExtension =
-  llvm::sys::path::extension(PresumedLocation.getFilename());
-  return HeaderFileExtensions.count(FileExtension.substr(1)) > 0;
+  return isHeaderFileExtension(PresumedLocation.getFilename(),
+   HeaderFileExtensions);
 }
 
 bool isSpellingLocInHeaderFile(
 SourceLocation Loc, SourceManager &SM,
 const HeaderFileExtensionsSet &HeaderFileExtensions) {
   SourceLocation SpellingLoc = SM.getSpellingLoc(Loc);
-  StringRef Fil

Re: [PATCH] D23279: clang-reorder-fields

2016-08-26 Thread Daniel Jasper via cfe-commits
djasper added inline comments.


Comment at: clang-reorder-fields/ReorderFieldsAction.cpp:29
@@ +28,3 @@
+using namespace llvm;
+using namespace clang;
+using namespace clang::ast_matchers;

Put everything here into the namespace clang and remove "using namespace 
clang". Similarly check if you (then) really still need the "using namespace 
llvm".


Comment at: clang-reorder-fields/ReorderFieldsAction.cpp:92
@@ +91,3 @@
+
+/// \brief Reorders fields in the definition of a struct/class
+/// At the moment reodering of fields with 

You need an empty line in the comment to end the "\brief", I think.


Comment at: clang-reorder-fields/ReorderFieldsAction.cpp:108
@@ +107,3 @@
+  continue;
+assert(Field->getAccess() ==
+   Fields[NewFieldsOrder[FieldIndex]]->getAccess() &&

I think you need to properly handle this in a different way, e.g. returning a 
bool value and aborting the replacement operation. Two main reasons:
- Otherwise you cannot test it (well)
- This alone mean that if I build this tool in a release (non-assert-enabled) 
build, it will just do the wrong thing.

asserts are supposed to be used only for code paths that you don't expect to 
ever get into.


Comment at: clang-reorder-fields/ReorderFieldsAction.cpp:118
@@ +117,3 @@
+
+/// \brief Reorders initializers in a C++ struct/class constructor
+static void reorderFieldsInConstructor(

This is not what I meant be writing a comment. I consider this comment pretty 
much useless, it doesn't add any information on top of the function name. You 
need to write significantly more comments so people can actually (easily) 
understand what your implementation is doing. You can write a sentence or two 
up here and/or add comments to the different things that are done within the 
function. Without that, this is really hard to follow, e.g. the different 
between NewFieldsOrder and NewFieldsPositions is not at all intuitive (at least 
to me). You want to write enough comments that other people can at a quick 
glance understand a) what this is doing and b) that the implementation is doing 
what you are writing.

E.g. something like:
  // A constructor can have initializers for an arbitrary subset of the classes 
fields. Thus,
  // we need to ensure that we reorder just the initializers that a present.


Comment at: clang-reorder-fields/ReorderFieldsAction.cpp:148
@@ +147,3 @@
+ NewWrittenInitializersOrder.size());
+  for (unsigned I = 0, E = NewWrittenInitializersOrder.size(); I < E; ++I)
+if (OldWrittenInitializersOrder[I] != NewWrittenInitializersOrder[I])

By convention we use I and E for iterators, i and e for ints.


Comment at: clang-reorder-fields/ReorderFieldsAction.cpp:165
@@ +164,3 @@
+return;
+  assert(InitListEx->getNumInits() == NewFieldsOrder.size() &&
+ "Currently only full initialization is supported");

Same here, an assert is insufficient.


Comment at: clang-reorder-fields/ReorderFieldsAction.cpp:202
@@ +201,3 @@
+for (const auto *C : RD->ctors()) {
+  if (C->isImplicit() || C->isDelegatingConstructor())
+continue;

Why are you ruling out delegating constructors?


Comment at: clang-reorder-fields/ReorderFieldsAction.cpp:204
@@ +203,3 @@
+continue;
+  if (const auto *D = C->getDefinition())
+reorderFieldsInConstructor(cast(D),

I'd do:

  if (const auto *D = dyn_cast(C->getDefinition))
reorderFieldsInConstructor(D, NewFieldsOrder, Context, Replacements);

But both should be fine.


Comment at: clang-reorder-fields/ReorderFieldsAction.cpp:208
@@ +207,3 @@
+}
+if (!RD->isAggregate())
+  return;

Here you could add a comment like:

  // We only need to reorder init list expressions for aggregate types. For 
other types
  // the order of constructor parameters is used, which we don't change.


Comment at: clang-reorder-fields/ReorderFieldsAction.cpp:210
@@ +209,3 @@
+  return;
+for (auto Result : match(initListExpr().bind("initListExpr"), Context)) {
+  const auto *E = Result.getNodeAs("initListExpr");

Something like:

  match(initListExpr(hasType(equalsNode(RD)))

should work.


Comment at: clang-reorder-fields/tool/ClangReorderFields.cpp:68
@@ +67,3 @@
+
+  int ExitCode = Tool.run(Factory.get());
+  LangOptions DefaultLangOptions;

Should you continue if the exit code isn't 0 here?


Repository:
  rL LLVM

https://reviews.llvm.org/D23279



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


Re: [PATCH] D23894: [Clang-tidy] Fix some checks documentation style

2016-08-26 Thread Haojian Wu via cfe-commits
hokein added a subscriber: hokein.
hokein accepted this revision.
hokein added a reviewer: hokein.
hokein added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


Repository:
  rL LLVM

https://reviews.llvm.org/D23894



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


[PATCH] D23918: [clang-tidy docs] Add missing options.

2016-08-26 Thread Haojian Wu via cfe-commits
hokein created this revision.
hokein added a subscriber: cfe-commits.
Herald added a subscriber: nemanjai.

https://reviews.llvm.org/D23918

Files:
  docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
  docs/clang-tidy/checks/google-build-namespaces.rst
  docs/clang-tidy/checks/google-readability-namespace-comments.rst
  docs/clang-tidy/checks/google-runtime-int.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-definitions-in-headers.rst
  docs/clang-tidy/checks/misc-move-constructor-init.rst
  docs/clang-tidy/checks/misc-sizeof-expression.rst
  docs/clang-tidy/checks/misc-string-constructor.rst
  docs/clang-tidy/checks/misc-suspicious-missing-comma.rst
  docs/clang-tidy/checks/misc-suspicious-string-compare.rst
  docs/clang-tidy/checks/modernize-pass-by-value.rst
  docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
  docs/clang-tidy/checks/performance-for-range-copy.rst
  docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
  docs/clang-tidy/checks/performance-unnecessary-value-param.rst
  docs/clang-tidy/checks/readability-implicit-bool-cast.rst

Index: docs/clang-tidy/checks/readability-implicit-bool-cast.rst
===
--- docs/clang-tidy/checks/readability-implicit-bool-cast.rst
+++ docs/clang-tidy/checks/readability-implicit-bool-cast.rst
@@ -97,3 +97,16 @@
 
 Occurrences of implicit casts inside macros and template instantiations are
 deliberately ignored, as it is not clear how to deal with such cases.
+
+Options
+---
+
+.. option::  AllowConditionalIntegerCasts
+
+   When non-zero, the check will allow conditional integer casts.
+   `0` by default.
+
+.. option::  AllowConditionalPointerCasts
+
+   When non-zero, the check will allow conditional pointer casts.
+   `0` by default.
Index: docs/clang-tidy/checks/performance-unnecessary-value-param.rst
===
--- docs/clang-tidy/checks/performance-unnecessary-value-param.rst
+++ docs/clang-tidy/checks/performance-unnecessary-value-param.rst
@@ -53,3 +53,11 @@
   void setValue(string Value) {
 Field = std::move(Value);
   }
+
+Options
+---
+
+.. option:: IncludeStyle
+
+   A string specifying which include-style is used, `llvm` or `google`. `llvm`
+   by default.
Index: docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
===
--- docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
+++ docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
@@ -47,3 +47,11 @@
void g() {
f(std::string(a).append("Bar").append(b));
}
+
+Options
+---
+
+.. option:: StrictMode
+
+   When zero, the check will only check the string usage in ``while``, ``for``
+   and ``for-range`` statements. 0 by default.
Index: docs/clang-tidy/checks/performance-for-range-copy.rst
===
--- docs/clang-tidy/checks/performance-for-range-copy.rst
+++ docs/clang-tidy/checks/performance-for-range-copy.rst
@@ -17,3 +17,10 @@
 2. The loop variable is not const, but only const methods or operators are
invoked on it, or it is used as const reference or value argument in
constructors or function calls.
+
+Options
+---
+
+.. options:: WarnOnAllAutoCopies
+
+   When non-zero, the check will warn on all auto copies. `0` by default.
Index: docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
===
--- docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
+++ docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
@@ -70,3 +70,11 @@
 
  // only 'f()' (or similar) will trigger the replacement.
 
+
+Options
+---
+
+.. option:: IncludeStyle
+
+   A string specifying which include-style is used, `llvm` or `google`.
+   `llvm` by default.
Index: docs/clang-tidy/checks/modernize-pass-by-value.rst
===
--- docs/clang-tidy/checks/modernize-pass-by-value.rst
+++ docs/clang-tidy/checks/modernize-pass-by-value.rst
@@ -151,3 +151,11 @@
   For more information about the pass-by-value idiom, read: `Want Speed? Pass by Value`_.
 
   .. _Want Speed? Pass by Value: http://cpp-next.com/archive/2009/08/want-speed-pass-by-value/
+
+Options
+---
+
+.. option:: IncludeStyle
+
+   A string specifying which include-style is used, `llvm` or `google`. `llvm`
+   by default.
Index: docs/clang-tidy/checks/misc-suspicious-string-compare.rst
===
--- docs/clang-tidy/checks/misc-suspicious-string-compare.rst
+++ docs/clang-tidy/checks/misc-suspicious-string-compare.rst
@@ -38,3 +38,19 @@
 .. code:: c++
 
 if (strcmp(...) < 0.)  // Incorrect usage of the returned value.
+
+Options
+---
+
+.. option:: WarnOnImplicitComparison
+
+   Wh

Re: [PATCH] D23918: [clang-tidy docs] Add missing options.

2016-08-26 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 69343.
hokein added a comment.

Fix style.


https://reviews.llvm.org/D23918

Files:
  docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
  docs/clang-tidy/checks/google-build-namespaces.rst
  docs/clang-tidy/checks/google-readability-namespace-comments.rst
  docs/clang-tidy/checks/google-runtime-int.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-definitions-in-headers.rst
  docs/clang-tidy/checks/misc-move-constructor-init.rst
  docs/clang-tidy/checks/misc-sizeof-expression.rst
  docs/clang-tidy/checks/misc-string-constructor.rst
  docs/clang-tidy/checks/misc-suspicious-missing-comma.rst
  docs/clang-tidy/checks/misc-suspicious-string-compare.rst
  docs/clang-tidy/checks/modernize-pass-by-value.rst
  docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
  docs/clang-tidy/checks/performance-for-range-copy.rst
  docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
  docs/clang-tidy/checks/performance-unnecessary-value-param.rst
  docs/clang-tidy/checks/readability-implicit-bool-cast.rst

Index: docs/clang-tidy/checks/readability-implicit-bool-cast.rst
===
--- docs/clang-tidy/checks/readability-implicit-bool-cast.rst
+++ docs/clang-tidy/checks/readability-implicit-bool-cast.rst
@@ -97,3 +97,16 @@
 
 Occurrences of implicit casts inside macros and template instantiations are
 deliberately ignored, as it is not clear how to deal with such cases.
+
+Options
+---
+
+.. option::  AllowConditionalIntegerCasts
+
+   When non-zero, the check will allow conditional integer casts.
+   `0` by default.
+
+.. option::  AllowConditionalPointerCasts
+
+   When non-zero, the check will allow conditional pointer casts.
+   `0` by default.
Index: docs/clang-tidy/checks/performance-unnecessary-value-param.rst
===
--- docs/clang-tidy/checks/performance-unnecessary-value-param.rst
+++ docs/clang-tidy/checks/performance-unnecessary-value-param.rst
@@ -53,3 +53,11 @@
   void setValue(string Value) {
 Field = std::move(Value);
   }
+
+Options
+---
+
+.. option:: IncludeStyle
+
+   A string specifying which include-style is used, `llvm` or `google`. `llvm`
+   by default.
Index: docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
===
--- docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
+++ docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
@@ -47,3 +47,11 @@
void g() {
f(std::string(a).append("Bar").append(b));
}
+
+Options
+---
+
+.. option:: StrictMode
+
+   When zero, the check will only check the string usage in ``while``, ``for``
+   and ``for-range`` statements. 0 by default.
Index: docs/clang-tidy/checks/performance-for-range-copy.rst
===
--- docs/clang-tidy/checks/performance-for-range-copy.rst
+++ docs/clang-tidy/checks/performance-for-range-copy.rst
@@ -17,3 +17,10 @@
 2. The loop variable is not const, but only const methods or operators are
invoked on it, or it is used as const reference or value argument in
constructors or function calls.
+
+Options
+---
+
+.. options:: WarnOnAllAutoCopies
+
+   When non-zero, the check will warn on all auto copies. `0` by default.
Index: docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
===
--- docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
+++ docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
@@ -70,3 +70,11 @@
 
  // only 'f()' (or similar) will trigger the replacement.
 
+
+Options
+---
+
+.. option:: IncludeStyle
+
+   A string specifying which include-style is used, `llvm` or `google`.
+   `llvm` by default.
Index: docs/clang-tidy/checks/modernize-pass-by-value.rst
===
--- docs/clang-tidy/checks/modernize-pass-by-value.rst
+++ docs/clang-tidy/checks/modernize-pass-by-value.rst
@@ -151,3 +151,11 @@
   For more information about the pass-by-value idiom, read: `Want Speed? Pass by Value`_.
 
   .. _Want Speed? Pass by Value: http://cpp-next.com/archive/2009/08/want-speed-pass-by-value/
+
+Options
+---
+
+.. option:: IncludeStyle
+
+   A string specifying which include-style is used, `llvm` or `google`. `llvm`
+   by default.
Index: docs/clang-tidy/checks/misc-suspicious-string-compare.rst
===
--- docs/clang-tidy/checks/misc-suspicious-string-compare.rst
+++ docs/clang-tidy/checks/misc-suspicious-string-compare.rst
@@ -38,3 +38,19 @@
 .. code:: c++
 
 if (strcmp(...) < 0.)  // Incorrect usage of the returned value.
+
+Options
+---
+
+.. option:: WarnOnImplicitComparison
+
+   When non-zero, the check wil

Re: [PATCH] D22334: Fix for Bug 28172 : clang crashes on invalid code (with too few arguments to __builtin_signbit) without any proper diagnostics.

2016-08-26 Thread Mayur Pandey via cfe-commits
mayurpandey updated this revision to Diff 69354.
mayurpandey added a comment.

Hi,

Updated the patch to handle the second crash.  __builtin_signbit("1") was 
crashing. I am not fully sure whether the check : if 
(!Ty->isRealFloatingType()) is correct. Please review and let me know whether 
it is fine and if not what all changes are needed.

Thanks,
Mayur


https://reviews.llvm.org/D22334

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaChecking.cpp
  test/Sema/builtins.c

Index: test/Sema/builtins.c
===
--- test/Sema/builtins.c
+++ test/Sema/builtins.c
@@ -248,3 +248,11 @@
 
 return buf;
 }
+
+int test21(double a) {
+  return __builtin_signbit();  // expected-error {{too few arguments}}
+}
+
+int test22(void) {
+  return __builtin_signbit("1");  // expected-error {{Argument type mismatch}}
+}
Index: lib/Sema/SemaChecking.cpp
===
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -99,6 +99,22 @@
   return false;
 }
 
+static bool SemaBuiltinSignbit(Sema &S, CallExpr *TheCall) {
+  if (checkArgCount(S, TheCall, 1))
+return true;
+
+  // Argument should be an float, double or long double.
+  Expr *ValArg = TheCall->getArg(0);
+  QualType Ty = ValArg->getType();
+  if (!Ty->isRealFloatingType()) {
+S.Diag(ValArg->getLocStart(), diag::err_builtin_signbit_wrong_argument)
+  << ValArg->getSourceRange();
+return true;
+  }
+
+  return false;
+}
+
 /// Check that the argument to __builtin_addressof is a glvalue, and set the
 /// result type to the corresponding pointer type.
 static bool SemaBuiltinAddressof(Sema &S, CallExpr *TheCall) {
@@ -763,6 +779,10 @@
 }
 break;
   }
+  case Builtin::BI__builtin_signbit:
+if (SemaBuiltinSignbit(*this, TheCall))
+  return ExprError();
+break;
   case Builtin::BI__builtin_isgreater:
   case Builtin::BI__builtin_isgreaterequal:
   case Builtin::BI__builtin_isless:
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -7398,6 +7398,9 @@
 def err_builtin_annotation_second_arg : Error<
   "second argument to __builtin_annotation must be a non-wide string 
constant">;
 
+def err_builtin_signbit_wrong_argument : Error<
+  "Argument type mismatch, must be float, double or long double">;
+
 // CFString checking
 def err_cfstring_literal_not_string_constant : Error<
   "CFString literal is not a string constant">;


Index: test/Sema/builtins.c
===
--- test/Sema/builtins.c
+++ test/Sema/builtins.c
@@ -248,3 +248,11 @@
 
 return buf;
 }
+
+int test21(double a) {
+  return __builtin_signbit();  // expected-error {{too few arguments}}
+}
+
+int test22(void) {
+  return __builtin_signbit("1");  // expected-error {{Argument type mismatch}}
+}
Index: lib/Sema/SemaChecking.cpp
===
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -99,6 +99,22 @@
   return false;
 }
 
+static bool SemaBuiltinSignbit(Sema &S, CallExpr *TheCall) {
+  if (checkArgCount(S, TheCall, 1))
+return true;
+
+  // Argument should be an float, double or long double.
+  Expr *ValArg = TheCall->getArg(0);
+  QualType Ty = ValArg->getType();
+  if (!Ty->isRealFloatingType()) {
+S.Diag(ValArg->getLocStart(), diag::err_builtin_signbit_wrong_argument)
+  << ValArg->getSourceRange();
+return true;
+  }
+
+  return false;
+}
+
 /// Check that the argument to __builtin_addressof is a glvalue, and set the
 /// result type to the corresponding pointer type.
 static bool SemaBuiltinAddressof(Sema &S, CallExpr *TheCall) {
@@ -763,6 +779,10 @@
 }
 break;
   }
+  case Builtin::BI__builtin_signbit:
+if (SemaBuiltinSignbit(*this, TheCall))
+  return ExprError();
+break;
   case Builtin::BI__builtin_isgreater:
   case Builtin::BI__builtin_isgreaterequal:
   case Builtin::BI__builtin_isless:
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -7398,6 +7398,9 @@
 def err_builtin_annotation_second_arg : Error<
   "second argument to __builtin_annotation must be a non-wide string constant">;
 
+def err_builtin_signbit_wrong_argument : Error<
+  "Argument type mismatch, must be float, double or long double">;
+
 // CFString checking
 def err_cfstring_literal_not_string_constant : Error<
   "CFString literal is not a string constant">;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23840: New options -fexceptions-fp-math and -fdenormal-fp-math

2016-08-26 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer updated this revision to Diff 69367.
SjoerdMeijer added a comment.

Hi James,

Thanks for the review. I got rid of that new option -fexceptions-fp-math and 
now use -ftrapping-math for that which indeed was not passed through to CC1.

Cheers.


https://reviews.llvm.org/D23840

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/CGCall.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/denormalfpmode.c
  test/CodeGen/noexceptionsfpmath.c
  test/Driver/fast-math.c

Index: test/Driver/fast-math.c
===
--- test/Driver/fast-math.c
+++ test/Driver/fast-math.c
@@ -231,3 +231,20 @@
 // CHECK-NO-UNSAFE-MATH: "-cc1"
 // CHECK-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math"
 // CHECK-NO-UNSAFE-MATH: "-o"
+//
+// RUN: %clang -### -fexceptions-fp-math -fno-exceptions-fp-math -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-FP-EXCEPTIONS %s
+// RUN: %clang -### -fno-exceptions-fp-math -fexceptions-fp-math -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-EXCEPTIONS %s
+// CHECK-NO-FP-EXCEPTIONS: "-fno-exceptions-fp-math"
+// CHECK-FP-EXCEPTIONS-NOT: "-fno-exceptions-fp-math"
+//
+// 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-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"
Index: test/CodeGen/noexceptionsfpmath.c
===
--- /dev/null
+++ test/CodeGen/noexceptionsfpmath.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -S -fno-trapping-math %s -emit-llvm -o - | FileCheck %s
+
+// CHECK-LABEL: main
+// CHECK: attributes #0 = {{.*}}"no-trapping-math"="true"{{.*}}
+
+int main() {
+  return 0;
+}
Index: test/CodeGen/denormalfpmode.c
===
--- /dev/null
+++ test/CodeGen/denormalfpmode.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -S -fdenormal-fp-math=ieee %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-IEEE
+// RUN: %clang_cc1 -S -fdenormal-fp-math=preserve-sign %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-PS
+// RUN: %clang_cc1 -S -fdenormal-fp-math=positive-zero %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-PZ
+
+// CHECK-LABEL: main
+// CHECK-IEEE: attributes #0 = {{.*}}"denormal-fp-math"="ieee"{{.*}}
+// CHECK-PS: attributes #0 = {{.*}}"denormal-fp-math"="preserve-sign"{{.*}}
+// CHECK-PZ: attributes #0 = {{.*}}"denormal-fp-math"="positive-zero"{{.*}}
+
+int main() {
+  return 0;
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -575,6 +575,7 @@
   Opts.CorrectlyRoundedDivSqrt =
   Args.hasArg(OPT_cl_fp32_correctly_rounded_divide_sqrt);
   Opts.ReciprocalMath = Args.hasArg(OPT_freciprocal_math);
+  Opts.NoTrappingMath = Args.hasArg(OPT_fno_trapping_math);
   Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_mno_zero_initialized_in_bss);
   Opts.BackendOptions = Args.getAllArgValues(OPT_backend_option);
   Opts.NumRegisterParameters = getLastArgIntValue(Args, OPT_mregparm, 0, Diags);
@@ -791,6 +792,18 @@
   Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
   }
 
+  if (Arg *A = Args.getLastArg(OPT_fdenormal_fp_math_EQ)) {
+StringRef Val = A->getValue();
+if (Val == "ieee")
+  Opts.FPDenormalMode = "ieee";
+else if (Val == "preserve-sign")
+  Opts.FPDenormalMode = "preserve-sign";
+else if (Val == "positive-zero")
+  Opts.FPDenormalMode = "positive-zero";
+else
+  Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
+  }
+
   if (Arg *A = Args.getLastArg(OPT_fpcc_struct_return, OPT_freg_struct_return)) {
 if (A->getOption().matches(OPT_fpcc_struct_return)) {
   Opts.setStructReturnConvention(CodeGenOptions::SRCK_OnStack);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4362,6 +4362,12 @@
   if (ReciprocalMath)
 CmdArgs.push_back("-freciprocal-math");
 
+  if (!TrappingMath) 
+CmdArgs.push_back("-fno-trapping-math");
+
+  if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ))
+Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ);
+
   // Validate and pass through -fp-contract option.
   if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,

Re: [PATCH] D23840: New options -fexceptions-fp-math and -fdenormal-fp-math

2016-08-26 Thread James Molloy via cfe-commits
jmolloy added a comment.

Hi Sjoerd,

This still needs a docs patch. I'd also really appreciate someone else to help 
sign this off - While it looks fine, I don't commit enough to clang to give the 
go-ahead.

Cheers,

James


https://reviews.llvm.org/D23840



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


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

2016-08-26 Thread Artem Dergachev via cfe-commits
NoQ added a comment.

Here's some pseudo-code of the way i see it.

  // This interface mimics CloneDetector's interface, hence omnipotent but 
useless.
  
  class BasicConstraint {
  public:
virtual void add(const StmtSequence &S) = 0;
virtual vector findClones() = 0;
  };

  // This constraint separates statements by their hash values.
  // Useful for the first pass, when we can't afford the number of sequences
  // to slow us down.
  
  class HashingConstraint: public BasicConstraint {
map M;
  
  public:
virtual hash_t hash(const StmtSequence &S) = 0;
  
virtual void add(const StmtSequence &S) override {
  M[hash(S)].append(S);
}
virtual vector findClones() override {
  vector V;
  for (I in M)
V.append(I.second);
  return V;
}
  };

  // This interface does pairwise comparisons via the provided compare() 
function.
  // Quadratic but easy to use for later passes.
  
  class ComparingConstraint {
vector V;
  
  public:
virtual void compare(const StmtSequence &LHS, const StmtSequence &RHS) = 0;
  
virtual void add(const StmtSequence &S) override {
  for (auto G in V) {
if (compare(G[0], S))
  G.append(S);
else
  V[V.length()].append(S);
  }
}
vector findClones() override {
  return V;
}
  };

And inherit custom constraints from these building blocks, probably provide 
more building blocks.


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] D23921: Remove va_start diagnostic false positive with enumerations

2016-08-26 Thread Aaron Ballman via cfe-commits
aaron.ballman created this revision.
aaron.ballman added reviewers: rsmith, dblaikie, rtrieu, friss.
aaron.ballman added a subscriber: cfe-commits.

r267338 improved the diagnostic checking for undefined behavior with 
va_start(), but it had some false positives regarding enumerations. The 
underlying type for an enumeration in C is either char, signed int, or unsigned 
int. In the case the underlying type is chosen to be char (such as when passing 
-fshort-enums or using __attribute__((packed)) on the enum declaration), the 
enumeration can result in undefined behavior. However, when the underlying type 
is signed int or unsigned int (or long long as an extension), there is no 
undefined behavior because the types are compatible. This patch silences 
diagnostics for the latter while retaining the diagnostics for the former.

This patch addresses PR29140.

https://reviews.llvm.org/D23921

Files:
  lib/Sema/SemaChecking.cpp
  test/Sema/varargs.c

Index: test/Sema/varargs.c
===
--- test/Sema/varargs.c
+++ test/Sema/varargs.c
@@ -1,5 +1,6 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s -triple i386-pc-unknown
 // RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-apple-darwin9
+// RUN: %clang_cc1 -fsyntax-only -fms-compatibility -DMS -verify %s
 
 void f1(int a)
 {
@@ -94,3 +95,20 @@
   __builtin_va_start(ap, i); // expected-warning {{passing a parameter 
declared with the 'register' keyword to 'va_start' has undefined behavior}}
   __builtin_va_end(ap);
 }
+
+enum __attribute__((packed)) E1 {
+  one1
+};
+
+void f13(enum E1 e, ...) {
+  __builtin_va_list va;
+  __builtin_va_start(va, e);
+#ifndef MS
+  // In Microsoft compatibility mode, all enum types are int, but in
+  // non-ms-compatibility mode, this enumeration type will undergo default
+  // argument promotions.
+  // expected-note@-7 {{parameter of type 'enum E1' is declared here}}
+  // expected-warning@-6 {{passing an object that undergoes default argument 
promotion to 'va_start' has undefined behavior}}
+#endif
+  __builtin_va_end(va);
+}
Index: lib/Sema/SemaChecking.cpp
===
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -3238,8 +3238,17 @@
 Diag(TheCall->getArg(1)->getLocStart(),
  diag::warn_second_arg_of_va_start_not_last_named_param);
   else if (IsCRegister || Type->isReferenceType() ||
-   Type->isPromotableIntegerType() ||
-   Type->isSpecificBuiltinType(BuiltinType::Float)) {
+   Type->isSpecificBuiltinType(BuiltinType::Float) || [=] {
+ // Promotable integers are UB, but enumerations need a bit of
+ // extra checking to see what their promotable type actually is.
+ if (!Type->isPromotableIntegerType())
+   return false;
+ if (!Type->isEnumeralType())
+   return true;
+ const EnumDecl *ED = Type->getAs()->getDecl();
+ return !(ED &&
+  Context.typesAreCompatible(ED->getPromotionType(), 
Type));
+   }()) {
 unsigned Reason = 0;
 if (Type->isReferenceType())  Reason = 1;
 else if (IsCRegister) Reason = 2;


Index: test/Sema/varargs.c
===
--- test/Sema/varargs.c
+++ test/Sema/varargs.c
@@ -1,5 +1,6 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s -triple i386-pc-unknown
 // RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-apple-darwin9
+// RUN: %clang_cc1 -fsyntax-only -fms-compatibility -DMS -verify %s
 
 void f1(int a)
 {
@@ -94,3 +95,20 @@
   __builtin_va_start(ap, i); // expected-warning {{passing a parameter declared with the 'register' keyword to 'va_start' has undefined behavior}}
   __builtin_va_end(ap);
 }
+
+enum __attribute__((packed)) E1 {
+  one1
+};
+
+void f13(enum E1 e, ...) {
+  __builtin_va_list va;
+  __builtin_va_start(va, e);
+#ifndef MS
+  // In Microsoft compatibility mode, all enum types are int, but in
+  // non-ms-compatibility mode, this enumeration type will undergo default
+  // argument promotions.
+  // expected-note@-7 {{parameter of type 'enum E1' is declared here}}
+  // expected-warning@-6 {{passing an object that undergoes default argument promotion to 'va_start' has undefined behavior}}
+#endif
+  __builtin_va_end(va);
+}
Index: lib/Sema/SemaChecking.cpp
===
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -3238,8 +3238,17 @@
 Diag(TheCall->getArg(1)->getLocStart(),
  diag::warn_second_arg_of_va_start_not_last_named_param);
   else if (IsCRegister || Type->isReferenceType() ||
-   Type->isPromotableIntegerType() ||
-   Type->isSpecificBuiltinType(BuiltinType::Float)) {
+   Type->isSpecificBuiltinType(BuiltinType::

Re: [PATCH] D23840: New options -fexceptions-fp-math and -fdenormal-fp-math

2016-08-26 Thread Renato Golin via cfe-commits
rengolin added a comment.

Hi James,

Also looks good to me, though it need docs (in the same patch).

Is there an LLVM counter part to this patch? Where is this going to be used?

From the fact that trapping-math wasn't passed down, its documentation may be 
missing/outdated/wrong, and probably nothing down the pipe is using it either. 
What are the plans for that?

cheers,
--renato


https://reviews.llvm.org/D23840



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


Re: [PATCH] D23840: New options -fexceptions-fp-math and -fdenormal-fp-math

2016-08-26 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer updated this revision to Diff 69379.
SjoerdMeijer added a comment.

Sorry, forgot to add the doc patch, but it has been included now.

This will be used in llvm to emit and appropriately set build attributes 
ABI_FP_denormal and ABI_FP_exceptions. I am now trying to get a llvm patch 
ready for that (not uploaded yet, but it will mainly affect only 
ARMAsmPrinter.cpp and perhaps TargetOptions to query buildattributes).


https://reviews.llvm.org/D23840

Files:
  docs/UsersManual.rst
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/CGCall.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/denormalfpmode.c
  test/CodeGen/noexceptionsfpmath.c
  test/Driver/fast-math.c

Index: test/Driver/fast-math.c
===
--- test/Driver/fast-math.c
+++ test/Driver/fast-math.c
@@ -231,3 +231,20 @@
 // CHECK-NO-UNSAFE-MATH: "-cc1"
 // CHECK-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math"
 // CHECK-NO-UNSAFE-MATH: "-o"
+//
+// RUN: %clang -### -fexceptions-fp-math -fno-exceptions-fp-math -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-FP-EXCEPTIONS %s
+// RUN: %clang -### -fno-exceptions-fp-math -fexceptions-fp-math -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-EXCEPTIONS %s
+// CHECK-NO-FP-EXCEPTIONS: "-fno-exceptions-fp-math"
+// CHECK-FP-EXCEPTIONS-NOT: "-fno-exceptions-fp-math"
+//
+// 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-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"
Index: test/CodeGen/noexceptionsfpmath.c
===
--- /dev/null
+++ test/CodeGen/noexceptionsfpmath.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -S -fno-trapping-math %s -emit-llvm -o - | FileCheck %s
+
+// CHECK-LABEL: main
+// CHECK: attributes #0 = {{.*}}"no-trapping-math"="true"{{.*}}
+
+int main() {
+  return 0;
+}
Index: test/CodeGen/denormalfpmode.c
===
--- /dev/null
+++ test/CodeGen/denormalfpmode.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -S -fdenormal-fp-math=ieee %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-IEEE
+// RUN: %clang_cc1 -S -fdenormal-fp-math=preserve-sign %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-PS
+// RUN: %clang_cc1 -S -fdenormal-fp-math=positive-zero %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-PZ
+
+// CHECK-LABEL: main
+// CHECK-IEEE: attributes #0 = {{.*}}"denormal-fp-math"="ieee"{{.*}}
+// CHECK-PS: attributes #0 = {{.*}}"denormal-fp-math"="preserve-sign"{{.*}}
+// CHECK-PZ: attributes #0 = {{.*}}"denormal-fp-math"="positive-zero"{{.*}}
+
+int main() {
+  return 0;
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -575,6 +575,7 @@
   Opts.CorrectlyRoundedDivSqrt =
   Args.hasArg(OPT_cl_fp32_correctly_rounded_divide_sqrt);
   Opts.ReciprocalMath = Args.hasArg(OPT_freciprocal_math);
+  Opts.NoTrappingMath = Args.hasArg(OPT_fno_trapping_math);
   Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_mno_zero_initialized_in_bss);
   Opts.BackendOptions = Args.getAllArgValues(OPT_backend_option);
   Opts.NumRegisterParameters = getLastArgIntValue(Args, OPT_mregparm, 0, Diags);
@@ -791,6 +792,18 @@
   Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
   }
 
+  if (Arg *A = Args.getLastArg(OPT_fdenormal_fp_math_EQ)) {
+StringRef Val = A->getValue();
+if (Val == "ieee")
+  Opts.FPDenormalMode = "ieee";
+else if (Val == "preserve-sign")
+  Opts.FPDenormalMode = "preserve-sign";
+else if (Val == "positive-zero")
+  Opts.FPDenormalMode = "positive-zero";
+else
+  Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
+  }
+
   if (Arg *A = Args.getLastArg(OPT_fpcc_struct_return, OPT_freg_struct_return)) {
 if (A->getOption().matches(OPT_fpcc_struct_return)) {
   Opts.setStructReturnConvention(CodeGenOptions::SRCK_OnStack);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4362,6 +4362,12 @@
   if (ReciprocalMath)
 CmdArgs.push_back("-freciprocal-math");
 
+  if (!TrappingMath) 
+CmdArgs.push_back("-fno-trapping-math");
+
+  if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ))
+Args.AddLastArg(

r279827 - Add support for -fdiagnostics-absolute-paths: printing absolute paths in diagnostics

2016-08-26 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Fri Aug 26 10:45:36 2016
New Revision: 279827

URL: http://llvm.org/viewvc/llvm-project?rev=279827&view=rev
Log:
Add support for -fdiagnostics-absolute-paths: printing absolute paths in 
diagnostics

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

Added:
cfe/trunk/test/Frontend/Inputs/absolute-paths.h
cfe/trunk/test/Frontend/absolute-paths.c
Modified:
cfe/trunk/include/clang/Basic/DiagnosticOptions.def
cfe/trunk/include/clang/Driver/CLCompatOptions.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/TextDiagnostic.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/TextDiagnostic.cpp
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticOptions.def?rev=279827&r1=279826&r2=279827&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticOptions.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticOptions.def Fri Aug 26 10:45:36 2016
@@ -50,6 +50,7 @@ DIAGOPT(Pedantic, 1, 0) /// -ped
 DIAGOPT(PedanticErrors, 1, 0)   /// -pedantic-errors
 DIAGOPT(ShowColumn, 1, 1)   /// Show column number on diagnostics.
 DIAGOPT(ShowLocation, 1, 1) /// Show source location information.
+DIAGOPT(AbsolutePath, 1, 0) /// Use absolute paths.
 DIAGOPT(ShowCarets, 1, 1)   /// Show carets in diagnostics.
 DIAGOPT(ShowFixits, 1, 1)   /// Show fixit information.
 DIAGOPT(ShowSourceRanges, 1, 0) /// Show source ranges in numeric form.

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=279827&r1=279826&r2=279827&view=diff
==
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Fri Aug 26 10:45:36 2016
@@ -291,8 +291,8 @@ def _SLASH_cgthreads : CLIgnoredJoined<"
 def _SLASH_d2FastFail : CLIgnoredFlag<"d2FastFail">;
 def _SLASH_d2Zi_PLUS : CLIgnoredFlag<"d2Zi+">;
 def _SLASH_errorReport : CLIgnoredJoined<"errorReport">;
-def _SLASH_Fd : CLIgnoredJoined<"Fd">;
 def _SLASH_FC : CLIgnoredFlag<"FC">;
+def _SLASH_Fd : CLIgnoredJoined<"Fd">;
 def _SLASH_FS : CLIgnoredFlag<"FS">, HelpText<"Force synchronous PDB writes">;
 def _SLASH_GF : CLIgnoredFlag<"GF">;
 def _SLASH_kernel_ : CLIgnoredFlag<"kernel-">;

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=279827&r1=279826&r2=279827&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Aug 26 10:45:36 2016
@@ -991,6 +991,8 @@ def fno_show_column : Flag<["-"], "fno-s
   HelpText<"Do not include column number on diagnostics">;
 def fno_show_source_location : Flag<["-"], "fno-show-source-location">, 
Group,
   Flags<[CC1Option]>, HelpText<"Do not include source location information 
with diagnostics">;
+def fdiagnostics_absolute_paths : Flag<["-"], "fdiagnostics-absolute-paths">, 
Group,
+  Flags<[CC1Option, CoreOption]>, HelpText<"Print absolute paths in 
diagnostics">;
 def fno_spell_checking : Flag<["-"], "fno-spell-checking">, Group,
   Flags<[CC1Option]>, HelpText<"Disable spell-checking">;
 def fno_stack_protector : Flag<["-"], "fno-stack-protector">, Group,

Modified: cfe/trunk/include/clang/Frontend/TextDiagnostic.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/TextDiagnostic.h?rev=279827&r1=279826&r2=279827&view=diff
==
--- cfe/trunk/include/clang/Frontend/TextDiagnostic.h (original)
+++ cfe/trunk/include/clang/Frontend/TextDiagnostic.h Fri Aug 26 10:45:36 2016
@@ -107,6 +107,8 @@ protected:
   const SourceManager &SM) override;
 
 private:
+  void emitFilename(StringRef Filename, const SourceManager &SM);
+
   void emitSnippetAndCaret(SourceLocation Loc, DiagnosticsEngine::Level Level,
SmallVectorImpl& Ranges,
ArrayRef Hints,

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=279827&r1=279826&r2=279827&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Aug 26 10:45:36 2016
@@ -5914,6 +5914,9 @@ void Clang::ConstructJob(Compilation &C,
 options::OPT_fno_show_source_location))
 CmdArgs.push_back("-fno-show-source-location");
 
+  if (Args.hasArg(opt

Re: [PATCH] D23902: Minor cleanup of PTHWriter

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

lgtm


Repository:
  rL LLVM

https://reviews.llvm.org/D23902



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


[PATCH] D23926: [libcxx] Don't use C99 math ops in -std=c++03 mode

2016-08-26 Thread Asiri Rathnayake via cfe-commits
rmaprath created this revision.
rmaprath added reviewers: mclow.lists, EricWF.
rmaprath added a subscriber: cfe-commits.

`C99` math ops should not be available when compiling in `-std=c++03` mode.

https://reviews.llvm.org/D23926

Files:
  include/math.h
  test/std/depr/depr.c.headers/math_h.pass.cpp
  test/std/numerics/c.math/cmath.pass.cpp
  test/std/numerics/complex.number/cmplx.over/proj.pass.cpp

Index: test/std/numerics/complex.number/cmplx.over/proj.pass.cpp
===
--- test/std/numerics/complex.number/cmplx.over/proj.pass.cpp
+++ test/std/numerics/complex.number/cmplx.over/proj.pass.cpp
@@ -34,16 +34,20 @@
 test(T x, typename std::enable_if::value>::type* = 0)
 {
 static_assert((std::is_same >::value), "");
+#if TEST_STD_VER > 3
 assert(std::proj(x) == proj(std::complex(x, 0)));
+#endif
 }
 
 template 
 void
 test(T x, typename std::enable_if::value &&
   !std::is_floating_point::value>::type* = 0)
 {
 static_assert((std::is_same >::value), "");
+#if TEST_STD_VER > 3
 assert(std::proj(x) == proj(std::complex(x, 0)));
+#endif
 }
 
 template 
Index: test/std/numerics/c.math/cmath.pass.cpp
===
--- test/std/numerics/c.math/cmath.pass.cpp
+++ test/std/numerics/c.math/cmath.pass.cpp
@@ -752,6 +752,8 @@
 assert(std::isunordered(-1.0, 0.F) == false);
 }
 
+#if TEST_STD_VER > 3
+
 void test_acosh()
 {
 static_assert((std::is_same::value), "");
@@ -1479,6 +1481,8 @@
 assert(std::trunc(1) == 1);
 }
 
+#endif
+
 int main()
 {
 test_abs();
@@ -1516,6 +1520,7 @@
 test_islessgreater();
 test_isnan();
 test_isunordered();
+#if TEST_STD_VER > 3
 test_acosh();
 test_asinh();
 test_atanh();
@@ -1551,4 +1556,5 @@
 test_scalbn();
 test_tgamma();
 test_trunc();
+#endif
 }
Index: test/std/depr/depr.c.headers/math_h.pass.cpp
===
--- test/std/depr/depr.c.headers/math_h.pass.cpp
+++ test/std/depr/depr.c.headers/math_h.pass.cpp
@@ -750,6 +750,8 @@
 assert(isunordered(-1.0, 0.F) == false);
 }
 
+#if TEST_STD_VER > 3
+
 void test_acosh()
 {
 static_assert((std::is_same::value), "");
@@ -1455,6 +1457,8 @@
 assert(trunc(1) == 1);
 }
 
+#endif
+
 int main()
 {
 test_abs();
@@ -1492,6 +1496,7 @@
 test_islessgreater();
 test_isnan();
 test_isunordered();
+#if TEST_STD_VER > 3
 test_acosh();
 test_asinh();
 test_atanh();
@@ -1527,4 +1532,5 @@
 test_scalbn();
 test_tgamma();
 test_trunc();
+#endif
 }
Index: include/math.h
===
--- include/math.h
+++ include/math.h
@@ -302,6 +302,10 @@
 
 #ifdef __cplusplus
 
+#if 201103L <= __cplusplus
+  #define __LIBCPP_USE_C99_MATH 1
+#endif
+
 // We support including .h headers inside 'extern "C"' contexts, so switch
 // back to C++ linkage before including these C++ headers.
 extern "C++" {
@@ -946,7 +950,7 @@
 
 // acosh
 
-#ifndef _LIBCPP_MSVCRT
+#if !defined(_LIBCPP_MSVCRT) && defined(__LIBCPP_USE_C99_MATH)
 inline _LIBCPP_INLINE_VISIBILITY float   acosh(float __lcpp_x) _NOEXCEPT   {return acoshf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return acoshl(__lcpp_x);}
 
@@ -958,7 +962,7 @@
 
 // asinh
 
-#ifndef _LIBCPP_MSVCRT
+#if !defined(_LIBCPP_MSVCRT) && defined(__LIBCPP_USE_C99_MATH)
 inline _LIBCPP_INLINE_VISIBILITY float   asinh(float __lcpp_x) _NOEXCEPT   {return asinhf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return asinhl(__lcpp_x);}
 
@@ -970,7 +974,7 @@
 
 // atanh
 
-#ifndef _LIBCPP_MSVCRT
+#if !defined(_LIBCPP_MSVCRT) && defined(__LIBCPP_USE_C99_MATH)
 inline _LIBCPP_INLINE_VISIBILITY float   atanh(float __lcpp_x) _NOEXCEPT   {return atanhf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return atanhl(__lcpp_x);}
 
@@ -982,7 +986,7 @@
 
 // cbrt
 
-#ifndef _LIBCPP_MSVCRT
+#if !defined(_LIBCPP_MSVCRT) && defined(__LIBCPP_USE_C99_MATH)
 inline _LIBCPP_INLINE_VISIBILITY float   cbrt(float __lcpp_x) _NOEXCEPT   {return cbrtf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return cbrtl(__lcpp_x);}
 
@@ -994,7 +998,7 @@
 
 // copysign
 
-#if !defined(_VC_CRT_MAJOR_VERSION) || (_VC_CRT_MAJOR_VERSION < 12)
+#if defined(__LIBCPP_USE_C99_MATH) && (!defined(_VC_CRT_MAJOR_VERSION) || (_VC_CRT_MAJOR_VERSION < 12))
 inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x,
 float __lcpp_y) _NOEXCEPT {
   return copysignf(__lcpp_x, __lcpp_y);
@@ -1005,6 +1009,7 @@
 }
 #endif
 
+#if defined(__LIBCPP_USE_C99_MATH)
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 typename std::__lazy_enable_if
@@ -1020,9 +1025,9 @@
   

Re: [PATCH] D23284: Add -Rpass-with-hotness

2016-08-26 Thread Diego Novillo via cfe-commits
dnovillo added a comment.

In https://reviews.llvm.org/D23284#526389, @anemet wrote:

> @dnovillo or @rsmith, can you please confirm if you agree that this new 
> option -Rpass-with-hotness should not be part of R_group.  R_group options 
> enable/disable groups of remarks whereas this one is only modifying the text 
> of the remarks.  Thanks!


I'm fine with it, but I don't have much of a say in how option groups are 
organized.  If Richard agrees, then it LGTM.


https://reviews.llvm.org/D23284



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


Re: [PATCH] D23284: Add -Rpass-with-hotness

2016-08-26 Thread Adam Nemet via cfe-commits
anemet added a comment.

@dnovillo or @rsmith, can you please confirm if you agree that this new option 
-Rpass-with-hotness should not be part of R_group.  R_group options 
enable/disable groups of remarks whereas this one is only modifying the text of 
the remarks.  Thanks!


https://reviews.llvm.org/D23284



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


Re: [PATCH] D22334: Fix for Bug 28172 : clang crashes on invalid code (with too few arguments to __builtin_signbit) without any proper diagnostics.

2016-08-26 Thread David Majnemer via cfe-commits
majnemer added a comment.

This looks much better. Please add a test that uses a template:

  template 
  int f(T t) { return __builtin_signbit(t); }



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:7401-7403
@@ -7400,2 +7400,5 @@
 
+def err_builtin_signbit_wrong_argument : Error<
+  "Argument type mismatch, must be float, double or long double">;
+
 // CFString checking

Hmm, I think it would be better if you added this near 
`err_typecheck_cond_expect_int_float`, named it 
`err_typecheck_cond_expect_float`, and gave it a similar error message.


https://reviews.llvm.org/D22334



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


Re: [PATCH] D23840: New options -fexceptions-fp-math and -fdenormal-fp-math

2016-08-26 Thread James Molloy via cfe-commits
jmolloy accepted this revision.
jmolloy added a comment.
This revision is now accepted and ready to land.

LGTM.

Cheers,

James


https://reviews.llvm.org/D23840



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


[PATCH] D23932: [XRay] ARM 32-bit no-Thumb support in Clang

2016-08-26 Thread Serge Rogatch via cfe-commits
rSerge created this revision.
rSerge added reviewers: dberris, rengolin.
rSerge added a subscriber: cfe-commits.
Herald added subscribers: dberris, samparker, rengolin, aemerson.

Just a test for now, adapted from x86_64 tests of XRay.

https://reviews.llvm.org/D23932

Files:
  test/CodeGen/xray-attributes-supported-arm.cpp

Index: test/CodeGen/xray-attributes-supported-arm.cpp
===
--- test/CodeGen/xray-attributes-supported-arm.cpp
+++ test/CodeGen/xray-attributes-supported-arm.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - 
-triple arm-unknown-linux-gnu | FileCheck %s
+
+// Make sure that the LLVM attribute for XRay-annotated functions do show up.
+[[clang::xray_always_instrument]] void foo() {
+// CHECK: define void @_Z3foov() #0
+};
+
+[[clang::xray_never_instrument]] void bar() {
+// CHECK: define void @_Z3barv() #1
+};
+
+// CHECK: #0 = {{.*}}"function-instrument"="xray-always"
+// CHECK: #1 = {{.*}}"function-instrument"="xray-never"


Index: test/CodeGen/xray-attributes-supported-arm.cpp
===
--- test/CodeGen/xray-attributes-supported-arm.cpp
+++ test/CodeGen/xray-attributes-supported-arm.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - -triple arm-unknown-linux-gnu | FileCheck %s
+
+// Make sure that the LLVM attribute for XRay-annotated functions do show up.
+[[clang::xray_always_instrument]] void foo() {
+// CHECK: define void @_Z3foov() #0
+};
+
+[[clang::xray_never_instrument]] void bar() {
+// CHECK: define void @_Z3barv() #1
+};
+
+// CHECK: #0 = {{.*}}"function-instrument"="xray-always"
+// CHECK: #1 = {{.*}}"function-instrument"="xray-never"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23816: Add support for -fdiagnostics-abs-path: printing absolute paths in diagnostics

2016-08-26 Thread Hans Wennborg via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279827: Add support for -fdiagnostics-absolute-paths: 
printing absolute paths in… (authored by hans).

Changed prior to commit:
  https://reviews.llvm.org/D23816?vs=69304&id=69384#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23816

Files:
  cfe/trunk/include/clang/Basic/DiagnosticOptions.def
  cfe/trunk/include/clang/Driver/CLCompatOptions.td
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/include/clang/Frontend/TextDiagnostic.h
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/lib/Frontend/TextDiagnostic.cpp
  cfe/trunk/test/Driver/cl-options.c
  cfe/trunk/test/Frontend/Inputs/absolute-paths.h
  cfe/trunk/test/Frontend/absolute-paths.c

Index: cfe/trunk/include/clang/Driver/CLCompatOptions.td
===
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td
@@ -291,8 +291,8 @@
 def _SLASH_d2FastFail : CLIgnoredFlag<"d2FastFail">;
 def _SLASH_d2Zi_PLUS : CLIgnoredFlag<"d2Zi+">;
 def _SLASH_errorReport : CLIgnoredJoined<"errorReport">;
-def _SLASH_Fd : CLIgnoredJoined<"Fd">;
 def _SLASH_FC : CLIgnoredFlag<"FC">;
+def _SLASH_Fd : CLIgnoredJoined<"Fd">;
 def _SLASH_FS : CLIgnoredFlag<"FS">, HelpText<"Force synchronous PDB writes">;
 def _SLASH_GF : CLIgnoredFlag<"GF">;
 def _SLASH_kernel_ : CLIgnoredFlag<"kernel-">;
Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -991,6 +991,8 @@
   HelpText<"Do not include column number on diagnostics">;
 def fno_show_source_location : Flag<["-"], "fno-show-source-location">, Group,
   Flags<[CC1Option]>, HelpText<"Do not include source location information with diagnostics">;
+def fdiagnostics_absolute_paths : Flag<["-"], "fdiagnostics-absolute-paths">, Group,
+  Flags<[CC1Option, CoreOption]>, HelpText<"Print absolute paths in diagnostics">;
 def fno_spell_checking : Flag<["-"], "fno-spell-checking">, Group,
   Flags<[CC1Option]>, HelpText<"Disable spell-checking">;
 def fno_stack_protector : Flag<["-"], "fno-stack-protector">, Group,
Index: cfe/trunk/include/clang/Basic/DiagnosticOptions.def
===
--- cfe/trunk/include/clang/Basic/DiagnosticOptions.def
+++ cfe/trunk/include/clang/Basic/DiagnosticOptions.def
@@ -50,6 +50,7 @@
 DIAGOPT(PedanticErrors, 1, 0)   /// -pedantic-errors
 DIAGOPT(ShowColumn, 1, 1)   /// Show column number on diagnostics.
 DIAGOPT(ShowLocation, 1, 1) /// Show source location information.
+DIAGOPT(AbsolutePath, 1, 0) /// Use absolute paths.
 DIAGOPT(ShowCarets, 1, 1)   /// Show carets in diagnostics.
 DIAGOPT(ShowFixits, 1, 1)   /// Show fixit information.
 DIAGOPT(ShowSourceRanges, 1, 0) /// Show source ranges in numeric form.
Index: cfe/trunk/include/clang/Frontend/TextDiagnostic.h
===
--- cfe/trunk/include/clang/Frontend/TextDiagnostic.h
+++ cfe/trunk/include/clang/Frontend/TextDiagnostic.h
@@ -107,6 +107,8 @@
   const SourceManager &SM) override;
 
 private:
+  void emitFilename(StringRef Filename, const SourceManager &SM);
+
   void emitSnippetAndCaret(SourceLocation Loc, DiagnosticsEngine::Level Level,
SmallVectorImpl& Ranges,
ArrayRef Hints,
Index: cfe/trunk/test/Driver/cl-options.c
===
--- cfe/trunk/test/Driver/cl-options.c
+++ cfe/trunk/test/Driver/cl-options.c
@@ -339,7 +339,6 @@
 // RUN: /FAs \
 // RUN: /FAu \
 // RUN: /favor:blend \
-// RUN: /FC \
 // RUN: /Fifoo \
 // RUN: /Fmfoo \
 // RUN: /FpDebug\main.pch \
@@ -491,6 +490,7 @@
 // RUN: -fdiagnostics-color \
 // RUN: -fno-diagnostics-color \
 // RUN: -fdiagnostics-parseable-fixits \
+// RUN: -fdiagnostics-absolute-paths \
 // RUN: -ferror-limit=10 \
 // RUN: -fmsc-version=1800 \
 // RUN: -fno-strict-aliasing \
Index: cfe/trunk/test/Frontend/Inputs/absolute-paths.h
===
--- cfe/trunk/test/Frontend/Inputs/absolute-paths.h
+++ cfe/trunk/test/Frontend/Inputs/absolute-paths.h
@@ -0,0 +1,3 @@
+int f() {
+  // Oops, no return.
+}
Index: cfe/trunk/test/Frontend/absolute-paths.c
===
--- cfe/trunk/test/Frontend/absolute-paths.c
+++ cfe/trunk/test/Frontend/absolute-paths.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fsyntax-only -I %S/Inputs/SystemHeaderPrefix/.. %s 2>&1 | FileCheck -check-prefix=NORMAL -check-prefix=CHECK %s
+// RUN: %clang_cc1 -fsyntax-only -I %S/Inputs/SystemHeaderPrefix/.. -fdiagnostics-abs

Re: [PATCH] D23856: [libc++] Perform configuration checks with -nodefaultlibs

2016-08-26 Thread Saleem Abdulrasool via cfe-commits
compnerd added inline comments.


Comment at: cmake/config-ix.cmake:18
@@ +17,3 @@
+if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
+  list(APPEND CMAKE_REQUIRED_LIBRARIES -nodefaultlibs)
+  if (LIBCXX_HAS_C_LIB)

Can we not use `CMAKE_SHARED_LINKER_FLAGS` instead of 
`CMAKE_REQUIRED_LIBRARIES`?  It is slightly misleading.


https://reviews.llvm.org/D23856



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


Re: [PATCH] D23905: [Modules] Add 'gnuinlineasm' to the 'requires-declaration' feature-list.

2016-08-26 Thread Bruno Cardoso Lopes via cfe-commits
On Thu, Aug 25, 2016 at 9:52 PM, Richard Smith  wrote:
> On 25 Aug 2016 7:37 p.m., "Bruno Cardoso Lopes" 
> wrote:
>
> bruno created this revision.
> bruno added a reviewer: rsmith.
> bruno added subscribers: cfe-commits, eladcohen.
>
> This adds support for modules that require (no-)gnu-inline-asm
> environment, such as the compiler builtin cpuid submodule.
>
> This is the gnu-inline-asm variant of https://reviews.llvm.org/D23871
>
> https://reviews.llvm.org/D23905
>
> Files:
>   docs/Modules.rst
>   lib/Basic/Module.cpp
>   lib/Headers/module.modulemap
>
> test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/NeedsGNUAsmInline.h
>   test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/Headers/asm.h
>   test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/module.map
>   test/Modules/requires-gnuasminline.m
>
> Index: test/Modules/requires-gnuasminline.m
> ===
> --- /dev/null
> +++ test/Modules/requires-gnuasminline.m
> @@ -0,0 +1,6 @@
> +// RUN: rm -rf %t
> +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules \
> +// RUN: -fimplicit-module-maps -F %S/Inputs/GNUAsm %s \
> +// RUN: -fno-gnu-inline-asm -verify
> +
> +@import NeedsGNUAsmInline.Asm; // expected-error{{module
> 'NeedsGNUAsmInline.Asm' requires feature 'gnuasminline'}}
>
>
> You should add a positive test for the case where inline asm is available,
> too...
>
> Index: test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/module.map
> ===
> --- /dev/null
> +++ test/Modules/Inputs/GNUAsm/NeedsGNUAsmInline.framework/module.map
> @@ -0,0 +1,8 @@
> +framework module NeedsGNUAsmInline {
> +  header "NeedsGNUAsmInline.h"
> +
> +  explicit module Asm {
> +requires gnuasminline
>
>
> ... that way, you'd catch this typo in the test :)

Oops :-)
Will do, thanks!

-- 
Bruno Cardoso Lopes
http://www.brunocardoso.cc
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23905: [Modules] Add 'gnuinlineasm' to the 'requires-declaration' feature-list.

2016-08-26 Thread Bruno Cardoso Lopes via cfe-commits
bruno updated this revision to Diff 69392.
bruno added a comment.

Update patch after Richard's comment


https://reviews.llvm.org/D23905

Files:
  docs/Modules.rst
  lib/Basic/Module.cpp
  lib/Headers/module.modulemap
  
test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/NeedsGNUInlineAsm.h
  test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/asm.h
  test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/module.map
  test/Modules/requires-gnuinlineasm.m

Index: test/Modules/requires-gnuinlineasm.m
===
--- /dev/null
+++ test/Modules/requires-gnuinlineasm.m
@@ -0,0 +1,16 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules \
+// RUN: -fimplicit-module-maps -F %S/Inputs/GNUAsm %s \
+// RUN: -fno-gnu-inline-asm -DNO_ASM_INLINE -verify
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules \
+// RUN: -fimplicit-module-maps -F %S/Inputs/GNUAsm %s \
+// RUN: -DASM_INLINE -verify
+
+#ifdef NO_ASM_INLINE
+@import NeedsGNUInlineAsm.Asm; // expected-error{{module 
'NeedsGNUInlineAsm.Asm' requires feature 'gnuinlineasm'}}
+#endif
+
+#ifdef ASM_INLINE
+@import NeedsGNUInlineAsm.Asm; // expected-no-diagnostics
+#endif
Index: test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/module.map
===
--- /dev/null
+++ test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/module.map
@@ -0,0 +1,8 @@
+framework module NeedsGNUInlineAsm {
+  header "NeedsGNUInlineAsm.h"
+
+  explicit module Asm {
+requires gnuinlineasm
+header "asm.h"
+  }
+}
Index: test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/asm.h
===
--- /dev/null
+++ test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/asm.h
@@ -0,0 +1 @@
+__asm("foo");
Index: 
test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/NeedsGNUInlineAsm.h
===
--- /dev/null
+++ 
test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/NeedsGNUInlineAsm.h
@@ -0,0 +1 @@
+// NeedsGNUInlineAsm.h
Index: lib/Headers/module.modulemap
===
--- lib/Headers/module.modulemap
+++ lib/Headers/module.modulemap
@@ -68,6 +68,7 @@
 }
 
 explicit module cpuid {
+  requires gnuinlineasm
   header "cpuid.h"
 }
 
Index: lib/Basic/Module.cpp
===
--- lib/Basic/Module.cpp
+++ lib/Basic/Module.cpp
@@ -64,6 +64,7 @@
 .Case("blocks", LangOpts.Blocks)
 .Case("cplusplus", LangOpts.CPlusPlus)
 .Case("cplusplus11", LangOpts.CPlusPlus11)
+.Case("gnuinlineasm", LangOpts.GNUAsm)
 .Case("objc", LangOpts.ObjC1)
 .Case("objc_arc", LangOpts.ObjCAutoRefCount)
 .Case("opencl", LangOpts.OpenCL)
Index: docs/Modules.rst
===
--- docs/Modules.rst
+++ docs/Modules.rst
@@ -413,6 +413,9 @@
 cplusplus11
   C++11 support is available.
 
+gnuinlineasm
+  GNU inline ASM is available.
+
 objc
   Objective-C support is available.
 


Index: test/Modules/requires-gnuinlineasm.m
===
--- /dev/null
+++ test/Modules/requires-gnuinlineasm.m
@@ -0,0 +1,16 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules \
+// RUN: -fimplicit-module-maps -F %S/Inputs/GNUAsm %s \
+// RUN: -fno-gnu-inline-asm -DNO_ASM_INLINE -verify
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules \
+// RUN: -fimplicit-module-maps -F %S/Inputs/GNUAsm %s \
+// RUN: -DASM_INLINE -verify
+
+#ifdef NO_ASM_INLINE
+@import NeedsGNUInlineAsm.Asm; // expected-error{{module 'NeedsGNUInlineAsm.Asm' requires feature 'gnuinlineasm'}}
+#endif
+
+#ifdef ASM_INLINE
+@import NeedsGNUInlineAsm.Asm; // expected-no-diagnostics
+#endif
Index: test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/module.map
===
--- /dev/null
+++ test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/module.map
@@ -0,0 +1,8 @@
+framework module NeedsGNUInlineAsm {
+  header "NeedsGNUInlineAsm.h"
+
+  explicit module Asm {
+requires gnuinlineasm
+header "asm.h"
+  }
+}
Index: test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/asm.h
===
--- /dev/null
+++ test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/asm.h
@@ -0,0 +1 @@
+__asm("foo");
Index: test/Modules/Inputs/GNUAsm/NeedsGNUInlineAsm.framework/Headers/NeedsGNUInlineAsm.h
===
-

Re: [PATCH] D23821: Minor cleanup of the class Pattern

2016-08-26 Thread Saleem Abdulrasool via cfe-commits
compnerd added a subscriber: compnerd.
compnerd closed this revision.
compnerd added a comment.

SVN r279832


Repository:
  rL LLVM

https://reviews.llvm.org/D23821



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


r279838 - Don't diagnose non-modular includes when we are not compiling a module.

2016-08-26 Thread Manman Ren via cfe-commits
Author: mren
Date: Fri Aug 26 12:16:46 2016
New Revision: 279838

URL: http://llvm.org/viewvc/llvm-project?rev=279838&view=rev
Log:
Don't diagnose non-modular includes when we are not compiling a module.

This is triggered when we are compiling an implementation of a module,
it has relative includes to a VFS-mapped module with umbrella headers.
Currently we will find the real path to headers under the umbrella directory,
but the umbrella directories are using virtual path.

rdar://27951255

Thanks Ben and Richard for reviewing the patch!
Differential Revision: http://reviews.llvm.org/D23858

Added:
cfe/trunk/test/VFS/Inputs/Nonmodular/
cfe/trunk/test/VFS/Inputs/Nonmodular/A.h
cfe/trunk/test/VFS/Inputs/Nonmodular/Nonmodular.modulemap
cfe/trunk/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml
cfe/trunk/test/VFS/Inputs/Nonmodular/test.c
cfe/trunk/test/VFS/Inputs/Nonmodular/umbrella.h
cfe/trunk/test/VFS/test_nonmodular.c
Modified:
cfe/trunk/lib/Lex/ModuleMap.cpp

Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=279838&r1=279837&r2=279838&view=diff
==
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Fri Aug 26 12:16:46 2016
@@ -297,7 +297,9 @@ void ModuleMap::diagnoseHeaderInclusion(
   if (LangOpts.ModulesStrictDeclUse) {
 Diags.Report(FilenameLoc, diag::err_undeclared_use_of_module)
 << RequestingModule->getFullModuleName() << Filename;
-  } else if (RequestingModule && RequestingModuleIsModuleInterface) {
+  } else if (RequestingModule && RequestingModuleIsModuleInterface &&
+ LangOpts.isCompilingModule()) {
+// Do not diagnose when we are not compiling a module. 
 diag::kind DiagID = RequestingModule->getTopLevelModule()->IsFramework ?
 diag::warn_non_modular_include_in_framework_module :
 diag::warn_non_modular_include_in_module;

Added: cfe/trunk/test/VFS/Inputs/Nonmodular/A.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/VFS/Inputs/Nonmodular/A.h?rev=279838&view=auto
==
--- cfe/trunk/test/VFS/Inputs/Nonmodular/A.h (added)
+++ cfe/trunk/test/VFS/Inputs/Nonmodular/A.h Fri Aug 26 12:16:46 2016
@@ -0,0 +1 @@
+// A.h

Added: cfe/trunk/test/VFS/Inputs/Nonmodular/Nonmodular.modulemap
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/VFS/Inputs/Nonmodular/Nonmodular.modulemap?rev=279838&view=auto
==
--- cfe/trunk/test/VFS/Inputs/Nonmodular/Nonmodular.modulemap (added)
+++ cfe/trunk/test/VFS/Inputs/Nonmodular/Nonmodular.modulemap Fri Aug 26 
12:16:46 2016
@@ -0,0 +1,5 @@
+framework module Nonmodular [extern_c] {
+  umbrella header "umbrella.h"
+  export *
+  module * { export * }
+}

Added: cfe/trunk/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml?rev=279838&view=auto
==
--- cfe/trunk/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml (added)
+++ cfe/trunk/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml Fri Aug 26 
12:16:46 2016
@@ -0,0 +1,34 @@
+{
+  'version': 0,
+  'case-sensitive': 'false',
+  'ignore-non-existent-contents': 'true',
+  'roots': [
+{
+  'type': 'directory',
+  'name': "VDIR/Nonmodular.framework/Headers",
+  'contents': [
+{
+  'type': 'file',
+  'name': "umbrella.h",
+  'external-contents': "IN_DIR/Inputs/Nonmodular/umbrella.h"
+},
+{
+  'type': 'file',
+  'name': "A.h",
+  'external-contents': "IN_DIR/Inputs/Nonmodular/A.h"
+}
+  ]
+},
+{
+  'type': 'directory',
+  'name': "VDIR/Nonmodular.framework/Modules",
+  'contents': [
+{
+  'type': 'file',
+  'name': "module.modulemap",
+  'external-contents': "OUT_DIR/module.modulemap"
+}
+  ]
+}
+  ]
+}

Added: cfe/trunk/test/VFS/Inputs/Nonmodular/test.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/VFS/Inputs/Nonmodular/test.c?rev=279838&view=auto
==
--- cfe/trunk/test/VFS/Inputs/Nonmodular/test.c (added)
+++ cfe/trunk/test/VFS/Inputs/Nonmodular/test.c Fri Aug 26 12:16:46 2016
@@ -0,0 +1,3 @@
+// expected-no-diagnostics
+
+#include "umbrella.h"

Added: cfe/trunk/test/VFS/Inputs/Nonmodular/umbrella.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/VFS/Inputs/Nonmodular/umbrella.h?rev=279838&view=auto
==
--- cfe/trunk/test/VFS/Inputs/Nonmodular/umbrella.h (added)
+++ cfe/trunk/test/VFS/Inputs/Nonmodular/umbrell

Re: [PATCH] D23918: [clang-tidy docs] Add missing option docs.

2016-08-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment.

General comments:

- I think //default is XYZ// is better then //XYZ by default//.

- There are discrepancies: option represent//ing// and option represent//s//.

I think will be good idea to involve native English speaker in review.



Comment at: docs/clang-tidy/checks/google-readability-namespace-comments.rst:11
@@ +10,3 @@
+
+Options
+---

This documentation is redirect, so options description should be moved to 
llvm-namespace-comment.rst.


Comment at: docs/clang-tidy/checks/google-readability-namespace-comments.rst:14
@@ +13,3 @@
+
+.. option:: ShortNamespaceLines;
+

Unnecessary semicolon at the end. Same below.


Comment at: docs/clang-tidy/checks/google-runtime-int.rst:27
@@ +26,2 @@
+
+   A string represents type suffix. `` by default.

Will empty string displayed? May be it should be expressed in words?


Comment at: docs/clang-tidy/checks/misc-move-constructor-init.rst:22
@@ +21,3 @@
+   by default.
+
+

Unnecessary empty line.


Comment at: docs/clang-tidy/checks/misc-move-constructor-init.rst:26
@@ +25,3 @@
+
+   When non-zero, the checker is also used to implement cert-oop11-cpp. `0` by
+   default.

s/checker/check/.  I think will be good idea to provide link to 
cert-oop11-cpp.rst.


Comment at: docs/clang-tidy/checks/misc-suspicious-missing-comma.rst:49
@@ +48,3 @@
+   An unsigned integer represents minimal size of a string literals array to be
+   considered by the checker. `5U` by default.
+

s/checker/check/


Comment at: docs/clang-tidy/checks/misc-suspicious-string-compare.rst:55
@@ +54,3 @@
+
+   A string represents the name of detecting string compare function. `` by
+   default.

Will empty string displayed? May be it should be expressed in words?


Comment at: docs/clang-tidy/checks/modernize-replace-auto-ptr.rst:73
@@ -72,1 +72,3 @@
 
+
+Options

Unnecessary empty string.


Comment at: docs/clang-tidy/checks/modernize-replace-auto-ptr.rst:79
@@ +78,3 @@
+
+   A string specifying which include-style is used, `llvm` or `google`.
+   `llvm` by default.

`llvm` should be on this line. See other similar descriptions.


Comment at: 
docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst:57
@@ +56,2 @@
+   When zero, the check will only check the string usage in ``while``, ``for``
+   and ``for-range`` statements. 0 by default.

Please highlight 0 with `.


Comment at: docs/clang-tidy/checks/readability-implicit-bool-cast.rst:106
@@ +105,3 @@
+
+   When non-zero, the check will allow conditional integer casts.
+   `0` by default.

Looks like `0` by should fit 80 characters. Same below.


https://reviews.llvm.org/D23918



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


[clang-tools-extra] r279846 - [Clang-tidy] Fix some checks documentation style.

2016-08-26 Thread Eugene Zelenko via cfe-commits
Author: eugenezelenko
Date: Fri Aug 26 12:46:51 2016
New Revision: 279846

URL: http://llvm.org/viewvc/llvm-project?rev=279846&view=rev
Log:
[Clang-tidy] Fix some checks documentation style.

Differential revision: https://reviews.llvm.org/D23894

Modified:
clang-tools-extra/trunk/docs/clang-tidy/checks/cert-err34-c.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-slicing.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-using-namespace.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/google-runtime-member-string-references.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-bool-pointer-implicit-conversion.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-fold-init-type.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-forward-declaration-namespace.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-const.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-move-const-arg.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-multiple-statement-macro.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-pointer-and-integral-operation.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-redundant-expression.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-sizeof-container.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-sizeof-expression.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-integer-assignment.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-literal-with-embedded-nul.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-string-compare.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-uniqueptr-reset-release.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-raii.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-using-decls.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-avoid-bind.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-using.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/performance-implicit-cast-in-loop.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/readability-avoid-const-params-in-decls.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/readability-deleted-default.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/readability-implicit-bool-cast.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/readability-inconsistent-declaration-parameter-name.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/readability-redundant-string-init.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/readability-static-definition-in-anonymous-namespace.rst

Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/cert-err34-c.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cert-err34-c.rst?rev=279846&r1=279845&r2=279846&view=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cert-err34-c.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cert-err34-c.rst Fri Aug 26 
12:46:51 2016
@@ -8,7 +8,7 @@ verify the validity of the conversion, s
 does not flag calls to ``strtol()``, or other, related conversion functions 
that
 do perform better error checking.
 
-.. code:: c
+.. code-block:: c
 
   #include 
   

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-slicing.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-slicing.rst?rev=279846&r1=279845&r2=279846&view=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-slicing.rst 
(original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-slicing.rst 
Fri Aug 26 12:46:51 2016
@@ -5,19 +5,21 @@ cppcoreguidelines-slicing
 
 Flags slicing of member variables or vtable. Slicing happens when copying a
 derived object into a base object: the members of the derived object (both
-member variables and virtual member functions) will be discarded.
-This can be misleading especially for member function slicing, for example:
+member variables and virtual member functions) will be discarded. This can be
+misleading especially for member function slicing, for example:
 
-.. code:: c++
+.. code-block:: c++
 
-struct B { int a; virtual int f(); };
-struct D : B { int b; int f() override; };
-void use(B b) {  // Missing reference, intended ?
-  b.f();  // Calls B::f.
-}
-D d;
-use(d);  // Slice.
+  struct B { int a; virtual int f(); };
+  struct D : B { int b; int f() override; };
 
-See the relevant CppCoreGuidelines sections for details:
+  void use(B b

Re: [PATCH] D23279: clang-reorder-fields

2016-08-26 Thread Alexander Shaposhnikov via cfe-commits
alexshap added inline comments.


Comment at: clang-reorder-fields/ReorderFieldsAction.cpp:165
@@ +164,3 @@
+return;
+  assert(InitListEx->getNumInits() == NewFieldsOrder.size() &&
+ "Currently only full initialization is supported");

djasper wrote:
> Same here, an assert is insufficient.
here and above - you are right - i had FIXMEs in the previous versions 
regarding error-handling.
I am aware of these issues, but wanted to postpone fixing them.
Anyway - i agree with you - will update this diff today.


Repository:
  rL LLVM

https://reviews.llvm.org/D23279



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


Re: [PATCH] D23853: Assert in performTrivialCopy - Bug report and a possible solution

2016-08-26 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

In https://reviews.llvm.org/D23853#524945, @xazax.hun wrote:

> > Also: I think r270511 is unlikely to be the change that caused this -- that 
> > is a change in LLVM's treatment of DebugInfo, which shouldn't affect the 
> > analyzer.
>
>
> I think Peter means that, that revision introduced the code that the analyzer 
> fails to analyze (and not the bug in the analyzer).


Can you add a reduced test case?


https://reviews.llvm.org/D23853



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


[PATCH] D23938: clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.

2016-08-26 Thread Nico Weber via cfe-commits
thakis created this revision.
thakis added a reviewer: hans.
thakis added a subscriber: cfe-commits.

Like https://reviews.llvm.org/D23807, but for execution-charset.

https://reviews.llvm.org/D23938

Files:
  include/clang/Driver/CLCompatOptions.td
  lib/Driver/Tools.cpp
  test/Driver/cl-options.c

Index: test/Driver/cl-options.c
===
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -184,6 +184,10 @@
 // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck 
-check-prefix=source-charset-utf-16 %s
 // source-charset-utf-16: invalid value 'utf-16'
 
+// /execution-charset: should warn on everything except UTF-8.
+// RUN: %clang_cl /execution-charset:utf-16 -### -- %s 2>&1 | FileCheck 
-check-prefix=execution-charset-utf-16 %s
+// execution-charset-utf-16: invalid value 'utf-16'
+//
 // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
 // U: "-U" "mymacro"
@@ -289,6 +293,7 @@
 // RUN:/d2FastFail \
 // RUN:/d2Zi+ \
 // RUN:/errorReport:foo \
+// RUN:/execution-charset:utf-8 \
 // RUN:/FC \
 // RUN:/Fdfoo \
 // RUN:/FS \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5843,7 +5843,7 @@
   // -fexec_charset=UTF-8 is default. Reject others
   if (Arg *execCharset = Args.getLastArg(options::OPT_fexec_charset_EQ)) {
 StringRef value = execCharset->getValue();
-if (value != "UTF-8")
+if (value.lower() != "UTF-8")
   D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args)
   << value;
   }
Index: include/clang/Driver/CLCompatOptions.td
===
--- include/clang/Driver/CLCompatOptions.td
+++ include/clang/Driver/CLCompatOptions.td
@@ -122,6 +122,8 @@
   Alias;
 def _SLASH_source_charset : CLCompileJoined<"source-charset:">,
   HelpText<"Source encoding, supports only UTF-8">, Alias;
+def _SLASH_execution_charset : CLCompileJoined<"execution-charset:">,
+  HelpText<"Runtime encoding, supports only UTF-8">, Alias;
 def _SLASH_std : CLCompileJoined<"std:">,
   HelpText<"Language standard to compile for">;
 def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,


Index: test/Driver/cl-options.c
===
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -184,6 +184,10 @@
 // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=source-charset-utf-16 %s
 // source-charset-utf-16: invalid value 'utf-16'
 
+// /execution-charset: should warn on everything except UTF-8.
+// RUN: %clang_cl /execution-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=execution-charset-utf-16 %s
+// execution-charset-utf-16: invalid value 'utf-16'
+//
 // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
 // U: "-U" "mymacro"
@@ -289,6 +293,7 @@
 // RUN:/d2FastFail \
 // RUN:/d2Zi+ \
 // RUN:/errorReport:foo \
+// RUN:/execution-charset:utf-8 \
 // RUN:/FC \
 // RUN:/Fdfoo \
 // RUN:/FS \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5843,7 +5843,7 @@
   // -fexec_charset=UTF-8 is default. Reject others
   if (Arg *execCharset = Args.getLastArg(options::OPT_fexec_charset_EQ)) {
 StringRef value = execCharset->getValue();
-if (value != "UTF-8")
+if (value.lower() != "UTF-8")
   D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args)
   << value;
   }
Index: include/clang/Driver/CLCompatOptions.td
===
--- include/clang/Driver/CLCompatOptions.td
+++ include/clang/Driver/CLCompatOptions.td
@@ -122,6 +122,8 @@
   Alias;
 def _SLASH_source_charset : CLCompileJoined<"source-charset:">,
   HelpText<"Source encoding, supports only UTF-8">, Alias;
+def _SLASH_execution_charset : CLCompileJoined<"execution-charset:">,
+  HelpText<"Runtime encoding, supports only UTF-8">, Alias;
 def _SLASH_std : CLCompileJoined<"std:">,
   HelpText<"Language standard to compile for">;
 def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23932: [XRay] ARM 32-bit no-Thumb support in Clang

2016-08-26 Thread Renato Golin via cfe-commits
rengolin accepted this revision.
rengolin added a comment.
This revision is now accepted and ready to land.

If this works without the other two patches, it's reasonably unrelated and 
harmless, and should be ok as soon as the other two patches are approved.

Not because it's wrong, just because we don't want to advertise features in 
Clang that yet don't exist in LLVM. :)


https://reviews.llvm.org/D23932



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


Re: [PATCH] D23938: clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.

2016-08-26 Thread David Majnemer via cfe-commits
On Friday, August 26, 2016, Nico Weber via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> thakis created this revision.
> thakis added a reviewer: hans.
> thakis added a subscriber: cfe-commits.
>
> Like https://reviews.llvm.org/D23807, but for execution-charset.
>
> https://reviews.llvm.org/D23938
>
> Files:
>   include/clang/Driver/CLCompatOptions.td
>   lib/Driver/Tools.cpp
>   test/Driver/cl-options.c
>
> Index: test/Driver/cl-options.c
> ===
> --- test/Driver/cl-options.c
> +++ test/Driver/cl-options.c
> @@ -184,6 +184,10 @@
>  // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck
> -check-prefix=source-charset-utf-16 %s
>  // source-charset-utf-16: invalid value 'utf-16'
>
> +// /execution-charset: should warn on everything except UTF-8.
> +// RUN: %clang_cl /execution-charset:utf-16 -### -- %s 2>&1 | FileCheck
> -check-prefix=execution-charset-utf-16 %s
> +// execution-charset-utf-16: invalid value 'utf-16'
> +//
>  // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
>  // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U
> %s
>  // U: "-U" "mymacro"
> @@ -289,6 +293,7 @@
>  // RUN:/d2FastFail \
>  // RUN:/d2Zi+ \
>  // RUN:/errorReport:foo \
> +// RUN:/execution-charset:utf-8 \
>  // RUN:/FC \
>  // RUN:/Fdfoo \
>  // RUN:/FS \
> Index: lib/Driver/Tools.cpp
> ===
> --- lib/Driver/Tools.cpp
> +++ lib/Driver/Tools.cpp
> @@ -5843,7 +5843,7 @@
>// -fexec_charset=UTF-8 is default. Reject others
>if (Arg *execCharset = Args.getLastArg(options::OPT_fexec_charset_EQ))
> {
>  StringRef value = execCharset->getValue();
> -if (value != "UTF-8")
> +if (value.lower() != "UTF-8")


Should that be "utf-8" instead?


>D.Diag(diag::err_drv_invalid_value) <<
> execCharset->getAsString(Args)
><< value;
>}
> Index: include/clang/Driver/CLCompatOptions.td
> ===
> --- include/clang/Driver/CLCompatOptions.td
> +++ include/clang/Driver/CLCompatOptions.td
> @@ -122,6 +122,8 @@
>Alias;
>  def _SLASH_source_charset : CLCompileJoined<"source-charset:">,
>HelpText<"Source encoding, supports only UTF-8">,
> Alias;
> +def _SLASH_execution_charset : CLCompileJoined<"execution-charset:">,
> +  HelpText<"Runtime encoding, supports only UTF-8">,
> Alias;
>  def _SLASH_std : CLCompileJoined<"std:">,
>HelpText<"Language standard to compile for">;
>  def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23938: clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.

2016-08-26 Thread Nico Weber via cfe-commits
thakis updated this revision to Diff 69415.
thakis added a comment.

;-;


https://reviews.llvm.org/D23938

Files:
  include/clang/Driver/CLCompatOptions.td
  lib/Driver/Tools.cpp
  test/Driver/cl-options.c

Index: test/Driver/cl-options.c
===
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -184,6 +184,10 @@
 // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck 
-check-prefix=source-charset-utf-16 %s
 // source-charset-utf-16: invalid value 'utf-16'
 
+// /execution-charset: should warn on everything except UTF-8.
+// RUN: %clang_cl /execution-charset:utf-16 -### -- %s 2>&1 | FileCheck 
-check-prefix=execution-charset-utf-16 %s
+// execution-charset-utf-16: invalid value 'utf-16'
+//
 // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
 // U: "-U" "mymacro"
@@ -289,6 +293,7 @@
 // RUN:/d2FastFail \
 // RUN:/d2Zi+ \
 // RUN:/errorReport:foo \
+// RUN:/execution-charset:utf-8 \
 // RUN:/FC \
 // RUN:/Fdfoo \
 // RUN:/FS \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5843,7 +5843,7 @@
   // -fexec_charset=UTF-8 is default. Reject others
   if (Arg *execCharset = Args.getLastArg(options::OPT_fexec_charset_EQ)) {
 StringRef value = execCharset->getValue();
-if (value != "UTF-8")
+if (value.lower != "utf-8")
   D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args)
   << value;
   }
Index: include/clang/Driver/CLCompatOptions.td
===
--- include/clang/Driver/CLCompatOptions.td
+++ include/clang/Driver/CLCompatOptions.td
@@ -122,6 +122,8 @@
   Alias;
 def _SLASH_source_charset : CLCompileJoined<"source-charset:">,
   HelpText<"Source encoding, supports only UTF-8">, Alias;
+def _SLASH_execution_charset : CLCompileJoined<"execution-charset:">,
+  HelpText<"Runtime encoding, supports only UTF-8">, Alias;
 def _SLASH_std : CLCompileJoined<"std:">,
   HelpText<"Language standard to compile for">;
 def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,


Index: test/Driver/cl-options.c
===
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -184,6 +184,10 @@
 // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=source-charset-utf-16 %s
 // source-charset-utf-16: invalid value 'utf-16'
 
+// /execution-charset: should warn on everything except UTF-8.
+// RUN: %clang_cl /execution-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=execution-charset-utf-16 %s
+// execution-charset-utf-16: invalid value 'utf-16'
+//
 // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
 // U: "-U" "mymacro"
@@ -289,6 +293,7 @@
 // RUN:/d2FastFail \
 // RUN:/d2Zi+ \
 // RUN:/errorReport:foo \
+// RUN:/execution-charset:utf-8 \
 // RUN:/FC \
 // RUN:/Fdfoo \
 // RUN:/FS \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5843,7 +5843,7 @@
   // -fexec_charset=UTF-8 is default. Reject others
   if (Arg *execCharset = Args.getLastArg(options::OPT_fexec_charset_EQ)) {
 StringRef value = execCharset->getValue();
-if (value != "UTF-8")
+if (value.lower != "utf-8")
   D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args)
   << value;
   }
Index: include/clang/Driver/CLCompatOptions.td
===
--- include/clang/Driver/CLCompatOptions.td
+++ include/clang/Driver/CLCompatOptions.td
@@ -122,6 +122,8 @@
   Alias;
 def _SLASH_source_charset : CLCompileJoined<"source-charset:">,
   HelpText<"Source encoding, supports only UTF-8">, Alias;
+def _SLASH_execution_charset : CLCompileJoined<"execution-charset:">,
+  HelpText<"Runtime encoding, supports only UTF-8">, Alias;
 def _SLASH_std : CLCompileJoined<"std:">,
   HelpText<"Language standard to compile for">;
 def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23938: clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.

2016-08-26 Thread Nico Weber via cfe-commits
thakis updated this revision to Diff 69416.
thakis added a comment.

!!


https://reviews.llvm.org/D23938

Files:
  include/clang/Driver/CLCompatOptions.td
  lib/Driver/Tools.cpp
  test/Driver/cl-options.c

Index: test/Driver/cl-options.c
===
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -184,6 +184,10 @@
 // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck 
-check-prefix=source-charset-utf-16 %s
 // source-charset-utf-16: invalid value 'utf-16'
 
+// /execution-charset: should warn on everything except UTF-8.
+// RUN: %clang_cl /execution-charset:utf-16 -### -- %s 2>&1 | FileCheck 
-check-prefix=execution-charset-utf-16 %s
+// execution-charset-utf-16: invalid value 'utf-16'
+//
 // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
 // U: "-U" "mymacro"
@@ -289,6 +293,7 @@
 // RUN:/d2FastFail \
 // RUN:/d2Zi+ \
 // RUN:/errorReport:foo \
+// RUN:/execution-charset:utf-8 \
 // RUN:/FC \
 // RUN:/Fdfoo \
 // RUN:/FS \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5843,7 +5843,7 @@
   // -fexec_charset=UTF-8 is default. Reject others
   if (Arg *execCharset = Args.getLastArg(options::OPT_fexec_charset_EQ)) {
 StringRef value = execCharset->getValue();
-if (value != "UTF-8")
+if (value.lower() != "utf-8")
   D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args)
   << value;
   }
Index: include/clang/Driver/CLCompatOptions.td
===
--- include/clang/Driver/CLCompatOptions.td
+++ include/clang/Driver/CLCompatOptions.td
@@ -122,6 +122,8 @@
   Alias;
 def _SLASH_source_charset : CLCompileJoined<"source-charset:">,
   HelpText<"Source encoding, supports only UTF-8">, Alias;
+def _SLASH_execution_charset : CLCompileJoined<"execution-charset:">,
+  HelpText<"Runtime encoding, supports only UTF-8">, Alias;
 def _SLASH_std : CLCompileJoined<"std:">,
   HelpText<"Language standard to compile for">;
 def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,


Index: test/Driver/cl-options.c
===
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -184,6 +184,10 @@
 // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=source-charset-utf-16 %s
 // source-charset-utf-16: invalid value 'utf-16'
 
+// /execution-charset: should warn on everything except UTF-8.
+// RUN: %clang_cl /execution-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=execution-charset-utf-16 %s
+// execution-charset-utf-16: invalid value 'utf-16'
+//
 // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
 // U: "-U" "mymacro"
@@ -289,6 +293,7 @@
 // RUN:/d2FastFail \
 // RUN:/d2Zi+ \
 // RUN:/errorReport:foo \
+// RUN:/execution-charset:utf-8 \
 // RUN:/FC \
 // RUN:/Fdfoo \
 // RUN:/FS \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5843,7 +5843,7 @@
   // -fexec_charset=UTF-8 is default. Reject others
   if (Arg *execCharset = Args.getLastArg(options::OPT_fexec_charset_EQ)) {
 StringRef value = execCharset->getValue();
-if (value != "UTF-8")
+if (value.lower() != "utf-8")
   D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args)
   << value;
   }
Index: include/clang/Driver/CLCompatOptions.td
===
--- include/clang/Driver/CLCompatOptions.td
+++ include/clang/Driver/CLCompatOptions.td
@@ -122,6 +122,8 @@
   Alias;
 def _SLASH_source_charset : CLCompileJoined<"source-charset:">,
   HelpText<"Source encoding, supports only UTF-8">, Alias;
+def _SLASH_execution_charset : CLCompileJoined<"execution-charset:">,
+  HelpText<"Runtime encoding, supports only UTF-8">, Alias;
 def _SLASH_std : CLCompileJoined<"std:">,
   HelpText<"Language standard to compile for">;
 def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23858: Don't diagnose non-modular includes when we are not compiling a module

2016-08-26 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279838: Don't diagnose non-modular includes when we are not 
compiling a module. (authored by mren).

Changed prior to commit:
  https://reviews.llvm.org/D23858?vs=69183&id=69397#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23858

Files:
  cfe/trunk/lib/Lex/ModuleMap.cpp
  cfe/trunk/test/VFS/Inputs/Nonmodular/A.h
  cfe/trunk/test/VFS/Inputs/Nonmodular/Nonmodular.modulemap
  cfe/trunk/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml
  cfe/trunk/test/VFS/Inputs/Nonmodular/test.c
  cfe/trunk/test/VFS/Inputs/Nonmodular/umbrella.h
  cfe/trunk/test/VFS/test_nonmodular.c

Index: cfe/trunk/lib/Lex/ModuleMap.cpp
===
--- cfe/trunk/lib/Lex/ModuleMap.cpp
+++ cfe/trunk/lib/Lex/ModuleMap.cpp
@@ -297,7 +297,9 @@
   if (LangOpts.ModulesStrictDeclUse) {
 Diags.Report(FilenameLoc, diag::err_undeclared_use_of_module)
 << RequestingModule->getFullModuleName() << Filename;
-  } else if (RequestingModule && RequestingModuleIsModuleInterface) {
+  } else if (RequestingModule && RequestingModuleIsModuleInterface &&
+ LangOpts.isCompilingModule()) {
+// Do not diagnose when we are not compiling a module. 
 diag::kind DiagID = RequestingModule->getTopLevelModule()->IsFramework ?
 diag::warn_non_modular_include_in_framework_module :
 diag::warn_non_modular_include_in_module;
Index: cfe/trunk/test/VFS/Inputs/Nonmodular/umbrella.h
===
--- cfe/trunk/test/VFS/Inputs/Nonmodular/umbrella.h
+++ cfe/trunk/test/VFS/Inputs/Nonmodular/umbrella.h
@@ -0,0 +1,5 @@
+#ifndef __umbrella_h__
+#define __umbrella_h__
+
+#include 
+#endif
Index: cfe/trunk/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml
===
--- cfe/trunk/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml
+++ cfe/trunk/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml
@@ -0,0 +1,34 @@
+{
+  'version': 0,
+  'case-sensitive': 'false',
+  'ignore-non-existent-contents': 'true',
+  'roots': [
+{
+  'type': 'directory',
+  'name': "VDIR/Nonmodular.framework/Headers",
+  'contents': [
+{
+  'type': 'file',
+  'name': "umbrella.h",
+  'external-contents': "IN_DIR/Inputs/Nonmodular/umbrella.h"
+},
+{
+  'type': 'file',
+  'name': "A.h",
+  'external-contents': "IN_DIR/Inputs/Nonmodular/A.h"
+}
+  ]
+},
+{
+  'type': 'directory',
+  'name': "VDIR/Nonmodular.framework/Modules",
+  'contents': [
+{
+  'type': 'file',
+  'name': "module.modulemap",
+  'external-contents': "OUT_DIR/module.modulemap"
+}
+  ]
+}
+  ]
+}
Index: cfe/trunk/test/VFS/Inputs/Nonmodular/A.h
===
--- cfe/trunk/test/VFS/Inputs/Nonmodular/A.h
+++ cfe/trunk/test/VFS/Inputs/Nonmodular/A.h
@@ -0,0 +1 @@
+// A.h
Index: cfe/trunk/test/VFS/Inputs/Nonmodular/test.c
===
--- cfe/trunk/test/VFS/Inputs/Nonmodular/test.c
+++ cfe/trunk/test/VFS/Inputs/Nonmodular/test.c
@@ -0,0 +1,3 @@
+// expected-no-diagnostics
+
+#include "umbrella.h"
Index: cfe/trunk/test/VFS/Inputs/Nonmodular/Nonmodular.modulemap
===
--- cfe/trunk/test/VFS/Inputs/Nonmodular/Nonmodular.modulemap
+++ cfe/trunk/test/VFS/Inputs/Nonmodular/Nonmodular.modulemap
@@ -0,0 +1,5 @@
+framework module Nonmodular [extern_c] {
+  umbrella header "umbrella.h"
+  export *
+  module * { export * }
+}
Index: cfe/trunk/test/VFS/test_nonmodular.c
===
--- cfe/trunk/test/VFS/test_nonmodular.c
+++ cfe/trunk/test/VFS/test_nonmodular.c
@@ -0,0 +1,11 @@
+// REQUIRES: shell
+
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/vdir %t/cache %t/outdir
+// We can't have module.map inside Inputs/Nonmodular.
+// RUN: cp %S/Inputs/Nonmodular/Nonmodular.modulemap %t/outdir/module.modulemap
+//
+// RUN: sed -e "s:VDIR:%t/vdir:g" -e "s:IN_DIR:%S:g" -e "s:OUT_DIR:%t/outdir:g" %S/Inputs/Nonmodular/nonmodular-headers.yaml > %t/vdir/nonmodular-headers.yaml
+// RUN: %clang_cc1 -fmodule-name=Nonmodular -fmodules -Wnon-modular-include-in-framework-module -verify -fimplicit-module-maps -fmodules-cache-path=%t/cache -ivfsoverlay %t/vdir/nonmodular-headers.yaml -I %S/Inputs -F %t/vdir -fsyntax-only %S/Inputs/Nonmodular/test.c
+
+// expected-no-diagnostics
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23820: Do not warn about format strings that are indexed string literals.

2016-08-26 Thread Meike Baumgärtner via cfe-commits
meikeb added inline comments.


Comment at: lib/Sema/SemaChecking.cpp:4089-4090
@@ +4088,4 @@
+if (BinOp->isAdditiveOp()) {
+  bool LIsInt = BinOp->getLHS()->EvaluateAsInt(LResult, S.Context);
+  bool RIsInt = BinOp->getRHS()->EvaluateAsInt(RResult, S.Context);
+

rsmith wrote:
> What happens if one of these expressions is value-dependent? The evaluator 
> can crash or assert if given a value-dependent expression. If we don't defer 
> these checks in dependent contexts, you'll need to handle that possibility 
> somehow.
> 
> Example:
> 
>   template void f(const char *p) {
> printf("blah blah %s" + N, p);
>   }
I think I don't understand what you are trying to tell me. Especially the 
example you provided does just fine and behaves as I expected. As far as I 
followed EvaluateAsInt it does not assert but returns false if we don't get a 
constexpr here. We warn under -Wformat-nonliteral for value-dependent string 
literals.

Could you explain this more or provide an example that triggers an assert or 
explain what behavior is wrong regarding the provided example? Thanks! 


https://reviews.llvm.org/D23820



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


Re: [PATCH] D23894: [Clang-tidy] Fix some checks documentation style

2016-08-26 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279846: [Clang-tidy] Fix some checks documentation style. 
(authored by eugenezelenko).

Changed prior to commit:
  https://reviews.llvm.org/D23894?vs=69301&id=69404#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23894

Files:
  clang-tools-extra/trunk/docs/clang-tidy/checks/cert-err34-c.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-slicing.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-using-namespace.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/google-runtime-member-string-references.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-bool-pointer-implicit-conversion.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/misc-fold-init-type.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-forward-declaration-namespace.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-const.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/misc-move-const-arg.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-multiple-statement-macro.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-pointer-and-integral-operation.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/misc-redundant-expression.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/misc-sizeof-container.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/misc-sizeof-expression.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-integer-assignment.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-literal-with-embedded-nul.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-string-compare.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-uniqueptr-reset-release.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-raii.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-using-decls.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-avoid-bind.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-using.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/performance-implicit-cast-in-loop.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/readability-avoid-const-params-in-decls.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/readability-deleted-default.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/readability-implicit-bool-cast.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/readability-inconsistent-declaration-parameter-name.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/readability-redundant-string-init.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/readability-static-definition-in-anonymous-namespace.rst

Index: clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-integer-assignment.rst
===
--- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-integer-assignment.rst
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-integer-assignment.rst
@@ -7,31 +7,31 @@
 (``std::string``, ``std::wstring``, etc.). The source of the problem is the
 following assignment operator of ``std::basic_string``:
 
-.. code:: c++
+.. code-block:: c++
 
   basic_string& operator=( CharT ch );
 
 Numeric types can be implicitly casted to character types.
 
-.. code:: c++
+.. code-block:: c++
 
   std::string s;
   int x = 5965;
   s = 6;
   s = x;
 
 Use the appropriate conversion functions or character literals.
 
-.. code:: c++
+.. code-block:: c++
 
   std::string s;
   int x = 5965;
   s = '6';
   s = std::to_string(x);
 
 In order to suppress false positives, use an explicit cast.
 
-.. code:: c++
+.. code-block:: c++
 
   std::string s;
   s = static_cast(6);
Index: clang-tools-extra/trunk/docs/clang-tidy/checks/readability-avoid-const-params-in-decls.rst
===
--- clang-tools-extra/trunk/docs/clang-tidy/checks/readability-avoid-const-params-in-decls.rst
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/readability-avoid-const-params-in-decls.rst
@@ -3,15 +3,15 @@
 readability-avoid-const-params-in-decls
 ===
 
-Checks whether a function declaration has parameters that are top level const.
+Checks whether a function declaration has parameters that are top level
+``const``.
 
-`const` values in declarations do not affect the signature of a function, so
-they should not be put there.  For example:
+``const`` values in declarations do not affect the signature of a function, so
+they should not be put there.
 
 Examples:
 
-.. code:: c++
+.. code-block:: c++
 
   void f(const string);   // Bad: const is top level.
   void f(const string&);  // Good: const is not top level.
-
Index: clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-slicing.rst
==

Re: [PATCH] D23856: [libc++] Perform configuration checks with -nodefaultlibs

2016-08-26 Thread Shoaib Meenai via cfe-commits
smeenai added inline comments.


Comment at: cmake/config-ix.cmake:18
@@ +17,3 @@
+if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
+  list(APPEND CMAKE_REQUIRED_LIBRARIES -nodefaultlibs)
+  if (LIBCXX_HAS_C_LIB)

compnerd wrote:
> Can we not use `CMAKE_SHARED_LINKER_FLAGS` instead of 
> `CMAKE_REQUIRED_LIBRARIES`?  It is slightly misleading.
That would pollute everything building a shared library, whereas this limits it 
to only configuration checks. I know it's misleading, but I view it similar to 
how `target_link_libraries` is also used for specifying linker flags.

Speaking of pollution though, my `REQUIRED_*` changes in this file will end up 
affecting other projects for non-standalone builds, correct? What's the best 
way to limit this to be libc++-only?


https://reviews.llvm.org/D23856



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


Re: [PATCH] D23895: [ms] Add support for parsing uuid as a MS attribute

2016-08-26 Thread Nico Weber via cfe-commits
thakis updated this revision to Diff 69419.
thakis added a comment.

Aaron's right that these are currently called "Microsoft" in the source. I 
agree that that's a confusing name and we should probably rename it, but on 
second thought that seems unrelated to this change. If y'all agree on a name, I 
can do the renaming in a separate change. I changed the patch to use 
"Microsoft" until then. I also realized that this was missing a tablegen 
change; now included.


https://reviews.llvm.org/D23895

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/Attributes.h
  include/clang/Parse/Parser.h
  include/clang/Sema/AttributeList.h
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseDeclCXX.cpp
  lib/Parse/ParseObjc.cpp
  lib/Parse/ParseOpenMP.cpp
  lib/Parse/Parser.cpp
  test/Parser/MicrosoftExtensions.cpp
  test/Sema/MicrosoftExtensions.c
  utils/TableGen/ClangAttrEmitter.cpp

Index: utils/TableGen/ClangAttrEmitter.cpp
===
--- utils/TableGen/ClangAttrEmitter.cpp
+++ utils/TableGen/ClangAttrEmitter.cpp
@@ -1312,6 +1312,9 @@
 } else if (Variety == "Declspec") {
   Prefix = " __declspec(";
   Suffix = ")";
+} else if (Variety == "Microsoft") {
+  Prefix = "[";
+  Suffix = "]";
 } else if (Variety == "Keyword") {
   Prefix = " ";
   Suffix = "";
@@ -2295,7 +2298,7 @@
   // Separate all of the attributes out into four group: generic, C++11, GNU,
   // and declspecs. Then generate a big switch statement for each of them.
   std::vector Attrs = Records.getAllDerivedDefinitions("Attr");
-  std::vector Declspec, GNU, Pragma;
+  std::vector Declspec, Microsoft, GNU, Pragma;
   std::map> CXX;
 
   // Walk over the list of all attributes, and split them out based on the
@@ -2308,6 +2311,8 @@
 GNU.push_back(R);
   else if (Variety == "Declspec")
 Declspec.push_back(R);
+  else if (Variety == "Microsoft")
+Microsoft.push_back(R);
   else if (Variety == "CXX11")
 CXX[SI.nameSpace()].push_back(R);
   else if (Variety == "Pragma")
@@ -2323,6 +2328,9 @@
   OS << "case AttrSyntax::Declspec:\n";
   OS << "  return llvm::StringSwitch(Name)\n";
   GenerateHasAttrSpellingStringSwitch(Declspec, OS, "Declspec");
+  OS << "case AttrSyntax::Microsoft:\n";
+  OS << "  return llvm::StringSwitch(Name)\n";
+  GenerateHasAttrSpellingStringSwitch(Microsoft, OS, "Microsoft");
   OS << "case AttrSyntax::Pragma:\n";
   OS << "  return llvm::StringSwitch(Name)\n";
   GenerateHasAttrSpellingStringSwitch(Pragma, OS, "Pragma");
@@ -2361,8 +2369,9 @@
 .Case("GNU", 0)
 .Case("CXX11", 1)
 .Case("Declspec", 2)
-.Case("Keyword", 3)
-.Case("Pragma", 4)
+.Case("Microsoft", 3)
+.Case("Keyword", 4)
+.Case("Pragma", 5)
 .Default(0)
  << " && Scope == \"" << Spellings[I].nameSpace() << "\")\n"
  << "return " << I << ";\n";
@@ -2982,7 +2991,8 @@
   emitSourceFileHeader("Attribute name matcher", OS);
 
   std::vector Attrs = Records.getAllDerivedDefinitions("Attr");
-  std::vector GNU, Declspec, CXX11, Keywords, Pragma;
+  std::vector GNU, Declspec, Microsoft, CXX11,
+  Keywords, Pragma;
   std::set Seen;
   for (const auto *A : Attrs) {
 const Record &Attr = *A;
@@ -3024,6 +3034,8 @@
   Matches = &GNU;
 else if (Variety == "Declspec")
   Matches = &Declspec;
+else if (Variety == "Microsoft")
+  Matches = &Microsoft;
 else if (Variety == "Keyword")
   Matches = &Keywords;
 else if (Variety == "Pragma")
@@ -3048,6 +3060,8 @@
   StringMatcher("Name", GNU, OS).Emit();
   OS << "  } else if (AttributeList::AS_Declspec == Syntax) {\n";
   StringMatcher("Name", Declspec, OS).Emit();
+  OS << "  } else if (AttributeList::AS_Microsoft == Syntax) {\n";
+  StringMatcher("Name", Microsoft, OS).Emit();
   OS << "  } else if (AttributeList::AS_CXX11 == Syntax) {\n";
   StringMatcher("Name", CXX11, OS).Emit();
   OS << "  } else if (AttributeList::AS_Keyword == Syntax || ";
@@ -3131,8 +3145,9 @@
   GNU = 1 << 0,
   CXX11 = 1 << 1,
   Declspec = 1 << 2,
-  Keyword = 1 << 3,
-  Pragma = 1 << 4
+  Microsoft = 1 << 3,
+  Keyword = 1 << 4,
+  Pragma = 1 << 5
 };
 
 static void WriteDocumentation(const DocumentationData &Doc,
@@ -3180,6 +3195,7 @@
 .Case("GNU", GNU)
 .Case("CXX11", CXX11)
 .Case("Declspec", Declspec)
+.Case("Microsoft", Microsoft)
 .Case("Keyword", Keyword)
 .Case("Pragma", Pragma);
 
Index: test/Parser/MicrosoftExtensions.cpp
===
--- test/Parser/MicrosoftExtensions.cpp
+++ test/Parser/MicrosoftExtensions.cpp
@@ -49,6 +49,7 @@
 struct __declspec(uuid("

[PATCH] D23934: Add a -ffixed-date-time= flag that sets the initial value of __DATE__, __TIME__, __TIMESTAMP__

2016-08-26 Thread Nico Weber via cfe-commits
thakis created this revision.
thakis added a reviewer: rsmith.
thakis added a subscriber: cfe-commits.

This is useful for creating reproducible builds. Defining these via -D triggers 
warnings, and can cause bugs (presently, e.g. PR29119). It makes it also 
impossible to override __DATE__ and __TIME__ and forget __TIMESTAMP__.

__TIMESTAMP__ has slightly different semantics in that it's the timestamp of 
the current TU, not the time of compilation, but either meaning is bad for 
reproducible builds.

https://reviews.llvm.org/D23934

Files:
  include/clang/Driver/Options.td
  include/clang/Lex/PreprocessorOptions.h
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Lex/PPMacroExpansion.cpp
  test/Preprocessor/fixed-date-time.cc

Index: test/Preprocessor/fixed-date-time.cc
===
--- test/Preprocessor/fixed-date-time.cc
+++ test/Preprocessor/fixed-date-time.cc
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -ffixed-date-time=2008-09-02T14:30:27 -std=c++11 %s -verify
+// RUN: not %clang_cc1 -ffixed-date-time=2008-09-02T14:30:27asdf -std=c++11 %s 2>&1 | FileCheck %s
+// expected-no-diagnostics
+
+// CHECK: error: invalid value '2008-09-02T14:30:27asdf' in '-ffixed-date-time=2008-09-02T14:30:27asdf'
+
+constexpr int constexpr_strcmp(const char *p, const char *q) {
+  return *p != *q ? *p - *q : !*p ? 0 : constexpr_strcmp(p + 1, q + 1);
+}
+
+static_assert(!constexpr_strcmp(__DATE__, "Sep  2 2008"), "");
+static_assert(!constexpr_strcmp(__TIME__, "14:30:27"), "");
+static_assert(!constexpr_strcmp(__TIMESTAMP__, "Tue Sep  2 14:30:27 2008"), "");
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -785,6 +785,9 @@
 def fexec_charset_EQ : Joined<["-"], "fexec-charset=">, Group;
 def finstrument_functions : Flag<["-"], "finstrument-functions">, Group, Flags<[CC1Option]>,
   HelpText<"Generate calls to instrument function entry and exit">;
+def ffixed_date_time_EQ : Joined<["-"], "ffixed-date-time=">, Group,
+  Flags<[CC1Option, CoreOption]>,
+  HelpText<"Set a fixed value for __DATE__, __TIME__, __TIMESTAMP__, formatted as 1969-12-31T23:59:59 (RFC3339 without fractional seconds and timezone)">;
 
 def fxray_instrument : Flag<["-"], "fxray-instrument">, Group,
   Flags<[CC1Option]>,
Index: include/clang/Lex/PreprocessorOptions.h
===
--- include/clang/Lex/PreprocessorOptions.h
+++ include/clang/Lex/PreprocessorOptions.h
@@ -12,11 +12,13 @@
 
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSet.h"
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -138,6 +140,9 @@
   /// build it again.
   IntrusiveRefCntPtr FailedModules;
 
+  /// If set, a fixed time that __DATE__, __TIME__, __TIMESTAMP__ expand to.
+  llvm::Optional FixedDateTime;
+
 public:
   PreprocessorOptions() : UsePredefines(true), DetailedRecord(false),
   DisablePCHValidation(false),
Index: lib/Lex/PPMacroExpansion.cpp
===
--- lib/Lex/PPMacroExpansion.cpp
+++ lib/Lex/PPMacroExpansion.cpp
@@ -21,6 +21,7 @@
 #include "clang/Lex/MacroArgs.h"
 #include "clang/Lex/MacroInfo.h"
 #include "clang/Lex/Preprocessor.h"
+#include "clang/Lex/PreprocessorOptions.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringSwitch.h"
@@ -1012,8 +1013,14 @@
 /// the identifier tokens inserted.
 static void ComputeDATE_TIME(SourceLocation &DATELoc, SourceLocation &TIMELoc,
  Preprocessor &PP) {
-  time_t TT = time(nullptr);
-  struct tm *TM = localtime(&TT);
+  struct tm *TM;
+  PreprocessorOptions &PO = PP.getPreprocessorOpts();
+  if (PO.FixedDateTime.hasValue())
+TM = PO.FixedDateTime.getPointer();
+  else {
+time_t TT = time(nullptr);
+TM = localtime(&TT);
+  }
 
   static const char * const Months[] = {
 "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"
@@ -1644,21 +1651,26 @@
 // MSVC, ICC, GCC, VisualAge C++ extension.  The generated string should be
 // of the form "Ddd Mmm dd hh::mm::ss ", which is returned by asctime.
 
-// Get the file that we are lexing out of.  If we're currently lexing from
-// a macro, dig into the include stack.
-const FileEntry *CurFile = nullptr;
-PreprocessorLexer *TheLexer = getCurrentFileLexer();
-
-if (TheLexer)
-  CurFile = SourceMgr.getFileEntryForID(TheLexer->getFileID());
-
 const char *Result;
-if (CurFile) {
-  time_t TT = CurFile->getModificationTime();
-  struct tm *TM = localtime(&TT);
-  Result = asctime(TM);
+PreprocessorOptions &PO = getPreprocessorOpts();
+if (PO.FixedDateTime

Re: [PATCH] D23938: clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.

2016-08-26 Thread David Majnemer via cfe-commits
majnemer added a subscriber: majnemer.


Comment at: lib/Driver/Tools.cpp:5838-5846
@@ -5837,11 +5837,11 @@
 StringRef value = inputCharset->getValue();
 if (value.lower() != "utf-8")
   D.Diag(diag::err_drv_invalid_value) << inputCharset->getAsString(Args)
   << value;
   }
 
   // -fexec_charset=UTF-8 is default. Reject others
   if (Arg *execCharset = Args.getLastArg(options::OPT_fexec_charset_EQ)) {
 StringRef value = execCharset->getValue();
-if (value != "UTF-8")
+if (value.lower() != "utf-8")
   D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args)

I'd use `compare_lower` because `lower` introduces a `std::string`.


https://reviews.llvm.org/D23938



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


Re: [PATCH] D23279: clang-reorder-fields

2016-08-26 Thread Alexander Shaposhnikov via cfe-commits
alexshap marked 2 inline comments as done.


Comment at: clang-reorder-fields/ReorderFieldsAction.cpp:202
@@ +201,3 @@
+for (const auto *C : RD->ctors()) {
+  if (C->isImplicit() || C->isDelegatingConstructor())
+continue;

djasper wrote:
> Why are you ruling out delegating constructors?
./include/clang/Basic/DiagnosticSemaKinds.td:1961:  "an initializer for a 
delegating constructor must appear alone";
So i assumed that right now we don't need to do anything with them.
Please, correct me if i am wrong. Anyway, good question.


Comment at: clang-reorder-fields/tool/ClangReorderFields.cpp:68
@@ +67,3 @@
+
+  int ExitCode = Tool.run(Factory.get());
+  LangOptions DefaultLangOptions;

djasper wrote:
> Should you continue if the exit code isn't 0 here?
the mode dumping changes to stdout & using text diagnostics) seems to be useful 
to for debugging / testing. I can simply return ExitCode, but probably that's 
not very convenient. 


Repository:
  rL LLVM

https://reviews.llvm.org/D23279



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


Re: [PATCH] D23938: clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.

2016-08-26 Thread Hans Wennborg via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

lgtm

majnemer's suggestion sounds good though, and for inputCharset too.


https://reviews.llvm.org/D23938



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


LLVM buildmaster will be restarted tonight

2016-08-26 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be restarted after 6 PM Pacific time today.

Thanks

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


r279866 - clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.

2016-08-26 Thread Nico Weber via cfe-commits
Author: nico
Date: Fri Aug 26 16:11:43 2016
New Revision: 279866

URL: http://llvm.org/viewvc/llvm-project?rev=279866&view=rev
Log:
clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.

Also makes -fexec-charset accept utf-8 case-insensitively.
Like https://reviews.llvm.org/D23807, but for execution-charset.
Also replace a few .lower() comparisons with equals_lower().

https://reviews.llvm.org/D23938

Modified:
cfe/trunk/include/clang/Driver/CLCompatOptions.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=279866&r1=279865&r2=279866&view=diff
==
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Fri Aug 26 16:11:43 2016
@@ -122,6 +122,8 @@ def _SLASH_showIncludes : CLFlag<"showIn
   Alias;
 def _SLASH_source_charset : CLCompileJoined<"source-charset:">,
   HelpText<"Source encoding, supports only UTF-8">, Alias;
+def _SLASH_execution_charset : CLCompileJoined<"execution-charset:">,
+  HelpText<"Runtime encoding, supports only UTF-8">, Alias;
 def _SLASH_std : CLCompileJoined<"std:">,
   HelpText<"Language standard to compile for">;
 def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=279866&r1=279865&r2=279866&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Aug 26 16:11:43 2016
@@ -5835,7 +5835,7 @@ void Clang::ConstructJob(Compilation &C,
   // -finput_charset=UTF-8 is default. Reject others
   if (Arg *inputCharset = Args.getLastArg(options::OPT_finput_charset_EQ)) {
 StringRef value = inputCharset->getValue();
-if (value.lower() != "utf-8")
+if (!value.equals_lower("utf-8"))
   D.Diag(diag::err_drv_invalid_value) << inputCharset->getAsString(Args)
   << value;
   }
@@ -5843,7 +5843,7 @@ void Clang::ConstructJob(Compilation &C,
   // -fexec_charset=UTF-8 is default. Reject others
   if (Arg *execCharset = Args.getLastArg(options::OPT_fexec_charset_EQ)) {
 StringRef value = execCharset->getValue();
-if (value != "UTF-8")
+if (!value.equals_lower("utf-8"))
   D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args)
   << value;
   }
@@ -9219,7 +9219,7 @@ void gnutools::Assembler::ConstructJob(C
 // march from being picked in the absence of a cpu flag.
 Arg *A;
 if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
-StringRef(A->getValue()).lower() == "krait")
+StringRef(A->getValue()).equals_lower("krait"))
   CmdArgs.push_back("-mcpu=cortex-a15");
 else
   Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);

Modified: cfe/trunk/test/Driver/cl-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=279866&r1=279865&r2=279866&view=diff
==
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Fri Aug 26 16:11:43 2016
@@ -184,6 +184,10 @@
 // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck 
-check-prefix=source-charset-utf-16 %s
 // source-charset-utf-16: invalid value 'utf-16'
 
+// /execution-charset: should warn on everything except UTF-8.
+// RUN: %clang_cl /execution-charset:utf-16 -### -- %s 2>&1 | FileCheck 
-check-prefix=execution-charset-utf-16 %s
+// execution-charset-utf-16: invalid value 'utf-16'
+//
 // RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
 // U: "-U" "mymacro"
@@ -289,6 +293,7 @@
 // RUN:/d2FastFail \
 // RUN:/d2Zi+ \
 // RUN:/errorReport:foo \
+// RUN:/execution-charset:utf-8 \
 // RUN:/FC \
 // RUN:/Fdfoo \
 // RUN:/FS \


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


Re: [PATCH] D23938: clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.

2016-08-26 Thread Nico Weber via cfe-commits
thakis closed this revision.
thakis marked an inline comment as done.
thakis added a comment.

r279866, thanks!


https://reviews.llvm.org/D23938



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


r279869 - clang-cl: Accept MSVC2015's '/utf-8' flag.

2016-08-26 Thread Nico Weber via cfe-commits
Author: nico
Date: Fri Aug 26 16:26:29 2016
New Revision: 279869

URL: http://llvm.org/viewvc/llvm-project?rev=279869&view=rev
Log:
clang-cl: Accept MSVC2015's '/utf-8' flag.

Clang always behaves as if that's passed, so just ignore the flag.

Modified:
cfe/trunk/include/clang/Driver/CLCompatOptions.td
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=279869&r1=279868&r2=279869&view=diff
==
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Fri Aug 26 16:26:29 2016
@@ -304,6 +304,7 @@ def _SLASH_openmp_ : CLIgnoredFlag<"open
 def _SLASH_RTC : CLIgnoredJoined<"RTC">;
 def _SLASH_sdl : CLIgnoredFlag<"sdl">;
 def _SLASH_sdl_ : CLIgnoredFlag<"sdl-">;
+def _SLASH_utf8 : CLIgnoredFlag<"utf-8">;
 def _SLASH_w : CLIgnoredJoined<"w">;
 def _SLASH_Zc_auto : CLIgnoredFlag<"Zc:auto">;
 def _SLASH_Zc_forScope : CLIgnoredFlag<"Zc:forScope">;

Modified: cfe/trunk/test/Driver/cl-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=279869&r1=279868&r2=279869&view=diff
==
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Fri Aug 26 16:26:29 2016
@@ -307,6 +307,7 @@
 // RUN:/sdl \
 // RUN:/sdl- \
 // RUN:/source-charset:utf-8 \
+// RUN:/utf-8 \
 // RUN:/vmg \
 // RUN:/volatile:iso \
 // RUN:/w12345 \


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


[PATCH] D23945: clang-cl: Support MSVC2015's /validate-charset flag.

2016-08-26 Thread Nico Weber via cfe-commits
thakis created this revision.
thakis added a reviewer: hans.
thakis added a subscriber: cfe-commits.

Clang always assumes that files are utf-8. If an invalidly encoded character is 
used in an identifier, clang always errors. If it's used in a character 
literal, clang warns Winvalid-source-encoding (on by default). Clang never 
checks the encoding of things in comments (adding this seems like a nice 
feature if it doesn't impact performance).

For cl.exe /utf-8 (which enables /validate-charset), if a bad character is used 
in an identifier, it emits both an error and a warning. If it's used in a 
literal or a comment, it emits a warning.

So mapping /validate-charset to -Winvalid-source-encoding seems like a fairly 
decent fit.

https://reviews.llvm.org/D23945

Files:
  include/clang/Driver/CLCompatOptions.td
  test/Driver/cl-options.c

Index: test/Driver/cl-options.c
===
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -192,6 +192,12 @@
 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
 // U: "-U" "mymacro"
 
+// RUN: %clang_cl /validate-charset -### -- %s 2>&1 | FileCheck 
-check-prefix=validate-charset %s
+// validate-charset: -Winvalid-source-encoding
+
+// RUN: %clang_cl /validate-charset- -### -- %s 2>&1 | FileCheck 
-check-prefix=validate-charset_ %s
+// validate-charset_: -Wno-invalid-source-encoding
+
 // RUN: %clang_cl /vd2 -### -- %s 2>&1 | FileCheck -check-prefix=VD2 %s
 // VD2: -vtordisp-mode=2
 
Index: include/clang/Driver/CLCompatOptions.td
===
--- include/clang/Driver/CLCompatOptions.td
+++ include/clang/Driver/CLCompatOptions.td
@@ -128,6 +128,10 @@
   HelpText<"Language standard to compile for">;
 def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,
   MetaVarName<"">, Alias;
+def _SLASH_validate_charset : CLFlag<"validate-charset">,
+  Alias, AliasArgs<["invalid-source-encoding"]>;
+def _SLASH_validate_charset_ : CLFlag<"validate-charset-">,
+  Alias, AliasArgs<["no-invalid-source-encoding"]>;
 def _SLASH_W0 : CLFlag<"W0">, HelpText<"Disable all warnings">, Alias;
 def _SLASH_W1 : CLFlag<"W1">, HelpText<"Enable -Wall">, Alias;
 def _SLASH_W2 : CLFlag<"W2">, HelpText<"Enable -Wall">, Alias;


Index: test/Driver/cl-options.c
===
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -192,6 +192,12 @@
 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
 // U: "-U" "mymacro"
 
+// RUN: %clang_cl /validate-charset -### -- %s 2>&1 | FileCheck -check-prefix=validate-charset %s
+// validate-charset: -Winvalid-source-encoding
+
+// RUN: %clang_cl /validate-charset- -### -- %s 2>&1 | FileCheck -check-prefix=validate-charset_ %s
+// validate-charset_: -Wno-invalid-source-encoding
+
 // RUN: %clang_cl /vd2 -### -- %s 2>&1 | FileCheck -check-prefix=VD2 %s
 // VD2: -vtordisp-mode=2
 
Index: include/clang/Driver/CLCompatOptions.td
===
--- include/clang/Driver/CLCompatOptions.td
+++ include/clang/Driver/CLCompatOptions.td
@@ -128,6 +128,10 @@
   HelpText<"Language standard to compile for">;
 def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,
   MetaVarName<"">, Alias;
+def _SLASH_validate_charset : CLFlag<"validate-charset">,
+  Alias, AliasArgs<["invalid-source-encoding"]>;
+def _SLASH_validate_charset_ : CLFlag<"validate-charset-">,
+  Alias, AliasArgs<["no-invalid-source-encoding"]>;
 def _SLASH_W0 : CLFlag<"W0">, HelpText<"Disable all warnings">, Alias;
 def _SLASH_W1 : CLFlag<"W1">, HelpText<"Enable -Wall">, Alias;
 def _SLASH_W2 : CLFlag<"W2">, HelpText<"Enable -Wall">, Alias;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r279871 - [ARM] Adding .arch directives around WMMX unwind code

2016-08-26 Thread Renato Golin via cfe-commits
Author: rengolin
Date: Fri Aug 26 16:45:39 2016
New Revision: 279871

URL: http://llvm.org/viewvc/llvm-project?rev=279871&view=rev
Log:
[ARM] Adding .arch directives around WMMX unwind code

Some unwind code is purposedly old enough to work on previous architecutres
and they're guaranteed to never trigger in newer architectures, so we need
to add .arch directives to tell the compiler/assembler that it's fine and we
know what we're doing.

Fixes PR29149.

Modified:
libunwind/trunk/src/UnwindRegistersRestore.S
libunwind/trunk/src/UnwindRegistersSave.S

Modified: libunwind/trunk/src/UnwindRegistersRestore.S
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersRestore.S?rev=279871&r1=279870&r2=279871&view=diff
==
--- libunwind/trunk/src/UnwindRegistersRestore.S (original)
+++ libunwind/trunk/src/UnwindRegistersRestore.S Fri Aug 26 16:45:39 2016
@@ -401,6 +401,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
 @  values pointer is in r0
 @
   .p2align 2
+  .arch armv5te
 
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm12restoreiWMMXEPy)
   ldcl p1, cr0, [r0], #8  @ wldrd wR0, [r0], #8
   ldcl p1, cr1, [r0], #8  @ wldrd wR1, [r0], #8
@@ -427,6 +428,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
 @  values pointer is in r0
 @
   .p2align 2
+  .arch armv5te
 
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreiWMMXControlEPj)
   ldc2 p1, cr8, [r0], #4  @ wldrw wCGR0, [r0], #4
   ldc2 p1, cr9, [r0], #4  @ wldrw wCGR1, [r0], #4

Modified: libunwind/trunk/src/UnwindRegistersSave.S
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersSave.S?rev=279871&r1=279870&r2=279871&view=diff
==
--- libunwind/trunk/src/UnwindRegistersSave.S (original)
+++ libunwind/trunk/src/UnwindRegistersSave.S Fri Aug 26 16:45:39 2016
@@ -391,6 +391,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
 @  values pointer is in r0
 @
   .p2align 2
+  .arch armv5te
 DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm9saveiWMMXEPy)
   stcl p1, cr0, [r0], #8  @ wstrd wR0, [r0], #8
   stcl p1, cr1, [r0], #8  @ wstrd wR1, [r0], #8
@@ -417,6 +418,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
 @  values pointer is in r0
 @
   .p2align 2
+  .arch armv5te
 
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm16saveiWMMXControlEPj)
   stc2 p1, cr8, [r0], #4  @ wstrw wCGR0, [r0], #4
   stc2 p1, cr9, [r0], #4  @ wstrw wCGR1, [r0], #4


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


Re: [PATCH] D23945: clang-cl: Support MSVC2015's /validate-charset flag.

2016-08-26 Thread Hans Wennborg via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

lgtm


https://reviews.llvm.org/D23945



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


r279872 - clang-cl: Support MSVC2015's /validate-charset flag.

2016-08-26 Thread Nico Weber via cfe-commits
Author: nico
Date: Fri Aug 26 16:51:14 2016
New Revision: 279872

URL: http://llvm.org/viewvc/llvm-project?rev=279872&view=rev
Log:
clang-cl: Support MSVC2015's /validate-charset flag.

Clang always assumes that files are utf-8. If an invalidly encoded character is
used in an identifier, clang always errors. If it's used in a character
literal, clang warns Winvalid-source-encoding (on by default). Clang never
checks the encoding of things in comments (adding this seems like a nice
feature if it doesn't impact performance).

For cl.exe /utf-8 (which enables /validate-charset), if a bad character is used
in an identifier, it emits both an error and a warning. If it's used in a
literal or a comment, it emits a warning.

So mapping /validate-charset to -Winvalid-source-encoding seems like a fairly
decent fit.

https://reviews.llvm.org/D23945

Modified:
cfe/trunk/include/clang/Driver/CLCompatOptions.td
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=279872&r1=279871&r2=279872&view=diff
==
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Fri Aug 26 16:51:14 2016
@@ -128,6 +128,10 @@ def _SLASH_std : CLCompileJoined<"std:">
   HelpText<"Language standard to compile for">;
 def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,
   MetaVarName<"">, Alias;
+def _SLASH_validate_charset : CLFlag<"validate-charset">,
+  Alias, AliasArgs<["invalid-source-encoding"]>;
+def _SLASH_validate_charset_ : CLFlag<"validate-charset-">,
+  Alias, AliasArgs<["no-invalid-source-encoding"]>;
 def _SLASH_W0 : CLFlag<"W0">, HelpText<"Disable all warnings">, Alias;
 def _SLASH_W1 : CLFlag<"W1">, HelpText<"Enable -Wall">, Alias;
 def _SLASH_W2 : CLFlag<"W2">, HelpText<"Enable -Wall">, Alias;

Modified: cfe/trunk/test/Driver/cl-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=279872&r1=279871&r2=279872&view=diff
==
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Fri Aug 26 16:51:14 2016
@@ -192,6 +192,12 @@
 // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
 // U: "-U" "mymacro"
 
+// RUN: %clang_cl /validate-charset -### -- %s 2>&1 | FileCheck 
-check-prefix=validate-charset %s
+// validate-charset: -Winvalid-source-encoding
+
+// RUN: %clang_cl /validate-charset- -### -- %s 2>&1 | FileCheck 
-check-prefix=validate-charset_ %s
+// validate-charset_: -Wno-invalid-source-encoding
+
 // RUN: %clang_cl /vd2 -### -- %s 2>&1 | FileCheck -check-prefix=VD2 %s
 // VD2: -vtordisp-mode=2
 


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


Re: [PATCH] D23945: clang-cl: Support MSVC2015's /validate-charset flag.

2016-08-26 Thread Nico Weber via cfe-commits
thakis closed this revision.
thakis added a comment.

r279872, thanks!


https://reviews.llvm.org/D23945



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


Re: [PATCH] D23279: clang-reorder-fields

2016-08-26 Thread Alexander Shaposhnikov via cfe-commits
alexshap marked 4 inline comments as done.
alexshap added a comment.

Repository:
  rL LLVM

https://reviews.llvm.org/D23279



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


Re: [PATCH] D23595: [Clang] Fix some Clang-tidy modernize-use-using and Include What You Use warnings

2016-08-26 Thread Mehdi AMINI via cfe-commits
mehdi_amini added inline comments.


Comment at: include/clang/Basic/IdentifierTable.h:103
@@ -95,1 +102,3 @@
+return getLength() == StrLen-1 &&
+   memcmp(getNameStart(), Str, StrLen-1) == 0;
   }

Eugene.Zelenko wrote:
> memcpy result is three state, so applying Boolean operator is not correct.
What do you mean "applying Boolean operator is not correct"?
http://en.cppreference.com/w/cpp/language/implicit_conversion # Boolean 
conversions
  ```The value zero (for integral, floating-point, and unscoped enumeration) 
and the null pointer and the null pointer-to-member values become false. All 
other values become true.```

Seems good to me?



Comment at: include/clang/Lex/PreprocessorOptions.h:22
@@ -23,2 +21,3 @@
 namespace llvm {
+
   class MemoryBuffer;

Eugene.Zelenko wrote:
> I wanted to make spacing consistent. Same in other places.
> 
> Actually, Include What You Use recommended to include MemoryBuffer.h. 
> MemoryBuffer is used in smart pointers, but I remember that I encountered 
> problems in LLDB MSVC builds, where forward declaration was not enough for 
> such usage.
I think in a recent review you mentioned "empty lines make code more readable 
for large namespaces", which does not seem to be the case here?


Repository:
  rL LLVM

https://reviews.llvm.org/D23595



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


Re: [PATCH] D23279: clang-reorder-fields

2016-08-26 Thread Alexander Shaposhnikov via cfe-commits
alexshap updated this revision to Diff 69445.
alexshap added a comment.

Address @djasper 's comments.

1. Try to flash out comments for helper functions / various interesting places 
in my code
2. More elaborate error-handling
3. Adjust the names of the variables: I -> i, E -> e
4. Minor cleanup & clang-format -i


Repository:
  rL LLVM

https://reviews.llvm.org/D23279

Files:
  CMakeLists.txt
  clang-reorder-fields/CMakeLists.txt
  clang-reorder-fields/ReorderFieldsAction.cpp
  clang-reorder-fields/ReorderFieldsAction.h
  clang-reorder-fields/tool/CMakeLists.txt
  clang-reorder-fields/tool/ClangReorderFields.cpp
  test/CMakeLists.txt
  test/clang-reorder-fields/CStructAmbiguousName.cpp
  test/clang-reorder-fields/CStructFieldsOrder.cpp
  test/clang-reorder-fields/ClassMixedInitialization.cpp
  test/clang-reorder-fields/ClassSimpleCtor.cpp

Index: test/clang-reorder-fields/ClassSimpleCtor.cpp
===
--- test/clang-reorder-fields/ClassSimpleCtor.cpp
+++ test/clang-reorder-fields/ClassSimpleCtor.cpp
@@ -0,0 +1,24 @@
+// RUN: clang-reorder-fields -record-name Foo -fields-order s1,x,z,s2 %s -- | FileCheck %s
+
+class Foo {
+public:
+  Foo();
+
+private:
+  int x;  // CHECK:  {{^  const char \*s1;}}
+  const char *s1; // CHECK-NEXT: {{^  int x;}}
+  const char *s2; // CHECK-NEXT: {{^  double z;}}
+  double z;   // CHECK-NEXT: {{^  const char \*s2;}}
+};
+
+Foo::Foo():
+  x(12),  // CHECK:  {{^  s1\("abc"\),}}
+  s1("abc"),  // CHECK-NEXT: {{^  x\(12\),}}
+  s2("def"),  // CHECK-NEXT: {{^  z\(3.14\),}}
+  z(3.14) // CHECK-NEXT: {{^  s2\("def"\)}}
+{}
+
+int main() {
+  Foo foo;
+  return 0;
+}
Index: test/clang-reorder-fields/ClassMixedInitialization.cpp
===
--- test/clang-reorder-fields/ClassMixedInitialization.cpp
+++ test/clang-reorder-fields/ClassMixedInitialization.cpp
@@ -0,0 +1,24 @@
+// RUN: clang-reorder-fields -record-name Foo -fields-order e,x,pi,s2,s1 %s -- -std=c++11 | FileCheck %s
+
+class Foo {
+public:
+  Foo();
+
+private:
+  int x;  // CHECK:  {{^  double e = 2.71;}}
+  const char *s1; // CHECK-NEXT: {{^  int x;}}
+  const char *s2; // CHECK-NEXT: {{^  double pi = 3.14;}}
+  double pi = 3.14;   // CHECK-NEXT: {{^  const char \*s2;}}
+  double e = 2.71;// CHECK-NEXT: {{^  const char \*s1;}}
+};
+
+Foo::Foo():
+  x(12),  // CHECK:  {{^  x\(12\)}},
+  s1("abc"),  // CHECK-NEXT: {{^  s2\("def"\)}},
+  s2("def")   // CHECK-NEXT: {{^  s1\("abc"\)}}
+{}
+
+int main() {
+  Foo foo;
+  return 0;
+}
Index: test/clang-reorder-fields/CStructFieldsOrder.cpp
===
--- test/clang-reorder-fields/CStructFieldsOrder.cpp
+++ test/clang-reorder-fields/CStructFieldsOrder.cpp
@@ -0,0 +1,16 @@
+// RUN: clang-reorder-fields -record-name ::bar::Foo -fields-order z,w,y,x %s -- | FileCheck %s
+
+namespace bar {
+struct Foo {
+  const int* x; // CHECK:  {{^  double z;}}
+  int y;// CHECK-NEXT: {{^  int w;}}
+  double z; // CHECK-NEXT: {{^  int y;}}
+  int w;// CHECK-NEXT: {{^  const int\* x}}
+};
+} // end namespace bar
+
+int main() {
+  const int x = 13;
+  bar::Foo foo = { &x, 0, 1.29, 17 }; // CHECK: {{^  bar::Foo foo = { 1.29, 17, 0, &x };}} 
+  return 0;
+}
Index: test/clang-reorder-fields/CStructAmbiguousName.cpp
===
--- test/clang-reorder-fields/CStructAmbiguousName.cpp
+++ test/clang-reorder-fields/CStructAmbiguousName.cpp
@@ -0,0 +1,18 @@
+// RUN: clang-reorder-fields -record-name ::Foo -fields-order y,x %s -- | FileCheck %s
+
+struct Foo {
+  int x;// CHECK:  {{^  double y;}}
+  double y; // CHECK-NEXT: {{^  int x;}}
+};
+
+namespace bar {
+struct Foo {
+  int x;// CHECK:  {{^  int x;}}
+  double y; // CHECK-NEXT: {{^  double y;}}
+};
+} // end namespace bar
+
+int main() {
+  bar::Foo foo = { 1, 1.7 }; // CHECK: {{^  bar::Foo foo = { 1, 1.7 };}}
+  return 0;
+}
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -45,6 +45,7 @@
   clang-include-fixer
   clang-query
   clang-rename
+  clang-reorder-fields
   clang-tidy
   find-all-symbols
   modularize
Index: clang-reorder-fields/tool/ClangReorderFields.cpp
===
--- clang-reorder-fields/tool/ClangReorderFields.cpp
+++ clang-reorder-fields/tool/ClangReorderFields.cpp
@@ -0,0 +1,88 @@
+//===-- tools/extra/clang-reorder-fields/tool/ClangReorderFields.cpp -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+///
+/// \fi

Re: [PATCH] D23595: [Clang] Fix some Clang-tidy modernize-use-using and Include What You Use warnings

2016-08-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added inline comments.


Comment at: include/clang/Basic/IdentifierTable.h:103
@@ -95,1 +102,3 @@
+return getLength() == StrLen-1 &&
+   memcmp(getNameStart(), Str, StrLen-1) == 0;
   }

mehdi_amini wrote:
> Eugene.Zelenko wrote:
> > memcpy result is three state, so applying Boolean operator is not correct.
> What do you mean "applying Boolean operator is not correct"?
> http://en.cppreference.com/w/cpp/language/implicit_conversion # Boolean 
> conversions
>   ```The value zero (for integral, floating-point, and unscoped enumeration) 
> and the null pointer and the null pointer-to-member values become false. All 
> other values become true.```
> 
> Seems good to me?
> 
I think explicit operation is more comprehensible them implicit.


Comment at: include/clang/Lex/PreprocessorOptions.h:22
@@ -23,2 +21,3 @@
 namespace llvm {
+
   class MemoryBuffer;

mehdi_amini wrote:
> Eugene.Zelenko wrote:
> > I wanted to make spacing consistent. Same in other places.
> > 
> > Actually, Include What You Use recommended to include MemoryBuffer.h. 
> > MemoryBuffer is used in smart pointers, but I remember that I encountered 
> > problems in LLDB MSVC builds, where forward declaration was not enough for 
> > such usage.
> I think in a recent review you mentioned "empty lines make code more readable 
> for large namespaces", which does not seem to be the case here?
I prefer spacing to be consistent.


Repository:
  rL LLVM

https://reviews.llvm.org/D23595



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


Re: [PATCH] D23279: clang-reorder-fields

2016-08-26 Thread Alexander Shaposhnikov via cfe-commits
alexshap marked 10 inline comments as done.
alexshap added a comment.

I have marked all the inline comments as done, if i need to change/fix smth 
else - pls, reopen the corresponding comment or add a new one.
**Current apporach** : correctly create all the necessary replacements 
supported by this tool (v0). This includes:
struct/class definition (if the new list of fields doesn't imply changes of the 
accesses), constructors and 
initializations of aggregates (at the moment partial initialization is not 
supported.
If for some reason we are not able to generate the correct replacement we write 
a message to llvm::errs() and don't generate it.


Repository:
  rL LLVM

https://reviews.llvm.org/D23279



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


Re: [PATCH] D23279: clang-reorder-fields

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

I've just rerun the tests - they are green.


Repository:
  rL LLVM

https://reviews.llvm.org/D23279



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


Re: [PATCH] D23746: Basic/Targets.cpp: Add polaris10 and polaris11 gpus

2016-08-26 Thread Tom Stellard via cfe-commits
tstellarAMD requested changes to this revision.
This revision now requires changes to proceed.


Comment at: lib/Basic/Targets.cpp:1959
@@ -1959,1 +1958,3 @@
+GK_VOLCANIC_ISLANDS,
+GK_ARCTIC_ISLANDS
   } GPU;

We're trying to move to more descriptive GPU family names, so this should be 
GK_GFX8 instead of GK_ARCTIC_ISLANDS.  GK_VOLCANIC_ISLANDS should also be 
changed to GK_GFX8, but that can be done in another patch, and would not be a 
prerequisite for this patch. 


https://reviews.llvm.org/D23746



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


Re: [PATCH] D23746: Basic/Targets.cpp: Add polaris10 and polaris11 gpus

2016-08-26 Thread Matt Arsenault via cfe-commits
arsenm added inline comments.


Comment at: lib/Basic/Targets.cpp:1959
@@ -1959,1 +1958,3 @@
+GK_VOLCANIC_ISLANDS,
+GK_ARCTIC_ISLANDS
   } GPU;

tstellarAMD wrote:
> We're trying to move to more descriptive GPU family names, so this should be 
> GK_GFX8 instead of GK_ARCTIC_ISLANDS.  GK_VOLCANIC_ISLANDS should also be 
> changed to GK_GFX8, but that can be done in another patch, and would not be a 
> prerequisite for this patch. 
For now I think polaris10/11 should just be left as VOLCANIC_ISLANDS


https://reviews.llvm.org/D23746



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


Re: [PATCH] D23852: [SemaObjC] Fix crash while parsing type arguments and protocols

2016-08-26 Thread Bruno Cardoso Lopes via cfe-commits
bruno updated the summary for this revision.
bruno updated this revision to Diff 69456.
bruno added a comment.

Updated patch and changed approach after Doug's comment.


https://reviews.llvm.org/D23852

Files:
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseObjc.cpp
  lib/Parse/Parser.cpp
  test/SemaObjC/crash-on-type-args-protocols.m

Index: test/SemaObjC/crash-on-type-args-protocols.m
===
--- /dev/null
+++ test/SemaObjC/crash-on-type-args-protocols.m
@@ -0,0 +1,40 @@
+// RUN: %clang_cc1 -DFIRST -fsyntax-only -verify %s
+// RUN: %clang_cc1 -DSECOND -fsyntax-only -verify %s
+// RUN: %clang_cc1 -DTHIRD -fsyntax-only -verify %s
+// RUN: %clang_cc1 -DFOURTH -fsyntax-only -verify %s
+
+@protocol P;
+@interface NSObject
+@end
+@protocol X
+@end
+@interface X : NSObject 
+@end
+
+@class A;
+
+#ifdef FIRST
+id F1(id<[P> v) { // expected-error {{expected a type}} // expected-error {{use of undeclared identifier 'P'}} // expected-error {{use of undeclared identifier 'v'}} // expected-note {{to match this '('}}
+  return 0;
+}
+#endif
+
+#ifdef SECOND
+id F2(id v) { // expected-error {{unknown type name 'P'}} // expected-error {{unexpected interface name 'X': expected expression}} // expected-error {{use of undeclared identifier 'v'}} // expected-note {{to match this '('}}
+  return 0;
+}
+#endif
+
+#ifdef THIRD
+id F3(id v) { // expected-error {{unknown type name 'P'}} // expected-error {{expected expression}} // expected-error {{use of undeclared identifier 'v'}} // expected-note {{to match this '('}}
+  return 0;
+}
+#endif
+
+#ifdef FOURTH
+id F4(id v { // expected-error {{unknown type name 'P'}} // expected-error {{expected ')'}} // expected-note {{to match this '('}} // expected-note {{to match this '('}}
+  return 0;
+}
+#endif
+
+// expected-error {{expected '>'}} // expected-error {{expected parameter declarator}} // expected-error {{expected ')'}} // expected-error {{expected function body after function declarator}}
Index: lib/Parse/Parser.cpp
===
--- lib/Parse/Parser.cpp
+++ lib/Parse/Parser.cpp
@@ -1513,6 +1513,8 @@
NewEndLoc);
   if (NewType.isUsable())
 Ty = NewType.get();
+  else if (Tok.is(tok::eof)) // Nothing to do here, bail out...
+return ANK_Error;
 }
 
 Tok.setKind(tok::annot_typename);
@@ -1744,6 +1746,8 @@
NewEndLoc);
 if (NewType.isUsable())
   Ty = NewType.get();
+else if (Tok.is(tok::eof)) // Nothing to do here, bail out...
+  return false;
   }
 
   // This is a typename. Replace the current token in-place with an
Index: lib/Parse/ParseObjc.cpp
===
--- lib/Parse/ParseObjc.cpp
+++ lib/Parse/ParseObjc.cpp
@@ -344,9 +344,11 @@
   protocols, protocolLocs, EndProtoLoc,
   /*consumeLastToken=*/true,
   /*warnOnIncompleteProtocols=*/true);
+  if (Tok.is(tok::eof))
+return nullptr;
 }
   }
-  
+
   // Next, we need to check for any protocol references.
   if (LAngleLoc.isValid()) {
 if (!ProtocolIdents.empty()) {
@@ -1814,6 +1816,8 @@
 protocolRAngleLoc,
 consumeLastToken,
 /*warnOnIncompleteProtocols=*/false);
+  if (Tok.is(tok::eof)) // Nothing else to do here...
+return;
 
   // An Objective-C object pointer followed by type arguments
   // can then be followed again by a set of protocol references, e.g.,
@@ -1862,6 +1866,9 @@
  protocols, protocolLocs,
  protocolRAngleLoc, consumeLastToken);
 
+  if (Tok.is(tok::eof))
+return true; // Invalid type result.
+
   // Compute the location of the last token.
   if (consumeLastToken)
 endLoc = PrevTokLocation;
Index: lib/Parse/ParseDecl.cpp
===
--- lib/Parse/ParseDecl.cpp
+++ lib/Parse/ParseDecl.cpp
@@ -5861,7 +5861,8 @@
  // To handle this, we check to see if the token after the first
  // identifier is a "," or ")".  Only then do we parse it as an
  // identifier list.
- && (NextToken().is(tok::comma) || NextToken().is(tok::r_paren));
+ && (!Tok.is(tok::eof) &&
+ (NextToken().is(tok::comma) || NextToken().is(tok::r_paren)));
 }
 
 /// ParseFunctionDeclaratorIdentifierList - While parsing a function declarator
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22968: [analyzer] A checker for macOS-specific bool-like objects.

2016-08-26 Thread Devin Coughlin via cfe-commits
dcoughlin added inline comments.


Comment at: lib/StaticAnalyzer/Checkers/BoolConversionChecker.cpp:62
@@ +61,3 @@
+   << "' to a plain boolean value: probably a forgotten "
+   << (IsObjC ? "'[boolValue]'" : "'->isTrue()'");
+BR.EmitBasicReport(

- The '[boolValue]' thing here is weird. Maybe use '-boolValue' instead?
- How about "Comparison between 'NSNumber *' and 'BOOL'; use -boolValue 
instead."
- You probably want to remove lifetime qualifiers from the type with 
`.getUnqualifiedType()`. before printing (i.e., don't mention '__strong') in 
the diagnostic.



Comment at: lib/StaticAnalyzer/Checkers/BoolConversionChecker.cpp:80
@@ +79,3 @@
+
+auto OSBooleanExprM =
+expr(ignoringParenImpCasts(

The AST matchers seem pretty convenient!


Comment at: test/Analysis/bool-conversion.cpp:18
@@ +17,3 @@
+#ifdef PEDANTIC
+  if (p) {} // expected-warning{{}}
+  if (!p) {} // expected-warning{{}}

It is generally good to include the diagnostic text in the test for the 
warning. This way we make sure we get the warning we expected.


Comment at: test/Analysis/bool-conversion.m:2
@@ +1,3 @@
+// RUN: %clang_cc1 -fblocks -w -analyze 
-analyzer-checker=alpha.osx.BoolConversion %s -verify
+// RUN: %clang_cc1 -fblocks -w -analyze 
-analyzer-checker=alpha.osx.BoolConversion -analyzer-config 
alpha.osx.BoolConversion:Pedantic=true -DPEDANTIC %s -verify
+

You should add a test invocation here where -fobjc-arc is set as well. This 
adds a bunch of implicit goop that it would be good to test with.


Comment at: test/Analysis/bool-conversion.m:6
@@ +5,3 @@
+
+void bad(const NSNumber *p) {
+#ifdef PEDANTIC

These 'const's are not idiomatic. It is probably better to remove them.


Comment at: test/Analysis/bool-conversion.m:10
@@ +9,3 @@
+  if (!p) {} // expected-warning{{}}
+  if (p == YES) {} // expected-warning{{}}
+  if (p == NO) {} // expected-warning{{}}

There is a Sema warning for `p == YES` already, right? ("comparison between 
pointer and integer ('NSNumber *' and 'int')")


Comment at: test/Analysis/bool-conversion.m:11
@@ +10,3 @@
+  if (p == YES) {} // expected-warning{{}}
+  if (p == NO) {} // expected-warning{{}}
+  (!p) ? 1 : 2; // expected-warning{{}}

Should `p == NO` be on in non-pedantic mode, as well? It also seems to me that 
you could warn on comparison of *any* ObjCObjectPointerType type to `NO`. At a 
minimum it would probably be good to check for comparisons of `id` to NO.


https://reviews.llvm.org/D22968



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


[libcxx] r279903 - Add attribute noreturn to functions that throw

2016-08-26 Thread Aditya Kumar via cfe-commits
Author: hiraditya
Date: Fri Aug 26 21:26:42 2016
New Revision: 279903

URL: http://llvm.org/viewvc/llvm-project?rev=279903&view=rev
Log:
Add attribute noreturn to functions that throw

Reviewers: mclow.lists, EricWF, howard.hinnant, sebpop
Subscribers: cfe-commits

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

Modified:
libcxx/trunk/include/__locale
libcxx/trunk/include/system_error

Modified: libcxx/trunk/include/__locale
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__locale?rev=279903&r1=279902&r2=279903&view=diff
==
--- libcxx/trunk/include/__locale (original)
+++ libcxx/trunk/include/__locale Fri Aug 26 21:26:42 2016
@@ -1183,6 +1183,8 @@ _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_T
 _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname)
 _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname)
 
+_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
+
 template 
 struct __narrow_to_utf8
 {

Modified: libcxx/trunk/include/system_error
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/system_error?rev=279903&r1=279902&r2=279903&view=diff
==
--- libcxx/trunk/include/system_error (original)
+++ libcxx/trunk/include/system_error Fri Aug 26 21:26:42 2016
@@ -635,7 +635,8 @@ private:
 static string __init(const error_code&, string);
 };
 
-_LIBCPP_FUNC_VIS void __throw_system_error(int ev, const char* what_arg);
+_LIBCPP_NORETURN _LIBCPP_FUNC_VIS
+void __throw_system_error(int ev, const char* what_arg);
 
 _LIBCPP_END_NAMESPACE_STD
 


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


Re: [PATCH] D23784: Remove trailing WS [NFC]

2016-08-26 Thread Aditya Kumar via cfe-commits
hiraditya closed this revision.
hiraditya added a comment.

commit fdb4f1713ece3c6f7fbf98f3ea3f8c19fa0c249e
Author: Aditya Kumar 
Date:   Thu Aug 25 11:52:38 2016 +

  Remove trailing WS [NFC]
  
  git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@279731 
91177308-0d34-0410-b5e6-96231b3b80d8


https://reviews.llvm.org/D23784



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


[PATCH] D23953: OpenCL: Defining __ENDIAN_LITTLE__ and fix target endianness

2016-08-26 Thread Matt Arsenault via cfe-commits
arsenm created this revision.
arsenm added a subscriber: cfe-commits.

OpenCL requires __ENDIAN_LITTLE__ be set for little endian targets.
The default for targets was also apparently big endian, so AMDGPU
was incorrectly reported as big endian. Set this from the triple
so targets don't have another place to set the endianness.


https://reviews.llvm.org/D23953

Files:
  include/clang/Basic/TargetInfo.h
  lib/Basic/TargetInfo.cpp
  lib/Basic/Targets.cpp
  lib/Frontend/InitPreprocessor.cpp
  test/Preprocessor/init.c

Index: test/Preprocessor/init.c
===
--- test/Preprocessor/init.c
+++ test/Preprocessor/init.c
@@ -6648,6 +6648,7 @@
 // RUN: %clang_cc1 -x cl -E -dM -ffreestanding -triple=amdgcn < /dev/null | FileCheck -match-full-lines -check-prefix AMDGCN --check-prefix AMDGPU %s
 // RUN: %clang_cc1 -x cl -E -dM -ffreestanding -triple=r600 -target-cpu caicos < /dev/null | FileCheck -match-full-lines --check-prefix AMDGPU %s
 //
+// AMDGPU:#define __ENDIAN_LITTLE__ 1
 // AMDGPU:#define cl_khr_byte_addressable_store 1
 // AMDGCN:#define cl_khr_fp64 1
 // AMDGPU:#define cl_khr_global_int32_base_atomics 1
Index: lib/Frontend/InitPreprocessor.cpp
===
--- lib/Frontend/InitPreprocessor.cpp
+++ lib/Frontend/InitPreprocessor.cpp
@@ -435,6 +435,9 @@
 Builder.defineMacro("CL_VERSION_1_2", "120");
 Builder.defineMacro("CL_VERSION_2_0", "200");
 
+if (TI.isLittlEndian())
+  Builder.defineMacro("__ENDIAN_LITTLE__");
+
 if (LangOpts.FastRelaxedMath)
   Builder.defineMacro("__FAST_RELAXED_MATH__");
   }
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -879,7 +879,6 @@
 : TargetInfo(Triple), HasVSX(false), HasP8Vector(false),
   HasP8Crypto(false), HasDirectMove(false), HasQPX(false), HasHTM(false),
   HasBPERMD(false), HasExtDiv(false) {
-BigEndian = (Triple.getArch() != llvm::Triple::ppc64le);
 SimdDefaultAlign = 128;
 LongDoubleWidth = LongDoubleAlign = 128;
 LongDoubleFormat = &llvm::APFloat::PPCDoubleDouble;
@@ -1712,7 +1711,6 @@
 public:
   NVPTXTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
   : TargetInfo(Triple) {
-BigEndian = false;
 TLSSupported = false;
 LongWidth = LongAlign = 64;
 AddrSpaceMap = &NVPTXAddrSpaceMap;
@@ -2661,7 +2659,6 @@
 public:
   X86TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
   : TargetInfo(Triple) {
-BigEndian = false;
 LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
   }
   unsigned getFloatEvalMethod() const override {
@@ -4876,11 +4873,9 @@
   }
 
 public:
-  ARMTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts,
-bool IsBigEndian)
+  ARMTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
   : TargetInfo(Triple), FPMath(FP_Default), IsAAPCS(true), LDREX(0),
 HW_FP(0) {
-BigEndian = IsBigEndian;
 
 switch (getTriple().getOS()) {
 case llvm::Triple::NetBSD:
@@ -5520,7 +5515,7 @@
 class ARMleTargetInfo : public ARMTargetInfo {
 public:
   ARMleTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
-  : ARMTargetInfo(Triple, Opts, /*BigEndian=*/false) {}
+  : ARMTargetInfo(Triple, Opts) {}
   void getTargetDefines(const LangOptions &Opts,
 MacroBuilder &Builder) const override {
 Builder.defineMacro("__ARMEL__");
@@ -5531,7 +5526,7 @@
 class ARMbeTargetInfo : public ARMTargetInfo {
 public:
   ARMbeTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
-  : ARMTargetInfo(Triple, Opts, /*BigEndian=*/true) {}
+  : ARMTargetInfo(Triple, Opts) {}
   void getTargetDefines(const LangOptions &Opts,
 MacroBuilder &Builder) const override {
 Builder.defineMacro("__ARMEB__");
@@ -6042,7 +6037,6 @@
 public:
   AArch64leTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
   : AArch64TargetInfo(Triple, Opts) {
-BigEndian = false;
   }
   void getTargetDefines(const LangOptions &Opts,
 MacroBuilder &Builder) const override {
@@ -6113,7 +6107,6 @@
 public:
   HexagonTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
   : TargetInfo(Triple) {
-BigEndian = false;
 // Specify the vector alignment explicitly. For v512x1, the calculated
 // alignment would be 512*alignment(i1), which is 512 bytes, instead of
 // the required minimum of 64 bytes.
@@ -6721,7 +6714,6 @@
SparcV8elTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: SparcV8TargetInfo(Triple, Opts) {
  resetDataLayout("e-m:e-p:32:32-i64:64-f128:64-n32-S64");
- BigEndian = false;
   }
 };
 
@@ -6956,7 +6948,6 @@
 public:
   MSP430TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
   : TargetInfo(Triple) {
-BigEndi

Re: [PATCH] D23953: OpenCL: Defining __ENDIAN_LITTLE__ and fix target endianness

2016-08-26 Thread Matt Arsenault via cfe-commits
arsenm updated this revision to Diff 69465.
arsenm added a comment.

Fix typo


https://reviews.llvm.org/D23953

Files:
  include/clang/Basic/TargetInfo.h
  lib/Basic/TargetInfo.cpp
  lib/Basic/Targets.cpp
  lib/Frontend/InitPreprocessor.cpp
  test/Preprocessor/init.c

Index: test/Preprocessor/init.c
===
--- test/Preprocessor/init.c
+++ test/Preprocessor/init.c
@@ -6648,6 +6648,7 @@
 // RUN: %clang_cc1 -x cl -E -dM -ffreestanding -triple=amdgcn < /dev/null | FileCheck -match-full-lines -check-prefix AMDGCN --check-prefix AMDGPU %s
 // RUN: %clang_cc1 -x cl -E -dM -ffreestanding -triple=r600 -target-cpu caicos < /dev/null | FileCheck -match-full-lines --check-prefix AMDGPU %s
 //
+// AMDGPU:#define __ENDIAN_LITTLE__ 1
 // AMDGPU:#define cl_khr_byte_addressable_store 1
 // AMDGCN:#define cl_khr_fp64 1
 // AMDGPU:#define cl_khr_global_int32_base_atomics 1
Index: lib/Frontend/InitPreprocessor.cpp
===
--- lib/Frontend/InitPreprocessor.cpp
+++ lib/Frontend/InitPreprocessor.cpp
@@ -435,6 +435,9 @@
 Builder.defineMacro("CL_VERSION_1_2", "120");
 Builder.defineMacro("CL_VERSION_2_0", "200");
 
+if (TI.isLittleEndian())
+  Builder.defineMacro("__ENDIAN_LITTLE__");
+
 if (LangOpts.FastRelaxedMath)
   Builder.defineMacro("__FAST_RELAXED_MATH__");
   }
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -879,7 +879,6 @@
 : TargetInfo(Triple), HasVSX(false), HasP8Vector(false),
   HasP8Crypto(false), HasDirectMove(false), HasQPX(false), HasHTM(false),
   HasBPERMD(false), HasExtDiv(false) {
-BigEndian = (Triple.getArch() != llvm::Triple::ppc64le);
 SimdDefaultAlign = 128;
 LongDoubleWidth = LongDoubleAlign = 128;
 LongDoubleFormat = &llvm::APFloat::PPCDoubleDouble;
@@ -1712,7 +1711,6 @@
 public:
   NVPTXTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
   : TargetInfo(Triple) {
-BigEndian = false;
 TLSSupported = false;
 LongWidth = LongAlign = 64;
 AddrSpaceMap = &NVPTXAddrSpaceMap;
@@ -2661,7 +2659,6 @@
 public:
   X86TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
   : TargetInfo(Triple) {
-BigEndian = false;
 LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
   }
   unsigned getFloatEvalMethod() const override {
@@ -4876,11 +4873,9 @@
   }
 
 public:
-  ARMTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts,
-bool IsBigEndian)
+  ARMTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
   : TargetInfo(Triple), FPMath(FP_Default), IsAAPCS(true), LDREX(0),
 HW_FP(0) {
-BigEndian = IsBigEndian;
 
 switch (getTriple().getOS()) {
 case llvm::Triple::NetBSD:
@@ -5520,7 +5515,7 @@
 class ARMleTargetInfo : public ARMTargetInfo {
 public:
   ARMleTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
-  : ARMTargetInfo(Triple, Opts, /*BigEndian=*/false) {}
+  : ARMTargetInfo(Triple, Opts) {}
   void getTargetDefines(const LangOptions &Opts,
 MacroBuilder &Builder) const override {
 Builder.defineMacro("__ARMEL__");
@@ -5531,7 +5526,7 @@
 class ARMbeTargetInfo : public ARMTargetInfo {
 public:
   ARMbeTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
-  : ARMTargetInfo(Triple, Opts, /*BigEndian=*/true) {}
+  : ARMTargetInfo(Triple, Opts) {}
   void getTargetDefines(const LangOptions &Opts,
 MacroBuilder &Builder) const override {
 Builder.defineMacro("__ARMEB__");
@@ -6042,7 +6037,6 @@
 public:
   AArch64leTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
   : AArch64TargetInfo(Triple, Opts) {
-BigEndian = false;
   }
   void getTargetDefines(const LangOptions &Opts,
 MacroBuilder &Builder) const override {
@@ -6113,7 +6107,6 @@
 public:
   HexagonTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
   : TargetInfo(Triple) {
-BigEndian = false;
 // Specify the vector alignment explicitly. For v512x1, the calculated
 // alignment would be 512*alignment(i1), which is 512 bytes, instead of
 // the required minimum of 64 bytes.
@@ -6721,7 +6714,6 @@
SparcV8elTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: SparcV8TargetInfo(Triple, Opts) {
  resetDataLayout("e-m:e-p:32:32-i64:64-f128:64-n32-S64");
- BigEndian = false;
   }
 };
 
@@ -6956,7 +6948,6 @@
 public:
   MSP430TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
   : TargetInfo(Triple) {
-BigEndian = false;
 TLSSupported = false;
 IntWidth = 16;
 IntAlign = 16;
@@ -7106,10 +7097,8 @@
 Int64Type   = SignedLong;
 RegParmMax = 5;
 if (Triple.getArch() == llvm::Triple::bpfeb) {
-  BigEndian = true;
   resetDataLay

Re: [PATCH] D23926: [libcxx] Don't use C99 math ops in -std=c++03 mode

2016-08-26 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

We already provide many C++11 extensions in C++03 mode, why should this be an 
exception?


https://reviews.llvm.org/D23926



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