[PATCH] D31130: B32239 clang-tidy should not warn about array to pointer decay on system macros

2017-03-25 Thread Breno Rodrigues Guimaraes via Phabricator via cfe-commits
brenoguim updated this revision to Diff 93062.
brenoguim added a comment.

- Removed the "#include " which caused problems in environments 
without that header
- Included a directory with -isystem to simulate system headers
- Added a "macro.h" header with definitions of types, functions and macros to 
simulate the assert.h header and others.
- Added checks for behavior in some situations

Some of the checks follow the comment "Not Ok. Should it be ok?"  to point the 
situations in which the check could be considered too strict for reporting such 
as violation. I would like to get feedback specially on them.


https://reviews.llvm.org/D31130

Files:
  clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
  
test/clang-tidy/Inputs/cppcoreguidelines-pro-bounds-array-to-pointer-decay/macro.h
  test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp

Index: test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp
===
--- test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp
+++ test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp
@@ -1,5 +1,7 @@
-// RUN: %check_clang_tidy %s cppcoreguidelines-pro-bounds-array-to-pointer-decay %t
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-bounds-array-to-pointer-decay %t -- -- -isystem%S/Inputs/cppcoreguidelines-pro-bounds-array-to-pointer-decay
+
 #include 
+#include 
 
 namespace gsl {
 template 
@@ -45,3 +47,49 @@
   void *a[2];
   f2(static_cast(a)); // OK, explicit cast
 }
+
+void user_fn_decay_str(const char *);
+void user_fn_decay_int_array(const int *);
+void bug32239() {
+  sys_macro_with_pretty_function_string_decay; // Ok
+  sys_macro_with_sys_string_decay; // Ok
+  sys_macro_with_sys_int_array_decay;  // Ok
+
+  sys_fn_decay_str(__PRETTY_FUNCTION__); // Not Ok - should it be ok?
+  // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]
+
+  sys_fn_decay_str(SYS_STRING);  // Not Ok - should it be ok?
+  // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]
+
+  sys_fn_decay_int_array(SYS_INT_ARRAY); // Not Ok
+  // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]
+
+  user_code_in_sys_macro(sys_fn_decay_str(__PRETTY_FUNCTION__)); // Not Ok - should it be ok?
+  // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]
+
+  user_code_in_sys_macro(sys_fn_decay_str(SYS_STRING));  // Not Ok - should it be ok?
+  // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]
+
+  user_code_in_sys_macro(sys_fn_decay_int_array(SYS_INT_ARRAY)); // Not Ok
+  // CHECK-MESSAGES: :[[@LINE-1]]:49: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]
+
+  const char UserString[1] = "";
+  decay_to_char_pointer_in_macro(UserString); // Not Ok
+  // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]
+
+  decay_to_char_pointer_in_macro(__PRETTY_FUNCTION__); // Not Ok
+  // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]
+
+  int a[5];
+  decay_to_int_pointer_in_macro(a); // Not Ok
+  // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]
+
+  user_fn_decay_str(__PRETTY_FUNCTION__); // Not Ok - should it be ok?
+  // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]
+
+  user_fn_decay_str(SYS_STRING); // Not Ok - should it be ok?
+  // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]
+

r298784 - [coroutines] Add codegen for await and yield expressions

2017-03-25 Thread Gor Nishanov via cfe-commits
Author: gornishanov
Date: Sat Mar 25 21:18:05 2017
New Revision: 298784

URL: http://llvm.org/viewvc/llvm-project?rev=298784=rev
Log:
[coroutines] Add codegen for await and yield expressions

Details:

Emit suspend expression which roughly looks like:

auto && x = CommonExpr();
if (!x.await_ready()) {
   llvm_coro_save();
   x.await_suspend(...); (*)
   llvm_coro_suspend(); (**)
}
x.await_resume();
where the result of the entire expression is the result of x.await_resume()

(*) If x.await_suspend return type is bool, it allows to veto a suspend:
if (x.await_suspend(...))
   llvm_coro_suspend();
(**) llvm_coro_suspend() encodes three possible continuations as a switch 
instruction:

%where-to = call i8 @llvm.coro.suspend(...)
switch i8 %where-to, label %coro.ret [ ; jump to epilogue to suspend
  i8 0, label %yield.ready   ; go here when resumed
  i8 1, label %yield.cleanup ; go here when destroyed
]

Added:
cfe/trunk/test/CodeGenCoroutines/coro-await.cpp
Modified:
cfe/trunk/lib/CodeGen/CGCoroutine.cpp
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
cfe/trunk/lib/CodeGen/CGExprComplex.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CGCoroutine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCoroutine.cpp?rev=298784=298783=298784=diff
==
--- cfe/trunk/lib/CodeGen/CGCoroutine.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCoroutine.cpp Sat Mar 25 21:18:05 2017
@@ -12,35 +12,58 @@
 
//===--===//
 
 #include "CodeGenFunction.h"
+#include "llvm/ADT/ScopeExit.h"
 #include "clang/AST/StmtCXX.h"
 
 using namespace clang;
 using namespace CodeGen;
 
-namespace clang {
-namespace CodeGen {
+using llvm::Value;
+using llvm::BasicBlock;
 
-struct CGCoroData {
+namespace {
+enum class AwaitKind { Init, Normal, Yield, Final };
+static constexpr llvm::StringLiteral AwaitKindStr[] = {"init", "await", 
"yield",
+   "final"};
+}
 
-  // Stores the jump destination just before the final suspend. Coreturn
-  // statements jumps to this point after calling return_xxx promise member.
-  CodeGenFunction::JumpDest FinalJD;
+struct clang::CodeGen::CGCoroData {
+  // What is the current await expression kind and how many
+  // await/yield expressions were encountered so far.
+  // These are used to generate pretty labels for await expressions in LLVM IR.
+  AwaitKind CurrentAwaitKind = AwaitKind::Init;
+  unsigned AwaitNum = 0;
+  unsigned YieldNum = 0;
 
+  // How many co_return statements are in the coroutine. Used to decide whether
+  // we need to add co_return; equivalent at the end of the user authored body.
   unsigned CoreturnCount = 0;
 
+  // A branch to this block is emitted when coroutine needs to suspend.
+  llvm::BasicBlock *SuspendBB = nullptr;
+
+  // Stores the jump destination just before the coroutine memory is freed.
+  // This is the destination that every suspend point jumps to for the cleanup
+  // branch.
+  CodeGenFunction::JumpDest CleanupJD;
+
+  // Stores the jump destination just before the final suspend. The co_return
+  // statements jumps to this point after calling return_xxx promise member.
+  CodeGenFunction::JumpDest FinalJD;
+
   // Stores the llvm.coro.id emitted in the function so that we can supply it
   // as the first argument to coro.begin, coro.alloc and coro.free intrinsics.
   // Note: llvm.coro.id returns a token that cannot be directly expressed in a
   // builtin.
   llvm::CallInst *CoroId = nullptr;
+
   // If coro.id came from the builtin, remember the expression to give better
   // diagnostic. If CoroIdExpr is nullptr, the coro.id was created by
   // EmitCoroutineBody.
   CallExpr const *CoroIdExpr = nullptr;
 };
-}
-}
 
+// Defining these here allows to keep CGCoroData private to this file.
 clang::CodeGen::CodeGenFunction::CGCoroInfo::CGCoroInfo() {}
 CodeGenFunction::CGCoroInfo::~CGCoroInfo() {}
 
@@ -66,6 +89,126 @@ static void createCoroData(CodeGenFuncti
   CurCoro.Data->CoroIdExpr = CoroIdExpr;
 }
 
+// Synthesize a pretty name for a suspend point.
+static SmallString<32> buildSuspendPrefixStr(CGCoroData , AwaitKind Kind) 
{
+  unsigned No = 0;
+  switch (Kind) {
+  case AwaitKind::Init:
+  case AwaitKind::Final:
+break;
+  case AwaitKind::Normal:
+No = ++Coro.AwaitNum;
+break;
+  case AwaitKind::Yield:
+No = ++Coro.YieldNum;
+break;
+  }
+  SmallString<32> Prefix(AwaitKindStr[static_cast(Kind)]);
+  if (No > 1) {
+Twine(No).toVector(Prefix);
+  }
+  return Prefix;
+}
+
+// Emit suspend expression which roughly looks like:
+//
+//   auto && x = CommonExpr();
+//   if (!x.await_ready()) {
+//  llvm_coro_save();
+//  x.await_suspend(...); (*)
+//  llvm_coro_suspend(); (**)
+//   }
+//   x.await_resume();
+//
+// where the result of the entire 

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

2017-03-25 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov updated this revision to Diff 93061.
GorNishanov added a comment.

Thank you very much for the review!

Merged with the top of the trunk and preparing to land


https://reviews.llvm.org/D30809

Files:
  lib/CodeGen/CGCoroutine.cpp
  lib/CodeGen/CGExprAgg.cpp
  lib/CodeGen/CGExprComplex.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/CodeGen/CodeGenFunction.h
  test/CodeGenCoroutines/coro-await.cpp

Index: test/CodeGenCoroutines/coro-await.cpp
===
--- /dev/null
+++ test/CodeGenCoroutines/coro-await.cpp
@@ -0,0 +1,230 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcoroutines-ts -std=c++14 -emit-llvm %s -o - -disable-llvm-passes | FileCheck %s
+
+namespace std {
+namespace experimental {
+template 
+struct coroutine_traits;
+
+template  struct coroutine_handle;
+
+template <>
+struct coroutine_handle {
+  void *ptr;
+  static coroutine_handle from_address(void *);
+};
+
+template 
+struct coroutine_handle : coroutine_handle<> {
+  static coroutine_handle from_address(void *);
+};
+
+}
+}
+
+struct suspend_always {
+  int stuff;
+  bool await_ready();
+  void await_suspend(std::experimental::coroutine_handle<>);
+  void await_resume();
+};
+
+template<>
+struct std::experimental::coroutine_traits {
+  struct promise_type {
+void get_return_object();
+suspend_always initial_suspend();
+suspend_always final_suspend();
+void return_void();
+  };
+};
+
+// CHECK-LABEL: f0(
+extern "C" void f0() {
+
+  co_await suspend_always{};
+  // See if we need to suspend:
+  // --
+  // CHECK: %[[READY:.+]] = call zeroext i1 @_ZN14suspend_always11await_readyEv(%struct.suspend_always* %[[AWAITABLE:.+]])
+  // CHECK: br i1 %[[READY]], label %[[READY_BB:.+]], label %[[SUSPEND_BB:.+]]
+
+  // If we are suspending:
+  // -
+  // CHECK: [[SUSPEND_BB]]:
+  // CHECK: %[[SUSPEND_ID:.+]] = call token @llvm.coro.save(
+  // ---
+  // Build the coroutine handle and pass it to await_suspend
+  // ---
+  // CHECK: %[[FRAME:.+]] = call i8* @llvm.coro.frame()
+  // CHECK: call i8* @_ZNSt12experimental16coroutine_handleINS_16coroutine_traitsIJvEE12promise_typeEE12from_addressEPv(i8* %[[FRAME]])
+  //   ... many lines of code to coerce coroutine_handle into an i8* scalar
+  // CHECK: %[[CH:.+]] = load i8*, i8** %{{.+}}
+  // CHECK: call void @_ZN14suspend_always13await_suspendENSt12experimental16coroutine_handleIvEE(%struct.suspend_always* %[[AWAITABLE]], i8* %[[CH]])
+  // -
+  // Generate a suspend point:
+  // -
+  // CHECK: %[[OUTCOME:.+]] = call i8 @llvm.coro.suspend(token %[[SUSPEND_ID]], i1 false)
+  // CHECK: switch i8 %[[OUTCOME]], label %[[RET_BB:.+]] [
+  // CHECK:   i8 0, label %[[READY_BB]]
+  // CHECK:   i8 1, label %[[CLEANUP_BB:.+]]
+  // CHECK: ]
+
+  // Cleanup code goes here:
+  // ---
+  // CHECK: [[CLEANUP_BB]]:
+
+  // When coroutine is resumed, call await_resume
+  // --
+  // CHECK: [[READY_BB]]:
+  // CHECK:  call void @_ZN14suspend_always12await_resumeEv(%struct.suspend_always* %[[AWAITABLE]])
+}
+
+struct suspend_maybe {
+  float stuff;
+  ~suspend_maybe();
+  bool await_ready();
+  bool await_suspend(std::experimental::coroutine_handle<>);
+  void await_resume();
+};
+
+
+template<>
+struct std::experimental::coroutine_traits {
+  struct promise_type {
+void get_return_object();
+suspend_always initial_suspend();
+suspend_always final_suspend();
+void return_void();
+suspend_maybe yield_value(int);
+  };
+};
+
+// CHECK-LABEL: f1(
+extern "C" void f1(int) {
+  co_yield 42;
+  // CHECK: %[[PROMISE:.+]] = alloca %"struct.std::experimental::coroutine_traits::promise_type"
+  // CHECK: call void @_ZNSt12experimental16coroutine_traitsIJviEE12promise_type11yield_valueEi(%struct.suspend_maybe* sret %[[AWAITER:.+]], %"struct.std::experimental::coroutine_traits::promise_type"* %[[PROMISE]], i32 42)
+
+  // See if we need to suspend:
+  // --
+  // CHECK: %[[READY:.+]] = call zeroext i1 @_ZN13suspend_maybe11await_readyEv(%struct.suspend_maybe* %[[AWAITABLE]])
+  // CHECK: br i1 %[[READY]], label %[[READY_BB:.+]], label %[[SUSPEND_BB:.+]]
+
+  // If we are suspending:
+  // -
+  // CHECK: [[SUSPEND_BB]]:
+  // CHECK: %[[SUSPEND_ID:.+]] = call token @llvm.coro.save(
+  // ---
+  // Build the coroutine handle and pass it to await_suspend
+  // ---
+  // CHECK: %[[FRAME:.+]] = call i8* @llvm.coro.frame()
+  // CHECK: call i8* @_ZNSt12experimental16coroutine_handleINS_16coroutine_traitsIJviEE12promise_typeEE12from_addressEPv(i8* %[[FRAME]])
+  //   ... many lines of code to coerce coroutine_handle into an i8* scalar
+  // CHECK: %[[CH:.+]] = load i8*, i8** %{{.+}}
+  // CHECK: %[[YES:.+]] = call zeroext i1 

[PATCH] D24892: [clang-tidy] Add option "LiteralInitializers" to cppcoreguidelines-pro-type-member-init

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



Comment at: clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp:377
+else if (type->isIntegerType())
+  Initializer = " = 0";
+else if (type->isFloatingType())

mgehre wrote:
> aaron.ballman wrote:
> > What about cases where a suffix is desired, like `U` or `LL`?
> Is this really necessary for initializing to zero?
> The compiler will figure out the correct thing, and I personally find "0" 
> easier to read than "0ULL".
It is necessary because of the way literals are typed. [lex.icon]p2 lists what 
happens when there is no suffix on a literal, but it boils down to the compiler 
picking the first type that can represent the value, out of int, long int, or 
long long int. Without the U or the LL, the type of the literal will not match 
the type of the field. This shouldn't have an impact on the generated code, but 
it may cause diagnostics for some compilers.


https://reviews.llvm.org/D24892



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


[PATCH] D31370: [clang-tidy] Prototype to check for exception specification

2017-03-25 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added inline comments.



Comment at: clang-tidy/modernize/NoexceptCorrectnessCheck.cpp:60
+  N.getNodeAs("direct_throwing_decl")) {
+// FIXME how is that done? i did not find a noThrow predicate
+//if (ThrowingDecl->isNoThrow()) {

JonasToth wrote:
> How can i find out the exception spepcification in a `FunctionDecl`? I would 
> like to check if `noexcept` might be added when it is not justified.
Try `ThrowingDecl ->getType()->getAs()->getNoexceptSpec()`



Comment at: clang-tidy/modernize/NoexceptCorrectnessCheck.cpp:48
+  // hasThrowingExpression
+  anyOf(hasDescendant(cxxDynamicCastExpr()),
+hasDescendant(cxxNewExpr())),

`dynamic_cast` can only throw if the new type is a reference type.



Comment at: test/clang-tidy/modernize-noexcept-correctness.cpp:4
+float throwing(float x) {
+  // CHECK-MESSAGES: :[[@LINE-1]]: 7: warning: function can be marked 
noexcept(false)
+  // CHECK-MESSAGES: :[[@LINE+2]]: 5: note: throw expression here

I find it helpful to get fixits for adding "noexcept", but not so much for 
adding noexcept(false) because this is already the default. I would prefer to 
hide generation of fixits that state the default behind an option.



Comment at: test/clang-tidy/modernize-noexcept-correctness.cpp:42
+
+// Could throw indirectly.
+float complex_wrongly_noexcept(float x, float y) noexcept {

Use `FIXME` here?



Comment at: test/clang-tidy/modernize-noexcept-correctness.cpp:48
+
+// Could be marked noexcept, but wont right now.
+float complex_non_throwing(float x, float y) {

Use `FIXME` here?


Repository:
  rL LLVM

https://reviews.llvm.org/D31370



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


[PATCH] D18914: [clang-tidy] new readability-redundant-inline

2017-03-25 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment.

Friendly ping


https://reviews.llvm.org/D18914



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


[PATCH] D31308: [clang-tidy] new check readability-no-alternative-tokens

2017-03-25 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 93057.
mgehre added a comment.

Rename check to readability-operators-representation


https://reviews.llvm.org/D31308

Files:
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/OperatorsRepresentationCheck.cpp
  clang-tidy/readability/OperatorsRepresentationCheck.h
  clang-tidy/readability/ReadabilityTidyModule.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/readability-operators-representation.rst
  test/clang-tidy/readability-operators-representation.cpp

Index: test/clang-tidy/readability-operators-representation.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-operators-representation.cpp
@@ -0,0 +1,54 @@
+// RUN: %check_clang_tidy %s readability-operators-representation %t
+
+void f() {
+  bool a, b, c;
+
+  c = a and b;
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: operator uses alternative spelling [readability-operators-representation]
+  // CHECK-FIXES: c = a && b;
+  c and_eq a;
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: operator
+  // CHECK-FIXES: c &= a;
+  c = a bitand b;
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: operator
+  // CHECK-FIXES: c = a & b;
+  c = a bitor b;
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: operator
+  // CHECK-FIXES: c = a | b;
+  c = compl a;
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: operator
+  // CHECK-FIXES: c = ~ a;
+  c = not a;
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: operator
+  // CHECK-FIXES: c = ! a;
+  c = a not_eq b;
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: operator
+  // CHECK-FIXES: c = a != b;
+  c = a or b;
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: operator
+  // CHECK-FIXES: c = a || b;
+  c or_eq a;
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: operator
+  // CHECK-FIXES: c |= a;
+  c = a xor b;
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: operator
+  // CHECK-FIXES: c = a ^ b;
+  c xor_eq a;
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: operator
+  // CHECK-FIXES: c ^= a;
+
+#define M a xor
+  // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: operator
+  // CHECK-FIXES: #define M a ^
+  c = M b;
+
+  int arr[2];
+  for (int i : arr) // OK (Here is an implicit != operator.)
+;
+
+  auto ptr =  // OK
+  auto i = -1;   // OK
+  c = a && b;// OK
+  c &= a;// OK
+  c = !a;// OK
+}
Index: docs/clang-tidy/checks/readability-operators-representation.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/readability-operators-representation.rst
@@ -0,0 +1,8 @@
+.. title:: clang-tidy - readability-operators-representation
+
+readability-operators-representation
+=
+
+Flags (and replaces) the alternative tokens for binary and unary operators,
+such as ``not`` (for ``!``), ``bitand`` (for ``&``), ``or`` (for ``||``) or ``not_eq``
+(for ``!=``).
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -145,6 +145,7 @@
readability-misleading-indentation
readability-misplaced-array-index
readability-named-parameter
+   readability-operators-representation
readability-non-const-parameter
readability-redundant-control-flow
readability-redundant-declaration
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -72,6 +72,12 @@
 
   Finds misleading indentation where braces should be introduced or the code should be reformatted.
 
+- New `readability-operators-representation
+  `_ check
+
+  Flags (and replaces) the alternative tokens for binary and unary operators,
+  such as ``not`` (for ``!``) and ``or`` (for ``||``).
+
 - Added `ParameterThreshold` to `readability-function-size`.
 
   Finds functions that have more then `ParameterThreshold` parameters and emits a warning.
Index: clang-tidy/readability/ReadabilityTidyModule.cpp
===
--- clang-tidy/readability/ReadabilityTidyModule.cpp
+++ clang-tidy/readability/ReadabilityTidyModule.cpp
@@ -23,6 +23,7 @@
 #include "MisleadingIndentationCheck.h"
 #include "MisplacedArrayIndexCheck.h"
 #include "NamedParameterCheck.h"
+#include "OperatorsRepresentationCheck.h"
 #include "NonConstParameterCheck.h"
 #include "RedundantControlFlowCheck.h"
 #include "RedundantDeclarationCheck.h"
@@ -66,6 +67,8 @@
 "readability-misleading-indentation");
 CheckFactories.registerCheck(
 "readability-misplaced-array-index");
+CheckFactories.registerCheck(
+"readability-operators-representation");
 CheckFactories.registerCheck(
 "readability-redundant-function-ptr-dereference");
 

[PATCH] D24892: [clang-tidy] Add option "LiteralInitializers" to cppcoreguidelines-pro-type-member-init

2017-03-25 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added inline comments.



Comment at: clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp:377
+else if (type->isIntegerType())
+  Initializer = " = 0";
+else if (type->isFloatingType())

aaron.ballman wrote:
> What about cases where a suffix is desired, like `U` or `LL`?
Is this really necessary for initializing to zero?
The compiler will figure out the correct thing, and I personally find "0" 
easier to read than "0ULL".



Comment at: clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp:379
+else if (type->isFloatingType())
+  Initializer = " = 0.0";
+else if (type->isPointerType())

aaron.ballman wrote:
> Same here for `f`.
This is now fixed in the check.



Comment at: 
test/clang-tidy/cppcoreguidelines-pro-type-member-init-literal-initializers.cpp:1
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-member-init %t -- 
-config="{CheckOptions: [{key: 
"cppcoreguidelines-pro-type-member-init.LiteralInitializers", value: 1}]}" -- 
-std=c++11
+

hokein wrote:
> `-std=c++11` is not needed. This extra compile argument is added by default 
> when running check_clang_tidy.
If I remove ``-std=c++11``, the behavior changes and 
Context.getLangOpts().CPlusPlus11 is false.


https://reviews.llvm.org/D24892



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


[PATCH] D24892: [clang-tidy] Add option "LiteralInitializers" to cppcoreguidelines-pro-type-member-init

2017-03-25 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 93056.
mgehre marked 2 inline comments as done.
mgehre added a comment.

Add suffix for floating point literals; clang-format


https://reviews.llvm.org/D24892

Files:
  clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
  clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/cppcoreguidelines-pro-type-member-init.rst
  
test/clang-tidy/cppcoreguidelines-pro-type-member-init-literal-initializers.cpp

Index: test/clang-tidy/cppcoreguidelines-pro-type-member-init-literal-initializers.cpp
===
--- /dev/null
+++ test/clang-tidy/cppcoreguidelines-pro-type-member-init-literal-initializers.cpp
@@ -0,0 +1,24 @@
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-member-init %t -- -config="{CheckOptions: [{key: "cppcoreguidelines-pro-type-member-init.LiteralInitializers", value: 1}]}" -- -std=c++11
+
+struct T {
+  int i;
+};
+
+struct S {
+  bool b;
+  // CHECK-FIXES: bool b = false;
+  int i;
+  // CHECK-FIXES: int i = 0;
+  float f;
+  // CHECK-FIXES: float f = 0.0f;
+  double d;
+  // CHECK-FIXES: double d = 0.0;
+  long double l;
+  // CHECK-FIXES: double l = 0.0l;
+  int *ptr;
+  // CHECK-FIXES: int *ptr = nullptr;
+  T t;
+  // CHECK-FIXES: T t{};
+  S() {};
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor does not initialize these fields:
+};
Index: docs/clang-tidy/checks/cppcoreguidelines-pro-type-member-init.rst
===
--- docs/clang-tidy/checks/cppcoreguidelines-pro-type-member-init.rst
+++ docs/clang-tidy/checks/cppcoreguidelines-pro-type-member-init.rst
@@ -33,6 +33,10 @@
zero-initialized during construction. For performance critical code, it may
be important to not initialize fixed-size array members. Default is `0`.
 
+.. option:: LiteralInitializers
+   If set to non-zero, the check will provide fix-its with literal initializers
+   (``int i = 0;``) instead of curly braces (``int i{};``).
+
 This rule is part of the "Type safety" profile of the C++ Core
 Guidelines, corresponding to rule Type.6. See
 https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-type-memberinit.
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -67,6 +67,10 @@
 
   Allow custom memory management functions to be considered as well.
 
+- Added `LiteralInitializers` option to `cppcoreguidelines-pro-type-member-init`
+   If set to true, the check will provide fix-its with literal initializers
+   (``int i = 0;``) instead of curly braces (``int i{};``).
+
 - New `readability-misleading-indentation
   `_ check
 
Index: clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.h
===
--- clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.h
+++ clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.h
@@ -65,6 +65,9 @@
 
   // Whether arrays need to be initialized or not. Default is false.
   bool IgnoreArrays;
+  // Whether fix-its for initializers of fundamental type use literals. Only
+  // effective in C++11 mode. Default is false.
+  bool LiteralInitializers;
 };
 
 } // namespace cppcoreguidelines
Index: clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
===
--- clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
+++ clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
@@ -255,7 +255,8 @@
 ProTypeMemberInitCheck::ProTypeMemberInitCheck(StringRef Name,
ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context),
-  IgnoreArrays(Options.get("IgnoreArrays", false)) {}
+  IgnoreArrays(Options.get("IgnoreArrays", false)),
+  LiteralInitializers(Options.get("LiteralInitializers", false)) {}
 
 void ProTypeMemberInitCheck::registerMatchers(MatchFinder *Finder) {
   if (!getLangOpts().CPlusPlus)
@@ -319,6 +320,7 @@
 
 void ProTypeMemberInitCheck::storeOptions(ClangTidyOptions::OptionMap ) {
   Options.store(Opts, "IgnoreArrays", IgnoreArrays);
+  Options.store(Opts, "LiteralInitializers", LiteralInitializers);
 }
 
 // FIXME: Copied from clang/lib/Sema/SemaDeclCXX.cpp.
@@ -343,6 +345,38 @@
   return isIncompleteOrZeroLengthArrayType(Context, Type);
 }
 
+static const char *getInitializer(QualType type, bool LiteralInitializers) {
+  const char *DefaultInitializer = "{}";
+  if (!LiteralInitializers)
+return DefaultInitializer;
+
+  if (type->isPointerType())
+return " = nullptr";
+
+  const BuiltinType *BT =
+  dyn_cast(type->getCanonicalTypeInternal());
+  if (!BT)
+return DefaultInitializer;
+
+  switch (BT->getKind()) {
+  case BuiltinType::Bool:
+return " = false";
+  case 

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

2017-03-25 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 93055.
mgehre added a comment.

Added test to misc; minor wording


https://reviews.llvm.org/D24886

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaStmtAttr.cpp
  test/Misc/ast-dump-attr.cpp
  test/SemaCXX/suppress.cpp

Index: test/SemaCXX/suppress.cpp
===
--- /dev/null
+++ test/SemaCXX/suppress.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only %s -verify
+
+[[gsl::suppress("globally")]];
+
+namespace N {
+  [[gsl::suppress("in-a-namespace")]];
+}
+
+[[gsl::suppress("readability-identifier-naming")]]
+void f_() {
+  int *p;
+  [[gsl::suppress("type", "bounds")]] {
+p = reinterpret_cast(7);
+  }
+
+  [[gsl::suppress]] int x; // expected-error {{'suppress' attribute takes at least 1 argument}}
+  [[gsl::suppress()]] int y; // expected-error {{'suppress' attribute takes at least 1 argument}}
+  int [[gsl::suppress("r")]] z; // expected-error {{'suppress' attribute cannot be applied to types}}
+  [[gsl::suppress(f_)]] float f; // expected-error {{'suppress' attribute requires a string}}
+}
+
+union [[gsl::suppress("type.1")]] U {
+  int i;
+  float f;
+};
Index: test/Misc/ast-dump-attr.cpp
===
--- test/Misc/ast-dump-attr.cpp
+++ test/Misc/ast-dump-attr.cpp
@@ -179,3 +179,25 @@
 __attribute__((external_source_symbol(generated_declaration, defined_in="module", language="Swift")));
 // CHECK: FunctionDecl{{.*}} TestExternalSourceSymbolAttr5
 // CHECK-NEXT: ExternalSourceSymbolAttr{{.*}} "Swift" "module" GeneratedDeclaration
+
+namespace TestSuppress {
+  [[gsl::suppress("at-namespace")]];
+  // CHECK: NamespaceDecl{{.*}} TestSuppress
+  // CHECK-NEXT: EmptyDecl{{.*}}
+  // CHECK-NEXT: SuppressAttr{{.*}} at-namespace
+  [[gsl::suppress("on-decl")]]
+  void TestSuppressFunction();
+  // CHECK: FunctionDecl{{.*}} TestSuppressFunction
+  // CHECK-NEXT SuppressAttr{{.*}} on-decl
+
+  void f() {
+  int *i;
+
+  [[gsl::suppress("on-stmt")]] {
+  // CHECK: AttributedStmt
+  // CHECK-NEXT: SuppressAttr{{.*}} on-stmt
+  // CHECK-NEXT: CompoundStmt
+i = reinterpret_cast(7);
+  }
+}
+}
Index: lib/Sema/SemaStmtAttr.cpp
===
--- lib/Sema/SemaStmtAttr.cpp
+++ lib/Sema/SemaStmtAttr.cpp
@@ -53,6 +53,31 @@
   return ::new (S.Context) auto(Attr);
 }
 
+static Attr *handleSuppressAttr(Sema , Stmt *St, const AttributeList ,
+SourceRange Range) {
+  if (A.getNumArgs() < 1) {
+S.Diag(A.getLoc(), diag::err_attribute_too_few_arguments)
+<< A.getName() << 1;
+return nullptr;
+  }
+
+  std::vector DiagnosticIdentifiers;
+  for (unsigned I = 0, E = A.getNumArgs(); I != E; ++I) {
+StringRef RuleName;
+
+if (!S.checkStringLiteralArgumentAttr(A, I, RuleName, nullptr))
+  return nullptr;
+
+// FIXME: Warn if the rule name is unknown. This is tricky because only
+// clang-tidy knows about available rules.
+DiagnosticIdentifiers.push_back(RuleName);
+  }
+
+  return ::new (S.Context) SuppressAttr(
+  A.getRange(), S.Context, DiagnosticIdentifiers.data(),
+  DiagnosticIdentifiers.size(), A.getAttributeSpellingListIndex());
+}
+
 static Attr *handleLoopHintAttr(Sema , Stmt *St, const AttributeList ,
 SourceRange) {
   IdentifierLoc *PragmaNameLoc = A.getArgAsIdent(0);
@@ -279,6 +304,8 @@
 return handleLoopHintAttr(S, St, A, Range);
   case AttributeList::AT_OpenCLUnrollHint:
 return handleOpenCLUnrollHint(S, St, A, Range);
+  case AttributeList::AT_Suppress:
+return handleSuppressAttr(S, St, A, Range);
   default:
 // if we're here, then we parsed a known attribute, but didn't recognize
 // it as a statement attribute => it is declaration attribute
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -4075,6 +4075,26 @@
   }
 }
 
+static void handleSuppressAttr(Sema , Decl *D, const AttributeList ) {
+  if (!checkAttributeAtLeastNumArgs(S, Attr, 1))
+return;
+
+  std::vector DiagnosticIdentifiers;
+  for (unsigned I = 0, E = Attr.getNumArgs(); I != E; ++I) {
+StringRef RuleName;
+
+if (!S.checkStringLiteralArgumentAttr(Attr, I, RuleName, nullptr))
+  return;
+
+// FIXME: Warn if the rule name is unknown. This is tricky because only
+// clang-tidy knows about available rules.
+DiagnosticIdentifiers.push_back(RuleName);
+  }
+  D->addAttr(::new (S.Context) SuppressAttr(
+  Attr.getRange(), S.Context, DiagnosticIdentifiers.data(),
+  DiagnosticIdentifiers.size(), Attr.getAttributeSpellingListIndex()));
+}
+
 bool Sema::CheckCallingConvAttr(const AttributeList , CallingConv , 
 const FunctionDecl 

Re: r298765 - Add the _CALL_LINUX preprocessor define for ppc linux platforms.

2017-03-25 Thread Eric Christopher via cfe-commits
Reading comprehension is hard. :)

Thanks for the catch.

echristo@athyra ~/s/l/t/clang> git svn dcommit
Committing to https://llvm.org/svn/llvm-project/cfe/trunk ...
M lib/Basic/Targets.cpp
M test/Preprocessor/init.c
Committed r298778

-eric

On Sat, Mar 25, 2017 at 12:44 AM David Majnemer 
wrote:

> Shouldn't this only be defined on 64-bit PPC platforms? I think that's
> what GCC does:
> https://github.com/gcc-mirror/gcc/blob/700a97608cadfe8adcd1a98e6388a5cbee9d76f6/gcc/config/rs6000/linux64.h#L372
>
> On Fri, Mar 24, 2017 at 8:33 PM, Eric Christopher via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: echristo
> Date: Fri Mar 24 22:33:59 2017
> New Revision: 298765
>
> URL: http://llvm.org/viewvc/llvm-project?rev=298765=rev
> Log:
> Add the _CALL_LINUX preprocessor define for ppc linux platforms.
>
> This typically is only for a new enough linker (bfd >= 2.16.2 or gold), but
> our ppc suppport post-dates this and it should work on all linux
> platforms. It
> is guaranteed to work on all elfv2 platforms.
>
> Modified:
> cfe/trunk/lib/Basic/Targets.cpp
> cfe/trunk/test/Preprocessor/init.c
>
> Modified: cfe/trunk/lib/Basic/Targets.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=298765=298764=298765=diff
>
> ==
> --- cfe/trunk/lib/Basic/Targets.cpp (original)
> +++ cfe/trunk/lib/Basic/Targets.cpp Fri Mar 24 22:33:59 2017
> @@ -1237,6 +1237,12 @@ void PPCTargetInfo::getTargetDefines(con
>if (ABI == "elfv2")
>  Builder.defineMacro("_CALL_ELF", "2");
>
> +  // This typically is only for a new enough linker (bfd >= 2.16.2 or
> gold), but
> +  // our suppport post-dates this and it should work on all linux
> platforms. It
> +  // is guaranteed to work on all elfv2 platforms.
> +  if (getTriple().getOS() == llvm::Triple::Linux)
> +Builder.defineMacro("_CALL_LINUX", "1");
> +
>// Subtarget options.
>Builder.defineMacro("__NATURAL_ALIGNMENT__");
>Builder.defineMacro("__REGISTER_PREFIX__", "");
>
> Modified: cfe/trunk/test/Preprocessor/init.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=298765=298764=298765=diff
>
> ==
> --- cfe/trunk/test/Preprocessor/init.c (original)
> +++ cfe/trunk/test/Preprocessor/init.c Fri Mar 24 22:33:59 2017
> @@ -6144,6 +6144,7 @@
>  // PPC64-LINUX:#define _ARCH_PPC 1
>  // PPC64-LINUX:#define _ARCH_PPC64 1
>  // PPC64-LINUX:#define _BIG_ENDIAN 1
> +// PPC64-LINUX:#define _CALL_LINUX 1
>  // PPC64-LINUX:#define _LP64 1
>  // PPC64-LINUX:#define __BIGGEST_ALIGNMENT__ 16
>  // PPC64-LINUX:#define __BIG_ENDIAN__ 1
> @@ -6346,6 +6347,11 @@
>  // PPC64-ELFv1:#define _CALL_ELF 1
>  // PPC64-ELFv2:#define _CALL_ELF 2
>  //
> +// Most of this is encompassed in other places.
> +// RUN: %clang_cc1 -E -dM -ffreestanding
> -triple=powerpc64le-unknown-linux-gnu -target-abi elfv2 < /dev/null |
> FileCheck -match-full-lines -check-prefix PPC64LE-LINUX %s
> +//
> +// PPC64LE-LINUX:#define _CALL_LINUX 1
> +//
>  // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-none-none
> -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix
> PPC %s
>  //
>  // PPC:#define _ARCH_PPC 1
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r298778 - _CALL_LINUX is only defined on 64-bit ppc linux platforms, not 32-bit.

2017-03-25 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Sat Mar 25 14:26:04 2017
New Revision: 298778

URL: http://llvm.org/viewvc/llvm-project?rev=298778=rev
Log:
_CALL_LINUX is only defined on 64-bit ppc linux platforms, not 32-bit.
Adjust and add a test for the 32-bit side.

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=298778=298777=298778=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat Mar 25 14:26:04 2017
@@ -1238,9 +1238,9 @@ void PPCTargetInfo::getTargetDefines(con
 Builder.defineMacro("_CALL_ELF", "2");
 
   // This typically is only for a new enough linker (bfd >= 2.16.2 or gold), 
but
-  // our suppport post-dates this and it should work on all linux platforms. It
-  // is guaranteed to work on all elfv2 platforms.
-  if (getTriple().getOS() == llvm::Triple::Linux)
+  // our suppport post-dates this and it should work on all 64-bit ppc linux
+  // platforms. It is guaranteed to work on all elfv2 platforms.
+  if (getTriple().getOS() == llvm::Triple::Linux && PointerWidth == 64)
 Builder.defineMacro("_CALL_LINUX", "1");
 
   // Subtarget options.

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=298778=298777=298778=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Sat Mar 25 14:26:04 2017
@@ -6747,6 +6747,10 @@
 // PPC-LINUX:#define __powerpc__ 1
 // PPC-LINUX:#define __ppc__ 1
 //
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-unknown-linux-gnu 
-fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix 
PPC32-LINUX %s
+//
+// PPC32-LINUX-NOT: _CALL_LINUX
+//
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-apple-darwin8 < 
/dev/null | FileCheck -match-full-lines -check-prefix PPC-DARWIN %s
 //
 // PPC-DARWIN:#define _ARCH_PPC 1


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


[PATCH] D31370: [clang-tidy] Prototype to check for exception specification

2017-03-25 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added a comment.

Please mention this check in docs/ReleaseNotes.rst (in alphabetical order).




Comment at: docs/clang-tidy/checks/modernize-noexcept-correctness.rst:7
+This check will mark functions as noexcept if that is possible.
+`noexcept` is a new keyword in C++ 11 to signal, that no exception will escape 
from 
+the function annotated with it. Some examples to show how this new feature is 
used are below.

Please highlight language constructs with ``.



Comment at: docs/clang-tidy/checks/modernize-noexcept-correctness.rst:16
+int i = 0;
+i+= 42;
+return i;

Please run Clang-format over all code snippets.



Comment at: docs/clang-tidy/checks/modernize-noexcept-correctness.rst:41
+
+- AnnotateThrow -> boolean if a function that can throw for sure will be 
annotated with `noexcept(false)`

Please highlight language constructs with ``.


Repository:
  rL LLVM

https://reviews.llvm.org/D31370



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


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

2017-03-25 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

Looks great, thanks.


https://reviews.llvm.org/D30809



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


[PATCH] D31005: [Objective-C] Fix "repeated use of weak" warning with -fobjc-weak

2017-03-25 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

LGTM, thanks.


https://reviews.llvm.org/D31005



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


[PATCH] D31276: Add #pragma clang fast_math

2017-03-25 Thread Adam Nemet via Phabricator via cfe-commits
anemet added a comment.

In https://reviews.llvm.org/D31276#710608, @hfinkel wrote:

> In https://reviews.llvm.org/D31276#709111, @anemet wrote:
>
> > In https://reviews.llvm.org/D31276#708992, @hfinkel wrote:
> >
> > > High-level comment ;)
> > >
> > >   #pragma clang fast_math contract_fast(on)
> > >   
> > >
> > > This seems a bit unfortunate because 'fast' appears twice? How are we 
> > > planning on naming the other fast-math flags? Maybe we should just name 
> > > it:
> >
> >
> > This is just pure laziness on my part, I was hoping that all these flags 
> > can be implemented with on/off but if you find it confusing that's a good 
> > indicator.
> >
> > > 
> > > 
> > >   #pragma clang math constract_fast(on)
> > >
> > > 
> > > or
> > > 
> > >   #pragma clang math contract(fast) // we could also accept off/on here 
> > > for consistency and compatibility with the standard pragma
> > >
> > > 
> > > or maybe fp_math or floating_point_math or floating_point or fp instead 
> > > of math.
> > > 
> > > I think that I prefer this last form (because it does not repeat 'fast' 
> > > and also makes our extension a pure superset of the standard pragma).
> > > 
> > > What do you want to name the other flags? I'd prefer if they're 
> > > grammatically consistent. Maybe we should stick closely to the 
> > > command-line options, and have:
> > > 
> > >   fp_contract(on/off/fast)
> > >   unsafe_optimizations(on/off)
> > >   finite_only(on/off)
> > >
> > > 
> > > What do you think?
> >
> > I really like #pragma clang fp or fp_math because contraction feels 
> > different from the other fast-math flags.  That said then we don't want to 
> > repeat fp in fp_contract.
> >
> > We should probably have the full list to make sure it works though with all 
> > the FMFs.  Here is a straw-man proposal:
> >
> >   UnsafeAlgebra  #pragma clang fp unsafe_optimizations(on/off)
> >   NoNaNs #pragma clang fp no_nans(on/off)
> >   NoInfs#pragma clang fp finite_only(on/off)
> >   NoSignedZeros #pragma clang fp no_signed_zeros(on/off)
> >   AllowReciprocal#pragma clang fp reciprocal_math
> >   AllowContract   #pragma clang fp contract(on/off/fast)
> >
> >
> > The negative ones feel a bit strange...   What do you think?
>
>
> I agree. The negative ones feel a bit strange. Why should we have no_nans(on) 
> instead of nans(off)? However, I feel that the negative sense is less 
> ambiguous - they better match how I think about it and makes a strict 
> environment one where all of these are 'off', and I like that consistency. In 
> short, I like this proposal.


Great, thanks!  I'll update the patch tonight.


https://reviews.llvm.org/D31276



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


[PATCH] D31276: Add #pragma clang fast_math

2017-03-25 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel added a comment.

In https://reviews.llvm.org/D31276#709111, @anemet wrote:

> In https://reviews.llvm.org/D31276#708992, @hfinkel wrote:
>
> > High-level comment ;)
> >
> >   #pragma clang fast_math contract_fast(on)
> >   
> >
> > This seems a bit unfortunate because 'fast' appears twice? How are we 
> > planning on naming the other fast-math flags? Maybe we should just name it:
>
>
> This is just pure laziness on my part, I was hoping that all these flags can 
> be implemented with on/off but if you find it confusing that's a good 
> indicator.
>
> > 
> > 
> >   #pragma clang math constract_fast(on)
> >
> > 
> > or
> > 
> >   #pragma clang math contract(fast) // we could also accept off/on here for 
> > consistency and compatibility with the standard pragma
> >
> > 
> > or maybe fp_math or floating_point_math or floating_point or fp instead of 
> > math.
> > 
> > I think that I prefer this last form (because it does not repeat 'fast' and 
> > also makes our extension a pure superset of the standard pragma).
> > 
> > What do you want to name the other flags? I'd prefer if they're 
> > grammatically consistent. Maybe we should stick closely to the command-line 
> > options, and have:
> > 
> >   fp_contract(on/off/fast)
> >   unsafe_optimizations(on/off)
> >   finite_only(on/off)
> >
> > 
> > What do you think?
>
> I really like #pragma clang fp or fp_math because contraction feels different 
> from the other fast-math flags.  That said then we don't want to repeat fp in 
> fp_contract.
>
> We should probably have the full list to make sure it works though with all 
> the FMFs.  Here is a straw-man proposal:
>
>   UnsafeAlgebra  #pragma clang fp unsafe_optimizations(on/off)
>   NoNaNs #pragma clang fp no_nans(on/off)
>   NoInfs#pragma clang fp finite_only(on/off)
>   NoSignedZeros #pragma clang fp no_signed_zeros(on/off)
>   AllowReciprocal#pragma clang fp reciprocal_math
>   AllowContract   #pragma clang fp contract(on/off/fast)
>
>
> The negative ones feel a bit strange...   What do you think?


I agree. The negative ones feel a bit strange. Why should we have no_nans(on) 
instead of nans(off)? However, I feel that the negative sense is less ambiguous 
- they better match how I think about it and makes a strict environment one 
where all of these are 'off', and I like that consistency. In short, I like 
this proposal.


https://reviews.llvm.org/D31276



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


r298773 - [AMDGPU] Make AMDGPUTargetInfo::AS private

2017-03-25 Thread Yaxun Liu via cfe-commits
Author: yaxunl
Date: Sat Mar 25 06:34:41 2017
New Revision: 298773

URL: http://llvm.org/viewvc/llvm-project?rev=298773=rev
Log:
[AMDGPU] Make AMDGPUTargetInfo::AS private

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

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=298773=298772=298773=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat Mar 25 06:34:41 2017
@@ -2110,6 +2110,7 @@ class AMDGPUTargetInfo final : public Ta
   bool hasFMAF:1;
   bool hasLDEXPF:1;
   bool hasFullSpeedFP32Denorms:1;
+  const AddrSpace AS;
 
   static bool isAMDGCN(const llvm::Triple ) {
 return TT.getArch() == llvm::Triple::amdgcn;
@@ -2371,8 +2372,6 @@ public:
   uint64_t getNullPointerValue(unsigned AS) const override {
 return AS == LangAS::opencl_local ? ~0 : 0;
   }
-
-  const AddrSpace AS;
 };
 
 const Builtin::Info AMDGPUTargetInfo::BuiltinInfo[] = {


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


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

2017-03-25 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added inline comments.



Comment at: lib/StaticAnalyzer/Checkers/CloneChecker.cpp:147
+// different algorithm).
+// TODO: In very big clones even multiple variables can be unintended,
+// so replacing this number with a percentage could better handle such

Could you transform the TODO into a FIXME?



Comment at: lib/StaticAnalyzer/Checkers/CloneChecker.cpp:172
 // which may confuse the user.
 // Think how to perform more accurate suggestions?
 

Could you add a FIXME here?


https://reviews.llvm.org/D23418



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


RE: r298767 - [AMDGPU] Switch address space mapping by triple environment amdgiz

2017-03-25 Thread Liu, Yaxun (Sam) via cfe-commits
Thanks for your comments. I will fix that.

Sam

From: Eric Christopher [mailto:echri...@gmail.com]
Sent: Saturday, March 25, 2017 1:52 AM
To: Liu, Yaxun (Sam) ; cfe-commits@lists.llvm.org
Subject: Re: r298767 - [AMDGPU] Switch address space mapping by triple 
environment amdgiz


On Fri, Mar 24, 2017 at 8:58 PM Yaxun Liu via cfe-commits 
> wrote:
Author: yaxunl
Date: Fri Mar 24 22:46:25 2017
New Revision: 298767

URL: http://llvm.org/viewvc/llvm-project?rev=298767=rev
Log:
[AMDGPU] Switch address space mapping by triple environment amdgiz

For target environment amdgiz and amdgizcl (giz means Generic Is Zero), AMDGPU 
will use new address space mapping where generic address space is 0 and private 
address space is 5. The data layout is also changed correspondingly.

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

Added:

cfe/trunk/test/CodeGenOpenCL/amdgpu-env-amdgiz.cl
Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=298767=298766=298767=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Mar 24 22:46:25 2017
@@ -2027,14 +2027,23 @@ ArrayRef NVPTXTargetInfo::
   return llvm::makeArrayRef(GCCRegNames);
 }

-static const unsigned AMDGPUAddrSpaceMap[] = {
-  1,// opencl_global
-  3,// opencl_local
-  2,// opencl_constant
-  4,// opencl_generic
-  1,// cuda_device
-  2,// cuda_constant
-  3 // cuda_shared
+static const LangAS::Map AMDGPUPrivateIsZeroMap = {
+1,  // opencl_global
+3,  // opencl_local
+2,  // opencl_constant
+4,  // opencl_generic
+1,  // cuda_device
+2,  // cuda_constant
+3   // cuda_shared
+};
+static const LangAS::Map AMDGPUGenericIsZeroMap = {
+1,  // opencl_global
+3,  // opencl_local
+4,  // opencl_constant
+0,  // opencl_generic
+1,  // cuda_device
+4,  // cuda_constant
+3   // cuda_shared
 };

 // If you edit the description strings, make sure you update
@@ -2044,15 +2053,39 @@ static const char *const DataLayoutStrin
   "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128"
   "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64";

-static const char *const DataLayoutStringSI =
+static const char *const DataLayoutStringSIPrivateIsZero =
   "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32"
   "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128"
   "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64";

+static const char *const DataLayoutStringSIGenericIsZero =
+  "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32"
+  "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128"
+  "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64";
+
 class AMDGPUTargetInfo final : public TargetInfo {
   static const Builtin::Info BuiltinInfo[];
   static const char * const GCCRegNames[];

+  struct AddrSpace {
+unsigned Generic, Global, Local, Constant, Private;
+AddrSpace(bool IsGenericZero_ = false){
+  if (IsGenericZero_) {
+Generic   = 0;
+Global= 1;
+Local = 3;
+Constant  = 4;
+Private   = 5;
+  } else {
+Generic   = 4;
+Global= 1;
+Local = 3;
+Constant  = 2;
+Private   = 0;
+  }
+}
+  };
+
   /// \brief The GPU profiles supported by the AMDGPU target.
   enum GPUKind {
 GK_NONE,
@@ -2079,6 +2112,10 @@ class AMDGPUTargetInfo final : public Ta
 return TT.getArch() == llvm::Triple::amdgcn;
   }

+  static bool isGenericZero(const llvm::Triple ) {
+return TT.getEnvironmentName() == "amdgiz" ||
+TT.getEnvironmentName() == "amdgizcl";
+  }
 public:
   AMDGPUTargetInfo(const llvm::Triple , const TargetOptions )
 : TargetInfo(Triple) ,
@@ -2086,17 +2123,21 @@ public:
   hasFP64(false),
   hasFMAF(false),
   hasLDEXPF(false),
-  hasFullSpeedFP32Denorms(false){
+  hasFullSpeedFP32Denorms(false),
+  AS(isGenericZero(Triple)){
 if (getTriple().getArch() == llvm::Triple::amdgcn) {
   hasFP64 = true;
   hasFMAF = true;
   hasLDEXPF = true;
 }
-
+auto IsGenericZero = isGenericZero(Triple);
 resetDataLayout(getTriple().getArch() == llvm::Triple::amdgcn ?
-DataLayoutStringSI : DataLayoutStringR600);
+(IsGenericZero ? DataLayoutStringSIGenericIsZero :
+DataLayoutStringSIPrivateIsZero)
+: DataLayoutStringR600);

-AddrSpaceMap = 
+AddrSpaceMap = IsGenericZero ?  :
+
 UseAddrSpaceMapMangling = true;
   }

@@ -2104,14 +2145,10 @@ public:
 if (GPU <= GK_CAYMAN)
   return 32;

-switch(AddrSpace) {
-  default:
-return 64;
-  case 0:
-  case 3:
-  

Re: r298765 - Add the _CALL_LINUX preprocessor define for ppc linux platforms.

2017-03-25 Thread David Majnemer via cfe-commits
Shouldn't this only be defined on 64-bit PPC platforms? I think that's what
GCC does:
https://github.com/gcc-mirror/gcc/blob/700a97608cadfe8adcd1a98e6388a5cbee9d76f6/gcc/config/rs6000/linux64.h#L372

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

> Author: echristo
> Date: Fri Mar 24 22:33:59 2017
> New Revision: 298765
>
> URL: http://llvm.org/viewvc/llvm-project?rev=298765=rev
> Log:
> Add the _CALL_LINUX preprocessor define for ppc linux platforms.
>
> This typically is only for a new enough linker (bfd >= 2.16.2 or gold), but
> our ppc suppport post-dates this and it should work on all linux
> platforms. It
> is guaranteed to work on all elfv2 platforms.
>
> Modified:
> cfe/trunk/lib/Basic/Targets.cpp
> cfe/trunk/test/Preprocessor/init.c
>
> Modified: cfe/trunk/lib/Basic/Targets.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/
> Targets.cpp?rev=298765=298764=298765=diff
> 
> ==
> --- cfe/trunk/lib/Basic/Targets.cpp (original)
> +++ cfe/trunk/lib/Basic/Targets.cpp Fri Mar 24 22:33:59 2017
> @@ -1237,6 +1237,12 @@ void PPCTargetInfo::getTargetDefines(con
>if (ABI == "elfv2")
>  Builder.defineMacro("_CALL_ELF", "2");
>
> +  // This typically is only for a new enough linker (bfd >= 2.16.2 or
> gold), but
> +  // our suppport post-dates this and it should work on all linux
> platforms. It
> +  // is guaranteed to work on all elfv2 platforms.
> +  if (getTriple().getOS() == llvm::Triple::Linux)
> +Builder.defineMacro("_CALL_LINUX", "1");
> +
>// Subtarget options.
>Builder.defineMacro("__NATURAL_ALIGNMENT__");
>Builder.defineMacro("__REGISTER_PREFIX__", "");
>
> Modified: cfe/trunk/test/Preprocessor/init.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> Preprocessor/init.c?rev=298765=298764=298765=diff
> 
> ==
> --- cfe/trunk/test/Preprocessor/init.c (original)
> +++ cfe/trunk/test/Preprocessor/init.c Fri Mar 24 22:33:59 2017
> @@ -6144,6 +6144,7 @@
>  // PPC64-LINUX:#define _ARCH_PPC 1
>  // PPC64-LINUX:#define _ARCH_PPC64 1
>  // PPC64-LINUX:#define _BIG_ENDIAN 1
> +// PPC64-LINUX:#define _CALL_LINUX 1
>  // PPC64-LINUX:#define _LP64 1
>  // PPC64-LINUX:#define __BIGGEST_ALIGNMENT__ 16
>  // PPC64-LINUX:#define __BIG_ENDIAN__ 1
> @@ -6346,6 +6347,11 @@
>  // PPC64-ELFv1:#define _CALL_ELF 1
>  // PPC64-ELFv2:#define _CALL_ELF 2
>  //
> +// Most of this is encompassed in other places.
> +// RUN: %clang_cc1 -E -dM -ffreestanding 
> -triple=powerpc64le-unknown-linux-gnu
> -target-abi elfv2 < /dev/null | FileCheck -match-full-lines -check-prefix
> PPC64LE-LINUX %s
> +//
> +// PPC64LE-LINUX:#define _CALL_LINUX 1
> +//
>  // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-none-none
> -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix
> PPC %s
>  //
>  // PPC:#define _ARCH_PPC 1
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r298771 - Update the comment on not yet generated preprocessor defines to remove __LONGDOUBLE128.

2017-03-25 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Sat Mar 25 01:38:57 2017
New Revision: 298771

URL: http://llvm.org/viewvc/llvm-project?rev=298771=rev
Log:
Update the comment on not yet generated preprocessor defines to remove 
__LONGDOUBLE128.

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

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=298771=298770=298771=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat Mar 25 01:38:57 2017
@@ -1412,7 +1412,6 @@ void PPCTargetInfo::getTargetDefines(con
   //   __RSQRTEF__
   //   _SOFT_DOUBLE_
   //   __NO_LWSYNC__
-  //   __LONGDOUBLE128
   //   __CMODEL_MEDIUM__
   //   __CMODEL_LARGE__
   //   _CALL_SYSV


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


r298770 - Add the __LONGDOUBLE128 define for ppc targets that have 128 bit long doubles.

2017-03-25 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Sat Mar 25 01:37:23 2017
New Revision: 298770

URL: http://llvm.org/viewvc/llvm-project?rev=298770=rev
Log:
Add the __LONGDOUBLE128 define for ppc targets that have 128 bit long doubles.

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=298770=298769=298770=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat Mar 25 01:37:23 2017
@@ -1248,8 +1248,10 @@ void PPCTargetInfo::getTargetDefines(con
   Builder.defineMacro("__REGISTER_PREFIX__", "");
 
   // FIXME: Should be controlled by command line option.
-  if (LongDoubleWidth == 128)
+  if (LongDoubleWidth == 128) {
 Builder.defineMacro("__LONG_DOUBLE_128__");
+Builder.defineMacro("__LONGDOUBLE128");
+  }
 
   // Define this for elfv2 (64-bit only) or 64-bit darwin.
   if (ABI == "elfv2" ||

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=298770=298769=298770=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Sat Mar 25 01:37:23 2017
@@ -5436,6 +5436,7 @@
 // PPC603E:#define __LDBL_MIN_10_EXP__ (-291)
 // PPC603E:#define __LDBL_MIN_EXP__ (-968)
 // PPC603E:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L
+// PPC603E:#define __LONGDOUBLE128 1
 // PPC603E:#define __LONG_DOUBLE_128__ 1
 // PPC603E:#define __LONG_LONG_MAX__ 9223372036854775807LL
 // PPC603E:#define __LONG_MAX__ 2147483647L
@@ -5638,6 +5639,7 @@
 // PPC64:#define __LDBL_MIN_10_EXP__ (-291)
 // PPC64:#define __LDBL_MIN_EXP__ (-968)
 // PPC64:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L
+// PPC64:#define __LONGDOUBLE128 1
 // PPC64:#define __LONG_DOUBLE_128__ 1
 // PPC64:#define __LONG_LONG_MAX__ 9223372036854775807LL
 // PPC64:#define __LONG_MAX__ 9223372036854775807L
@@ -5843,6 +5845,7 @@
 // PPC64LE:#define __LDBL_MIN_EXP__ (-968)
 // PPC64LE:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L
 // PPC64LE:#define __LITTLE_ENDIAN__ 1
+// PPC64LE:#define __LONGDOUBLE128 1
 // PPC64LE:#define __LONG_DOUBLE_128__ 1
 // PPC64LE:#define __LONG_LONG_MAX__ 9223372036854775807LL
 // PPC64LE:#define __LONG_MAX__ 9223372036854775807L
@@ -6262,6 +6265,7 @@
 // PPC64-LINUX:#define __LDBL_MIN_10_EXP__ (-291)
 // PPC64-LINUX:#define __LDBL_MIN_EXP__ (-968)
 // PPC64-LINUX:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L
+// PPC64-LINUX:#define __LONGDOUBLE128 1
 // PPC64-LINUX:#define __LONG_DOUBLE_128__ 1
 // PPC64-LINUX:#define __LONG_LONG_MAX__ 9223372036854775807LL
 // PPC64-LINUX:#define __LONG_MAX__ 9223372036854775807L
@@ -6474,6 +6478,7 @@
 // PPC:#define __LDBL_MIN_10_EXP__ (-291)
 // PPC:#define __LDBL_MIN_EXP__ (-968)
 // PPC:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L
+// PPC:#define __LONGDOUBLE128 1
 // PPC:#define __LONG_DOUBLE_128__ 1
 // PPC:#define __LONG_LONG_MAX__ 9223372036854775807LL
 // PPC:#define __LONG_MAX__ 2147483647L
@@ -,6 +6671,7 @@
 // PPC-LINUX:#define __LDBL_MIN_10_EXP__ (-291)
 // PPC-LINUX:#define __LDBL_MIN_EXP__ (-968)
 // PPC-LINUX:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L
+// PPC-LINUX:#define __LONGDOUBLE128 1
 // PPC-LINUX:#define __LONG_DOUBLE_128__ 1
 // PPC-LINUX:#define __LONG_LONG_MAX__ 9223372036854775807LL
 // PPC-LINUX:#define __LONG_MAX__ 2147483647L
@@ -6858,6 +6864,7 @@
 // PPC-DARWIN:#define __LDBL_MIN_10_EXP__ (-291)
 // PPC-DARWIN:#define __LDBL_MIN_EXP__ (-968)
 // PPC-DARWIN:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L
+// PPC-DARWIN:#define __LONGDOUBLE128 1
 // PPC-DARWIN:#define __LONG_DOUBLE_128__ 1
 // PPC-DARWIN:#define __LONG_LONG_MAX__ 9223372036854775807LL
 // PPC-DARWIN:#define __LONG_MAX__ 2147483647L


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