[PATCH] D41486: [OpenMP][Clang] Add missing argument to runtime functions.

2017-12-28 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld removed a reviewer: Hahnfeld.
Hahnfeld added a comment.

Not needed anymore, we decided on the order of arguments in 
https://reviews.llvm.org/D41012.


Repository:
  rL LLVM

https://reviews.llvm.org/D41486



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


[PATCH] D41594: Support `ivfsoverlay` option in Tooling

2017-12-28 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment.

I'm not sure if it's ok to ignore the shared `FileManager` here.
@klimek, @bkramer, @alexfh, does tooling library rely on having the same 
`FileManager` for all invocations? Is it just a performance optimization or 
there's more to it?




Comment at: lib/Tooling/Tooling.cpp:287
+  if (Files->getVirtualFileSystem() != VirtualFileSystem) {
+Files = new FileManager(Invocation->getFileSystemOpts(), 
VirtualFileSystem);
+  }

`Files` is a raw pointer, so we're leaking memory here.



Repository:
  rC Clang

https://reviews.llvm.org/D41594



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


[PATCH] D41594: Support `ivfsoverlay` option in Tooling

2017-12-28 Thread Vladimir Plyashkun via Phabricator via cfe-commits
vladimir.plyashkun added inline comments.



Comment at: lib/Tooling/Tooling.cpp:287
+  if (Files->getVirtualFileSystem() != VirtualFileSystem) {
+Files = new FileManager(Invocation->getFileSystemOpts(), 
VirtualFileSystem);
+  }

ilya-biryukov wrote:
> `Files` is a raw pointer, so we're leaking memory here.
> 
Agree.
I can try to replace type of this field to `llvm::IntrusiveRefCntPtr`  
instead of raw pointer.
But if i understand correctly, this class is available during whole execution, 
so memory will be freed on exit. 
I saw some other usages, for example, `createFileManager` method in the 
`CompilerInstance` also just reassign value to raw pointer.
https://clang.llvm.org/doxygen/classclang_1_1CompilerInstance.html#abeb2bbf46a8de987c227125a84935802


Repository:
  rC Clang

https://reviews.llvm.org/D41594



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


[PATCH] D41535: Add -vfsoverlay option for Clang-Tidy

2017-12-28 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment.

In https://reviews.llvm.org/D41535#963859, @vladimir.plyashkun wrote:

> Unfortunately, `-ivfsoverlay` in the compile commands works for the compiler 
> invocation, but it doesn't work for tooling.


This looks like a bug in tooling, but let's wait for responses on the other 
therad.

It seems that `clang-tidy` will terribly broken with per-translation-unit 
overlays anyway. The problem is that clang-tidy seems to report errors and 
fixits in `ErrorReporter` class after running the tooling invocation, therefore 
it won't see any overlays that were local to each translation unit and may 
report wrong ranges, etc.
Probably global overlays (i.e. this patch) is probably the way to go.




Comment at: clang-tidy/ClangTidy.cpp:549
+  if (Context.getOptions().VfsOverlay) {
+pushVfsOverlayFromFile(*Context.getOptions().VfsOverlay, 
Tool.getOverlayFileSystem());
+  }

Could we add a defaulted `vfs::FileSystem BaseFS = getRealFileSystem()` 
parameter to a constructor of `ClangTool` instead?
It seems like we're exposing implementation details of `ClangTool` here for no 
good reason.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D41535



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


[PATCH] D41594: Support `ivfsoverlay` option in Tooling

2017-12-28 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments.



Comment at: lib/Tooling/Tooling.cpp:287
+  if (Files->getVirtualFileSystem() != VirtualFileSystem) {
+Files = new FileManager(Invocation->getFileSystemOpts(), 
VirtualFileSystem);
+  }

vladimir.plyashkun wrote:
> ilya-biryukov wrote:
> > `Files` is a raw pointer, so we're leaking memory here.
> > 
> Agree.
> I can try to replace type of this field to `llvm::IntrusiveRefCntPtr`  
> instead of raw pointer.
> But if i understand correctly, this class is available during whole 
> execution, so memory will be freed on exit. 
> I saw some other usages, for example, `createFileManager` method in the 
> `CompilerInstance` also just reassign value to raw pointer.
> https://clang.llvm.org/doxygen/classclang_1_1CompilerInstance.html#abeb2bbf46a8de987c227125a84935802
Using `IntrusiveRefCntPtr` locally should do the trick, the 
clients can take ownership if they want and `FileManager` will be properly 
freed if they don't do that.

`CompilerInstance::createFileManager` stores `IntrusiveRefCntPtr` as a field 
before returning a raw pointer, so it seems to properly manage memory there.


Repository:
  rC Clang

https://reviews.llvm.org/D41594



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


[PATCH] D40443: [Modules TS] Make imports from an interface unit visible to its implementation units

2017-12-28 Thread Hamza Sood via Phabricator via cfe-commits
hamzasood updated this revision to Diff 128284.
hamzasood added a comment.

I've been investigating an issue regarding visibility during code synthesis, 
and I noticed that this patch half fixes it. I've added the rest of the fix 
since it's related to what's going on here, and I guess this is now a 
"correctly handle imports from an interface unit" patch.

I believe this fixes this bug  
posted on the LLVM bug tracker.

@boris if this is still okay with you after seeing the changes I've made, would 
you mind accepting the revision so I can commit this without Phabricator 
shouting at me?


https://reviews.llvm.org/D40443

Files:
  include/clang/Basic/Module.h
  lib/Basic/Module.cpp
  lib/Sema/SemaDecl.cpp
  test/CXX/modules-ts/basic/basic.def.odr/p6/module-vs-module.cpp
  test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/p1.cpp
  test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/p1/export-kw.cpp
  
test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/p1/interface-imports.cpp

Index: test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/p1.cpp
===
--- test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/p1.cpp
+++ test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/p1.cpp
@@ -1,28 +0,0 @@
-// RUN: %clang_cc1 -fmodules-ts %s -verify -o /dev/null
-// RUN: %clang_cc1 -fmodules-ts %s -DINTERFACE -verify -emit-module-interface -o %t
-// RUN: %clang_cc1 -fmodules-ts %s -DIMPLEMENTATION -verify -fmodule-file=%t -o /dev/null
-//
-// RUN: %clang_cc1 -fmodules-ts %s -DBUILT_AS_INTERFACE -emit-module-interface -verify -o /dev/null
-// RUN: %clang_cc1 -fmodules-ts %s -DINTERFACE -DBUILT_AS_INTERFACE -emit-module-interface -verify -o /dev/null
-// RUN: %clang_cc1 -fmodules-ts %s -DIMPLEMENTATION -DBUILT_AS_INTERFACE -emit-module-interface -verify -o /dev/null
-
-#if INTERFACE
-// expected-no-diagnostics
-export module A;
-#elif IMPLEMENTATION
-module A;
- #ifdef BUILT_AS_INTERFACE
-  // expected-error@-2 {{missing 'export' specifier in module declaration while building module interface}}
-  #define INTERFACE
- #endif
-#else
- #ifdef BUILT_AS_INTERFACE
-  // expected-error@1 {{missing 'export module' declaration in module interface unit}}
- #endif
-#endif
-
-#ifndef INTERFACE
-export int b; // expected-error {{export declaration can only be used within a module interface unit}}
-#else
-export int a;
-#endif
Index: test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/p1/interface-imports.cpp
===
--- test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/p1/interface-imports.cpp
+++ test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/p1/interface-imports.cpp
@@ -0,0 +1,40 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: echo 'export module a; export class A { };' > %t/a.cppm
+// RUN: echo 'export module b; export class B { };' > %t/b.cppm
+//
+// RUN: %clang_cc1 -fmodules-ts -emit-module-interface %t/a.cppm -o %t/a.pcm
+// RUN: %clang_cc1 -fmodules-ts -emit-module-interface %t/b.cppm -o %t/b.pcm
+// RUN: %clang_cc1 -fmodules-ts -fprebuilt-module-path=%t -emit-module-interface %s -o %t/test.pcm -DTEST_INTERFACE
+//
+// RUN: %clang_cc1 -fmodules-ts -I%t -fmodule-file=%t/test.pcm %s -verify -DTEST_IMPLEMENTATION
+// RUN: %clang_cc1 -fmodules-ts -I%t -fmodule-file=%t/test.pcm %s -verify -DOTHER_TU
+
+
+#ifdef TEST_INTERFACE
+import a;
+export module test;
+import b;
+#endif
+
+#ifdef TEST_IMPLEMENTATION
+module test;
+
+A a; // expected-error {{must be imported from module 'a'}}
+ // expected-n...@a.cppm:1 {{here}}
+
+// Module b is imported within the purview of this module's interface unit.
+// So its exported definitions should be visible here.
+B b;
+#endif
+
+
+#ifdef OTHER_TU
+import test;
+
+A a; // expected-error {{must be imported from module 'a'}}
+ // expected-n...@a.cppm:1 {{here}}
+
+B b; // expected-error {{must be imported from module 'b'}}
+ // expected-n...@b.cppm:1 {{here}}
+#endif
Index: test/CXX/modules-ts/basic/basic.def.odr/p6/module-vs-module.cpp
===
--- test/CXX/modules-ts/basic/basic.def.odr/p6/module-vs-module.cpp
+++ test/CXX/modules-ts/basic/basic.def.odr/p6/module-vs-module.cpp
@@ -10,9 +10,7 @@
 //
 // RUN: %clang_cc1 -fmodules-ts -std=c++17 %s -fmodule-file=%t/M.pcm -emit-module-interface -o %t/N.pcm -DMODULE_INTERFACE -DNO_ERRORS
 // RUN: %clang_cc1 -fmodules-ts -std=c++17 %s -fmodule-file=%t/N.pcm -verify
-// FIXME: Once we start importing "import" declarations properly, this should
-// be rejected (-verify should be added to the following line).
-// RUN: %clang_cc1 -fmodules-ts -std=c++17 %s -fmodule-file=%t/N.pcm -DNO_IMPORT
+// RUN: %clang_cc1 -fmodules-ts -std=c++17 %s -fmodule-file=%t/N.pcm -DNO_IMPORT -verify
 //
 // RUN: %clang_cc1 -fmodules-ts -std=c++17 %s -fmodule-file=

[PATCH] D40295: -fsanitize=vptr warnings on bad static types in dynamic_cast and typeid

2017-12-28 Thread Stephan Bergmann via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL321518: -fsanitize=vptr warnings on bad static types in 
dynamic_cast and typeid (authored by sberg, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D40295?vs=127676&id=128288#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D40295

Files:
  compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc
  compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr.cpp

Index: compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc
===
--- compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc
+++ compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc
@@ -38,7 +38,8 @@
 const char *TypeCheckKinds[] = {
 "load of", "store to", "reference binding to", "member access within",
 "member call on", "constructor call on", "downcast of", "downcast of",
-"upcast of", "cast to virtual base of", "_Nonnull binding to"};
+"upcast of", "cast to virtual base of", "_Nonnull binding to",
+"dynamic operation on"};
 }
 
 static void handleTypeMismatchImpl(TypeMismatchData *Data, ValueHandle Pointer,
Index: compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr.cpp
===
--- compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr.cpp
+++ compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr.cpp
@@ -1,41 +1,53 @@
-// RUN: %clangxx -frtti -fsanitize=null,vptr -fno-sanitize-recover=null,vptr -g %s -O3 -o %t -mllvm -enable-tail-merge=false
-// RUN: %run %t rT && %run %t mT && %run %t fT && %run %t cT
-// RUN: %run %t rU && %run %t mU && %run %t fU && %run %t cU
-// RUN: %run %t rS && %run %t rV && %run %t oV
-// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t mS 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER --check-prefix=CHECK-%os-MEMBER --strict-whitespace
-// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t fS 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN --strict-whitespace
-// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t cS 2>&1 | FileCheck %s --check-prefix=CHECK-DOWNCAST --check-prefix=CHECK-%os-DOWNCAST --strict-whitespace
-// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t mV 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER --check-prefix=CHECK-%os-MEMBER --strict-whitespace
-// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t fV 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN --strict-whitespace
-// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t cV 2>&1 | FileCheck %s --check-prefix=CHECK-DOWNCAST --check-prefix=CHECK-%os-DOWNCAST --strict-whitespace
-// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t oU 2>&1 | FileCheck %s --check-prefix=CHECK-OFFSET --check-prefix=CHECK-%os-OFFSET --strict-whitespace
-// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t m0 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-MEMBER --check-prefix=CHECK-%os-NULL-MEMBER --strict-whitespace
-// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t m0 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-MEMBER --check-prefix=CHECK-%os-NULL-MEMBER --strict-whitespace
-// RUN: not %run %t nN 2>&1 | FileCheck %s --check-prefix=CHECK-NULL-MEMFUN --strict-whitespace
+// RUN: %clangxx -frtti -fsanitize=null,vptr -g %s -O3 -o %t -mllvm -enable-tail-merge=false
+// RUN: %env_ubsan_opts=halt_on_error=1 %run %t rT
+// RUN: %env_ubsan_opts=halt_on_error=1 %run %t mT
+// RUN: %env_ubsan_opts=halt_on_error=1 %run %t fT
+// RUN: %env_ubsan_opts=halt_on_error=1 %run %t cT
+// RUN: %env_ubsan_opts=halt_on_error=1 %run %t rU
+// RUN: %env_ubsan_opts=halt_on_error=1 %run %t mU
+// RUN: %env_ubsan_opts=halt_on_error=1 %run %t fU
+// RUN: %env_ubsan_opts=halt_on_error=1 %run %t cU
+// RUN: %env_ubsan_opts=halt_on_error=1 %run %t rS
+// RUN: %env_ubsan_opts=halt_on_error=1 %run %t rV
+// RUN: %env_ubsan_opts=halt_on_error=1 %run %t oV
+// RUN: %env_ubsan_opts=halt_on_error=1 %run %t zN
+// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t mS 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER --check-prefix=CHECK-%os-MEMBER --strict-whitespace
+// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t fS 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN --strict-whitespace
+// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t cS 2>&1 | FileCheck %s --check-prefix=CHECK-DOWNCAST --check-prefix=CHECK-%os-DOWNCAST --strict-whitespace
+// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t mV 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER --check-prefix=CHECK-%os-MEMBER --strict-whitespace
+// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t fV 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN --strict-whitespace
+// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t cV 2>&1 | FileCheck %s --check-prefix=CHECK-DOWNCAST --check-prefix=CHECK-%os-DOWNCAST --strict-whitespace
+// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t

r321519 - -fsanitize=vptr warnings on bad static types in dynamic_cast and typeid

2017-12-28 Thread Stephan Bergmann via cfe-commits
Author: sberg
Date: Thu Dec 28 04:45:41 2017
New Revision: 321519

URL: http://llvm.org/viewvc/llvm-project?rev=321519&view=rev
Log:
-fsanitize=vptr warnings on bad static types in dynamic_cast and typeid

...when such an operation is done on an object during con-/destruction.

This is the cfe part of a patch covering both cfe and compiler-rt.

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


Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/test/CodeGenCXX/ubsan-vtable-checks.cpp

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=321519&r1=321518&r2=321519&view=diff
==
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Thu Dec 28 04:45:41 2017
@@ -570,7 +570,7 @@ static llvm::Value *emitHash16Bytes(CGBu
 
 bool CodeGenFunction::isNullPointerAllowed(TypeCheckKind TCK) {
   return TCK == TCK_DowncastPointer || TCK == TCK_Upcast ||
- TCK == TCK_UpcastToVirtualBase;
+ TCK == TCK_UpcastToVirtualBase || TCK == TCK_DynamicOperation;
 }
 
 bool CodeGenFunction::isVptrCheckRequired(TypeCheckKind TCK, QualType Ty) {
@@ -578,7 +578,7 @@ bool CodeGenFunction::isVptrCheckRequire
   return (RD && RD->hasDefinition() && RD->isDynamicClass()) &&
  (TCK == TCK_MemberAccess || TCK == TCK_MemberCall ||
   TCK == TCK_DowncastPointer || TCK == TCK_DowncastReference ||
-  TCK == TCK_UpcastToVirtualBase);
+  TCK == TCK_UpcastToVirtualBase || TCK == TCK_DynamicOperation);
 }
 
 bool CodeGenFunction::sanitizePerformTypeCheck() const {

Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=321519&r1=321518&r2=321519&view=diff
==
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Thu Dec 28 04:45:41 2017
@@ -2056,6 +2056,15 @@ static llvm::Value *EmitTypeidFromVTable
   // Get the vtable pointer.
   Address ThisPtr = CGF.EmitLValue(E).getAddress();
 
+  QualType SrcRecordTy = E->getType();
+
+  // C++ [class.cdtor]p4:
+  //   If the operand of typeid refers to the object under construction or
+  //   destruction and the static type of the operand is neither the 
constructor
+  //   or destructor’s class nor one of its bases, the behavior is undefined.
+  CGF.EmitTypeCheck(CodeGenFunction::TCK_DynamicOperation, E->getExprLoc(),
+ThisPtr.getPointer(), SrcRecordTy);
+
   // C++ [expr.typeid]p2:
   //   If the glvalue expression is obtained by applying the unary * operator 
to
   //   a pointer and the pointer is a null pointer value, the typeid expression
@@ -2064,7 +2073,6 @@ static llvm::Value *EmitTypeidFromVTable
   // However, this paragraph's intent is not clear.  We choose a very generous
   // interpretation which implores us to consider comma operators, conditional
   // operators, parentheses and other such constructs.
-  QualType SrcRecordTy = E->getType();
   if (CGF.CGM.getCXXABI().shouldTypeidBeNullChecked(
   isGLValueFromPointerDeref(E), SrcRecordTy)) {
 llvm::BasicBlock *BadTypeidBlock =
@@ -2127,10 +2135,6 @@ llvm::Value *CodeGenFunction::EmitDynami
   CGM.EmitExplicitCastExprType(DCE, this);
   QualType DestTy = DCE->getTypeAsWritten();
 
-  if (DCE->isAlwaysNull())
-if (llvm::Value *T = EmitDynamicCastToNull(*this, DestTy))
-  return T;
-
   QualType SrcTy = DCE->getSubExpr()->getType();
 
   // C++ [expr.dynamic.cast]p7:
@@ -2151,6 +2155,18 @@ llvm::Value *CodeGenFunction::EmitDynami
 DestRecordTy = DestTy->castAs()->getPointeeType();
   }
 
+  // C++ [class.cdtor]p5:
+  //   If the operand of the dynamic_cast refers to the object under
+  //   construction or destruction and the static type of the operand is not a
+  //   pointer to or object of the constructor or destructor’s own class or 
one
+  //   of its bases, the dynamic_cast results in undefined behavior.
+  EmitTypeCheck(TCK_DynamicOperation, DCE->getExprLoc(), ThisAddr.getPointer(),
+SrcRecordTy);
+
+  if (DCE->isAlwaysNull())
+if (llvm::Value *T = EmitDynamicCastToNull(*this, DestTy))
+  return T;
+
   assert(SrcRecordTy->isRecordType() && "source type must be a record type!");
 
   // C++ [expr.dynamic.cast]p4: 

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=321519&r1=321518&r2=321519&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Thu Dec 28 04:45:41 2017
@@ -2371,7 +2371,10 @@ public:
 /// object within its lifetime.
 TCK_UpcastToVi

[PATCH] D40720: No -fsanitize=function warning when calling noexcept function through non-noexcept pointer in C++17

2017-12-28 Thread Stephan Bergmann via Phabricator via cfe-commits
sberg updated this revision to Diff 128289.
sberg added a comment.

made the recommended changes


https://reviews.llvm.org/D40720

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/ItaniumCXXABI.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/CodeGenCXX/ubsan-function-noexcept.cpp
  compiler-rt/test/ubsan/TestCases/TypeCheck/Function/function.cpp

Index: compiler-rt/test/ubsan/TestCases/TypeCheck/Function/function.cpp
===
--- compiler-rt/test/ubsan/TestCases/TypeCheck/Function/function.cpp
+++ compiler-rt/test/ubsan/TestCases/TypeCheck/Function/function.cpp
@@ -1,4 +1,4 @@
-// RUN: %clangxx -fsanitize=function %s -O3 -g -o %t
+// RUN: %clangxx -std=c++17 -fsanitize=function %s -O3 -g -o %t
 // RUN: %run %t 2>&1 | FileCheck %s
 // Verify that we can disable symbolization if needed:
 // RUN: %env_ubsan_opts=symbolize=0 %run %t 2>&1 | FileCheck %s --check-prefix=NOSYM
@@ -23,9 +23,49 @@
   reinterpret_cast(reinterpret_cast(f))(42);
 }
 
+void f1(int) {}
+void f2(unsigned int) {}
+void f3(int) noexcept {}
+void f4(unsigned int) noexcept {}
+
+void check_noexcept_calls() {
+  void (*p1)(int);
+  p1 = &f1;
+  p1(0);
+  p1 = reinterpret_cast(&f2);
+  // CHECK: function.cpp:[[@LINE+2]]:3: runtime error: call to function f2(unsigned int) through pointer to incorrect function type 'void (*)(int)'
+  // NOSYM: function.cpp:[[@LINE+1]]:3: runtime error: call to function (unknown) through pointer to incorrect function type 'void (*)(int)'
+  p1(0);
+  p1 = &f3;
+  p1(0);
+  p1 = reinterpret_cast(&f4);
+  // CHECK: function.cpp:[[@LINE+2]]:3: runtime error: call to function f4(unsigned int) through pointer to incorrect function type 'void (*)(int)'
+  // NOSYM: function.cpp:[[@LINE+1]]:3: runtime error: call to function (unknown) through pointer to incorrect function type 'void (*)(int)'
+  p1(0);
+
+  void (*p2)(int) noexcept;
+  p2 = reinterpret_cast(&f1);
+  // TODO: Unclear whether calling a non-noexcept function through a pointer to
+  // nexcept function should cause an error.
+  // CHECK-NOT: function.cpp:[[@LINE+2]]:3: runtime error: call to function f1(int) through pointer to incorrect function type 'void (*)(int) noexcept'
+  // NOSYM-NOT: function.cpp:[[@LINE+1]]:3: runtime error: call to function (unknown) through pointer to incorrect function type 'void (*)(int) noexcept'
+  p2(0);
+  p2 = reinterpret_cast(&f2);
+  // CHECK: function.cpp:[[@LINE+2]]:3: runtime error: call to function f2(unsigned int) through pointer to incorrect function type 'void (*)(int) noexcept'
+  // NOSYM: function.cpp:[[@LINE+1]]:3: runtime error: call to function (unknown) through pointer to incorrect function type 'void (*)(int) noexcept'
+  p2(0);
+  p2 = &f3;
+  p2(0);
+  p2 = reinterpret_cast(&f4);
+  // CHECK: function.cpp:[[@LINE+2]]:3: runtime error: call to function f4(unsigned int) through pointer to incorrect function type 'void (*)(int) noexcept'
+  // NOSYM: function.cpp:[[@LINE+1]]:3: runtime error: call to function (unknown) through pointer to incorrect function type 'void (*)(int) noexcept'
+  p2(0);
+}
+
 int main(void) {
   make_valid_call();
   make_invalid_call();
+  check_noexcept_calls();
   // Check that no more errors will be printed.
   // CHECK-NOT: runtime error: call to function
   // NOSYM-NOT: runtime error: call to function
Index: clang/test/CodeGenCXX/ubsan-function-noexcept.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/ubsan-function-noexcept.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -std=c++17 -fsanitize=function -emit-llvm -triple x86_64-linux-gnu %s -o - | FileCheck %s
+
+// Check that typeinfo recorded in function prolog doesn't have "Do" noexcept
+// qualifier in its mangled name.
+// CHECK: @[[RTTI:[0-9]+]] = private constant i8* bitcast ({ i8*, i8* }* @_ZTIFvvE to i8*)
+// CHECK: define void @_Z1fv() #{{.*}} prologue <{ i32, i32 }> <{ i32 {{.*}}, i32 trunc (i64 sub (i64 ptrtoint (i8** @[[RTTI]] to i64), i64 ptrtoint (void ()* @_Z1fv to i64)) to i32) }>
+void f() noexcept {}
+
+// CHECK: define void @_Z1gPDoFvvE
+void g(void (*p)() noexcept) {
+  // Check that reference typeinfo at call site doesn't have "Do" noexcept
+  // qualifier in its mangled name, either.
+  // CHECK: icmp eq i8* %{{.*}}, bitcast ({ i8*, i8* }* @_ZTIFvvE to i8*), !nosanitize
+  p();
+}
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -1475,10 +1475,8 @@
 const auto *ToFPT = cast(ToFn);
 if (FromFPT->isNothrow(Context) && !ToFPT->isNothrow(Context)) {
   FromFn = cast(
-  Context.getFunctionType(FromFPT->getReturnType(),
-  FromFPT->getParamTypes(),
-  FromFPT->g

r321520 - [Frontend] Correctly handle instantiating ctors with skipped bodies

2017-12-28 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Thu Dec 28 05:05:46 2017
New Revision: 321520

URL: http://llvm.org/viewvc/llvm-project?rev=321520&view=rev
Log:
[Frontend] Correctly handle instantiating ctors with skipped bodies

Summary:
Previsouly clang tried instantiating member initializers even if ctor
body was skipped, this caused spurious errors (see the test).

Reviewers: sepavloff, klimek

Reviewed By: sepavloff

Subscribers: cfe-commits

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

Added:
cfe/trunk/test/Index/skipped-bodies-ctors.cpp
Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=321520&r1=321519&r2=321520&view=diff
==
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Thu Dec 28 05:05:46 2017
@@ -3932,22 +3932,22 @@ void Sema::InstantiateFunctionDefinition
  TemplateArgs))
   return;
 
-if (CXXConstructorDecl *Ctor = dyn_cast(Function)) {
-  // If this is a constructor, instantiate the member initializers.
-  InstantiateMemInitializers(Ctor, cast(PatternDecl),
- TemplateArgs);
-
-  // If this is an MS ABI dllexport default constructor, instantiate any
-  // default arguments.
-  if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
-  Ctor->isDefaultConstructor()) {
-InstantiateDefaultCtorDefaultArgs(*this, Ctor);
-  }
-}
-
 if (PatternDecl->hasSkippedBody()) {
   ActOnSkippedFunctionBody(Function);
 } else {
+  if (CXXConstructorDecl *Ctor = dyn_cast(Function)) {
+// If this is a constructor, instantiate the member initializers.
+InstantiateMemInitializers(Ctor, cast(PatternDecl),
+   TemplateArgs);
+
+// If this is an MS ABI dllexport default constructor, instantiate any
+// default arguments.
+if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
+Ctor->isDefaultConstructor()) {
+  InstantiateDefaultCtorDefaultArgs(*this, Ctor);
+}
+  }
+
   // Instantiate the function body.
   StmtResult Body = SubstStmt(Pattern, TemplateArgs);
 

Added: cfe/trunk/test/Index/skipped-bodies-ctors.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/skipped-bodies-ctors.cpp?rev=321520&view=auto
==
--- cfe/trunk/test/Index/skipped-bodies-ctors.cpp (added)
+++ cfe/trunk/test/Index/skipped-bodies-ctors.cpp Thu Dec 28 05:05:46 2017
@@ -0,0 +1,16 @@
+// RUN: env CINDEXTEST_SKIP_FUNCTION_BODIES=1 c-index-test -test-load-source 
all %s 2>&1 \
+// RUN: | FileCheck --implicit-check-not "error:" %s
+
+
+template 
+struct Foo {
+  template 
+  Foo(int &a) : a(a) {
+  }
+
+  int &a;
+};
+
+
+int bar = Foo(bar).a + Foo(bar).a;
+// CHECK-NOT: error: constructor for 'Foo' must explicitly initialize the 
reference


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


[PATCH] D41492: [Frontend] Correctly handle instantiating ctors with skipped bodies

2017-12-28 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC321520: [Frontend] Correctly handle instantiating ctors with 
skipped bodies (authored by ibiryukov, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D41492?vs=127882&id=128290#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D41492

Files:
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  test/Index/skipped-bodies-ctors.cpp


Index: lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3932,22 +3932,22 @@
  TemplateArgs))
   return;
 
-if (CXXConstructorDecl *Ctor = dyn_cast(Function)) {
-  // If this is a constructor, instantiate the member initializers.
-  InstantiateMemInitializers(Ctor, cast(PatternDecl),
- TemplateArgs);
-
-  // If this is an MS ABI dllexport default constructor, instantiate any
-  // default arguments.
-  if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
-  Ctor->isDefaultConstructor()) {
-InstantiateDefaultCtorDefaultArgs(*this, Ctor);
-  }
-}
-
 if (PatternDecl->hasSkippedBody()) {
   ActOnSkippedFunctionBody(Function);
 } else {
+  if (CXXConstructorDecl *Ctor = dyn_cast(Function)) {
+// If this is a constructor, instantiate the member initializers.
+InstantiateMemInitializers(Ctor, cast(PatternDecl),
+   TemplateArgs);
+
+// If this is an MS ABI dllexport default constructor, instantiate any
+// default arguments.
+if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
+Ctor->isDefaultConstructor()) {
+  InstantiateDefaultCtorDefaultArgs(*this, Ctor);
+}
+  }
+
   // Instantiate the function body.
   StmtResult Body = SubstStmt(Pattern, TemplateArgs);
 
Index: test/Index/skipped-bodies-ctors.cpp
===
--- test/Index/skipped-bodies-ctors.cpp
+++ test/Index/skipped-bodies-ctors.cpp
@@ -0,0 +1,16 @@
+// RUN: env CINDEXTEST_SKIP_FUNCTION_BODIES=1 c-index-test -test-load-source 
all %s 2>&1 \
+// RUN: | FileCheck --implicit-check-not "error:" %s
+
+
+template 
+struct Foo {
+  template 
+  Foo(int &a) : a(a) {
+  }
+
+  int &a;
+};
+
+
+int bar = Foo(bar).a + Foo(bar).a;
+// CHECK-NOT: error: constructor for 'Foo' must explicitly initialize the 
reference


Index: lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3932,22 +3932,22 @@
  TemplateArgs))
   return;
 
-if (CXXConstructorDecl *Ctor = dyn_cast(Function)) {
-  // If this is a constructor, instantiate the member initializers.
-  InstantiateMemInitializers(Ctor, cast(PatternDecl),
- TemplateArgs);
-
-  // If this is an MS ABI dllexport default constructor, instantiate any
-  // default arguments.
-  if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
-  Ctor->isDefaultConstructor()) {
-InstantiateDefaultCtorDefaultArgs(*this, Ctor);
-  }
-}
-
 if (PatternDecl->hasSkippedBody()) {
   ActOnSkippedFunctionBody(Function);
 } else {
+  if (CXXConstructorDecl *Ctor = dyn_cast(Function)) {
+// If this is a constructor, instantiate the member initializers.
+InstantiateMemInitializers(Ctor, cast(PatternDecl),
+   TemplateArgs);
+
+// If this is an MS ABI dllexport default constructor, instantiate any
+// default arguments.
+if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
+Ctor->isDefaultConstructor()) {
+  InstantiateDefaultCtorDefaultArgs(*this, Ctor);
+}
+  }
+
   // Instantiate the function body.
   StmtResult Body = SubstStmt(Pattern, TemplateArgs);
 
Index: test/Index/skipped-bodies-ctors.cpp
===
--- test/Index/skipped-bodies-ctors.cpp
+++ test/Index/skipped-bodies-ctors.cpp
@@ -0,0 +1,16 @@
+// RUN: env CINDEXTEST_SKIP_FUNCTION_BODIES=1 c-index-test -test-load-source all %s 2>&1 \
+// RUN: | FileCheck --implicit-check-not "error:" %s
+
+
+template 
+struct Foo {
+  template 
+  Foo(int &a) : a(a) {
+  }
+
+  int &a;
+};
+
+
+int bar = Foo(bar).a + Foo(bar).a;
+// CHECK-NOT: error: constructor for 'Foo' must explicitly initialize the reference
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41492: [Frontend] Correctly handle instantiating ctors with skipped bodies

2017-12-28 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL321520: [Frontend] Correctly handle instantiating ctors with 
skipped bodies (authored by ibiryukov, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D41492

Files:
  cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
  cfe/trunk/test/Index/skipped-bodies-ctors.cpp


Index: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3932,22 +3932,22 @@
  TemplateArgs))
   return;
 
-if (CXXConstructorDecl *Ctor = dyn_cast(Function)) {
-  // If this is a constructor, instantiate the member initializers.
-  InstantiateMemInitializers(Ctor, cast(PatternDecl),
- TemplateArgs);
-
-  // If this is an MS ABI dllexport default constructor, instantiate any
-  // default arguments.
-  if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
-  Ctor->isDefaultConstructor()) {
-InstantiateDefaultCtorDefaultArgs(*this, Ctor);
-  }
-}
-
 if (PatternDecl->hasSkippedBody()) {
   ActOnSkippedFunctionBody(Function);
 } else {
+  if (CXXConstructorDecl *Ctor = dyn_cast(Function)) {
+// If this is a constructor, instantiate the member initializers.
+InstantiateMemInitializers(Ctor, cast(PatternDecl),
+   TemplateArgs);
+
+// If this is an MS ABI dllexport default constructor, instantiate any
+// default arguments.
+if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
+Ctor->isDefaultConstructor()) {
+  InstantiateDefaultCtorDefaultArgs(*this, Ctor);
+}
+  }
+
   // Instantiate the function body.
   StmtResult Body = SubstStmt(Pattern, TemplateArgs);
 
Index: cfe/trunk/test/Index/skipped-bodies-ctors.cpp
===
--- cfe/trunk/test/Index/skipped-bodies-ctors.cpp
+++ cfe/trunk/test/Index/skipped-bodies-ctors.cpp
@@ -0,0 +1,16 @@
+// RUN: env CINDEXTEST_SKIP_FUNCTION_BODIES=1 c-index-test -test-load-source 
all %s 2>&1 \
+// RUN: | FileCheck --implicit-check-not "error:" %s
+
+
+template 
+struct Foo {
+  template 
+  Foo(int &a) : a(a) {
+  }
+
+  int &a;
+};
+
+
+int bar = Foo(bar).a + Foo(bar).a;
+// CHECK-NOT: error: constructor for 'Foo' must explicitly initialize the 
reference


Index: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3932,22 +3932,22 @@
  TemplateArgs))
   return;
 
-if (CXXConstructorDecl *Ctor = dyn_cast(Function)) {
-  // If this is a constructor, instantiate the member initializers.
-  InstantiateMemInitializers(Ctor, cast(PatternDecl),
- TemplateArgs);
-
-  // If this is an MS ABI dllexport default constructor, instantiate any
-  // default arguments.
-  if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
-  Ctor->isDefaultConstructor()) {
-InstantiateDefaultCtorDefaultArgs(*this, Ctor);
-  }
-}
-
 if (PatternDecl->hasSkippedBody()) {
   ActOnSkippedFunctionBody(Function);
 } else {
+  if (CXXConstructorDecl *Ctor = dyn_cast(Function)) {
+// If this is a constructor, instantiate the member initializers.
+InstantiateMemInitializers(Ctor, cast(PatternDecl),
+   TemplateArgs);
+
+// If this is an MS ABI dllexport default constructor, instantiate any
+// default arguments.
+if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
+Ctor->isDefaultConstructor()) {
+  InstantiateDefaultCtorDefaultArgs(*this, Ctor);
+}
+  }
+
   // Instantiate the function body.
   StmtResult Body = SubstStmt(Pattern, TemplateArgs);
 
Index: cfe/trunk/test/Index/skipped-bodies-ctors.cpp
===
--- cfe/trunk/test/Index/skipped-bodies-ctors.cpp
+++ cfe/trunk/test/Index/skipped-bodies-ctors.cpp
@@ -0,0 +1,16 @@
+// RUN: env CINDEXTEST_SKIP_FUNCTION_BODIES=1 c-index-test -test-load-source all %s 2>&1 \
+// RUN: | FileCheck --implicit-check-not "error:" %s
+
+
+template 
+struct Foo {
+  template 
+  Foo(int &a) : a(a) {
+  }
+
+  int &a;
+};
+
+
+int bar = Foo(bar).a + Foo(bar).a;
+// CHECK-NOT: error: constructor for 'Foo' must explicitly initialize the reference
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r321521 - [clangd] Skip function bodies when building the preamble

2017-12-28 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Thu Dec 28 05:10:15 2017
New Revision: 321521

URL: http://llvm.org/viewvc/llvm-project?rev=321521&view=rev
Log:
[clangd] Skip function bodies when building the preamble

Summary: To make building preambles faster and keep them smaller.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

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

Modified:
clang-tools-extra/trunk/clangd/ClangdUnit.cpp

Modified: clang-tools-extra/trunk/clangd/ClangdUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdUnit.cpp?rev=321521&r1=321520&r2=321521&view=diff
==
--- clang-tools-extra/trunk/clangd/ClangdUnit.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdUnit.cpp Thu Dec 28 05:10:15 2017
@@ -529,12 +529,22 @@ CppFile::deferRebuild(StringRef NewConte
   IntrusiveRefCntPtr PreambleDiagsEngine =
   CompilerInstance::createDiagnostics(
   &CI->getDiagnosticOpts(), &PreambleDiagnosticsConsumer, false);
+
+  // Skip function bodies when building the preamble to speed up building
+  // the preamble and make it smaller.
+  assert(!CI->getFrontendOpts().SkipFunctionBodies);
+  CI->getFrontendOpts().SkipFunctionBodies = true;
+
   CppFilePreambleCallbacks SerializedDeclsCollector;
   auto BuiltPreamble = PrecompiledPreamble::Build(
   *CI, ContentsBuffer.get(), Bounds, *PreambleDiagsEngine, VFS, PCHs,
   /*StoreInMemory=*/That->StorePreamblesInMemory,
   SerializedDeclsCollector);
 
+  // When building the AST for the main file, we do want the function
+  // bodies.
+  CI->getFrontendOpts().SkipFunctionBodies = false;
+
   if (BuiltPreamble) {
 log(Ctx, "Built preamble of size " + Twine(BuiltPreamble->getSize()) +
  " for file " + Twine(That->FileName));


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


[PATCH] D41495: [clangd] Skip function bodies when building the preamble

2017-12-28 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL321521: [clangd] Skip function bodies when building the 
preamble (authored by ibiryukov, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D41495

Files:
  clang-tools-extra/trunk/clangd/ClangdUnit.cpp


Index: clang-tools-extra/trunk/clangd/ClangdUnit.cpp
===
--- clang-tools-extra/trunk/clangd/ClangdUnit.cpp
+++ clang-tools-extra/trunk/clangd/ClangdUnit.cpp
@@ -529,12 +529,22 @@
   IntrusiveRefCntPtr PreambleDiagsEngine =
   CompilerInstance::createDiagnostics(
   &CI->getDiagnosticOpts(), &PreambleDiagnosticsConsumer, false);
+
+  // Skip function bodies when building the preamble to speed up building
+  // the preamble and make it smaller.
+  assert(!CI->getFrontendOpts().SkipFunctionBodies);
+  CI->getFrontendOpts().SkipFunctionBodies = true;
+
   CppFilePreambleCallbacks SerializedDeclsCollector;
   auto BuiltPreamble = PrecompiledPreamble::Build(
   *CI, ContentsBuffer.get(), Bounds, *PreambleDiagsEngine, VFS, PCHs,
   /*StoreInMemory=*/That->StorePreamblesInMemory,
   SerializedDeclsCollector);
 
+  // When building the AST for the main file, we do want the function
+  // bodies.
+  CI->getFrontendOpts().SkipFunctionBodies = false;
+
   if (BuiltPreamble) {
 log(Ctx, "Built preamble of size " + Twine(BuiltPreamble->getSize()) +
  " for file " + Twine(That->FileName));


Index: clang-tools-extra/trunk/clangd/ClangdUnit.cpp
===
--- clang-tools-extra/trunk/clangd/ClangdUnit.cpp
+++ clang-tools-extra/trunk/clangd/ClangdUnit.cpp
@@ -529,12 +529,22 @@
   IntrusiveRefCntPtr PreambleDiagsEngine =
   CompilerInstance::createDiagnostics(
   &CI->getDiagnosticOpts(), &PreambleDiagnosticsConsumer, false);
+
+  // Skip function bodies when building the preamble to speed up building
+  // the preamble and make it smaller.
+  assert(!CI->getFrontendOpts().SkipFunctionBodies);
+  CI->getFrontendOpts().SkipFunctionBodies = true;
+
   CppFilePreambleCallbacks SerializedDeclsCollector;
   auto BuiltPreamble = PrecompiledPreamble::Build(
   *CI, ContentsBuffer.get(), Bounds, *PreambleDiagsEngine, VFS, PCHs,
   /*StoreInMemory=*/That->StorePreamblesInMemory,
   SerializedDeclsCollector);
 
+  // When building the AST for the main file, we do want the function
+  // bodies.
+  CI->getFrontendOpts().SkipFunctionBodies = false;
+
   if (BuiltPreamble) {
 log(Ctx, "Built preamble of size " + Twine(BuiltPreamble->getSize()) +
  " for file " + Twine(That->FileName));
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libunwind] r321469 - There is no portable format string for printing `uintptr_t` values.

2017-12-28 Thread Shoaib Meenai via cfe-commits
Isn't PRIuPTR (from inttypes.h) the portable way to print a uintptr_t?



On 12/27/17, 10:47 AM, "cfe-commits on behalf of Chandler Carruth via 
cfe-commits"  wrote:



Author: chandlerc

Date: Tue Dec 26 21:46:53 2017

New Revision: 321469



URL: 
https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D321469-26view-3Drev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=MrCL0yxupzyiw5gb5FUuieLYS_IsKGZWx7bEvlEEcIA&s=TtvpLBY95jLHo_IzHMotPEJ5BSh0lIHhmXjuGYj9GcY&e=

Log:

There is no portable format string for printing `uintptr_t` values.

Instead, cast them to `void *` which has a portable format string syntax

of `%p`.



This fixes a -Wformat error when building libunwind.



Modified:

libunwind/trunk/src/AddressSpace.hpp



Modified: libunwind/trunk/src/AddressSpace.hpp

URL: 
https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_libunwind_trunk_src_AddressSpace.hpp-3Frev-3D321469-26r1-3D321468-26r2-3D321469-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=MrCL0yxupzyiw5gb5FUuieLYS_IsKGZWx7bEvlEEcIA&s=ek_G7axgNz_LrqBu1RZ3clq1PkTu1FwDkkaFjZFu1T8&e=


==

--- libunwind/trunk/src/AddressSpace.hpp (original)

+++ libunwind/trunk/src/AddressSpace.hpp Tue Dec 26 21:46:53 2017

@@ -384,13 +384,13 @@ inline bool LocalAddressSpace::findUnwin

   // Bare metal is statically linked, so no need to ask the dynamic loader

   info.dwarf_section_length = (uintptr_t)(&__eh_frame_end - 
&__eh_frame_start);

   info.dwarf_section =(uintptr_t)(&__eh_frame_start);

-  _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %X length %x",

- info.dwarf_section, 
info.dwarf_section_length);

+  _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %p length %p",

+ (void *)info.dwarf_section, (void 
*)info.dwarf_section_length);

 #if defined(_LIBUNWIND_SUPPORT_DWARF_INDEX)

   info.dwarf_index_section =(uintptr_t)(&__eh_frame_hdr_start);

   info.dwarf_index_section_length = (uintptr_t)(&__eh_frame_hdr_end - 
&__eh_frame_hdr_start);

-  _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: index section %X length 
%x",

- info.dwarf_index_section, 
info.dwarf_index_section_length);

+  _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: index section %p length 
%p",

+ (void *)info.dwarf_index_section, (void 
*)info.dwarf_index_section_length);

 #endif

   if (info.dwarf_section_length)

 return true;

@@ -398,8 +398,8 @@ inline bool LocalAddressSpace::findUnwin

   // Bare metal is statically linked, so no need to ask the dynamic loader

   info.arm_section =(uintptr_t)(&__exidx_start);

   info.arm_section_length = (uintptr_t)(&__exidx_end - &__exidx_start);

-  _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %X length %x",

- info.arm_section, info.arm_section_length);

+  _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %p length %p",

+ (void *)info.arm_section, (void 
*)info.arm_section_length);

   if (info.arm_section && info.arm_section_length)

 return true;

 #elif defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) && defined(_WIN32)





___

cfe-commits mailing list

cfe-commits@lists.llvm.org


https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommits&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=MrCL0yxupzyiw5gb5FUuieLYS_IsKGZWx7bEvlEEcIA&s=lW2e-8AqrhoM9xYXcuGtLKrqsZAff2PFJllWlzitxAc&e=


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


[clang-tools-extra] r321523 - [clangd] Simplify code. No functionality change intended.

2017-12-28 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Thu Dec 28 06:47:01 2017
New Revision: 321523

URL: http://llvm.org/viewvc/llvm-project?rev=321523&view=rev
Log:
[clangd] Simplify code. No functionality change intended.

Modified:
clang-tools-extra/trunk/clangd/index/FileIndex.cpp
clang-tools-extra/trunk/clangd/index/FileIndex.h
clang-tools-extra/trunk/clangd/index/Index.cpp
clang-tools-extra/trunk/clangd/index/Index.h
clang-tools-extra/trunk/clangd/index/MemIndex.cpp
clang-tools-extra/trunk/clangd/index/MemIndex.h
clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp

Modified: clang-tools-extra/trunk/clangd/index/FileIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/FileIndex.cpp?rev=321523&r1=321522&r2=321523&view=diff
==
--- clang-tools-extra/trunk/clangd/index/FileIndex.cpp (original)
+++ clang-tools-extra/trunk/clangd/index/FileIndex.cpp Thu Dec 28 06:47:01 2017
@@ -37,7 +37,7 @@ void FileSymbols::update(PathRef Path, s
   if (!Slab)
 FileToSlabs.erase(Path);
   else
-FileToSlabs[Path] = std::shared_ptr(Slab.release());
+FileToSlabs[Path] = std::move(Slab);
 }
 
 std::shared_ptr> FileSymbols::allSymbols() {
@@ -74,9 +74,10 @@ void FileIndex::update(const Context &Ct
   Index.build(std::move(Symbols));
 }
 
-bool FileIndex::fuzzyFind(const Context &Ctx, const FuzzyFindRequest &Req,
-  std::function Callback) const {
-  return Index.fuzzyFind(Ctx, Req, std::move(Callback));
+bool FileIndex::fuzzyFind(
+const Context &Ctx, const FuzzyFindRequest &Req,
+llvm::function_ref Callback) const {
+  return Index.fuzzyFind(Ctx, Req, Callback);
 }
 
 } // namespace clangd

Modified: clang-tools-extra/trunk/clangd/index/FileIndex.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/FileIndex.h?rev=321523&r1=321522&r2=321523&view=diff
==
--- clang-tools-extra/trunk/clangd/index/FileIndex.h (original)
+++ clang-tools-extra/trunk/clangd/index/FileIndex.h Thu Dec 28 06:47:01 2017
@@ -60,8 +60,9 @@ public:
   /// nullptr, this removes all symbols in the file
   void update(const Context &Ctx, PathRef Path, ParsedAST *AST);
 
-  bool fuzzyFind(const Context &Ctx, const FuzzyFindRequest &Req,
- std::function Callback) const override;
+  bool
+  fuzzyFind(const Context &Ctx, const FuzzyFindRequest &Req,
+llvm::function_ref Callback) const override;
 
 private:
   FileSymbols FSymbols;

Modified: clang-tools-extra/trunk/clangd/index/Index.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/Index.cpp?rev=321523&r1=321522&r2=321523&view=diff
==
--- clang-tools-extra/trunk/clangd/index/Index.cpp (original)
+++ clang-tools-extra/trunk/clangd/index/Index.cpp Thu Dec 28 06:47:01 2017
@@ -29,10 +29,6 @@ void operator>>(StringRef Str, SymbolID
   std::copy(HexString.begin(), HexString.end(), ID.HashValue.begin());
 }
 
-SymbolSlab::const_iterator SymbolSlab::begin() const { return Symbols.begin(); 
}
-
-SymbolSlab::const_iterator SymbolSlab::end() const { return Symbols.end(); }
-
 SymbolSlab::const_iterator SymbolSlab::find(const SymbolID &ID) const {
   auto It = std::lower_bound(Symbols.begin(), Symbols.end(), ID,
  [](const Symbol &S, const SymbolID &I) {
@@ -50,9 +46,7 @@ static void own(Symbol &S, DenseSet(V.size());
-  memcpy(Data, V.data(), V.size());
-  *R.first = StringRef(Data, V.size());
+  *R.first = V.copy(Arena);
 }
 V = *R.first;
   };

Modified: clang-tools-extra/trunk/clangd/index/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/Index.h?rev=321523&r1=321522&r2=321523&view=diff
==
--- clang-tools-extra/trunk/clangd/index/Index.h (original)
+++ clang-tools-extra/trunk/clangd/index/Index.h Thu Dec 28 06:47:01 2017
@@ -140,8 +140,8 @@ public:
 
   SymbolSlab() = default;
 
-  const_iterator begin() const;
-  const_iterator end() const;
+  const_iterator begin() const { return Symbols.begin(); }
+  const_iterator end() const { return Symbols.end(); }
   const_iterator find(const SymbolID &SymID) const;
 
   size_t size() const { return Symbols.size(); }
@@ -214,7 +214,7 @@ public:
   /// to MaxCandidateCount
   virtual bool
   fuzzyFind(const Context &Ctx, const FuzzyFindRequest &Req,
-std::function Callback) const = 0;
+llvm::function_ref Callback) const = 0;
 
   // FIXME: add interfaces for more index use cases:
   //  - Symbol getSymbolInfo(SymbolID);

Modified: clang-tools-extra/trunk/clangd/index/MemIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/MemIndex.cpp?rev=321523&r1=321522&r2=321523&view=diff

[PATCH] D40443: [Modules TS] Make imports from an interface unit visible to its implementation units

2017-12-28 Thread Boris Kolpackov via Phabricator via cfe-commits
boris added a comment.

I don't think it will be wise for me to accept this revision since I can't 
claim to have good understanding of Clang's internal modules model. I think it 
will be wise to have Richard take a look.




Comment at: lib/Basic/Module.cpp:349
 
+  // Everything visible to the interface unit's global module fragment is
+  // visible to the interface unit.

This comment (not sure about the code)  sounds wrong to me: names from the 
interface unit before the module purview (I assume this is what "global module 
fragment" refers to) should not be visible in the implementation units.


https://reviews.llvm.org/D40443



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


[clang-tools-extra] r321525 - [clangd] Get rid of unnecessary global variable. No functionality change.

2017-12-28 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Thu Dec 28 07:03:02 2017
New Revision: 321525

URL: http://llvm.org/viewvc/llvm-project?rev=321525&view=rev
Log:
[clangd] Get rid of unnecessary global variable. No functionality change.

Modified:
clang-tools-extra/trunk/clangd/Protocol.cpp
clang-tools-extra/trunk/clangd/Protocol.h

Modified: clang-tools-extra/trunk/clangd/Protocol.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Protocol.cpp?rev=321525&r1=321524&r2=321525&view=diff
==
--- clang-tools-extra/trunk/clangd/Protocol.cpp (original)
+++ clang-tools-extra/trunk/clangd/Protocol.cpp Thu Dec 28 07:03:02 2017
@@ -266,7 +266,7 @@ bool fromJSON(const json::Expr &Params,
   return O && O.map("changes", R.changes);
 }
 
-const std::string ExecuteCommandParams::CLANGD_APPLY_FIX_COMMAND =
+const llvm::StringLiteral ExecuteCommandParams::CLANGD_APPLY_FIX_COMMAND =
 "clangd.applyFix";
 
 bool fromJSON(const json::Expr &Params, ExecuteCommandParams &R) {

Modified: clang-tools-extra/trunk/clangd/Protocol.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Protocol.h?rev=321525&r1=321524&r2=321525&view=diff
==
--- clang-tools-extra/trunk/clangd/Protocol.h (original)
+++ clang-tools-extra/trunk/clangd/Protocol.h Thu Dec 28 07:03:02 2017
@@ -380,7 +380,7 @@ json::Expr toJSON(const WorkspaceEdit &W
 /// one argument type will be parsed and set.
 struct ExecuteCommandParams {
   // Command to apply fix-its. Uses WorkspaceEdit as argument.
-  const static std::string CLANGD_APPLY_FIX_COMMAND;
+  const static llvm::StringLiteral CLANGD_APPLY_FIX_COMMAND;
 
   /// The command identifier, e.g. CLANGD_APPLY_FIX_COMMAND
   std::string command;


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


[PATCH] D40443: [Modules TS] Make imports from an interface unit visible to its implementation units

2017-12-28 Thread Hamza Sood via Phabricator via cfe-commits
hamzasood added inline comments.



Comment at: lib/Basic/Module.cpp:349
 
+  // Everything visible to the interface unit's global module fragment is
+  // visible to the interface unit.

boris wrote:
> This comment (not sure about the code)  sounds wrong to me: names from the 
> interface unit before the module purview (I assume this is what "global 
> module fragment" refers to) should not be visible in the implementation units.
Yes, the documentation comment for this function (in the header) notes that 
things visible to the interface unit aren’t necessarily visible to the 
implementation units.

There’re a few reasons why I chose for the function to count modules that’re 
only visible from the interface unit:


  # The `Module::Kind` for a C++ module is `ModuleInterfaceUnit`. Since the 
module identifies itself as an interface unit, I figured it’d make sense for 
queries such as this to return what’s relevant for the interface unit.
  # I think it’s just more useful that way. I can’t think of any situation 
where a module would need to know what’s visible to implementation units of 
other modules (and I couldn’t find any such examples in Clang). However 
there’re plenty of reasons why one would want to know about visibility to an 
interface unit (synthesising default members, instantiating templates etc.)




https://reviews.llvm.org/D40443



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


r321526 - Avoid int to string conversion in Twine or raw_ostream contexts.

2017-12-28 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Thu Dec 28 08:58:54 2017
New Revision: 321526

URL: http://llvm.org/viewvc/llvm-project?rev=321526&view=rev
Log:
Avoid int to string conversion in Twine or raw_ostream contexts.

Some output changes from uppercase hex to lowercase hex, no other functionality 
change intended.

Modified:
cfe/trunk/lib/Basic/Targets/AArch64.cpp
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/lib/Driver/SanitizerArgs.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp
cfe/trunk/test/Preprocessor/arm-acle-6.4.c
cfe/trunk/test/Preprocessor/arm-acle-6.5.c
cfe/trunk/test/Preprocessor/arm-target-features.c
cfe/trunk/utils/TableGen/NeonEmitter.cpp

Modified: cfe/trunk/lib/Basic/Targets/AArch64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/AArch64.cpp?rev=321526&r1=321525&r2=321526&view=diff
==
--- cfe/trunk/lib/Basic/Targets/AArch64.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/AArch64.cpp Thu Dec 28 08:58:54 2017
@@ -159,7 +159,7 @@ void AArch64TargetInfo::getTargetDefines
 Builder.defineMacro("__ARM_FP_FAST", "1");
 
   Builder.defineMacro("__ARM_SIZEOF_WCHAR_T",
-  llvm::utostr(Opts.WCharSize ? Opts.WCharSize : 4));
+  Twine(Opts.WCharSize ? Opts.WCharSize : 4));
 
   Builder.defineMacro("__ARM_SIZEOF_MINIMAL_ENUM", Opts.ShortEnums ? "1" : 
"4");
 

Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=321526&r1=321525&r2=321526&view=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp Thu Dec 28 08:58:54 2017
@@ -582,7 +582,7 @@ void ARMTargetInfo::getTargetDefines(con
 
   // ACLE 6.4.4 LDREX/STREX
   if (LDREX)
-Builder.defineMacro("__ARM_FEATURE_LDREX", "0x" + llvm::utohexstr(LDREX));
+Builder.defineMacro("__ARM_FEATURE_LDREX", "0x" + Twine::utohexstr(LDREX));
 
   // ACLE 6.4.5 CLZ
   if (ArchVersion == 5 || (ArchVersion == 6 && CPUProfile != "M") ||
@@ -591,7 +591,7 @@ void ARMTargetInfo::getTargetDefines(con
 
   // ACLE 6.5.1 Hardware Floating Point
   if (HW_FP)
-Builder.defineMacro("__ARM_FP", "0x" + llvm::utohexstr(HW_FP));
+Builder.defineMacro("__ARM_FP", "0x" + Twine::utohexstr(HW_FP));
 
   // ACLE predefines.
   Builder.defineMacro("__ARM_ACLE", "200");
@@ -672,11 +672,11 @@ void ARMTargetInfo::getTargetDefines(con
 // current AArch32 NEON implementations do not support double-precision
 // floating-point even when it is present in VFP.
 Builder.defineMacro("__ARM_NEON_FP",
-"0x" + llvm::utohexstr(HW_FP & ~HW_FP_DP));
+"0x" + Twine::utohexstr(HW_FP & ~HW_FP_DP));
   }
 
   Builder.defineMacro("__ARM_SIZEOF_WCHAR_T",
-  llvm::utostr(Opts.WCharSize ? Opts.WCharSize : 4));
+  Twine(Opts.WCharSize ? Opts.WCharSize : 4));
 
   Builder.defineMacro("__ARM_SIZEOF_MINIMAL_ENUM", Opts.ShortEnums ? "1" : 
"4");
 

Modified: cfe/trunk/lib/Driver/SanitizerArgs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/SanitizerArgs.cpp?rev=321526&r1=321525&r2=321526&view=diff
==
--- cfe/trunk/lib/Driver/SanitizerArgs.cpp (original)
+++ cfe/trunk/lib/Driver/SanitizerArgs.cpp Thu Dec 28 08:58:54 2017
@@ -794,7 +794,7 @@ void SanitizerArgs::addArgs(const ToolCh
 
   if (MsanTrackOrigins)
 CmdArgs.push_back(Args.MakeArgString("-fsanitize-memory-track-origins=" +
- llvm::utostr(MsanTrackOrigins)));
+ Twine(MsanTrackOrigins)));
 
   if (MsanUseAfterDtor)
 CmdArgs.push_back("-fsanitize-memory-use-after-dtor");
@@ -829,7 +829,7 @@ void SanitizerArgs::addArgs(const ToolCh
 
   if (AsanFieldPadding)
 CmdArgs.push_back(Args.MakeArgString("-fsanitize-address-field-padding=" +
- llvm::utostr(AsanFieldPadding)));
+ Twine(AsanFieldPadding)));
 
   if (AsanUseAfterScope)
 CmdArgs.push_back("-fsanitize-address-use-after-scope");

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=321526&r1=321525&r2=321526&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Dec 28 08:58:54 2017
@@ -1738,10 +1738,9 @@ void Clang::AddHexagonTargetArgs(const A
   CmdArgs.push_back("-Wreturn-type");
 
   if (auto G = toolchains::HexagonToolChai

[clang-tools-extra] r321526 - Avoid int to string conversion in Twine or raw_ostream contexts.

2017-12-28 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Thu Dec 28 08:58:54 2017
New Revision: 321526

URL: http://llvm.org/viewvc/llvm-project?rev=321526&view=rev
Log:
Avoid int to string conversion in Twine or raw_ostream contexts.

Some output changes from uppercase hex to lowercase hex, no other functionality 
change intended.

Modified:
clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp

Modified: clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp?rev=321526&r1=321525&r2=321526&view=diff
==
--- clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp (original)
+++ clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp Thu Dec 28 08:58:54 
2017
@@ -196,7 +196,7 @@ void clangd::runLanguageServerLoop(std::
   log(Context::empty(),
   "Warning: Duplicate Content-Length header received. "
   "The previous value for this message (" +
-  std::to_string(ContentLength) + ") was ignored.\n");
+  llvm::Twine(ContentLength) + ") was ignored.\n");
 }
 
 llvm::getAsUnsignedInteger(LineRef.trim(), 0, ContentLength);
@@ -230,10 +230,9 @@ void clangd::runLanguageServerLoop(std::
 // If the stream is aborted before we read ContentLength bytes, In
 // will have eofbit and failbit set.
 if (!In) {
-  log(Context::empty(), "Input was aborted. Read only " +
-std::to_string(In.gcount()) +
-" bytes of expected " +
-std::to_string(ContentLength) + ".\n");
+  log(Context::empty(),
+  "Input was aborted. Read only " + llvm::Twine(In.gcount()) +
+  " bytes of expected " + llvm::Twine(ContentLength) + ".\n");
   break;
 }
 


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


[PATCH] D41566: [Modules TS] Diagnose exported internal linkage declarations

2017-12-28 Thread Hamza Sood via Phabricator via cfe-commits
hamzasood updated this revision to Diff 128302.
hamzasood added a comment.

I've removed the `isExported` fix for namespaces as it's somewhat unrelated to 
this patch.
I'll do a separate patch for fixing namespaces (which will include the stuff 
removed from here and a bit more)


https://reviews.llvm.org/D41566

Files:
  include/clang/AST/DeclBase.h
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaDecl.cpp
  test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp
  test/CXX/modules-ts/basic/basic.def.odr/p4/module.cppm
  test/CXX/modules-ts/basic/basic.def.odr/p4/user.cpp
  test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/p2.cpp

Index: test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/p2.cpp
===
--- test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/p2.cpp
+++ test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/p2.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -fmodules-ts %s -emit-module-interface -verify
+
+export module A;
+
+export namespace { } // expected-error {{unnamed namespace}}
+
+export static int n = 5; // expected-error {{internal linkage}}
+
+namespace { // expected-note 3{{in this}}
+  export {
+int a = 1;   // expected-error {{internal linkage}}
+void f() { } // expected-error {{internal linkage}}
+class B { }; // expected-error {{internal linkage}}
+  }
+}
+
+export namespace a {
+  namespace b {
+namespace c {
+  static int i = 3; // expected-error {{internal linkage}}
+}
+  }
+}
Index: test/CXX/modules-ts/basic/basic.def.odr/p4/user.cpp
===
--- test/CXX/modules-ts/basic/basic.def.odr/p4/user.cpp
+++ test/CXX/modules-ts/basic/basic.def.odr/p4/user.cpp
@@ -3,7 +3,6 @@
 
 // CHECK-DAG: @extern_var_exported = external global
 // CHECK-DAG: @inline_var_exported = linkonce_odr global
-// CHECK-DAG: @_ZW6ModuleE19static_var_exported = available_externally global i32 0
 // CHECK-DAG: @const_var_exported = available_externally constant i32 3
 
 import Module;
@@ -16,7 +15,6 @@
 
   (void)&extern_var_exported;
   (void)&inline_var_exported;
-  (void)&static_var_exported;
   (void)&const_var_exported;
 
   // Module-linkage declarations are not visible here.
Index: test/CXX/modules-ts/basic/basic.def.odr/p4/module.cppm
===
--- test/CXX/modules-ts/basic/basic.def.odr/p4/module.cppm
+++ test/CXX/modules-ts/basic/basic.def.odr/p4/module.cppm
@@ -11,7 +11,6 @@
 // can discard this global and its initializer (if any), and other TUs are not
 // permitted to run the initializer for this variable.
 // CHECK-DAG: @inline_var_exported = linkonce_odr global
-// CHECK-DAG: @_ZW6ModuleE19static_var_exported = global
 // CHECK-DAG: @const_var_exported = constant
 //
 // CHECK-DAG: @_ZW6ModuleE25extern_var_module_linkage = external global
@@ -58,32 +57,20 @@
 export module Module;
 
 export {
-  // FIXME: These should be ill-formed: you can't export an internal linkage
-  // symbol, per [dcl.module.interface]p2.
-  // CHECK: define void {{.*}}@_ZW6ModuleE22unused_static_exportedv
-  static void unused_static_exported() {}
-  // CHECK: define void {{.*}}@_ZW6ModuleE20used_static_exportedv
-  static void used_static_exported() {}
-
   inline void unused_inline_exported() {}
   inline void used_inline_exported() {}
 
   extern int extern_var_exported;
   inline int inline_var_exported;
-  // FIXME: This should be ill-formed: you can't export an internal linkage
-  // symbol.
-  static int static_var_exported;
   const int const_var_exported = 3;
 
   // CHECK: define void {{.*}}@_Z18noninline_exportedv
   void noninline_exported() {
-used_static_exported();
 // CHECK: define linkonce_odr {{.*}}@_Z20used_inline_exportedv
 used_inline_exported();
 
 (void)&extern_var_exported;
 (void)&inline_var_exported;
-(void)&static_var_exported;
 (void)&const_var_exported;
   }
 }
Index: test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp
===
--- test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp
+++ test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp
@@ -3,12 +3,10 @@
 
 // CHECK-DAG: @extern_var_exported = external global
 // CHECK-DAG: @inline_var_exported = linkonce_odr global
-// CHECK-DAG: @_ZW6ModuleE19static_var_exported = available_externally global i32 0,
 // CHECK-DAG: @const_var_exported = available_externally constant i32 3,
 //
 // CHECK-DAG: @_ZW6ModuleE25extern_var_module_linkage = external global
 // CHECK-DAG: @_ZW6ModuleE25inline_var_module_linkage = linkonce_odr global
-// CHECK-DAG: @_ZW6ModuleE25static_var_module_linkage = available_externally global i32 0,
 // CHECK-DAG: @_ZW6ModuleE24const_var_module_linkage = available_externally constant i32 3,
 
 module Module;
@@ -21,7 +19,6 @@
 
   (void)&extern_var_exported;
   (void)&inline_var_exported;
-  (void)

LLVM buildmaster will be updated and restarted tonight

2017-12-28 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be updated and restarted after 5 PM Pacific time.

Thanks

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


Buildbot numbers for the week of 12/10/2017 - 12/16/2017

2017-12-28 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the week of 12/10/2017 - 12/16/2017.

Please see the same data in attached csv files:

The longest time each builder was red during the week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the week:

buildername| was_red
---+-
 llvm-clang-x86_64-expensive-checks-win| 71:23:24
 clang-ppc64le-linux-multistage| 58:28:42
 ubuntu-gcc7.1-werror  | 51:53:30
 sanitizer-x86_64-linux-fuzzer | 39:48:21
 clang-x64-ninja-win7  | 34:31:36
 clang-ppc64be-linux-multistage| 26:10:41
 libcxx-libcxxabi-x86_64-linux-debian  | 21:04:30
 clang-x86_64-linux-selfhost-modules   | 09:52:57
 clang-x86_64-linux-selfhost-modules-2 | 09:04:12
 clang-cmake-thumbv7-a15-full-sh   | 08:05:51
 clang-s390x-linux-multistage  | 07:23:57
 clang-ppc64le-linux-lnt   | 06:45:03
 sanitizer-ppc64le-linux   | 06:23:23
 clang-cmake-armv7-a15-full| 06:21:20
 clang-cmake-armv7-a15-selfhost-neon   | 06:07:52
 lldb-windows7-android | 05:52:17
 clang-lld-x86_64-2stage   | 05:48:48
 clang-cmake-armv7-a15-selfhost| 05:41:38
 libcxx-libcxxabi-libunwind-arm-linux-noexceptions | 05:02:49
 clang-with-lto-ubuntu | 05:02:23
 clang-cmake-aarch64-full  | 04:58:40
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast| 04:29:56
 clang-x86_64-debian-fast  | 04:29:10
 clang-with-thin-lto-ubuntu| 04:24:14
 clang-cmake-aarch64-lld   | 04:20:35
 libcxx-libcxxabi-libunwind-arm-linux  | 04:18:01
 sanitizer-x86_64-linux-bootstrap-msan | 04:10:31
 lldb-x86_64-darwin-13.4   | 03:59:57
 clang-s390x-linux-lnt | 03:41:27
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast  | 03:21:04
 sanitizer-windows | 03:19:02
 lldb-x86-windows-msvc2015 | 03:16:45
 lld-x86_64-win7   | 03:16:19
 lld-x86_64-darwin13   | 03:11:44
 sanitizer-x86_64-linux| 03:11:15
 clang-cuda-build  | 02:54:23
 clang-hexagon-elf | 02:46:24
 clang-cmake-x86_64-sde-avx512-linux   | 02:34:13
 polly-amd64-linux | 02:30:47
 llvm-hexagon-elf  | 02:21:28
 sanitizer-x86_64-linux-bootstrap  | 02:16:05
 clang-ppc64le-linux   | 02:09:57
 sanitizer-x86_64-linux-android| 02:09:24
 sanitizer-x86_64-linux-fast   | 02:06:48
 lldb-amd64-ninja-netbsd8  | 02:03:55
 sanitizer-x86_64-linux-bootstrap-ubsan| 01:52:28
 reverse-iteration | 01:48:52
 sanitizer-ppc64be-linux   | 01:46:55
 lld-x86_64-freebsd| 01:37:59
 lldb-x86_64-ubuntu-14.04-buildserver  | 01:37:43
 clang-atom-d525-fedora-rel| 01:37:40
 clang-cmake-x86_64-avx2-linux | 01:34:07
 clang-s390x-linux | 01:32:46
 clang-cmake-aarch64-quick | 01:29:04
 lldb-x86_64-ubuntu-14.04-cmake| 01:25:17
 polly-arm-linux   | 01:21:49
 clang-cmake-thumbv7-a15   | 01:21:01
 clang-cmake-armv7-a15 | 01:18:18
 clang-cmake-x86_64-avx2-linux-perf| 01:14:32
 clang-x86_64-linux-abi-test   | 01:13:58
 clang-bpf-build   | 01:13:08
 clang-cmake-aarch64-global-isel   | 01:10:36
 clang-ppc64be-linux   | 01:09:47
 clang-ppc64be-linux-lnt   | 01:03:14
 perf-x86_64-penryn-O3-polly-parallel-fast | 00:56:06
 perf-x86_64-penryn-O3-polly-unprofitable  | 00:56:00
 sanitizer-x86_64-linux-autoconf   | 00:39:21
 lldb-x86_64-ubuntu-14.04-android  | 00:36:04
 lldb-amd64-ninja-freebsd11

Buildbot numbers for the week of 12/17/2017 - 12/23/2017

2017-12-28 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 12/17/2017 -
12/23/2017.

Please see the same data in attached csv files:

The longest time each builder was red during the week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the week:

   buildername| was_red
--+-
 llvm-mips-linux  | 86:05:19
 openmp-ompt-gcc-x86_64-linux-debian  | 66:55:04
 perf-x86_64-penryn-O3-polly-unprofitable | 65:33:59
 llvm-clang-x86_64-expensive-checks-win   | 62:57:35
 libcxx-libcxxabi-libunwind-x86_64-linux-debian   | 32:45:39
 reverse-iteration| 31:04:41
 sanitizer-ppc64le-linux  | 30:24:22
 clang-lld-x86_64-2stage  | 28:09:44
 ubuntu-gcc7.1-werror | 28:06:31
 clang-with-lto-ubuntu| 26:34:49
 sanitizer-ppc64be-linux  | 26:29:44
 clang-cmake-aarch64-full | 26:10:16
 clang-ppc64le-linux-multistage   | 26:00:40
 clang-ppc64le-linux-lnt  | 25:53:05
 clang-with-thin-lto-ubuntu   | 25:44:08
 clang-ppc64be-linux-multistage   | 25:20:38
 clang-x86_64-linux-selfhost-modules  | 24:50:24
 clang-x86_64-linux-selfhost-modules-2| 24:25:47
 clang-s390x-linux-multistage | 20:29:52
 clang-s390x-linux-lnt| 06:49:34
 clang-s390x-linux| 06:48:12
 lldb-windows7-android| 06:42:05
 clang-bpf-build  | 06:25:36
 clang-atom-d525-fedora-rel   | 04:56:08
 clang-cmake-x86_64-avx2-linux| 04:31:15
 lldb-amd64-ninja-netbsd8 | 04:15:51
 clang-cmake-x86_64-sde-avx512-linux  | 04:09:32
 clang-ppc64be-linux-lnt  | 03:52:55
 sanitizer-x86_64-linux-bootstrap-ubsan   | 03:51:49
 clang-hexagon-elf| 03:47:45
 perf-x86_64-penryn-O3-polly-parallel-fast| 03:42:42
 clang-x86_64-linux-abi-test  | 03:42:23
 clang-cuda-build | 03:34:17
 clang-x86_64-debian-fast | 03:32:14
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast   | 03:30:01
 sanitizer-x86_64-linux-bootstrap-msan| 03:26:41
 clang-cmake-aarch64-lld  | 03:24:50
 clang-cmake-armv7-a15-full   | 03:23:07
 sanitizer-x86_64-linux-fast  | 03:16:42
 sanitizer-x86_64-linux-bootstrap | 03:15:05
 clang-cmake-aarch64-global-isel  | 03:04:14
 clang-ppc64le-linux  | 03:00:02
 clang-ppc64be-linux  | 02:57:59
 llvm-hexagon-elf | 02:47:56
 lldb-x86_64-ubuntu-14.04-android | 02:44:54
 clang-cmake-thumbv7-a15  | 02:38:17
 clang-cmake-armv7-a15| 02:22:38
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast | 02:18:03
 clang-cmake-x86_64-avx2-linux-perf   | 02:14:43
 polly-amd64-linux| 01:49:19
 lldb-x86_64-darwin-13.4  | 01:45:44
 clang-native-arm-lnt | 01:33:05
 sanitizer-x86_64-linux   | 01:22:29
 sanitizer-x86_64-linux-android   | 01:12:38
 sanitizer-x86_64-linux-fuzzer| 01:11:16
 lld-x86_64-freebsd   | 00:59:30
 lld-x86_64-win7  | 00:53:01
 lldb-x86-windows-msvc2015| 00:47:32
 lld-x86_64-darwin13  | 00:44:37
 lldb-x86_64-ubuntu-14.04-cmake   | 00:27:01
 polly-arm-linux  | 00:19:47
 sanitizer-windows| 00:18:45
 lldb-amd64-ninja-freebsd11   | 00:15:35
 clang-tools-sphinx-docs  | 00:10:08
(64 rows)


"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green):

   buildername   | builds | changes
| status_change_ratio
-++-+

[PATCH] D41621: [cmake] Fix path problems when cross compiling.

2017-12-28 Thread Don Hinton via Phabricator via cfe-commits
hintonda created this revision.
hintonda added reviewers: EricWF, compnerd, phosek, beanz.
Herald added a subscriber: mgorny.

When cross compiling, users can set CMAKE_FIND_ROOT_PATH to
the sysroot of the TARGET system which adds the sysroot prefix to the
paths used in the FIND_XXX commands.  Since these FIND_PATH commands
use absolute paths found on the HOST system, pass
NO_CMAKE_FIND_ROOT_PATH to keep the prefix from being added.


https://reviews.llvm.org/D41621

Files:
  CMakeLists.txt


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -329,7 +329,8 @@
   PATHS ${LLVM_MAIN_SRC_DIR}/projects/libcxx/include
 ${LLVM_MAIN_SRC_DIR}/runtimes/libcxx/include
   NO_DEFAULT_PATH
-)
+  NO_CMAKE_FIND_ROOT_PATH
+  )
 if ((NOT LIBUNWIND_STANDALONE_BUILD OR HAVE_LIBCXX) AND
 IS_DIRECTORY "${LIBUNWIND_LIBCXX_INCLUDES_INTERNAL}")
   set(LIBUNWIND_CXX_INCLUDE_PATHS_DEFAULT 
"${LIBUNWIND_LIBCXX_INCLUDES_INTERNAL}")


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -329,7 +329,8 @@
   PATHS ${LLVM_MAIN_SRC_DIR}/projects/libcxx/include
 ${LLVM_MAIN_SRC_DIR}/runtimes/libcxx/include
   NO_DEFAULT_PATH
-)
+  NO_CMAKE_FIND_ROOT_PATH
+  )
 if ((NOT LIBUNWIND_STANDALONE_BUILD OR HAVE_LIBCXX) AND
 IS_DIRECTORY "${LIBUNWIND_LIBCXX_INCLUDES_INTERNAL}")
   set(LIBUNWIND_CXX_INCLUDE_PATHS_DEFAULT "${LIBUNWIND_LIBCXX_INCLUDES_INTERNAL}")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41622: [cmake] Fix path and flag problems when cross compiling.

2017-12-28 Thread Don Hinton via Phabricator via cfe-commits
hintonda created this revision.
hintonda added reviewers: EricWF, compnerd, phosek, vkalintiris, beanz.
Herald added a subscriber: mgorny.

When cross compiling, users can set CMAKE_FIND_ROOT_PATH to
the sysroot of the TARGET system which adds the sysroot prefix to the
paths used in the FIND_XXX commands.  Since these FIND_PATH commands
use absolute paths found on the HOST system, pass
NO_CMAKE_FIND_ROOT_PATH to keep the prefix from being added.

Don't overwrite CMAKE_REQUIRED_FLAGS when adding temporary flags.


Repository:
  rCXX libc++

https://reviews.llvm.org/D41622

Files:
  CMakeLists.txt
  cmake/Modules/CheckLibcxxAtomic.cmake


Index: cmake/Modules/CheckLibcxxAtomic.cmake
===
--- cmake/Modules/CheckLibcxxAtomic.cmake
+++ cmake/Modules/CheckLibcxxAtomic.cmake
@@ -9,7 +9,7 @@
 
 function(check_cxx_atomics varname)
   set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
-  set(CMAKE_REQUIRED_FLAGS "-nodefaultlibs -std=c++11 -nostdinc++ -isystem 
${LIBCXX_SOURCE_DIR}/include")
+  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs -std=c++11 
-nostdinc++ -isystem ${LIBCXX_SOURCE_DIR}/include")
   if (${LIBCXX_GCC_TOOLCHAIN})
 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} 
--gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}")
   endif()
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -123,6 +123,7 @@
   ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include
   ${LLVM_MAIN_SRC_DIR}/../libcxxabi/include
 NO_DEFAULT_PATH
+NO_CMAKE_FIND_ROOT_PATH
   )
   if (LIBCXX_TARGETING_MSVC)
 # FIXME: Figure out how to configure the ABI library on Windows.


Index: cmake/Modules/CheckLibcxxAtomic.cmake
===
--- cmake/Modules/CheckLibcxxAtomic.cmake
+++ cmake/Modules/CheckLibcxxAtomic.cmake
@@ -9,7 +9,7 @@
 
 function(check_cxx_atomics varname)
   set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
-  set(CMAKE_REQUIRED_FLAGS "-nodefaultlibs -std=c++11 -nostdinc++ -isystem ${LIBCXX_SOURCE_DIR}/include")
+  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs -std=c++11 -nostdinc++ -isystem ${LIBCXX_SOURCE_DIR}/include")
   if (${LIBCXX_GCC_TOOLCHAIN})
 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}")
   endif()
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -123,6 +123,7 @@
   ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include
   ${LLVM_MAIN_SRC_DIR}/../libcxxabi/include
 NO_DEFAULT_PATH
+NO_CMAKE_FIND_ROOT_PATH
   )
   if (LIBCXX_TARGETING_MSVC)
 # FIXME: Figure out how to configure the ABI library on Windows.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41623: [cmake] Fix path problems when cross compiling.

2017-12-28 Thread Don Hinton via Phabricator via cfe-commits
hintonda created this revision.
hintonda added reviewers: EricWF, compnerd, phosek, beanz.
Herald added a subscriber: mgorny.

When cross compiling, users can set CMAKE_FIND_ROOT_PATH to
the sysroot of the TARGET system which adds the sysroot prefix to the
paths used in the FIND_XXX commands.  Since these FIND_PATH commands
use absolute paths found on the HOST system, pass
NO_CMAKE_FIND_ROOT_PATH to keep the prefix from being added.


Repository:
  rCXXA libc++abi

https://reviews.llvm.org/D41623

Files:
  CMakeLists.txt


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -115,6 +115,7 @@
 ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBCXX_INCLUDES}
 ${LIBCXXABI_LIBCXX_INCLUDE_DIRS}
 ${LLVM_INCLUDE_DIR}/c++/v1
+  NO_CMAKE_FIND_ROOT_PATH
   )
 
 set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXXABI_LIBCXX_INCLUDES}" CACHE PATH
@@ -127,6 +128,7 @@
 ${LIBCXXABI_LIBCXX_INCLUDES}/../
 ${LIBCXXABI_LIBCXX_SRC_DIRS}
   NO_DEFAULT_PATH
+  NO_CMAKE_FIND_ROOT_PATH
   )
 
 if (LIBCXXABI_LIBCXX_PATH STREQUAL "LIBCXXABI_LIBCXX_PATH-NOTFOUND")
@@ -425,6 +427,7 @@
   ${LLVM_MAIN_SRC_DIR}/projects/libunwind/include
   ${LLVM_MAIN_SRC_DIR}/runtimes/libunwind/include
 NO_DEFAULT_PATH
+NO_CMAKE_FIND_ROOT_PATH
   )
 
   if (LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL STREQUAL 
"LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL-NOTFOUND")


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -115,6 +115,7 @@
 ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBCXX_INCLUDES}
 ${LIBCXXABI_LIBCXX_INCLUDE_DIRS}
 ${LLVM_INCLUDE_DIR}/c++/v1
+  NO_CMAKE_FIND_ROOT_PATH
   )
 
 set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXXABI_LIBCXX_INCLUDES}" CACHE PATH
@@ -127,6 +128,7 @@
 ${LIBCXXABI_LIBCXX_INCLUDES}/../
 ${LIBCXXABI_LIBCXX_SRC_DIRS}
   NO_DEFAULT_PATH
+  NO_CMAKE_FIND_ROOT_PATH
   )
 
 if (LIBCXXABI_LIBCXX_PATH STREQUAL "LIBCXXABI_LIBCXX_PATH-NOTFOUND")
@@ -425,6 +427,7 @@
   ${LLVM_MAIN_SRC_DIR}/projects/libunwind/include
   ${LLVM_MAIN_SRC_DIR}/runtimes/libunwind/include
 NO_DEFAULT_PATH
+NO_CMAKE_FIND_ROOT_PATH
   )
 
   if (LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL STREQUAL "LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL-NOTFOUND")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r321546 - [NFC] Modernize enum Declarator::TheContext to a type-safe scoped enum.

2017-12-28 Thread Faisal Vali via cfe-commits
Author: faisalv
Date: Thu Dec 28 21:41:00 2017
New Revision: 321546

URL: http://llvm.org/viewvc/llvm-project?rev=321546&view=rev
Log:
[NFC] Modernize enum Declarator::TheContext to a type-safe scoped enum.

Note, we don't do any bitwise manipulations when using them.






Modified:
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/include/clang/Parse/RAIIObjectsForParser.h
cfe/trunk/include/clang/Sema/DeclSpec.h
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/lib/Parse/ParseOpenMP.cpp
cfe/trunk/lib/Parse/ParseStmt.cpp
cfe/trunk/lib/Parse/ParseTemplate.cpp
cfe/trunk/lib/Parse/Parser.cpp
cfe/trunk/lib/Sema/DeclSpec.cpp
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaType.cpp

Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=321546&r1=321545&r2=321546&view=diff
==
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Thu Dec 28 21:41:00 2017
@@ -1447,7 +1447,7 @@ private:
 
   bool isTokIdentifier_in() const;
 
-  ParsedType ParseObjCTypeName(ObjCDeclSpec &DS, Declarator::TheContext Ctx,
+  ParsedType ParseObjCTypeName(ObjCDeclSpec &DS, DeclaratorContext Ctx,
ParsedAttributes *ParamAttrs);
   void ParseObjCMethodRequirement();
   Decl *ParseObjCMethodPrototype(
@@ -1920,15 +1920,16 @@ private:
 bool ParsedForRangeDecl() { return !ColonLoc.isInvalid(); }
   };
 
-  DeclGroupPtrTy ParseDeclaration(unsigned Context, SourceLocation &DeclEnd,
+  DeclGroupPtrTy ParseDeclaration(DeclaratorContext Context,
+  SourceLocation &DeclEnd,
   ParsedAttributesWithRange &attrs);
-  DeclGroupPtrTy ParseSimpleDeclaration(unsigned Context,
+  DeclGroupPtrTy ParseSimpleDeclaration(DeclaratorContext Context,
 SourceLocation &DeclEnd,
 ParsedAttributesWithRange &attrs,
 bool RequireSemi,
 ForRangeInit *FRI = nullptr);
-  bool MightBeDeclarator(unsigned Context);
-  DeclGroupPtrTy ParseDeclGroup(ParsingDeclSpec &DS, unsigned Context,
+  bool MightBeDeclarator(DeclaratorContext Context);
+  DeclGroupPtrTy ParseDeclGroup(ParsingDeclSpec &DS, DeclaratorContext Context,
 SourceLocation *DeclEnd = nullptr,
 ForRangeInit *FRI = nullptr);
   Decl *ParseDeclarationAfterDeclarator(Declarator &D,
@@ -1951,7 +1952,8 @@ private:
 const ParsedTemplateInfo &TemplateInfo,
 AccessSpecifier AS, DeclSpecContext DSC, 
 ParsedAttributesWithRange &Attrs);
-  DeclSpecContext getDeclSpecContextFromDeclaratorContext(unsigned Context);
+  DeclSpecContext
+  getDeclSpecContextFromDeclaratorContext(DeclaratorContext Context);
   void ParseDeclarationSpecifiers(DeclSpec &DS,
 const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(),
   AccessSpecifier AS = AS_none,
@@ -1965,7 +1967,7 @@ private:
DeclSpecContext DSC = DSC_normal);
 
   void ParseObjCTypeQualifierList(ObjCDeclSpec &DS,
-  Declarator::TheContext Context);
+  DeclaratorContext Context);
 
   void ParseEnumSpecifier(SourceLocation TagLoc, DeclSpec &DS,
   const ParsedTemplateInfo &TemplateInfo,
@@ -2161,8 +2163,8 @@ private:
 
 public:
   TypeResult ParseTypeName(SourceRange *Range = nullptr,
-   Declarator::TheContext Context
- = Declarator::TypeNameContext,
+   DeclaratorContext Context
+ = DeclaratorContext::TypeNameContext,
AccessSpecifier AS = AS_none,
Decl **OwnedType = nullptr,
ParsedAttributes *Attrs = nullptr);
@@ -2512,20 +2514,21 @@ private:
 
   void DiagnoseUnexpectedNamespace(NamedDecl *Context);
 
-  DeclGroupPtrTy ParseNamespace(unsigned Context, SourceLocation &DeclEnd,
+  DeclGroupPtrTy ParseNamespace(DeclaratorContext Context,
+SourceLocation &DeclEnd,
 SourceLocation InlineLoc = SourceLocation());
-  void ParseInnerNamespace(std::vector& IdentLoc,
-   std::vector& Ident,
-   

r321547 - Revert r321504 "[X86] Don't accidentally enable PKU on cannon lake and icelake or CLWB on cannonlake."

2017-12-28 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Thu Dec 28 22:39:16 2017
New Revision: 321547

URL: http://llvm.org/viewvc/llvm-project?rev=321547&view=rev
Log:
Revert r321504 "[X86] Don't accidentally enable PKU on cannon lake and icelake 
or CLWB on cannonlake."

I based that commit on what was in Intel's public documentation here 
https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf

Which specifically said CLWB wasn't until Icelake.

But I've since cross checked with SDE and it thinks these features exist on CNL 
and ICL. So now I don't know what to believe.

I've added test coverage of the current behavior as part of the revert so at 
least now have proof of what we're doing.

Modified:
cfe/trunk/lib/Basic/Targets/X86.cpp
cfe/trunk/test/Preprocessor/predefined-arch-macros.c

Modified: cfe/trunk/lib/Basic/Targets/X86.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/X86.cpp?rev=321547&r1=321546&r2=321547&view=diff
==
--- cfe/trunk/lib/Basic/Targets/X86.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/X86.cpp Thu Dec 28 22:39:16 2017
@@ -139,7 +139,6 @@ bool X86TargetInfo::initFeatureMap(
 setFeatureEnabledImpl(Features, "avx512vnni", true);
 setFeatureEnabledImpl(Features, "avx512vbmi2", true);
 setFeatureEnabledImpl(Features, "avx512vpopcntdq", true);
-setFeatureEnabledImpl(Features, "clwb", true);
 LLVM_FALLTHROUGH;
   case CK_Cannonlake:
 setFeatureEnabledImpl(Features, "avx512ifma", true);
@@ -152,10 +151,8 @@ bool X86TargetInfo::initFeatureMap(
 setFeatureEnabledImpl(Features, "avx512dq", true);
 setFeatureEnabledImpl(Features, "avx512bw", true);
 setFeatureEnabledImpl(Features, "avx512vl", true);
-if (Kind == CK_SkylakeServer) {
-  setFeatureEnabledImpl(Features, "pku", true);
-  setFeatureEnabledImpl(Features, "clwb", true);
-}
+setFeatureEnabledImpl(Features, "pku", true);
+setFeatureEnabledImpl(Features, "clwb", true);
 LLVM_FALLTHROUGH;
   case CK_SkylakeClient:
 setFeatureEnabledImpl(Features, "xsavec", true);

Modified: cfe/trunk/test/Preprocessor/predefined-arch-macros.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/predefined-arch-macros.c?rev=321547&r1=321546&r2=321547&view=diff
==
--- cfe/trunk/test/Preprocessor/predefined-arch-macros.c (original)
+++ cfe/trunk/test/Preprocessor/predefined-arch-macros.c Thu Dec 28 22:39:16 
2017
@@ -972,14 +972,14 @@
 // CHECK_CNL_M32: #define __BMI2__ 1
 // CHECK_CNL_M32: #define __BMI__ 1
 // CHECK_CNL_M32: #define __CLFLUSHOPT__ 1
-// CHECK_CNL_M32-NOT: #define __CLWB__ 1
+// CHECK_CNL_M32: #define __CLWB__ 1
 // CHECK_CNL_M32: #define __F16C__ 1
 // CHECK_CNL_M32: #define __FMA__ 1
 // CHECK_CNL_M32: #define __LZCNT__ 1
 // CHECK_CNL_M32: #define __MMX__ 1
 // CHECK_CNL_M32: #define __MPX__ 1
 // CHECK_CNL_M32: #define __PCLMUL__ 1
-// CHECK_CNL_M32-NOT: #define __PKU__ 1
+// CHECK_CNL_M32: #define __PKU__ 1
 // CHECK_CNL_M32: #define __POPCNT__ 1
 // CHECK_CNL_M32: #define __PRFCHW__ 1
 // CHECK_CNL_M32: #define __RDRND__ 1
@@ -1019,14 +1019,14 @@
 // CHECK_CNL_M64: #define __BMI2__ 1
 // CHECK_CNL_M64: #define __BMI__ 1
 // CHECK_CNL_M64: #define __CLFLUSHOPT__ 1
-// CHECK_CNL_M64-NOT: #define __CLWB__ 1
+// CHECK_CNL_M64: #define __CLWB__ 1
 // CHECK_CNL_M64: #define __F16C__ 1
 // CHECK_CNL_M64: #define __FMA__ 1
 // CHECK_CNL_M64: #define __LZCNT__ 1
 // CHECK_CNL_M64: #define __MMX__ 1
 // CHECK_CNL_M64: #define __MPX__ 1
 // CHECK_CNL_M64: #define __PCLMUL__ 1
-// CHECK_CNL_M64-NOT: #define __PKU__ 1
+// CHECK_CNL_M64: #define __PKU__ 1
 // CHECK_CNL_M64: #define __POPCNT__ 1
 // CHECK_CNL_M64: #define __PRFCHW__ 1
 // CHECK_CNL_M64: #define __RDRND__ 1
@@ -1079,7 +1079,7 @@
 // CHECK_ICL_M32: #define __MMX__ 1
 // CHECK_ICL_M32: #define __MPX__ 1
 // CHECK_ICL_M32: #define __PCLMUL__ 1
-// CHECK_ICL_M32-NOT: #define __PKU__ 1
+// CHECK_ICL_M32: #define __PKU__ 1
 // CHECK_ICL_M32: #define __POPCNT__ 1
 // CHECK_ICL_M32: #define __PRFCHW__ 1
 // CHECK_ICL_M32: #define __RDRND__ 1
@@ -1133,7 +1133,7 @@
 // CHECK_ICL_M64: #define __MMX__ 1
 // CHECK_ICL_M64: #define __MPX__ 1
 // CHECK_ICL_M64: #define __PCLMUL__ 1
-// CHECK_ICL_M64-NOT: #define __PKU__ 1
+// CHECK_ICL_M64: #define __PKU__ 1
 // CHECK_ICL_M64: #define __POPCNT__ 1
 // CHECK_ICL_M64: #define __PRFCHW__ 1
 // CHECK_ICL_M64: #define __RDRND__ 1


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