r254876 - [PGO] Instrument only base constructors and destructors.

2015-12-06 Thread Serge Pavlov via cfe-commits
Author: sepavloff
Date: Sun Dec  6 08:32:39 2015
New Revision: 254876

URL: http://llvm.org/viewvc/llvm-project?rev=254876=rev
Log:
[PGO] Instrument only base constructors and destructors.

Constructors and destructors may be represented by several functions
in IR. Only base structors correspond to source code, others are
small pieces of code and eventually call the base variant. In this
case instrumentation of non-base structors has little sense, this
fix remove it. Now profile data of a declaration corresponds to
exactly one function in IR, it agrees with the current logic of the
profile data loading.

This change fixes PR24996.

Differential Revision: http://reviews.llvm.org/D15158

Added:
cfe/trunk/test/Profile/cxx-structors.cpp
Modified:
cfe/trunk/lib/CodeGen/CGBlocks.cpp
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
cfe/trunk/lib/CodeGen/CodeGenPGO.h
cfe/trunk/test/Profile/cxx-virtual-destructor-calls.cpp

Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=254876=254875=254876=diff
==
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Sun Dec  6 08:32:39 2015
@@ -1241,7 +1241,7 @@ CodeGenFunction::GenerateBlockFunction(G
   if (IsLambdaConversionToBlock)
 EmitLambdaBlockInvokeBody();
   else {
-PGO.assignRegionCounters(blockDecl, fn);
+PGO.assignRegionCounters(GlobalDecl(blockDecl), fn);
 incrementProfileCounter(blockDecl->getBody());
 EmitStmt(blockDecl->getBody());
   }

Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=254876=254875=254876=diff
==
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Sun Dec  6 08:32:39 2015
@@ -557,7 +557,7 @@ static llvm::Value *emitARCRetainLoadOfS
 /// its pointer, name, and types registered in the class struture.
 void CodeGenFunction::GenerateObjCMethod(const ObjCMethodDecl *OMD) {
   StartObjCMethod(OMD, OMD->getClassInterface());
-  PGO.assignRegionCounters(OMD, CurFn);
+  PGO.assignRegionCounters(GlobalDecl(OMD), CurFn);
   assert(isa(OMD->getBody()));
   incrementProfileCounter(OMD->getBody());
   EmitCompoundStmtWithoutScope(*cast(OMD->getBody()));

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=254876=254875=254876=diff
==
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Sun Dec  6 08:32:39 2015
@@ -2170,7 +2170,7 @@ CodeGenFunction::GenerateCapturedStmtFun
 CXXThisValue = EmitLoadOfLValue(ThisLValue, Loc).getScalarVal();
   }
 
-  PGO.assignRegionCounters(CD, F);
+  PGO.assignRegionCounters(GlobalDecl(CD), F);
   CapturedStmtInfo->EmitBody(*this, CD->getBody());
   FinishFunction(CD->getBodyRBrace());
 

Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=254876=254875=254876=diff
==
--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Sun Dec  6 08:32:39 2015
@@ -185,7 +185,7 @@ CodeGenFunction::GenerateOpenMPCapturedS
 ++Cnt, ++I;
   }
 
-  PGO.assignRegionCounters(CD, F);
+  PGO.assignRegionCounters(GlobalDecl(CD), F);
   CapturedStmtInfo->EmitBody(*this, CD->getBody());
   FinishFunction(CD->getBodyRBrace());
 

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=254876=254875=254876=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Sun Dec  6 08:32:39 2015
@@ -957,8 +957,7 @@ void CodeGenFunction::GenerateCode(Globa
   StartFunction(GD, ResTy, Fn, FnInfo, Args, Loc, BodyRange.getBegin());
 
   // Generate the body of the function.
-  PGO.checkGlobalDecl(GD);
-  PGO.assignRegionCounters(GD.getDecl(), CurFn);
+  PGO.assignRegionCounters(GD, CurFn);
   if (isa(FD))
 EmitDestructorBody(Args);
   else if (isa(FD))

Modified: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=254876=254875=254876=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Sun Dec  6 08:32:39 2015
@@ -605,27 +605,24 @@ 

Re: [PATCH] D15158: [PGO] Instrument only base constructors and destructors.

2015-12-06 Thread Serge Pavlov via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL254876: [PGO] Instrument only base constructors and 
destructors. (authored by sepavloff).

Changed prior to commit:
  http://reviews.llvm.org/D15158?vs=41744=42011#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15158

Files:
  cfe/trunk/lib/CodeGen/CGBlocks.cpp
  cfe/trunk/lib/CodeGen/CGObjC.cpp
  cfe/trunk/lib/CodeGen/CGStmt.cpp
  cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
  cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
  cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
  cfe/trunk/lib/CodeGen/CodeGenPGO.h
  cfe/trunk/test/Profile/cxx-structors.cpp
  cfe/trunk/test/Profile/cxx-virtual-destructor-calls.cpp

Index: cfe/trunk/test/Profile/cxx-virtual-destructor-calls.cpp
===
--- cfe/trunk/test/Profile/cxx-virtual-destructor-calls.cpp
+++ cfe/trunk/test/Profile/cxx-virtual-destructor-calls.cpp
@@ -13,18 +13,25 @@
   virtual ~B();
 };
 
-// Complete dtor
-// CHECK: @__llvm_profile_name__ZN1BD1Ev = private constant [9 x i8] c"_ZN1BD1Ev"
+// Base dtor
+// CHECK: @__llvm_profile_name__ZN1BD2Ev = private constant [9 x i8] c"_ZN1BD2Ev"
 
-// Deleting dtor
-// CHECK: @__llvm_profile_name__ZN1BD0Ev = private constant [9 x i8] c"_ZN1BD0Ev"
+// Complete dtor must not be instrumented
+// CHECK-NOT: @__llvm_profile_name__ZN1BD1Ev = private constant [9 x i8] c"_ZN1BD1Ev"
 
-// Complete dtor counters and profile data
-// CHECK: @__llvm_profile_counters__ZN1BD1Ev = private global [1 x i64] zeroinitializer
-// CHECK: @__llvm_profile_data__ZN1BD1Ev =
-
-// Deleting dtor counters and profile data
-// CHECK: @__llvm_profile_counters__ZN1BD0Ev = private global [1 x i64] zeroinitializer
-// CHECK: @__llvm_profile_data__ZN1BD0Ev =
+// Deleting dtor must not be instrumented
+// CHECK-NOT: @__llvm_profile_name__ZN1BD0Ev = private constant [9 x i8] c"_ZN1BD0Ev"
+
+// Base dtor counters and profile data
+// CHECK: @__llvm_profile_counters__ZN1BD2Ev = private global [1 x i64] zeroinitializer
+// CHECK: @__llvm_profile_data__ZN1BD2Ev =
+
+// Complete dtor counters and profile data must absent
+// CHECK-NOT: @__llvm_profile_counters__ZN1BD1Ev = private global [1 x i64] zeroinitializer
+// CHECK-NOT: @__llvm_profile_data__ZN1BD1Ev =
+
+// Deleting dtor counters and profile data must absent
+// CHECK-NOT: @__llvm_profile_counters__ZN1BD0Ev = private global [1 x i64] zeroinitializer
+// CHECK-NOT: @__llvm_profile_data__ZN1BD0Ev =
 
 B::~B() { }
Index: cfe/trunk/test/Profile/cxx-structors.cpp
===
--- cfe/trunk/test/Profile/cxx-structors.cpp
+++ cfe/trunk/test/Profile/cxx-structors.cpp
@@ -0,0 +1,32 @@
+// Tests for instrumentation of C++ constructors and destructors.
+//
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.11.0 -x c++ %s -o - -emit-llvm -fprofile-instr-generate | FileCheck %s
+
+struct Foo {
+  Foo() {}
+  Foo(int) {}
+  ~Foo() {}
+};
+
+struct Bar : public Foo {
+  Bar() {}
+  Bar(int x) : Foo(x) {}
+  ~Bar();
+};
+
+Foo foo;
+Foo foo2(1);
+Bar bar;
+
+// Profile data for complete constructors and destructors must absent.
+
+// CHECK-NOT: @__llvm_profile_name__ZN3FooC1Ev
+// CHECK-NOT: @__llvm_profile_name__ZN3FooC1Ei
+// CHECK-NOT: @__llvm_profile_name__ZN3FooD1Ev
+// CHECK-NOT: @__llvm_profile_name__ZN3BarC1Ev
+// CHECK-NOT: @__llvm_profile_name__ZN3BarD1Ev
+// CHECK-NOT: @__llvm_profile_counters__ZN3FooD1Ev
+// CHECK-NOT: @__llvm_profile_data__ZN3FooD1Ev
+
+int main() {
+}
Index: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
===
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
@@ -605,27 +605,24 @@
   return endian::read(Result);
 }
 
-void CodeGenPGO::checkGlobalDecl(GlobalDecl GD) {
-  // Make sure we only emit coverage mapping for one constructor/destructor.
-  // Clang emits several functions for the constructor and the destructor of
-  // a class. Every function is instrumented, but we only want to provide
-  // coverage for one of them. Because of that we only emit the coverage mapping
-  // for the base constructor/destructor.
-  if ((isa(GD.getDecl()) &&
-   GD.getCtorType() != Ctor_Base) ||
-  (isa(GD.getDecl()) &&
-   GD.getDtorType() != Dtor_Base)) {
-SkipCoverageMapping = true;
-  }
-}
-
-void CodeGenPGO::assignRegionCounters(const Decl *D, llvm::Function *Fn) {
+void CodeGenPGO::assignRegionCounters(GlobalDecl GD, llvm::Function *Fn) {
+  const Decl *D = GD.getDecl();
   bool InstrumentRegions = CGM.getCodeGenOpts().ProfileInstrGenerate;
   llvm::IndexedInstrProfReader *PGOReader = CGM.getPGOReader();
   if (!InstrumentRegions && !PGOReader)
 return;
   if (D->isImplicit())
 return;
+  // Constructors and destructors may be represented by several functions in IR.
+  // If so, instrument only base variant, others are implemented by delegation
+  // to the base one, it 

Re: [PATCH] D15062: [clang-format] Add test for AlignAfterOpenBracket = AlwaysBreak in C++.

2015-12-06 Thread Daniel Jasper via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Looks good.


http://reviews.llvm.org/D15062



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


r254889 - Fix PR20334: invalid assertion while diagnosing list initialization failure

2015-12-06 Thread Faisal Vali via cfe-commits
Author: faisalv
Date: Sun Dec  6 20:37:44 2015
New Revision: 254889

URL: http://llvm.org/viewvc/llvm-project?rev=254889=rev
Log:
Fix PR20334: invalid assertion while diagnosing list initialization failure

https://llvm.org/bugs/show_bug.cgi?id=20334

Unfortunately, clang currently checks for a certain brokenness of 
implementations of std::initializer_list in CodeGen (void 
AggExprEmitter::VisitCXXStdInitializerListExpr), not in SemaInit.  Until that 
is fixed, make sure we don't let broken attempts that are aggregates leak 
through into sema, which allows maintenance of expected invariants, and avoids 
triggering an assertion.



 

Added:
cfe/trunk/test/SemaCXX/PR20334-std_initializer_list_diagnosis_assertion.cpp
Modified:
cfe/trunk/lib/Sema/SemaInit.cpp

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=254889=254888=254889=diff
==
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Sun Dec  6 20:37:44 2015
@@ -3732,7 +3732,9 @@ static void TryListInitialization(Sema &
 
   // C++11 [dcl.init.list]p3:
   //   - If T is an aggregate, aggregate initialization is performed.
-  if (DestType->isRecordType() && !DestType->isAggregateType()) {
+  if ((DestType->isRecordType() && !DestType->isAggregateType()) ||
+  (S.getLangOpts().CPlusPlus11 &&
+   S.isStdInitializerList(DestType, nullptr))) {
 if (S.getLangOpts().CPlusPlus11) {
   //   - Otherwise, if the initializer list has no elements and T is a
   // class type with a default constructor, the object is

Added: 
cfe/trunk/test/SemaCXX/PR20334-std_initializer_list_diagnosis_assertion.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/PR20334-std_initializer_list_diagnosis_assertion.cpp?rev=254889=auto
==
--- cfe/trunk/test/SemaCXX/PR20334-std_initializer_list_diagnosis_assertion.cpp 
(added)
+++ cfe/trunk/test/SemaCXX/PR20334-std_initializer_list_diagnosis_assertion.cpp 
Sun Dec  6 20:37:44 2015
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -std=c++11 -verify -emit-llvm-only %s
+// RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify %s -DCPP98
+
+namespace std {
+  template 
+  class initializer_list
+  {};
+}
+
+template int f(std::initializer_list il);
+   
+
+int F = f({1, 2, 3});
+#ifdef CPP98
+//expected-error@-2{{expected expression}}
+#else
+//expected-error@-4{{cannot compile}}
+#endif
+
+


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


Re: [PATCH] D15174: [MSVC] Fix for http://llvm.org/PR25636: indexed accessor property not supported correctly.

2015-12-06 Thread Alexey Bataev via cfe-commits
ABataev updated this revision to Diff 42026.
ABataev marked 2 inline comments as done.
ABataev added a comment.

Update after review


http://reviews.llvm.org/D15174

Files:
  lib/Sema/SemaPseudoObject.cpp
  test/CodeGenCXX/ms-property.cpp
  test/SemaCXX/ms-property-error.cpp
  test/SemaCXX/ms-property.cpp

Index: lib/Sema/SemaPseudoObject.cpp
===
--- lib/Sema/SemaPseudoObject.cpp
+++ lib/Sema/SemaPseudoObject.cpp
@@ -229,7 +229,7 @@
 }
 
 /// Return true if assignments have a non-void result.
-bool CanCaptureValue(Expr *exp) {
+static bool CanCaptureValue(Expr *exp) {
   if (exp->isGLValue())
 return true;
   QualType ty = exp->getType();
@@ -245,6 +245,7 @@
 virtual ExprResult buildGet() = 0;
 virtual ExprResult buildSet(Expr *, SourceLocation,
 bool captureSetValueAsResult) = 0;
+virtual bool useSetterResultAsExprResult(Expr *) const { return false; }
   };
 
   /// A PseudoOpBuilder for Objective-C \@properties.
@@ -339,6 +340,7 @@
Expr *rebuildAndCaptureObject(Expr *) override;
ExprResult buildGet() override;
ExprResult buildSet(Expr *op, SourceLocation, bool) override;
+   bool useSetterResultAsExprResult(Expr *) const override;
  };
 }
 
@@ -458,6 +460,8 @@
   result = buildSet(result.get(), opcLoc, /*captureSetValueAsResult*/ true);
   if (result.isInvalid()) return ExprError();
   addSemanticExpr(result.get());
+  if (useSetterResultAsExprResult(result.get()))
+setResultToLastSemantic();
 
   return complete(syntactic);
 }
@@ -502,6 +506,9 @@
   result = buildSet(result.get(), opcLoc, UnaryOperator::isPrefix(opcode));
   if (result.isInvalid()) return ExprError();
   addSemanticExpr(result.get());
+  if (UnaryOperator::isPrefix(opcode) &&
+  useSetterResultAsExprResult(result.get()))
+setResultToLastSemantic();
 
   UnaryOperator *syntactic =
 new (S.Context) UnaryOperator(syntacticOp, opcode, resultType,
@@ -1497,6 +1504,12 @@
  op->getSourceRange().getEnd());
 }
 
+bool MSPropertyOpBuilder::useSetterResultAsExprResult(Expr *ResExpr) const {
+  assert(ResExpr);
+  return !ResExpr->getType()->isVoidType() &&
+ (ResExpr->getType()->isDependentType() || CanCaptureValue(ResExpr));
+}
+
 //===--===//
 //  General Sema routines.
 //===--===//
Index: test/SemaCXX/ms-property.cpp
===
--- test/SemaCXX/ms-property.cpp
+++ test/SemaCXX/ms-property.cpp
@@ -29,7 +29,7 @@
 public:
   __declspec(property(get=GetX,put=PutX)) T x[];
   T GetX(T i, T j) { return i+j; }
-  void PutX(T i, T j, T k) { j = i = k; }
+  T PutX(T i, T j, T k) { return j = i = k; }
   ~St() { x[0][0] = x[1][1]; }
 };
 
@@ -52,6 +52,8 @@
   ((p2->x)[23])[1] = j1;
   // CHECK-NEXT: ++(((p2->x)[23])[1]);
   ++(((p2->x)[23])[1]);
+  // CHECK-NEXT: j1 = ((p2->x)[23])[1] = j1;
+  j1 = ((p2->x)[23])[1] = j1;
   // CHECK-NEXT: return Test1::GetTest1()->X;
   return Test1::GetTest1()->X;
 }
Index: test/SemaCXX/ms-property-error.cpp
===
--- test/SemaCXX/ms-property-error.cpp
+++ test/SemaCXX/ms-property-error.cpp
@@ -7,17 +7,19 @@
   void PutX(int i, int j, int k) { j = i = k; } // expected-note {{'PutX' declared here}}
 };
 
+char *ptr;
 template 
 class St {
 public:
   __declspec(property(get=GetX,put=PutX)) T x[];
   T GetX(T i, T j) { return i+j; } // expected-note 3 {{'GetX' declared here}}
-  void PutX(T i, T j, T k) { j = i = k; }  // expected-note 2 {{'PutX' declared here}}
+  T PutX(T i, T j, T k) { return j = i = k; }  // expected-note 2 {{'PutX' declared here}}
   ~St() {
 x[1] = 0; // expected-error {{too few arguments to function call, expected 3, have 2}}
 x[2][3] = 4;
 ++x[2][3];
 x[1][2] = x[3][4][5]; // expected-error {{too many arguments to function call, expected 2, have 3}}
+ptr = x[1][2] = x[3][4]; // expected-error {{assigning to 'char *' from incompatible type 'int'}}
   }
 };
 
@@ -30,5 +32,6 @@
   (p1->x[23]) = argc; // expected-error {{too few arguments to function call, expected 3, have 2}}
   float j1 = (p2->x); // expected-error {{too few arguments to function call, expected 2, have 0}}
   ((p2->x)[23])[1][2] = *argv; // expected-error {{too many arguments to function call, expected 3, have 4}}
+  argv = p2->x[11][22] = argc; // expected-error {{assigning to 'char **' from incompatible type 'float'}}
   return ++(((p2->x)[23])); // expected-error {{too few arguments to function call, expected 2, have 1}}
 }
Index: test/CodeGenCXX/ms-property.cpp
===
--- test/CodeGenCXX/ms-property.cpp
+++ test/CodeGenCXX/ms-property.cpp
@@ -31,7 +31,7 @@
   __declspec(property(get=GetX,put=PutX)) 

Re: [PATCH] D15220: [OPENMP] dist_schedule clause for distribute directive

2015-12-06 Thread Alexey Bataev via cfe-commits
ABataev added a comment.

Tests?


Repository:
  rL LLVM

http://reviews.llvm.org/D15220



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


Re: [PATCH] D10834: Added functions to retrieve information about whether a vardecl is local in libclang and its python bindings.

2015-12-06 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

Ping


http://reviews.llvm.org/D10834



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


Re: [PATCH] D15174: [MSVC] Fix for http://llvm.org/PR25636: indexed accessor property not supported correctly.

2015-12-06 Thread Alexey Bataev via cfe-commits
John,
Your example won't be compiled at all. Clang and MSVC emit error 
messages in this case.
The next code

  struct A {
 __declspec(property(get=GetX,put=SetX)) int x;
 int GetX() const { return 0; }
 void SetX(long y) {}
   };

a.x = 5;
compiled fine by MSVC and clang and provides correct result on clang 
(i.e. the result value can't be captured at all, because SetX() returns 
void)
return a.x = 5;
clang: error: cannot initialize return object of type 'int' with an 
rvalue of type 'void'
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15120: Add support for __float128 type to be used by targets that support it

2015-12-06 Thread Richard Smith via cfe-commits
rsmith added a comment.

+rjmccall for `@encode` and USR mangling.



Comment at: include/clang-c/Index.h:2879-2885
@@ -2878,8 +2878,9 @@
   CXType_LongDouble = 23,
-  CXType_NullPtr = 24,
-  CXType_Overload = 25,
-  CXType_Dependent = 26,
-  CXType_ObjCId = 27,
-  CXType_ObjCClass = 28,
-  CXType_ObjCSel = 29,
+  CXType_Float128 = 24,
+  CXType_NullPtr = 25,
+  CXType_Overload = 26,
+  CXType_Dependent = 27,
+  CXType_ObjCId = 28,
+  CXType_ObjCClass = 29,
+  CXType_ObjCSel = 30,
   CXType_FirstBuiltin = CXType_Void,

Do not renumber these, the libclang ABI has stability guarantees. Add your new 
enumerator with value 30 instead.


Comment at: include/clang/Analysis/Analyses/ThreadSafetyTIL.h:244-245
@@ -243,2 +243,4 @@
 }
+// FIXME: does this need a __float128 specialization as well?
+//Presumably not since most targets don't support it.
 

I don't know, and this template looks suspicious already. We likely shouldn't 
be assuming that `long double`'s size is 128 in the previous function.


Comment at: include/clang/Basic/TokenKinds.def:260
@@ -259,2 +259,3 @@
 KEYWORD(double  , KEYALL)
+KEYWORD(__float128  , KEYALL)
 KEYWORD(else, KEYALL)

Please keep the list in alphabetical order, and in any case add this to the GNU 
extensions list below, not here.


Comment at: include/clang/Serialization/ASTBitCodes.h:813
@@ +812,3 @@
+  PREDEF_TYPE_OMP_ARRAY_SECTION = 55,
+  /// \brief The IEEE 754R 128-bit floating point type
+  PREDEF_TYPE_FLOAT128_ID = 56

I would say "The '__float128' type." here -- we don't need to assume that it's 
*this* 128-bit floating point type on any particular platform (except in the 
setup for that particular target).


Comment at: lib/AST/ASTContext.cpp:972
@@ -971,2 +971,3 @@
 TypeDecl *ASTContext::getFloat128StubType() const {
+  // FIXME: Is the assert (and indeed the function) needed?
   assert(LangOpts.CPlusPlus && "should only be called for c++");

This function only existed to allow us to parse libstdc++'s `numeric_limits` 
specialization for `__float128`. We won't need it any more once we have real 
support for `__float128`.


Comment at: lib/AST/ASTContext.cpp:8031
@@ -8015,2 +8030,3 @@
 break;
+  // FIXME: we will probably need to handle __float128
   case 'd':

We can defer that until we want to add a builtin that takes a `__float128`.


Comment at: lib/AST/ItaniumMangle.cpp:2061
@@ -2060,1 +2060,3 @@
 break;
+  // FIXME: is this the right thing to do (always)?
+  case BuiltinType::Float128:

We should test a platform that uses `useFloat128ManglingForLongDouble`. 
Presumably they must either not support `__float128` or use a different 
mangling here. (IIRC, they can't make `long double` and `__float128` the same 
type because that would break libstdc++.)


Comment at: lib/AST/MicrosoftMangle.cpp:1708
@@ -1707,1 +1707,3 @@
 
+  // FIXME: We probably want to bail on this for now.
+  case BuiltinType::Float128:

Yes, that seems like the best thing to do for now; you can just drop this FIXME.


Comment at: lib/AST/NSAPI.cpp:444-445
@@ -443,2 +443,4 @@
   case BuiltinType::UInt128:
+  // FIXME: Added for completeness. Not sure if it's needed.
+  case BuiltinType::Float128:
   case BuiltinType::NullPtr:

This looks appropriate.


Comment at: lib/AST/StmtPrinter.cpp:1212-1213
@@ -1211,2 +1211,4 @@
   case BuiltinType::LongDouble: OS << 'L'; break;
+  // FIXME: Need to figure out what this should be
+  case BuiltinType::Float128:   OS << 'Q'; break;
   }

Does GCC support a suffix for `__int128`? If not, just add a FIXME like we do 
for `Half`. This case -- presumably -- should never happen if there are no 
literals of this type.


Comment at: lib/Basic/TargetInfo.cpp:225-228
@@ -223,2 +224,6 @@
   case 128:
+// FIXME: Return __float128 or long double on targets that support both?
+//This placement of the condition will favour the former.
+if (hasFloat128Type())
+  return Float128;
 if (() == ::APFloat::PPCDoubleDouble ||

Return `long double`. We should prefer the standard type over the GNU extension 
here.


Comment at: lib/Basic/Targets.cpp:1037-1044
@@ -1035,7 +1036,10 @@
 
   bool useFloat128ManglingForLongDouble() const override {
 return LongDoubleWidth == 128 &&
LongDoubleFormat == ::APFloat::PPCDoubleDouble &&
getTriple().isOSBinFormatELF();
   }
+  bool hasFloat128Type() const override {
+return HasFloat128;
+  }
 };

Should we really support both `__float128` and using the `__float128` mangling 
for `long double` simultaneously? That seems likely 

Re: [PATCH] D15174: [MSVC] Fix for http://llvm.org/PR25636: indexed accessor property not supported correctly.

2015-12-06 Thread Alexey Bataev via cfe-commits
ABataev marked 2 inline comments as done.


Comment at: lib/Sema/SemaPseudoObject.cpp:232
@@ -231,3 +231,3 @@
 /// Return true if assignments have a non-void result.
-bool CanCaptureValue(Expr *exp) {
+bool CanCaptureValue(Expr *exp) const {
   if (exp->isGLValue())

rjmccall wrote:
> Just make this static.
Ok


Comment at: lib/Sema/SemaPseudoObject.cpp:464
@@ -461,1 +463,3 @@
+  if (useSetterResultAsExprResult(result.get()))
+setResultToLastSemantic();
 

rjmccall wrote:
> This will leave the result as the captured set value if it can't capture the 
> setter result.  Is that desired?
The fact that the value can be captured must be checked in 
useSetterResultAsExprResult()


http://reviews.llvm.org/D15174



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


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-12-06 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

Ping


http://reviews.llvm.org/D10833



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