Re: [PATCH] D61914: [Support][Test] Time profiler: add regression test

2019-06-07 Thread Puyan Lotfi via cfe-commits
--target=

Sent from ProtonMail Mobile

On Fri, Jun 7, 2019 at 2:01 PM, Anton Afanasyev via Phabricator 
 wrote:

> anton-afanasyev marked an inline comment as done.
> anton-afanasyev added a comment.
>
> In D61914#1534508 , @plotfi wrote:
>
>> cfe/trunk/test/Driver/check-time-trace.cpp appears to fail on Darwin. Did 
>> you mean to pass the target explicitly ?
>
> This commit is reverted now. How can I pass the target explicitly?
>
> 
> Comment at: cfe/trunk/test/Driver/check-time-trace.cpp:1
> +// RUN: %clangxx -ftime-trace %s 2>&1 | grep "Time trace json-file dumped 
> to" \
> +// RUN: | awk '{print $NF}' | xargs cat \
> 
> plotfi wrote:
>> This test should probably have // REQUIRES: shell
> Thanks! I haven't found `REQUIRES: shell` here: 
> `https://llvm.org/docs/CommandGuide/FileCheck.html`. Does this directive mean 
> the target OS must have utils like `awk` and `xargs`?
>
> Repository:
> rL LLVM
>
> CHANGES SINCE LAST ACTION
> https://reviews.llvm.org/D61914/new/
>
> https://reviews.llvm.org/D61914-BEGIN PGP PUBLIC KEY BLOCK-
Version: Pmcrypto Golang 0.0.1 (ddacebe0)
Comment: https://protonmail.com

xsBNBFiqrSIBCADBs95WesbqXDDK3y+LLHh/EuIZUAFg6tSOCD3r7VPBjRTAw6+e
H8VztrEyPm6MffHJBCh9K9N+lE7U/jtDzdEMlPX7rxt+VbkNTadkitNxHpJQqifu
qI4SyOQfpedyIJZ/VokXgtqdBV0iugtlRvkC7kyk+H8rOwBDNEGL9eh+zL/k20RP
CNATpXl902yOMC9nCaB7zDZt/twPbUY7qGjV3wxSwIzUySdZPLgPcseip84O3uYX
+QShZAqgi5ajCJflqcQKNUMJDN0dX4tFmaOWQ4HKQ4tTFkX4x6iOFy/1lRb6irHp
g7/BXpNLeagvyjMc598+tYObSpqVHIVAqc/RABEBAAHNIXB1eWFuQHB1eWFuLm9y
ZyA8cHV5YW5AcHV5YW4ub3JnPsLAdQQQAQgAKQUCWKqtIgYLCQcIAwIJEHs5Mm+b
S7GXBBUIAgoDFgIBAhkBAhsDAh4BAAAN8gf7BVfluoQUyiIQx2ponrIRv6jeOTiv
0aYUyFwUzQ7aPdtHSORYoQNKtLbXV2jUMtrsR3MIW2eYVA51iO/V0OqYGAFtc45W
YnQ0XK0bEPjQHx/oMhCGnlcFVGt5dLymqIQN8X0AROYydx0QG8EMGIyrU5OkJOJG
grIfnImUJ5N9naBBolXoGeO4q5tZ9PewcbYWm+jVZa92CO2f6LXeEQUCDXN6GpsT
WF3O8G8fRNC89maOIZKpx23Pv9JnPA0fBWJb1vyJujygtCHkPwa4SwQw9p9bcds9
n22XRIOICNbgT3fJ19JIuVkt9guHXrJE7jLWCAd8f+7vLfYs+LreS1fwBs7ATQRY
qq0iAQgAoUEmT7Epc7aX+Ylh+eHdxeLbGizzm1wzwtQtm/f72DiqJueLC/I1RQKe
M6wTXyfdF2yZ0E0/Hf7YREnLEjqVxmD5ygS1Ifvv2gzNyAvDWc8bey3t3NRGsWvv
8nUeJNM3vhWPpRIEUZ+t0l4fLYFlm1o1lOh6T33LdiyZW62shVmuS82Vr4B223Yx
/oHtgIBD+PTXlETrOPKPdxwbUjaQkqlFlzTH2Wc1ygW8wM+rXuHQPJ8BlIIopIZt
I3ZFz3r3Zy3j4k6I0QyP7Z5j1jm3bIOXgIJeE2HqNWhpYNFAGqzrlGY+1sEH2T/A
6sfca5oe+6ziPpWJxqmou+9GgiYbPwARAQABwsBfBBgBCAATBQJYqq0iCRB7OTJv
m0uxlwIbDAAAO8cH/0UtYyy4pm2E9xfw3cz3/7NfPoY5KZH0DtivFFxmlzo07BJh
qmFVql7yE8yzK8pqssBqmsV012H2+/sqPbudShbW4UOPcnDiHAgfDb+UR8QEqmJf
bDo9Gpk6Bo3VHGbpCtlZY88cHJYpXu2g69jQIyseG0pQKGcRJZ+8t/rK3IX086Uy
ZehflSk3uU3hxdN96JlvFf4GEdgdzxlE6S3AnyjV05yrjkiDhFmSRt1Pr4U9uSES
swXnufUmP+QgdINI94GPhyJSkvdRoFk0nb7E3lCyzCgIEc2p//vfuhBMN2Znrwzp
MccpJXqocidMX0HqjMh9ZUlLkEaYeAGg+qwBVRE=
=HAbn
-END PGP PUBLIC KEY BLOCK-___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r363626 - [clang-ifs] Clang Interface Stubs, first version.

2019-06-17 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Mon Jun 17 15:46:54 2019
New Revision: 363626

URL: http://llvm.org/viewvc/llvm-project?rev=363626&view=rev
Log:
[clang-ifs] Clang Interface Stubs, first version.

Clang interface stubs (previously referred to as clang-ifsos) is a new frontend
action in clang that allows the generation of stub files that contain mangled
name info that can be used to produce a stub library. These stub libraries can
be useful for breaking up build dependencies and controlling access to a
library's internal symbols. Generation of these stubs can be invoked by:

clang -fvisibility= -emit-interface-stubs \
-interface-stub-version=

Notice that -fvisibility (along with use of visibility attributes) can be used
to control what symbols get generated. Currently the interface format is
experimental but there are a wide range of possibilities here.

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



Added:
cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
cfe/trunk/test/InterfaceStubs/
cfe/trunk/test/InterfaceStubs/bad-format.cpp
cfe/trunk/test/InterfaceStubs/class-template-specialization.cpp
cfe/trunk/test/InterfaceStubs/externstatic.c
cfe/trunk/test/InterfaceStubs/function-template-specialization.cpp
cfe/trunk/test/InterfaceStubs/hidden-class-inheritance.cpp
cfe/trunk/test/InterfaceStubs/inline.c
cfe/trunk/test/InterfaceStubs/inline.h
cfe/trunk/test/InterfaceStubs/object.cpp
cfe/trunk/test/InterfaceStubs/template-namespace-function.cpp
cfe/trunk/test/InterfaceStubs/virtual.cpp
cfe/trunk/test/InterfaceStubs/visibility.cpp
cfe/trunk/test/InterfaceStubs/weak.cpp
Modified:
cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Driver/Types.def
cfe/trunk/include/clang/Frontend/FrontendActions.h
cfe/trunk/include/clang/Frontend/FrontendOptions.h
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CMakeLists.txt
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=363626&r1=363625&r2=363626&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Mon Jun 17 
15:46:54 2019
@@ -220,6 +220,8 @@ def err_module_header_file_not_found :
 def err_module_header_file_invalid :
   Error<"unexpected module header file input '%0'">, DefaultFatal;
 
+def err_interface_stubs : Error<"clang-ifs (-emit-iterface-stubs): %0">;
+
 def err_test_module_file_extension_version : Error<
   "test module file extension '%0' has different version (%1.%2) than expected 
"
   "(%3.%4)">;

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=363626&r1=363625&r2=363626&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Jun 17 15:46:54 2019
@@ -623,6 +623,9 @@ def emit_ast : Flag<["-"], "emit-ast">,
   HelpText<"Emit Clang AST files for source inputs">;
 def emit_llvm : Flag<["-"], "emit-llvm">, Flags<[CC1Option]>, 
Group,
   HelpText<"Use the LLVM representation for assembler and object files">;
+def emit_iterface_stubs : Flag<["-"], "emit-interface-stubs">, 
Flags<[CC1Option]>, Group,
+  HelpText<"Generate Inteface Stub Files.">;
+def iterface_stub_version_EQ : JoinedOrSeparate<["-"], 
"interface-stub-version=">, Flags<[CC1Option]>;
 def exported__symbols__list : Separate<["-"], "exported_symbols_list">;
 def e : JoinedOrSeparate<["-"], "e">, Group;
 def fPIC : Flag<["-"], "fPIC">, Group;

Modified: cfe/trunk/include/clang/Driver/Types.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.def?rev=363626&r1=363625&r2=363626&view=diff
==
--- cfe/trunk/include/clang/Driver/Types.def (original)
+++ cfe/trunk/include/clang/Driver/Types.def Mon Jun 17 15:46:54 2019
@@ -88,6 +88,7 @@ TYPE("lto-bc",   LTO_BC,
 
 // Misc.
 TYPE("ast",  AST,  INVALID, "ast",   "u")
+TYPE("ifs",  IFS,  INVALID, "ifs",   "u")
 TYPE("pcm",  ModuleFile,   INVALID, "pcm",   "u")
 TYPE("plist",Plist,INVALID, "plist", "")
 TYPE("rewritten-objc",   RewrittenObjC,INVALID, "cpp",   "")

Modified: cfe/trunk/include/clang/Frontend/FrontendActions.h
URL: 
http://ll

r363646 - [NFC] Fixing -DBUILD_SHARED_LIBS=ON problem caused by layering issue in D60974

2019-06-17 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Mon Jun 17 21:40:03 2019
New Revision: 363646

URL: http://llvm.org/viewvc/llvm-project?rev=363646&view=rev
Log:
[NFC] Fixing -DBUILD_SHARED_LIBS=ON problem caused by layering issue in  D60974

Modified:
cfe/trunk/lib/Frontend/CMakeLists.txt

Modified: cfe/trunk/lib/Frontend/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CMakeLists.txt?rev=363646&r1=363645&r2=363646&view=diff
==
--- cfe/trunk/lib/Frontend/CMakeLists.txt (original)
+++ cfe/trunk/lib/Frontend/CMakeLists.txt Mon Jun 17 21:40:03 2019
@@ -55,7 +55,6 @@ add_clang_library(clangFrontend
   clangAST
   clangBasic
   clangDriver
-  clangIndex
   clangEdit
   clangLex
   clangParse


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


r363648 - [NFC] Undoing r363646 to fix bots.

2019-06-17 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Mon Jun 17 22:15:59 2019
New Revision: 363648

URL: http://llvm.org/viewvc/llvm-project?rev=363648&view=rev
Log:
[NFC] Undoing r363646 to fix bots.

-DBUILD_SHARED_LIBS=ON is still having problem caused by layering issues with
D60974. Locally there weren't problems building with shared libs on or off but
the bots appear to be acting up.



Modified:
cfe/trunk/lib/Frontend/CMakeLists.txt

Modified: cfe/trunk/lib/Frontend/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CMakeLists.txt?rev=363648&r1=363647&r2=363648&view=diff
==
--- cfe/trunk/lib/Frontend/CMakeLists.txt (original)
+++ cfe/trunk/lib/Frontend/CMakeLists.txt Mon Jun 17 22:15:59 2019
@@ -55,6 +55,7 @@ add_clang_library(clangFrontend
   clangAST
   clangBasic
   clangDriver
+  clangIndex
   clangEdit
   clangLex
   clangParse


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


r363878 - [clang][AST] ASTNameGenerator: A refactoring of CodegenNameGeneratorImpl (NFC).

2019-06-19 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Wed Jun 19 13:51:35 2019
New Revision: 363878

URL: http://llvm.org/viewvc/llvm-project?rev=363878&view=rev
Log:
[clang][AST] ASTNameGenerator: A refactoring of CodegenNameGeneratorImpl (NFC).

This is a NFC refactor move of CodegenNameGeneratorImpl from clang::Index to
clang:AST (and rename to ASTNameGenerator). The purpose is to make the
highlevel mangling code more reusable inside of clang (say in places like clang
FrontendAction). This does not affect anything in CodegenNameGenerator, except
that CodegenNameGenerator will now use ASTNameGenerator (in AST).

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

Modified:
cfe/trunk/include/clang/AST/Mangle.h
cfe/trunk/include/clang/Index/CodegenNameGenerator.h
cfe/trunk/lib/AST/CMakeLists.txt
cfe/trunk/lib/AST/Mangle.cpp
cfe/trunk/lib/Index/CodegenNameGenerator.cpp

Modified: cfe/trunk/include/clang/AST/Mangle.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Mangle.h?rev=363878&r1=363877&r2=363878&view=diff
==
--- cfe/trunk/include/clang/AST/Mangle.h (original)
+++ cfe/trunk/include/clang/AST/Mangle.h Wed Jun 19 13:51:35 2019
@@ -17,6 +17,7 @@
 #include "clang/AST/Type.h"
 #include "clang/Basic/ABI.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/IR/DataLayout.h"
 #include "llvm/Support/Casting.h"
 
 namespace llvm {
@@ -243,6 +244,24 @@ public:
   static MicrosoftMangleContext *create(ASTContext &Context,
 DiagnosticsEngine &Diags);
 };
+
+class ASTNameGenerator {
+  std::unique_ptr MC;
+  llvm::DataLayout DL;
+
+public:
+  explicit ASTNameGenerator(ASTContext &Ctx);
+  bool writeName(const Decl *D, raw_ostream &OS);
+  std::string getName(const Decl *D);
+  std::vector getAllManglings(const Decl *D);
+
+private:
+  std::vector getAllManglings(const ObjCContainerDecl *OCD);
+  bool writeFuncOrVarName(const NamedDecl *D, raw_ostream &OS);
+  void writeObjCClassName(const ObjCInterfaceDecl *D, raw_ostream &OS);
+  std::string getMangledStructor(const NamedDecl *ND, unsigned StructorType);
+  std::string getMangledThunk(const CXXMethodDecl *MD, const ThunkInfo &T);
+};
 }
 
 #endif

Modified: cfe/trunk/include/clang/Index/CodegenNameGenerator.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Index/CodegenNameGenerator.h?rev=363878&r1=363877&r2=363878&view=diff
==
--- cfe/trunk/include/clang/Index/CodegenNameGenerator.h (original)
+++ cfe/trunk/include/clang/Index/CodegenNameGenerator.h Wed Jun 19 13:51:35 
2019
@@ -13,6 +13,7 @@
 #ifndef LLVM_CLANG_INDEX_CODEGENNAMEGENERATOR_H
 #define LLVM_CLANG_INDEX_CODEGENNAMEGENERATOR_H
 
+#include "clang/AST/Mangle.h"
 #include "clang/Basic/LLVM.h"
 #include 
 #include 
@@ -42,7 +43,7 @@ public:
 
 private:
   struct Implementation;
-  std::unique_ptr Impl;
+  std::unique_ptr Impl;
 };
 
 } // namespace index

Modified: cfe/trunk/lib/AST/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CMakeLists.txt?rev=363878&r1=363877&r2=363878&view=diff
==
--- cfe/trunk/lib/AST/CMakeLists.txt (original)
+++ cfe/trunk/lib/AST/CMakeLists.txt Wed Jun 19 13:51:35 2019
@@ -1,5 +1,6 @@
 set(LLVM_LINK_COMPONENTS
   BinaryFormat
+  Core
   Support
   )
 

Modified: cfe/trunk/lib/AST/Mangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Mangle.cpp?rev=363878&r1=363877&r2=363878&view=diff
==
--- cfe/trunk/lib/AST/Mangle.cpp (original)
+++ cfe/trunk/lib/AST/Mangle.cpp Wed Jun 19 13:51:35 2019
@@ -17,10 +17,12 @@
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/Mangle.h"
+#include "clang/AST/VTableBuilder.h"
 #include "clang/Basic/ABI.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/IR/Mangler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -280,3 +282,184 @@ void MangleContext::mangleObjCMethodName
   mangleObjCMethodNameWithoutSize(MD, OS);
   Out << OS.str().size() << OS.str();
 }
+
+ASTNameGenerator::ASTNameGenerator(ASTContext &Ctx)
+: MC(Ctx.createMangleContext()), DL(Ctx.getTargetInfo().getDataLayout()) {}
+
+bool ASTNameGenerator::writeName(const Decl *D, raw_ostream &OS) {
+  // First apply frontend mangling.
+  SmallString<128> FrontendBuf;
+  llvm::raw_svector_ostream FrontendBufOS(FrontendBuf);
+  if (auto *FD = dyn_cast(D)) {
+if (FD->isDependentContext())
+  return true;
+if (writeFuncOrVarName(FD, FrontendBufOS))
+  return true;
+  } else if (auto *VD = dyn_cast(D)) {
+if (writeFuncOrVarName(VD, FrontendBufOS))
+  return true;
+  } else if (auto *MD = dyn_cast(D)) {
+MC->m

r363908 - [clang][AST] Refactoring ASTNameGenerator to use pimpl pattern (NFC).

2019-06-19 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Wed Jun 19 23:01:06 2019
New Revision: 363908

URL: http://llvm.org/viewvc/llvm-project?rev=363908&view=rev
Log:
[clang][AST] Refactoring ASTNameGenerator to use pimpl pattern (NFC).

The original pimpl pattern used between CodegenNameGenerator and
CodegenNameGeneratorImpl did a good job of hiding DataLayout making it so that
users of CodegenNameGenerator did not need to link with llvm core.  This is an
NFC change to neatly wrap ASTNameGenerator in a pimpl.

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



Modified:
cfe/trunk/include/clang/AST/Mangle.h
cfe/trunk/lib/AST/Mangle.cpp

Modified: cfe/trunk/include/clang/AST/Mangle.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Mangle.h?rev=363908&r1=363907&r2=363908&view=diff
==
--- cfe/trunk/include/clang/AST/Mangle.h (original)
+++ cfe/trunk/include/clang/AST/Mangle.h Wed Jun 19 23:01:06 2019
@@ -17,7 +17,6 @@
 #include "clang/AST/Type.h"
 #include "clang/Basic/ABI.h"
 #include "llvm/ADT/DenseMap.h"
-#include "llvm/IR/DataLayout.h"
 #include "llvm/Support/Casting.h"
 
 namespace llvm {
@@ -246,21 +245,16 @@ public:
 };
 
 class ASTNameGenerator {
-  std::unique_ptr MC;
-  llvm::DataLayout DL;
-
 public:
   explicit ASTNameGenerator(ASTContext &Ctx);
+  ~ASTNameGenerator();
   bool writeName(const Decl *D, raw_ostream &OS);
   std::string getName(const Decl *D);
   std::vector getAllManglings(const Decl *D);
 
 private:
-  std::vector getAllManglings(const ObjCContainerDecl *OCD);
-  bool writeFuncOrVarName(const NamedDecl *D, raw_ostream &OS);
-  void writeObjCClassName(const ObjCInterfaceDecl *D, raw_ostream &OS);
-  std::string getMangledStructor(const NamedDecl *ND, unsigned StructorType);
-  std::string getMangledThunk(const CXXMethodDecl *MD, const ThunkInfo &T);
+  class Implementation;
+  std::unique_ptr Impl;
 };
 }
 

Modified: cfe/trunk/lib/AST/Mangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Mangle.cpp?rev=363908&r1=363907&r2=363908&view=diff
==
--- cfe/trunk/lib/AST/Mangle.cpp (original)
+++ cfe/trunk/lib/AST/Mangle.cpp Wed Jun 19 23:01:06 2019
@@ -22,6 +22,7 @@
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/IR/DataLayout.h"
 #include "llvm/IR/Mangler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
@@ -283,183 +284,204 @@ void MangleContext::mangleObjCMethodName
   Out << OS.str().size() << OS.str();
 }
 
-ASTNameGenerator::ASTNameGenerator(ASTContext &Ctx)
-: MC(Ctx.createMangleContext()), DL(Ctx.getTargetInfo().getDataLayout()) {}
-
-bool ASTNameGenerator::writeName(const Decl *D, raw_ostream &OS) {
-  // First apply frontend mangling.
-  SmallString<128> FrontendBuf;
-  llvm::raw_svector_ostream FrontendBufOS(FrontendBuf);
-  if (auto *FD = dyn_cast(D)) {
-if (FD->isDependentContext())
+class ASTNameGenerator::Implementation {
+  std::unique_ptr MC;
+  llvm::DataLayout DL;
+
+public:
+  explicit Implementation(ASTContext &Ctx)
+  : MC(Ctx.createMangleContext()), DL(Ctx.getTargetInfo().getDataLayout()) 
{
+  }
+
+  bool writeName(const Decl *D, raw_ostream &OS) {
+// First apply frontend mangling.
+SmallString<128> FrontendBuf;
+llvm::raw_svector_ostream FrontendBufOS(FrontendBuf);
+if (auto *FD = dyn_cast(D)) {
+  if (FD->isDependentContext())
+return true;
+  if (writeFuncOrVarName(FD, FrontendBufOS))
+return true;
+} else if (auto *VD = dyn_cast(D)) {
+  if (writeFuncOrVarName(VD, FrontendBufOS))
+return true;
+} else if (auto *MD = dyn_cast(D)) {
+  MC->mangleObjCMethodNameWithoutSize(MD, OS);
+  return false;
+} else if (auto *ID = dyn_cast(D)) {
+  writeObjCClassName(ID, FrontendBufOS);
+} else {
   return true;
-if (writeFuncOrVarName(FD, FrontendBufOS))
-  return true;
-  } else if (auto *VD = dyn_cast(D)) {
-if (writeFuncOrVarName(VD, FrontendBufOS))
-  return true;
-  } else if (auto *MD = dyn_cast(D)) {
-MC->mangleObjCMethodNameWithoutSize(MD, OS);
+}
+
+// Now apply backend mangling.
+llvm::Mangler::getNameWithPrefix(OS, FrontendBufOS.str(), DL);
 return false;
-  } else if (auto *ID = dyn_cast(D)) {
-writeObjCClassName(ID, FrontendBufOS);
-  } else {
-return true;
   }
 
-  // Now apply backend mangling.
-  llvm::Mangler::getNameWithPrefix(OS, FrontendBufOS.str(), DL);
-  return false;
-}
-
-std::string ASTNameGenerator::getName(const Decl *D) {
-  std::string Name;
-  {
-llvm::raw_string_ostream OS(Name);
-writeName(D, OS);
+  std::string getName(const Decl *D) {
+std::string Name;
+{
+  llvm::raw_string_ostream OS(Name);
+  writeName(D, OS);
+}
+return Name;
   }
-  return Name;
-}
 
-enum ObjCKind {
-  ObjCClass,
- 

r363948 - [clang-ifs] Clang Interface Stubs, first version (second landing attempt).

2019-06-20 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Thu Jun 20 09:59:48 2019
New Revision: 363948

URL: http://llvm.org/viewvc/llvm-project?rev=363948&view=rev
Log:
[clang-ifs] Clang Interface Stubs, first version (second landing attempt).

This change reverts r363649; effectively re-landing r363626. At this point
clang::Index::CodegenNameGeneratorImpl has been refactored into
clang::AST::ASTNameGenerator. This makes it so that the previous circular link
dependency no longer exists, fixing the previous share lib
(-DBUILD_SHARED_LIBS=ON) build issue which was the reason for r363649.

Clang interface stubs (previously referred to as clang-ifsos) is a new frontend
action in clang that allows the generation of stub files that contain mangled
name info that can be used to produce a stub library. These stub libraries can
be useful for breaking up build dependencies and controlling access to a
library's internal symbols. Generation of these stubs can be invoked by:

clang -fvisibility= -emit-interface-stubs \
-interface-stub-version=

Notice that -fvisibility (along with use of visibility attributes) can be used
to control what symbols get generated. Currently the interface format is
experimental but there are a wide range of possibilities here.

Currently clang-ifs produces .ifs files that can be thought of as analogous to
object (.o) files, but just for the mangled symbol info. In a subsequent patch
I intend to add support for merging the .ifs files into one .ifs/.ifso file
that can be the input to something like llvm-elfabi to produce something like a
.so file or .dll (but without any of the code, just symbols).

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

Added:
cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
cfe/trunk/test/InterfaceStubs/bad-format.cpp
cfe/trunk/test/InterfaceStubs/class-template-specialization.cpp
cfe/trunk/test/InterfaceStubs/externstatic.c
cfe/trunk/test/InterfaceStubs/function-template-specialization.cpp
cfe/trunk/test/InterfaceStubs/hidden-class-inheritance.cpp
cfe/trunk/test/InterfaceStubs/inline.c
cfe/trunk/test/InterfaceStubs/inline.h
cfe/trunk/test/InterfaceStubs/object.cpp
cfe/trunk/test/InterfaceStubs/template-namespace-function.cpp
cfe/trunk/test/InterfaceStubs/virtual.cpp
cfe/trunk/test/InterfaceStubs/visibility.cpp
cfe/trunk/test/InterfaceStubs/weak.cpp
Modified:
cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Driver/Types.def
cfe/trunk/include/clang/Frontend/FrontendActions.h
cfe/trunk/include/clang/Frontend/FrontendOptions.h
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CMakeLists.txt
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=363948&r1=363947&r2=363948&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Thu Jun 20 
09:59:48 2019
@@ -220,6 +220,8 @@ def err_module_header_file_not_found :
 def err_module_header_file_invalid :
   Error<"unexpected module header file input '%0'">, DefaultFatal;
 
+def err_interface_stubs : Error<"clang-ifs (-emit-iterface-stubs): %0">;
+
 def err_test_module_file_extension_version : Error<
   "test module file extension '%0' has different version (%1.%2) than expected 
"
   "(%3.%4)">;

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=363948&r1=363947&r2=363948&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Thu Jun 20 09:59:48 2019
@@ -623,6 +623,9 @@ def emit_ast : Flag<["-"], "emit-ast">,
   HelpText<"Emit Clang AST files for source inputs">;
 def emit_llvm : Flag<["-"], "emit-llvm">, Flags<[CC1Option]>, 
Group,
   HelpText<"Use the LLVM representation for assembler and object files">;
+def emit_iterface_stubs : Flag<["-"], "emit-interface-stubs">, 
Flags<[CC1Option]>, Group,
+  HelpText<"Generate Inteface Stub Files.">;
+def iterface_stub_version_EQ : JoinedOrSeparate<["-"], 
"interface-stub-version=">, Flags<[CC1Option]>;
 def exported__symbols__list : Separate<["-"], "exported_symbols_list">;
 def e : JoinedOrSeparate<["-"], "e">, Group;
 def fPIC : Flag<["-"], "fPIC">, Group;

Modified: cfe/trunk/include/clang/Driver/Types.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.def?rev=363948&r1=363947&r2=363948&view=diff

r363963 - [NFC] Fix for InterfaceStubs tests (adding REQUIRES: x86-registered-target).

2019-06-20 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Thu Jun 20 11:28:21 2019
New Revision: 363963

URL: http://llvm.org/viewvc/llvm-project?rev=363963&view=rev
Log:
[NFC] Fix for InterfaceStubs tests (adding REQUIRES: x86-registered-target).

clang-hexagon-elf bot was failing with:

'No available targets are compatible with triple "x86_64-unknown-linux-gnu"'

Adding a "// REQUIRES: x86-registered-target" to these tests to quiet the bot.

Modified:
cfe/trunk/test/InterfaceStubs/bad-format.cpp
cfe/trunk/test/InterfaceStubs/class-template-specialization.cpp
cfe/trunk/test/InterfaceStubs/externstatic.c
cfe/trunk/test/InterfaceStubs/function-template-specialization.cpp
cfe/trunk/test/InterfaceStubs/hidden-class-inheritance.cpp
cfe/trunk/test/InterfaceStubs/inline.c
cfe/trunk/test/InterfaceStubs/inline.h
cfe/trunk/test/InterfaceStubs/object.cpp
cfe/trunk/test/InterfaceStubs/template-namespace-function.cpp
cfe/trunk/test/InterfaceStubs/virtual.cpp
cfe/trunk/test/InterfaceStubs/visibility.cpp
cfe/trunk/test/InterfaceStubs/weak.cpp

Modified: cfe/trunk/test/InterfaceStubs/bad-format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/bad-format.cpp?rev=363963&r1=363962&r2=363963&view=diff
==
--- cfe/trunk/test/InterfaceStubs/bad-format.cpp (original)
+++ cfe/trunk/test/InterfaceStubs/bad-format.cpp Thu Jun 20 11:28:21 2019
@@ -1,3 +1,4 @@
+// REQUIRES: x86-registered-target
 // RUN: not %clang -target x86_64-linux-gnu -o - -emit-interface-stubs \
 // RUN: -interface-stub-version=bar-format %s 2>&1 | FileCheck %s
 

Modified: cfe/trunk/test/InterfaceStubs/class-template-specialization.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/class-template-specialization.cpp?rev=363963&r1=363962&r2=363963&view=diff
==
--- cfe/trunk/test/InterfaceStubs/class-template-specialization.cpp (original)
+++ cfe/trunk/test/InterfaceStubs/class-template-specialization.cpp Thu Jun 20 
11:28:21 2019
@@ -1,3 +1,4 @@
+// REQUIRES: x86-registered-target
 // RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
 // RUN: -interface-stub-version=experimental-tapi-elf-v1 %s | \
 // RUN: FileCheck -check-prefix=CHECK-TAPI %s

Modified: cfe/trunk/test/InterfaceStubs/externstatic.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/externstatic.c?rev=363963&r1=363962&r2=363963&view=diff
==
--- cfe/trunk/test/InterfaceStubs/externstatic.c (original)
+++ cfe/trunk/test/InterfaceStubs/externstatic.c Thu Jun 20 11:28:21 2019
@@ -1,3 +1,4 @@
+// REQUIRES: x86-registered-target
 // RUN: %clang -DSTORAGE="extern" -target x86_64-unknown-linux-gnu -o - \
 // RUN: -emit-interface-stubs \
 // RUN: -interface-stub-version=experimental-yaml-elf-v1 -std=c99 -xc %s | \

Modified: cfe/trunk/test/InterfaceStubs/function-template-specialization.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/function-template-specialization.cpp?rev=363963&r1=363962&r2=363963&view=diff
==
--- cfe/trunk/test/InterfaceStubs/function-template-specialization.cpp 
(original)
+++ cfe/trunk/test/InterfaceStubs/function-template-specialization.cpp Thu Jun 
20 11:28:21 2019
@@ -1,3 +1,4 @@
+// REQUIRES: x86-registered-target
 // RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
 // RUN: -interface-stub-version=experimental-tapi-elf-v1 %s | FileCheck %s
 

Modified: cfe/trunk/test/InterfaceStubs/hidden-class-inheritance.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/hidden-class-inheritance.cpp?rev=363963&r1=363962&r2=363963&view=diff
==
--- cfe/trunk/test/InterfaceStubs/hidden-class-inheritance.cpp (original)
+++ cfe/trunk/test/InterfaceStubs/hidden-class-inheritance.cpp Thu Jun 20 
11:28:21 2019
@@ -1,3 +1,4 @@
+// REQUIRES: x86-registered-target
 // RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
 // RUN: -interface-stub-version=experimental-tapi-elf-v1 \
 // RUN: -DPARENT_CLASS_VISIBILITY="" -DCHILD_CLASS_VISIBILITY="" \

Modified: cfe/trunk/test/InterfaceStubs/inline.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/inline.c?rev=363963&r1=363962&r2=363963&view=diff
==
--- cfe/trunk/test/InterfaceStubs/inline.c (original)
+++ cfe/trunk/test/InterfaceStubs/inline.c Thu Jun 20 11:28:21 2019
@@ -1,3 +1,4 @@
+// REQUIRES: x86-registered-target
 // RUN: %clang -DINLINE=inline -target x86_64-unknown-linux-gnu -o - \
 // RUN: -emit-interface-stubs \
 // RUN: -interface-stub-version=experimental-yaml-elf-v1 -std=gn

r366761 - [NFC][clang] Refactor getCompilationPhases()+Types.def step 1.

2019-07-22 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Mon Jul 22 16:10:10 2019
New Revision: 366761

URL: http://llvm.org/viewvc/llvm-project?rev=366761&view=rev
Log:
[NFC][clang] Refactor getCompilationPhases()+Types.def step 1.

Moves list of phases into Types.def table: Currently Types.def contains a
table of strings that are used to assemble a list of compilation phases to be
setup in the clang driver's jobs pipeline. This change makes it so that the 
table
itself contains the list of phases. A subsequent patch will remove the strings.

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


Modified:
cfe/trunk/include/clang/Driver/Types.def
cfe/trunk/include/clang/Driver/Types.h
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/Types.cpp

Modified: cfe/trunk/include/clang/Driver/Types.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.def?rev=366761&r1=366760&r2=366761&view=diff
==
--- cfe/trunk/include/clang/Driver/Types.def (original)
+++ cfe/trunk/include/clang/Driver/Types.def Mon Jul 22 16:10:10 2019
@@ -37,69 +37,71 @@
 //  A - The type's temporary suffix should be appended when generating
 //  outputs of this type.
 
+// The sixth value is a variadic list of phases for each type. Eventually the
+// options flag string will be replaced with this variadic list.
 
 // C family source language (with and without preprocessing).
-TYPE("cpp-output",   PP_C, INVALID, "i", "u")
-TYPE("c",C,PP_C,"c", "u")
-TYPE("cl",   CL,   PP_C,"cl","u")
-TYPE("cuda-cpp-output",  PP_CUDA,  INVALID, "cui",   "u")
-TYPE("cuda", CUDA, PP_CUDA, "cu","u")
-TYPE("cuda", CUDA_DEVICE,  PP_CUDA, "cu","")
-TYPE("hip-cpp-output",   PP_HIP,   INVALID, "cui",   "u")
-TYPE("hip",  HIP,  PP_HIP,  "cu","u")
-TYPE("hip",  HIP_DEVICE,   PP_HIP,  "cu","")
-TYPE("objective-c-cpp-output",   PP_ObjC,  INVALID, "mi","u")
-TYPE("objc-cpp-output",  PP_ObjC_Alias, INVALID,"mi","u")
-TYPE("objective-c",  ObjC, PP_ObjC, "m", "u")
-TYPE("c++-cpp-output",   PP_CXX,   INVALID, "ii","u")
-TYPE("c++",  CXX,  PP_CXX,  "cpp",   "u")
-TYPE("objective-c++-cpp-output", PP_ObjCXX,INVALID, "mii",   "u")
-TYPE("objc++-cpp-output",PP_ObjCXX_Alias, INVALID,  "mii",   "u")
-TYPE("objective-c++",ObjCXX,   PP_ObjCXX,   "mm","u")
-TYPE("renderscript", RenderScript, PP_C,"rs","u")
+TYPE("cpp-output",   PP_C, INVALID, "i", "u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
+TYPE("c",C,PP_C,"c", "u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
+TYPE("cl",   CL,   PP_C,"cl","u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
+TYPE("cuda-cpp-output",  PP_CUDA,  INVALID, "cui",   "u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
+TYPE("cuda", CUDA, PP_CUDA, "cu","u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
+TYPE("cuda", CUDA_DEVICE,  PP_CUDA, "cu","" , 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
+TYPE("hip-cpp-output",   PP_HIP,   INVALID, "cui",   "u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
+TYPE("hip",  HIP,  PP_HIP,  "cu","u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
+TYPE("hip",  HIP_DEVICE,   PP_HIP,  "cu","" , 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
+TYPE("objective-c-cpp-output",   PP_ObjC,  INVALID, "mi","u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
+TYPE("objc-cpp-output",  PP_ObjC_Alias, INVALID,"mi","u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
+TYPE("objective-c",  ObjC, PP_ObjC, "m", "u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
+TYPE("c++-cpp-output",   PP_CXX,   INVALID, "ii","u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
+TYPE("c++",  CXX,  PP_CXX,  "cpp",   "u", 

r367063 - [NFC][clang] Refactor getCompilationPhases()+Types.def step 2.

2019-07-25 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Thu Jul 25 15:05:55 2019
New Revision: 367063

URL: http://llvm.org/viewvc/llvm-project?rev=367063&view=rev
Log:
[NFC][clang] Refactor getCompilationPhases()+Types.def step 2.

- Removing a few of the entries in the Flags for the Types.def table.
- Removing redundant parts of getCompilationPhases().

Flags have been removed from Types.def:

 a - The type should only be assembled: Now, check that Phases contains
 phases::Assemble but not phases::Compile or phases::Backend.
 p - The type should only be precompiled: Now, check that Phases contains
 phases::Precompile but that Flags does not contain 'm'.
 m - Precompiling this type produces a module file: Now, check that
 isPrepeocessedModuleType.



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

Modified:
cfe/trunk/include/clang/Driver/Types.def
cfe/trunk/lib/Driver/Types.cpp

Modified: cfe/trunk/include/clang/Driver/Types.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.def?rev=367063&r1=367062&r2=367063&view=diff
==
--- cfe/trunk/include/clang/Driver/Types.def (original)
+++ cfe/trunk/include/clang/Driver/Types.def Thu Jul 25 15:05:55 2019
@@ -30,15 +30,12 @@
 // of this type, or null if unspecified.
 
 // The fifth value is a string containing option flags. Valid values:
-//  a - The type should only be assembled.
-//  p - The type should only be precompiled.
 //  u - The type can be user specified (with -x).
-//  m - Precompiling this type produces a module file.
-//  A - The type's temporary suffix should be appended when generating
-//  outputs of this type.
 
 // The sixth value is a variadic list of phases for each type. Eventually the
 // options flag string will be replaced with this variadic list.
+// Most of the options in Flags have been removed in favor of subsuming their
+// meaning from the phases list.
 
 // C family source language (with and without preprocessing).
 TYPE("cpp-output",   PP_C, INVALID, "i", "u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
@@ -61,22 +58,22 @@ TYPE("objective-c++",ObjCXX,
 TYPE("renderscript", RenderScript, PP_C,"rs","u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
 
 // C family input files to precompile.
-TYPE("c-header-cpp-output",  PP_CHeader,   INVALID, "i", "p",  
phases::Precompile)
-TYPE("c-header", CHeader,  PP_CHeader,  "h", "pu", 
phases::Preprocess, phases::Precompile)
-TYPE("cl-header",CLHeader, PP_CHeader,  "h", "pu", 
phases::Preprocess, phases::Precompile)
-TYPE("objective-c-header-cpp-output", PP_ObjCHeader, INVALID,   "mi","p",  
phases::Precompile)
-TYPE("objective-c-header",   ObjCHeader,   PP_ObjCHeader,   "h", "pu", 
phases::Preprocess, phases::Precompile)
-TYPE("c++-header-cpp-output",PP_CXXHeader, INVALID, "ii","p",  
phases::Precompile)
-TYPE("c++-header",   CXXHeader,PP_CXXHeader,"hh","pu", 
phases::Preprocess, phases::Precompile)
-TYPE("objective-c++-header-cpp-output", PP_ObjCXXHeader, INVALID, "mii", "p",  
phases::Precompile)
-TYPE("objective-c++-header", ObjCXXHeader, PP_ObjCXXHeader, "h", "pu", 
phases::Preprocess, phases::Precompile)
-TYPE("c++-module",   CXXModule,PP_CXXModule,"cppm",  "mu", 
phases::Preprocess, phases::Precompile, phases::Compile, phases::Backend, 
phases::Assemble, phases::Link)
-TYPE("c++-module-cpp-output",PP_CXXModule, INVALID, "iim",   "m",  
phases::Precompile, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
+TYPE("c-header-cpp-output",  PP_CHeader,   INVALID, "i", "",   
phases::Precompile)
+TYPE("c-header", CHeader,  PP_CHeader,  "h", "u",  
phases::Preprocess, phases::Precompile)
+TYPE("cl-header",CLHeader, PP_CHeader,  "h", "u",  
phases::Preprocess, phases::Precompile)
+TYPE("objective-c-header-cpp-output", PP_ObjCHeader, INVALID,   "mi","",   
phases::Precompile)
+TYPE("objective-c-header",   ObjCHeader,   PP_ObjCHeader,   "h", "u",  
phases::Preprocess, phases::Precompile)
+TYPE("c++-header-cpp-output",PP_CXXHeader, INVALID, "ii","",   
phases::Precompile)
+TYPE("c++-header",   CXXHeader,PP_CXXHeader,"hh","u",  
phases::Preprocess, phases::Precompile)
+TYPE("objective-c++-header-cpp-output", PP_ObjCXXHeader, INVALID, "mii", "",   
phases::Precompile)
+TYPE("objective-c++-header", ObjCXXHeader, PP_ObjCXXHeader, "h", "u",  
phases::Preprocess, phases::Precompile)
+TYPE("c++-module",   CXXModule,PP_CXXModule,"cppm",  "u",  
phases::Preprocess, phases::Precompile, phases::Compile, phases::Backend, 
phases::Assemble, phases::Lin

r367345 - [NFC][clang] Refactor getCompilationPhases()+Types.def step 3.

2019-07-30 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Tue Jul 30 12:03:17 2019
New Revision: 367345

URL: http://llvm.org/viewvc/llvm-project?rev=367345&view=rev
Log:
[NFC][clang] Refactor getCompilationPhases()+Types.def step 3.

Dropping the 'u' entry and the entire Flags table from Types.def.
Now it'll be a bit easier to tablegenify this.

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

Modified:
cfe/trunk/include/clang/Driver/Types.def
cfe/trunk/include/clang/Driver/Types.h
cfe/trunk/lib/Driver/Types.cpp

Modified: cfe/trunk/include/clang/Driver/Types.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.def?rev=367345&r1=367344&r2=367345&view=diff
==
--- cfe/trunk/include/clang/Driver/Types.def (original)
+++ cfe/trunk/include/clang/Driver/Types.def Tue Jul 30 12:03:17 2019
@@ -29,76 +29,73 @@
 // The fourth value is the suffix to use when creating temporary files
 // of this type, or null if unspecified.
 
-// The fifth value is a string containing option flags. Valid values:
-//  u - The type can be user specified (with -x).
-
-// The sixth value is a variadic list of phases for each type. Eventually the
+// The final value is a variadic list of phases for each type. Eventually the
 // options flag string will be replaced with this variadic list.
 // Most of the options in Flags have been removed in favor of subsuming their
 // meaning from the phases list.
 
 // C family source language (with and without preprocessing).
-TYPE("cpp-output",   PP_C, INVALID, "i", "u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
-TYPE("c",C,PP_C,"c", "u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("cl",   CL,   PP_C,"cl","u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("cuda-cpp-output",  PP_CUDA,  INVALID, "cui",   "u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
-TYPE("cuda", CUDA, PP_CUDA, "cu","u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("cuda", CUDA_DEVICE,  PP_CUDA, "cu","" , 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("hip-cpp-output",   PP_HIP,   INVALID, "cui",   "u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
-TYPE("hip",  HIP,  PP_HIP,  "cu","u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("hip",  HIP_DEVICE,   PP_HIP,  "cu","" , 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("objective-c-cpp-output",   PP_ObjC,  INVALID, "mi","u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
-TYPE("objc-cpp-output",  PP_ObjC_Alias, INVALID,"mi","u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
-TYPE("objective-c",  ObjC, PP_ObjC, "m", "u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("c++-cpp-output",   PP_CXX,   INVALID, "ii","u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
-TYPE("c++",  CXX,  PP_CXX,  "cpp",   "u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("objective-c++-cpp-output", PP_ObjCXX,INVALID, "mii",   "u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
-TYPE("objc++-cpp-output",PP_ObjCXX_Alias, INVALID,  "mii",   "u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
-TYPE("objective-c++",ObjCXX,   PP_ObjCXX,   "mm","u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("renderscript", RenderScript, PP_C,"rs","u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
+TYPE("cpp-output",   PP_C, INVALID, "i",  
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
+TYPE("c",C,PP_C,"c",  
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
+TYPE("cl",   CL,   PP_C,"cl", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
+TYPE("cuda-cpp-output",  PP_CUDA,  INVALID, "cui",
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
+TYPE("cu

r367478 - [NFC][clang] Refactor getCompilationPhases()+Types.def step 3.

2019-07-31 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Wed Jul 31 13:40:08 2019
New Revision: 367478

URL: http://llvm.org/viewvc/llvm-project?rev=367478&view=rev
Log:
[NFC][clang] Refactor getCompilationPhases()+Types.def step 3.

Second landing attempt: Changed TY_ObjCXXHeader to TY_PP_ObjCXXHeader to fix
-xobjective-c++-header. This time I verified against
preprocessor output.

Dropping the 'u' entry and the entire Flags table from Types.def.
Now it'll be a bit easier to tablegenify this.

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


Modified:
cfe/trunk/include/clang/Driver/Types.def
cfe/trunk/include/clang/Driver/Types.h
cfe/trunk/lib/Driver/Types.cpp

Modified: cfe/trunk/include/clang/Driver/Types.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.def?rev=367478&r1=367477&r2=367478&view=diff
==
--- cfe/trunk/include/clang/Driver/Types.def (original)
+++ cfe/trunk/include/clang/Driver/Types.def Wed Jul 31 13:40:08 2019
@@ -29,76 +29,73 @@
 // The fourth value is the suffix to use when creating temporary files
 // of this type, or null if unspecified.
 
-// The fifth value is a string containing option flags. Valid values:
-//  u - The type can be user specified (with -x).
-
-// The sixth value is a variadic list of phases for each type. Eventually the
+// The final value is a variadic list of phases for each type. Eventually the
 // options flag string will be replaced with this variadic list.
 // Most of the options in Flags have been removed in favor of subsuming their
 // meaning from the phases list.
 
 // C family source language (with and without preprocessing).
-TYPE("cpp-output",   PP_C, INVALID, "i", "u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
-TYPE("c",C,PP_C,"c", "u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("cl",   CL,   PP_C,"cl","u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("cuda-cpp-output",  PP_CUDA,  INVALID, "cui",   "u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
-TYPE("cuda", CUDA, PP_CUDA, "cu","u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("cuda", CUDA_DEVICE,  PP_CUDA, "cu","" , 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("hip-cpp-output",   PP_HIP,   INVALID, "cui",   "u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
-TYPE("hip",  HIP,  PP_HIP,  "cu","u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("hip",  HIP_DEVICE,   PP_HIP,  "cu","" , 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("objective-c-cpp-output",   PP_ObjC,  INVALID, "mi","u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
-TYPE("objc-cpp-output",  PP_ObjC_Alias, INVALID,"mi","u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
-TYPE("objective-c",  ObjC, PP_ObjC, "m", "u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("c++-cpp-output",   PP_CXX,   INVALID, "ii","u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
-TYPE("c++",  CXX,  PP_CXX,  "cpp",   "u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("objective-c++-cpp-output", PP_ObjCXX,INVALID, "mii",   "u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
-TYPE("objc++-cpp-output",PP_ObjCXX_Alias, INVALID,  "mii",   "u", 
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
-TYPE("objective-c++",ObjCXX,   PP_ObjCXX,   "mm","u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
-TYPE("renderscript", RenderScript, PP_C,"rs","u", 
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
+TYPE("cpp-output",   PP_C, INVALID, "i",  
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
+TYPE("c",C,PP_C,"c",  
phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, 
phases::Link)
+TYPE("cl",   CL,   PP_C,"cl", 
phases::Preprocess, phases::Compile, 

Re: [PATCH] D58418: [clang][DirectoryWatcher] Upstream DirectoryWatcher

2019-08-02 Thread Puyan Lotfi via cfe-commits
Hi Jan, Thanks for the follow up!

Me and Compnerd narrowed down the issue to the inotify file count limit
being exceeded as the cause. DirectoryWatcherLinux::create() in
DirectoryWatcher-linux.cpp also doesn't properly perror, I'll post a patch
for this shortly to print perror info if the file count is exceeded.

The cause of the inotify limit being exceeded was... drumroll... _Dropbox_

PL



On Thu, Aug 1, 2019 at 11:24 AM Jan Korous via Phabricator via llvm-commits
 wrote:

> jkorous added a comment.
>
> Hi Puyan,
>
> I failed to reproduce with llvm.org/master
> (5faa533e47b0e54b04166b0257c5ebb48e6ffcaa <
> https://reviews.llvm.org/rG5faa533e47b0e54b04166b0257c5ebb48e6ffcaa>) on
> Ubuntu 18.04.1 LTS both in debug and release build.
>
> Since it sounds like you can reproduce "reliably" - can you please share
> more info how to reproduce?
>
>
> Repository:
>   rL LLVM
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D58418/new/
>
> https://reviews.llvm.org/D58418
>
>
>
> ___
> llvm-commits mailing list
> llvm-comm...@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D58418: [clang][DirectoryWatcher] Upstream DirectoryWatcher

2019-08-04 Thread Puyan Lotfi via cfe-commits
https://reviews.llvm.org/D65704
https://reviews.llvm.org/D65708

Thanks!

PL

On Thu, Aug 1, 2019 at 5:42 PM Jan Korous  wrote:

> Oh! Interesting! Thanks for investigating this.
>
> I'm happy to review the patch.
>
> On Aug 1, 2019, at 5:17 PM, Puyan Lotfi 
> wrote:
>
> Hi Jan, Thanks for the follow up!
>
> Me and Compnerd narrowed down the issue to the inotify file count limit
> being exceeded as the cause. DirectoryWatcherLinux::create() in
> DirectoryWatcher-linux.cpp also doesn't properly perror, I'll post a patch
> for this shortly to print perror info if the file count is exceeded.
>
>
> The cause of the inotify limit being exceeded was... drumroll... _Dropbox_
>
> PL
>
>
>
> On Thu, Aug 1, 2019 at 11:24 AM Jan Korous via Phabricator via
> llvm-commits  wrote:
>
>> jkorous added a comment.
>>
>> Hi Puyan,
>>
>> I failed to reproduce with llvm.org/master
>> (5faa533e47b0e54b04166b0257c5ebb48e6ffcaa <
>> https://reviews.llvm.org/rG5faa533e47b0e54b04166b0257c5ebb48e6ffcaa>) on
>> Ubuntu 18.04.1 LTS both in debug and release build.
>>
>> Since it sounds like you can reproduce "reliably" - can you please share
>> more info how to reproduce?
>>
>>
>> Repository:
>>   rL LLVM
>>
>> CHANGES SINCE LAST ACTION
>>   https://reviews.llvm.org/D58418/new/
>>
>> https://reviews.llvm.org/D58418
>>
>>
>>
>> ___
>> llvm-commits mailing list
>> llvm-comm...@lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r367968 - [NFC][DirectoryWatchedTests] Unlocks mutexes before signaling condition variable

2019-08-05 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Mon Aug  5 18:26:46 2019
New Revision: 367968

URL: http://llvm.org/viewvc/llvm-project?rev=367968&view=rev
Log:
[NFC][DirectoryWatchedTests] Unlocks mutexes before signaling condition variable

This should not affect actual behavior, but should pessimize the threading less
by avoiding the situation where:

  * mutex is still locked
  * T1 notifies on condition variable
  * T2 wakes to check mutex
  * T2 sees mutex is still locked
  * T2 waits
  * T1 unlocks mutex
  * T2 tries again, acquires mutex.

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


Modified:
cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp

Modified: cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp?rev=367968&r1=367967&r2=367968&view=diff
==
--- cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp (original)
+++ cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp Mon Aug  5 
18:26:46 2019
@@ -132,8 +132,10 @@ struct VerifyingConsumer {
 } else {
   ExpectedInitial.erase(It);
 }
-if (result())
+if (result()) {
+  L.unlock();
   ResultIsReady.notify_one();
+}
   }
 
   void consumeNonInitial(DirectoryWatcher::Event E) {
@@ -151,8 +153,10 @@ struct VerifyingConsumer {
 } else {
   ExpectedNonInitial.erase(It);
 }
-if (result())
+if (result()) {
+  L.unlock();
   ResultIsReady.notify_one();
+}
   }
 
   // This method is used by DirectoryWatcher.


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


r367979 - [clang][DirectoryWatcher] Adding llvm::Expected error handling to create.

2019-08-05 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Mon Aug  5 22:12:23 2019
New Revision: 367979

URL: http://llvm.org/viewvc/llvm-project?rev=367979&view=rev
Log:
[clang][DirectoryWatcher] Adding llvm::Expected error handling to create.

Prior to this patch Unix style errno error reporting from the inotify layer was
used by DirectoryWatcher::create to simply return a nullptr on error. This
would generally be ok, except that in LLVM we have much more robust error
reporting through the facilities of llvm::Expected.

The other critical thing I stumbled across was that the unit tests for
DirectoryWatcher were not failing abruptly when inotify_init() was reporting an
error, but would continue with the testing and eventually hit a deadlock in a
pathological machine state (ie in the unit test, the return nullptr on ::create
was ignored).

Generally this pathological state never happens on any build bot, so it is
totally understandable that it was overlooked, but on a Linux desktop running
a dubious desktop environment (which I will not name) there is a chance that
said desktop environment could use up enough inotify instances to exceed the
user's limit. These are the conditions that led me to hit the deadlock I am
addressing in this patch with more robust error handling.

With the new llvm::Expected error handling when your system runs out of inotify
instances for your user, the unit test will be forced to handle the error or
crash and report the issue to the user instead of weirdly deadlocking on a
condition variable wait.

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


Modified:
cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h
cfe/trunk/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
cfe/trunk/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp

Modified: cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h?rev=367979&r1=367978&r2=367979&view=diff
==
--- cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h (original)
+++ cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h Mon Aug  5 
22:12:23 2019
@@ -11,6 +11,7 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
 #include 
 #include 
 #include 
@@ -98,10 +99,11 @@ public:
 : Kind(Kind), Filename(Filename) {}
   };
 
-  /// Returns nullptr if \param Path doesn't exist or isn't a directory.
-  /// Returns nullptr if OS kernel API told us we can't start watching. In such
-  /// case it's unclear whether just retrying has any chance to succeeed.
-  static std::unique_ptr
+  /// Asserts if \param Path doesn't exist or isn't a directory.
+  /// Returns llvm::Expected Error if OS kernel API told us we can't start
+  /// watching. In such case it's unclear whether just retrying has any chance
+  /// to succeeed.
+  static llvm::Expected>
   create(llvm::StringRef Path,
  std::function Events,
 bool IsInitial)>

Modified: 
cfe/trunk/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp?rev=367979&r1=367978&r2=367979&view=diff
==
--- cfe/trunk/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp 
(original)
+++ cfe/trunk/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp 
Mon Aug  5 22:12:23 2019
@@ -11,9 +11,11 @@
 using namespace llvm;
 using namespace clang;
 
-std::unique_ptr clang::DirectoryWatcher::create(
+llvm::Expected> 
clang::DirectoryWatcher::create(
 StringRef Path,
 std::function, bool)> 
Receiver,
 bool WaitForInitialSync) {
-  return nullptr;
+  return llvm::make_error(
+  "DirectoryWatcher is not implemented for this platform!",
+  llvm::inconvertibleErrorCode());
 }
\ No newline at end of file

Modified: cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp?rev=367979&r1=367978&r2=367979&view=diff
==
--- cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp (original)
+++ cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp Mon Aug  5 
22:12:23 2019
@@ -13,6 +13,7 @@
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/AlignOf.h"
 #include "llvm/Support/Errno.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/Mutex.h"
 #include "llvm/Support/Path.h"
 #include 
@@ -320,16 +321,17 @@ DirectoryWatcherLinux::DirectoryWatcherL
 
 } // namespace
 
-

Re: r367979 - [clang][DirectoryWatcher] Adding llvm::Expected error handling to create.

2019-08-06 Thread Puyan Lotfi via cfe-commits
Thank you! I had forgot that cmake decides which cpp file to build with for 
DirectoryWatcher depending on the os you’re building on :-(

PL

Sent from ProtonMail Mobile

On Tue, Aug 6, 2019 at 12:14 AM, Shoaib Meenai  wrote:

> You missed a semicolon after an assert, which broke asserts Mac builds. I 
> fixed it in r367984.
>
> From: cfe-commits  on behalf of Puyan 
> Lotfi via cfe-commits 
> Reply-To: Puyan Lotfi 
> Date: Monday, August 5, 2019 at 10:11 PM
> To: "cfe-commits@lists.llvm.org" 
> Subject: r367979 - [clang][DirectoryWatcher] Adding llvm::Expected error 
> handling to create.
>
> Author: zer0
>
> Date: Mon Aug  5 22:12:23 2019
>
> New Revision: 367979
>
> URL: 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D367979-26view-3Drev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=6k2w1Mw8wKFqzKnFgq4r1I7Zmx7B-N-JdVMvtHYpjJs&s=GdHgTwHdRXipmG75D6eyJGuUUbCL0EMIl0YPYAY0y2U&e=
>
> Log:
>
> [clang][DirectoryWatcher] Adding llvm::Expected error handling to create.
>
> Prior to this patch Unix style errno error reporting from the inotify layer 
> was
>
> used by DirectoryWatcher::create to simply return a nullptr on error. This
>
> would generally be ok, except that in LLVM we have much more robust error
>
> reporting through the facilities of llvm::Expected.
>
> The other critical thing I stumbled across was that the unit tests for
>
> DirectoryWatcher were not failing abruptly when inotify_init() was reporting 
> an
>
> error, but would continue with the testing and eventually hit a deadlock in a
>
> pathological machine state (ie in the unit test, the return nullptr on 
> ::create
>
> was ignored).
>
> Generally this pathological state never happens on any build bot, so it is
>
> totally understandable that it was overlooked, but on a Linux desktop running
>
> a dubious desktop environment (which I will not name) there is a chance that
>
> said desktop environment could use up enough inotify instances to exceed the
>
> user's limit. These are the conditions that led me to hit the deadlock I am
>
> addressing in this patch with more robust error handling.
>
> With the new llvm::Expected error handling when your system runs out of 
> inotify
>
> instances for your user, the unit test will be forced to handle the error or
>
> crash and report the issue to the user instead of weirdly deadlocking on a
>
> condition variable wait.
>
> Differential Revision: 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D65704&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=6k2w1Mw8wKFqzKnFgq4r1I7Zmx7B-N-JdVMvtHYpjJs&s=vGtUV_-i1W7ejLSH8cWFnYlusAJMA8EK5kMTvuMmQB4&e=
>
> Modified:
>
> cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h
>
> 
> cfe/trunk/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
>
> cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
>
> cfe/trunk/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
>
> cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
>
> Modified: cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h
>
> URL: 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_include_clang_DirectoryWatcher_DirectoryWatcher.h-3Frev-3D367979-26r1-3D367978-26r2-3D367979-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=6k2w1Mw8wKFqzKnFgq4r1I7Zmx7B-N-JdVMvtHYpjJs&s=VCfJ3mXkHYvO_8Iw35iGLiTPxX-OaQIrX9fUY22ukbw&e=
>
> ==
>
> --- cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h (original)
>
> +++ cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h Mon Aug  5 
> 22:12:23 2019
>
> @@ -11,6 +11,7 @@
>
> #include "llvm/ADT/ArrayRef.h"
>
> #include "llvm/ADT/StringRef.h"
>
> +#include "llvm/Support/Error.h"
>
> #include 
>
> #include 
>
> #include 
>
> @@ -98,10 +99,11 @@ public:
>
>  : Kind(Kind), Filename(Filename) {}
>
>};
>
> -  /// Returns nullptr if \param Path doesn't exist or isn't a directory.
>
> -  /// Returns nullptr if OS kernel API told us we can't start watching. In 
> such
>
> -  /// case it's unclear whether just retrying has any chance to succeeed.
>
> -  static std::unique_ptr
>
> +  /// Asserts if \param Path doesn't exist or isn't a directory.
>
> +  /// Returns llvm::Expected Error if OS kernel API told us we can't start
>
&

r368108 - [clang][DirectoryWatcher][NFC] Swapping asserts for llvm fatal_error in create

2019-08-06 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Tue Aug  6 16:25:34 2019
New Revision: 368108

URL: http://llvm.org/viewvc/llvm-project?rev=368108&view=rev
Log:
[clang][DirectoryWatcher][NFC] Swapping asserts for llvm fatal_error in create

I also have replaced all the instances of
"auto DW = DirectoryWatcher::create" with
llvm::Expected> DW = DirectoryWatcher::create
to make it more clear that DirectoryWatcher::create is returning an Expected.

I've also allowed for logAllUnhandledErrors to consume errors in the case were
DirectoryWatcher::create produces them.

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



Modified:
cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h
cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
cfe/trunk/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp

Modified: cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h?rev=368108&r1=368107&r2=368108&view=diff
==
--- cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h (original)
+++ cfe/trunk/include/clang/DirectoryWatcher/DirectoryWatcher.h Tue Aug  6 
16:25:34 2019
@@ -99,10 +99,10 @@ public:
 : Kind(Kind), Filename(Filename) {}
   };
 
-  /// Asserts if \param Path doesn't exist or isn't a directory.
+  /// llvm fatal_error if \param Path doesn't exist or isn't a directory.
   /// Returns llvm::Expected Error if OS kernel API told us we can't start
   /// watching. In such case it's unclear whether just retrying has any chance
-  /// to succeeed.
+  /// to succeed.
   static llvm::Expected>
   create(llvm::StringRef Path,
  std::function Events,

Modified: cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp?rev=368108&r1=368107&r2=368108&view=diff
==
--- cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp (original)
+++ cfe/trunk/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp Tue Aug  6 
16:25:34 2019
@@ -325,7 +325,9 @@ llvm::Expected, bool)> 
Receiver,
 bool WaitForInitialSync) {
-  assert(!Path.empty() && "Path.empty()");
+  if (Path.empty())
+llvm::report_fatal_error(
+"DirectoryWatcher::create can not accept an empty Path.");
 
   const int InotifyFD = inotify_init1(IN_CLOEXEC);
   if (InotifyFD == -1)

Modified: cfe/trunk/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp?rev=368108&r1=368107&r2=368108&view=diff
==
--- cfe/trunk/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp (original)
+++ cfe/trunk/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp Tue Aug  6 
16:25:34 2019
@@ -150,7 +150,8 @@ FSEventStreamRef createFSEventStream(
 StringRef Path,
 std::function, bool)> 
Receiver,
 dispatch_queue_t Queue) {
-  assert(!Path.empty() && "Path.empty()");
+  if (Path.empty())
+return nullptr;
 
   CFMutableArrayRef PathsToWatch = [&]() {
 CFMutableArrayRef PathsToWatch =
@@ -208,7 +209,10 @@ llvm::Expectedhttp://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp?rev=368108&r1=368107&r2=368108&view=diff
==
--- cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp (original)
+++ cfe/trunk/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp Tue Aug  6 
16:25:34 2019
@@ -277,14 +277,20 @@ TEST(DirectoryWatcherTest, InitialScanSy
{EventKind::Modified, "c"}}
   };
 
-  auto DW = DirectoryWatcher::create(
-  fixture.TestWatchedDir,
-  [&TestConsumer](llvm::ArrayRef Events,
-  bool IsInitial) {
-TestConsumer.consume(Events, IsInitial);
-  },
-  /*waitForInitialSync=*/true);
-  if (!DW) return;
+  llvm::Expected> DW =
+  DirectoryWatcher::create(
+  fixture.TestWatchedDir,
+  [&TestConsumer](llvm::ArrayRef Events,
+  bool IsInitial) {
+TestConsumer.consume(Events, IsInitial);
+  },
+  /*waitForInitialSync=*/true);
+  if (!DW) {
+logAllUnhandledErrors(
+DW.takeError(), llvm::errs(),
+"DirectoryWatcherTest Failure on DirectoryWatcher::create(): ");
+exit(EXIT_FAILURE);
+  }
 
   checkEventualResultWithTimeout(TestConsumer);
 }
@@ -309,14 +315,20 @@ TEST(DirectoryWatcherTest, InitialScanAs
{EventKind::Modified, "c"}}
};
 
-  auto DW = DirectoryWatcher::create(
-  fixture.TestWatchedDir,
-  [&TestConsumer](llvm::ArrayRef Events,
-  

r368393 - [clang][NFC] Consolidating usage of "FinalPhase" in Driver::BuildActions.

2019-08-08 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Thu Aug  8 21:55:09 2019
New Revision: 368393

URL: http://llvm.org/viewvc/llvm-project?rev=368393&view=rev
Log:
[clang][NFC] Consolidating usage of "FinalPhase" in Driver::BuildActions.

I am working to remove this concept of the "FinalPhase" in the clang driver,
but it is used in a lot of different places to do argument handling for
different combinations of phase pipelines and arguments. I am trying to
consolidate most of the uses of "FinalPhase" into its own separate scope.
Eventually, in a subsequent patch I will move all of this stuff to a separate
function, and have more of the complication phase list construction setup into
types::getComplicationPhases.

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



Modified:
cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=368393&r1=368392&r2=368393&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Thu Aug  8 21:55:09 2019
@@ -3157,17 +3157,6 @@ void Driver::BuildActions(Compilation &C
 return;
   }
 
-  Arg *FinalPhaseArg;
-  phases::ID FinalPhase = getFinalPhase(Args, &FinalPhaseArg);
-
-  if (FinalPhase == phases::Link) {
-if (Args.hasArg(options::OPT_emit_llvm))
-  Diag(clang::diag::err_drv_emit_llvm_link);
-if (IsCLMode() && LTOMode != LTOK_None &&
-!Args.getLastArgValue(options::OPT_fuse_ld_EQ).equals_lower("lld"))
-  Diag(clang::diag::err_drv_lto_without_lld);
-  }
-
   // Reject -Z* at the top level, these options should never have been exposed
   // by gcc.
   if (Arg *A = Args.getLastArg(options::OPT_Z_Joined))
@@ -3220,15 +3209,6 @@ void Driver::BuildActions(Compilation &C
 Args.eraseArg(options::OPT__SLASH_Yc);
 YcArg = nullptr;
   }
-  if (FinalPhase == phases::Preprocess || Args.hasArg(options::OPT__SLASH_Y_)) 
{
-// If only preprocessing or /Y- is used, all pch handling is disabled.
-// Rather than check for it everywhere, just remove clang-cl pch-related
-// flags here.
-Args.eraseArg(options::OPT__SLASH_Fp);
-Args.eraseArg(options::OPT__SLASH_Yc);
-Args.eraseArg(options::OPT__SLASH_Yu);
-YcArg = YuArg = nullptr;
-  }
 
   // Builder to be used to build offloading actions.
   OffloadingActionBuilder OffloadBuilder(C, Args, Inputs);
@@ -3237,70 +3217,115 @@ void Driver::BuildActions(Compilation &C
   HeaderModulePrecompileJobAction *HeaderModuleAction = nullptr;
   ActionList LinkerInputs;
 
-  unsigned LastPLSize = 0;
+  phases::ID FinalPhase;
+  {
+Arg *FinalPhaseArg;
+FinalPhase = getFinalPhase(Args, &FinalPhaseArg);
+
+if (FinalPhase == phases::Link) {
+  if (Args.hasArg(options::OPT_emit_llvm))
+Diag(clang::diag::err_drv_emit_llvm_link);
+  if (IsCLMode() && LTOMode != LTOK_None &&
+  !Args.getLastArgValue(options::OPT_fuse_ld_EQ).equals_lower("lld"))
+Diag(clang::diag::err_drv_lto_without_lld);
+}
+
+if (FinalPhase == phases::Preprocess ||
+Args.hasArg(options::OPT__SLASH_Y_)) {
+  // If only preprocessing or /Y- is used, all pch handling is disabled.
+  // Rather than check for it everywhere, just remove clang-cl pch-related
+  // flags here.
+  Args.eraseArg(options::OPT__SLASH_Fp);
+  Args.eraseArg(options::OPT__SLASH_Yc);
+  Args.eraseArg(options::OPT__SLASH_Yu);
+  YcArg = YuArg = nullptr;
+}
+
+unsigned LastPLSize = 0;
+for (auto &I : Inputs) {
+  types::ID InputType = I.first;
+  const Arg *InputArg = I.second;
+
+  llvm::SmallVector PL;
+  types::getCompilationPhases(InputType, PL);
+  LastPLSize = PL.size();
+
+  // If the first step comes after the final phase we are doing as part of
+  // this compilation, warn the user about it.
+  phases::ID InitialPhase = PL[0];
+  if (InitialPhase > FinalPhase) {
+if (InputArg->isClaimed())
+  continue;
+
+// Claim here to avoid the more general unused warning.
+InputArg->claim();
+
+// Suppress all unused style warnings with -Qunused-arguments
+if (Args.hasArg(options::OPT_Qunused_arguments))
+  continue;
+
+// Special case when final phase determined by binary name, rather than
+// by a command-line argument with a corresponding Arg.
+if (CCCIsCPP())
+  Diag(clang::diag::warn_drv_input_file_unused_by_cpp)
+  << InputArg->getAsString(Args) << getPhaseName(InitialPhase);
+// Special case '-E' warning on a previously preprocessed file to make
+// more sense.
+else if (InitialPhase == phases::Compile &&
+ (Args.getLastArg(options::OPT__SLASH_EP,
+  options::OPT__SLASH_P) ||
+  Args.getLastArg(options::OPT_E) ||
+  Args.getLastArg(options::OPT_M,

r368734 - [NFC][clang] Adding argument based Phase list filtering to getComplicationPhases

2019-08-13 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Tue Aug 13 11:42:03 2019
New Revision: 368734

URL: http://llvm.org/viewvc/llvm-project?rev=368734&view=rev
Log:
[NFC][clang] Adding argument based Phase list filtering to getComplicationPhases

This patch removes usage of FinalPhase from anywhere outside of the scope where
it is used to do argument handling.  It also adds argument based trimming of
the Phase list pulled out of the Types.def table.

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


Modified:
cfe/trunk/include/clang/Driver/Types.h
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/Types.cpp

Modified: cfe/trunk/include/clang/Driver/Types.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.h?rev=368734&r1=368733&r2=368734&view=diff
==
--- cfe/trunk/include/clang/Driver/Types.h (original)
+++ cfe/trunk/include/clang/Driver/Types.h Tue Aug 13 11:42:03 2019
@@ -11,12 +11,14 @@
 
 #include "clang/Driver/Phases.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Option/ArgList.h"
 
 namespace llvm {
 class StringRef;
 }
 namespace clang {
 namespace driver {
+class Driver;
 namespace types {
   enum ID {
 TY_INVALID,
@@ -100,6 +102,9 @@ namespace types {
   void getCompilationPhases(
 ID Id,
 llvm::SmallVectorImpl &Phases);
+  void getCompilationPhases(const clang::driver::Driver &Driver,
+llvm::opt::DerivedArgList &DAL, ID Id,
+llvm::SmallVectorImpl &Phases);
 
   /// lookupCXXTypeForCType - Lookup CXX input type that corresponds to given
   /// C type (used for clang++ emulation of g++ behaviour)

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=368734&r1=368733&r2=368734&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Aug 13 11:42:03 2019
@@ -3217,10 +3217,9 @@ void Driver::BuildActions(Compilation &C
   HeaderModulePrecompileJobAction *HeaderModuleAction = nullptr;
   ActionList LinkerInputs;
 
-  phases::ID FinalPhase;
   {
 Arg *FinalPhaseArg;
-FinalPhase = getFinalPhase(Args, &FinalPhaseArg);
+phases::ID FinalPhase = getFinalPhase(Args, &FinalPhaseArg);
 
 if (FinalPhase == phases::Link) {
   if (Args.hasArg(options::OPT_emit_llvm))
@@ -3323,10 +3322,13 @@ void Driver::BuildActions(Compilation &C
 const Arg *InputArg = I.second;
 
 llvm::SmallVector PL;
-types::getCompilationPhases(InputType, PL);
-if (PL[0] > FinalPhase)
+types::getCompilationPhases(*this, Args, InputType, PL);
+if (PL.empty())
   continue;
 
+llvm::SmallVector FullPL;
+types::getCompilationPhases(InputType, FullPL);
+
 // Build the pipeline for this file.
 Action *Current = C.MakeAction(*InputArg, InputType);
 
@@ -3337,13 +3339,9 @@ void Driver::BuildActions(Compilation &C
 
 for (phases::ID Phase : PL) {
 
-  // We are done if this step is past what the user requested.
-  if (Phase > FinalPhase)
-break;
-
   // Add any offload action the host action depends on.
   Current = OffloadBuilder.addDeviceDependencesToHostAction(
-  Current, InputArg, Phase, FinalPhase, PL);
+  Current, InputArg, Phase, PL.back(), FullPL);
   if (!Current)
 break;
 

Modified: cfe/trunk/lib/Driver/Types.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Types.cpp?rev=368734&r1=368733&r2=368734&view=diff
==
--- cfe/trunk/lib/Driver/Types.cpp (original)
+++ cfe/trunk/lib/Driver/Types.cpp Tue Aug 13 11:42:03 2019
@@ -7,9 +7,13 @@
 
//===--===//
 
 #include "clang/Driver/Types.h"
+#include "clang/Driver/Driver.h"
+#include "clang/Driver/DriverDiagnostic.h"
+#include "clang/Driver/Options.h"
 #include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/StringSwitch.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/Option/Arg.h"
 #include 
 #include 
 
@@ -293,6 +297,56 @@ void types::getCompilationPhases(ID Id,
   assert(P.size() <= phases::MaxNumberOfPhases && "Too many phases in list");
 }
 
+void types::getCompilationPhases(const clang::driver::Driver &Driver,
+ llvm::opt::DerivedArgList &DAL, ID Id,
+ llvm::SmallVectorImpl &P) {
+  llvm::SmallVector PhaseList;
+  types::getCompilationPhases(Id, PhaseList);
+
+  // Filter to compiler mode. When the compiler is run as a preprocessor then
+  // compilation is not an option.
+  // -S runs the compiler in Assembly listing mode.
+  if (Driver.CCCIsCPP() || DAL.getLastArg(options::OPT_E) ||
+  DAL.getLastArg(options::OPT__SLASH_EP) ||
+  DAL.getLastArg(options::OPT_M, o

r368881 - [NFC][clang] Moving argument handling: Driver::BuildActions -> handleArguments

2019-08-14 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Wed Aug 14 10:02:21 2019
New Revision: 368881

URL: http://llvm.org/viewvc/llvm-project?rev=368881&view=rev
Log:
[NFC][clang] Moving argument handling: Driver::BuildActions -> handleArguments

This patch simply moves code that already exists into a new function.
Specifically I think it will make the BuildActions code for building a clang
job pipeline easier to read and work with.

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




Modified:
cfe/trunk/include/clang/Driver/Driver.h
cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=368881&r1=368880&r2=368881&view=diff
==
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Wed Aug 14 10:02:21 2019
@@ -18,6 +18,7 @@
 #include "clang/Driver/Util.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Support/StringSaver.h"
 
@@ -250,9 +251,17 @@ private:
 
   // getFinalPhase - Determine which compilation mode we are in and record
   // which option we used to determine the final phase.
+  // TODO: Much of what getFinalPhase returns are not actually true compiler
+  //   modes. Fold this functionality into Types::getCompilationPhases and
+  //   handleArguments.
   phases::ID getFinalPhase(const llvm::opt::DerivedArgList &DAL,
llvm::opt::Arg **FinalPhaseArg = nullptr) const;
 
+  // handleArguments - All code related to claiming and printing diagnostics
+  // related to arguments to the driver are done here.
+  void handleArguments(Compilation &C, llvm::opt::DerivedArgList &Args,
+   const InputList &Inputs, ActionList &Actions) const;
+
   // Before executing jobs, sets up response files for commands that need them.
   void setUpResponseFiles(Compilation &C, Command &Cmd);
 

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=368881&r1=368880&r2=368881&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Wed Aug 14 10:02:21 2019
@@ -3148,6 +3148,123 @@ public:
 };
 } // anonymous namespace.
 
+void Driver::handleArguments(Compilation &C, DerivedArgList &Args,
+ const InputList &Inputs,
+ ActionList &Actions) const {
+
+  // Ignore /Yc/Yu if both /Yc and /Yu passed but with different filenames.
+  Arg *YcArg = Args.getLastArg(options::OPT__SLASH_Yc);
+  Arg *YuArg = Args.getLastArg(options::OPT__SLASH_Yu);
+  if (YcArg && YuArg && strcmp(YcArg->getValue(), YuArg->getValue()) != 0) {
+Diag(clang::diag::warn_drv_ycyu_different_arg_clang_cl);
+Args.eraseArg(options::OPT__SLASH_Yc);
+Args.eraseArg(options::OPT__SLASH_Yu);
+YcArg = YuArg = nullptr;
+  }
+  if (YcArg && Inputs.size() > 1) {
+Diag(clang::diag::warn_drv_yc_multiple_inputs_clang_cl);
+Args.eraseArg(options::OPT__SLASH_Yc);
+YcArg = nullptr;
+  }
+
+  Arg *FinalPhaseArg;
+  phases::ID FinalPhase = getFinalPhase(Args, &FinalPhaseArg);
+
+  if (FinalPhase == phases::Link) {
+if (Args.hasArg(options::OPT_emit_llvm))
+  Diag(clang::diag::err_drv_emit_llvm_link);
+if (IsCLMode() && LTOMode != LTOK_None &&
+!Args.getLastArgValue(options::OPT_fuse_ld_EQ).equals_lower("lld"))
+  Diag(clang::diag::err_drv_lto_without_lld);
+  }
+
+  if (FinalPhase == phases::Preprocess || Args.hasArg(options::OPT__SLASH_Y_)) 
{
+// If only preprocessing or /Y- is used, all pch handling is disabled.
+// Rather than check for it everywhere, just remove clang-cl pch-related
+// flags here.
+Args.eraseArg(options::OPT__SLASH_Fp);
+Args.eraseArg(options::OPT__SLASH_Yc);
+Args.eraseArg(options::OPT__SLASH_Yu);
+YcArg = YuArg = nullptr;
+  }
+
+  unsigned LastPLSize = 0;
+  for (auto &I : Inputs) {
+types::ID InputType = I.first;
+const Arg *InputArg = I.second;
+
+llvm::SmallVector PL;
+types::getCompilationPhases(InputType, PL);
+LastPLSize = PL.size();
+
+// If the first step comes after the final phase we are doing as part of
+// this compilation, warn the user about it.
+phases::ID InitialPhase = PL[0];
+if (InitialPhase > FinalPhase) {
+  if (InputArg->isClaimed())
+continue;
+
+  // Claim here to avoid the more general unused warning.
+  InputArg->claim();
+
+  // Suppress all unused style warnings with -Qunused-arguments
+  if (Args.hasArg(options::OPT_Qunused_arguments))
+continue;
+
+  // Special case when final phase determined by binary name, rather than
+  // by a command-line argument with a corresponding Arg.

r373538 - [clang][ifs] Clang Interface Stubs ToolChain plumbing.

2019-10-02 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Wed Oct  2 15:50:07 2019
New Revision: 373538

URL: http://llvm.org/viewvc/llvm-project?rev=373538&view=rev
Log:
[clang][ifs] Clang Interface Stubs ToolChain plumbing.

This patch enables end to end support for generating ELF interface stubs
directly from clang. Now the following:

clang -emit-interface-stubs -o libfoo.so a.cpp b.cpp c.cpp

will product an ELF binary with visible symbols populated. Visibility attributes
and -fvisibility can be used to control what gets populated.

* Adding ToolChain support for clang Driver IFS Merge Phase
* Implementing a default InterfaceStubs Merge clang Tool, used by ToolChain
* Adds support for the clang Driver to involve llvm-ifs on ifs files.
* Adds -emit-merged-ifs flag, to tell llvm-ifs to emit a merged ifs text file
  instead of the final object format (normally ELF)


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

Added:
cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.cpp
cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.h
cfe/trunk/test/InterfaceStubs/conflict-type.ifs
cfe/trunk/test/InterfaceStubs/driver-test.c
cfe/trunk/test/InterfaceStubs/func.ifs
cfe/trunk/test/InterfaceStubs/merge-conflict-test.c
cfe/trunk/test/InterfaceStubs/object-double.c
cfe/trunk/test/InterfaceStubs/object-float.c
cfe/trunk/test/InterfaceStubs/object.c
cfe/trunk/test/InterfaceStubs/object.ifs
Modified:
cfe/trunk/include/clang/Driver/Action.h
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Driver/Phases.h
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/include/clang/Driver/Types.def
cfe/trunk/lib/Driver/Action.cpp
cfe/trunk/lib/Driver/CMakeLists.txt
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/Phases.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Driver/Types.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/InterfaceStubs/bad-format.cpp
cfe/trunk/test/InterfaceStubs/class-template-specialization.cpp
cfe/trunk/test/InterfaceStubs/externstatic.c
cfe/trunk/test/InterfaceStubs/function-template-specialization.cpp
cfe/trunk/test/InterfaceStubs/inline.c
cfe/trunk/test/InterfaceStubs/template-namespace-function.cpp
cfe/trunk/test/InterfaceStubs/weak.cpp
cfe/trunk/test/lit.cfg.py

Modified: cfe/trunk/include/clang/Driver/Action.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Action.h?rev=373538&r1=373537&r2=373538&view=diff
==
--- cfe/trunk/include/clang/Driver/Action.h (original)
+++ cfe/trunk/include/clang/Driver/Action.h Wed Oct  2 15:50:07 2019
@@ -65,6 +65,7 @@ public:
 BackendJobClass,
 AssembleJobClass,
 LinkJobClass,
+IfsMergeJobClass,
 LipoJobClass,
 DsymutilJobClass,
 VerifyDebugInfoJobClass,
@@ -485,6 +486,17 @@ public:
   }
 };
 
+class IfsMergeJobAction : public JobAction {
+  void anchor() override;
+
+public:
+  IfsMergeJobAction(ActionList &Inputs, types::ID Type);
+
+  static bool classof(const Action *A) {
+return A->getKind() == IfsMergeJobClass;
+  }
+};
+
 class LinkJobAction : public JobAction {
   void anchor() override;
 

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=373538&r1=373537&r2=373538&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Wed Oct  2 15:50:07 2019
@@ -633,6 +633,9 @@ def emit_llvm : Flag<["-"], "emit-llvm">
   HelpText<"Use the LLVM representation for assembler and object files">;
 def emit_iterface_stubs : Flag<["-"], "emit-interface-stubs">, 
Flags<[CC1Option]>, Group,
   HelpText<"Generate Inteface Stub Files.">;
+def emit_merged_ifs : Flag<["-"], "emit-merged-ifs">,
+  Flags<[CC1Option]>, Group,
+  HelpText<"Generate Interface Stub Files, emit merged text not binary.">;
 def iterface_stub_version_EQ : JoinedOrSeparate<["-"], 
"interface-stub-version=">, Flags<[CC1Option]>;
 def exported__symbols__list : Separate<["-"], "exported_symbols_list">;
 def e : JoinedOrSeparate<["-"], "e">, Group;

Modified: cfe/trunk/include/clang/Driver/Phases.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Phases.h?rev=373538&r1=373537&r2=373538&view=diff
==
--- cfe/trunk/include/clang/Driver/Phases.h (original)
+++ cfe/trunk/include/clang/Driver/Phases.h Wed Oct  2 15:50:07 2019
@@ -20,7 +20,8 @@ namespace phases {
 Compile,
 Backend,
 Assemble,
-Link
+Link,
+IfsMerge,
   };
 
   enum {

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=373538&r1=37

r373549 - Fixing broken builds due to r373538 due to test that should have been deleted.

2019-10-02 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Wed Oct  2 17:41:13 2019
New Revision: 373549

URL: http://llvm.org/viewvc/llvm-project?rev=373549&view=rev
Log:
Fixing broken builds due to r373538 due to test that should have been deleted.

test/InterfaceStubs/object.cpp should have been deleted.

Removed:
cfe/trunk/test/InterfaceStubs/object.cpp

Removed: cfe/trunk/test/InterfaceStubs/object.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/object.cpp?rev=373548&view=auto
==
--- cfe/trunk/test/InterfaceStubs/object.cpp (original)
+++ cfe/trunk/test/InterfaceStubs/object.cpp (removed)
@@ -1,14 +0,0 @@
-// REQUIRES: x86-registered-target
-// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
-// RUN: -interface-stub-version=experimental-ifs-v1 %s | \
-// RUN: FileCheck -check-prefix=CHECK-TAPI %s
-
-// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
-// RUN: -interface-stub-version=experimental-ifs-v1 %s | \
-// RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
-// RUN: %clang -target x86_64-unknown-linux-gnu -o - -c %s | llvm-nm - 2>&1 | \
-// RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
-
-// CHECK-TAPI: data: { Type: Object, Size: 4 }
-// CHECK-SYMBOLS: data
-int data = 42;


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


r373552 - Fixing broken builds due to r373538, issues with filepath and hexagon toolchain.

2019-10-02 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Wed Oct  2 18:19:51 2019
New Revision: 373552

URL: http://llvm.org/viewvc/llvm-project?rev=373552&view=rev
Log:
Fixing broken builds due to r373538, issues with filepath and hexagon toolchain.

It appears there are some issues with the hexagon toolchain, and also the file
path for the library file. If this doesn't fix the remaining breakages I will
attempt a revert.

Modified:
cfe/trunk/test/InterfaceStubs/driver-test.c

Modified: cfe/trunk/test/InterfaceStubs/driver-test.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/driver-test.c?rev=373552&r1=373551&r2=373552&view=diff
==
--- cfe/trunk/test/InterfaceStubs/driver-test.c (original)
+++ cfe/trunk/test/InterfaceStubs/driver-test.c Wed Oct  2 18:19:51 2019
@@ -1,12 +1,19 @@
-// RUN: %clang -x c -o libfoo.so -emit-interface-stubs %s %S/object.c 
%S/weak.cpp && \
-// RUN: llvm-nm libfoo.so 2>&1 | FileCheck %s
+// REQUIRES: x86-registered-target
 
-// RUN: %clang -x c -o libfoo.so -shared %s %S/object.c %S/weak.cpp && \
-// RUN: llvm-nm libfoo.so 2>&1 | FileCheck %s
+// RUN: %clang -target x86_64-unknown-linux-gnu -x c -o %t1.so 
-emit-interface-stubs %s %S/object.c %S/weak.cpp && \
+// RUN: llvm-nm %t1.so 2>&1 | FileCheck --check-prefix=CHECK-IFS %s
 
-// CHECK-DAG: data
-// CHECK-DAG: foo
-// CHECK-DAG: strongFunc
-// CHECK-DAG: weakFunc
+// RUN: %clang -target x86_64-unknown-linux-gnu -x c -o %t2.so -shared %s 
%S/object.c %S/weak.cpp && \
+// RUN: llvm-nm %t2.so 2>&1 | FileCheck --check-prefix=CHECK-SO %s
 
-int foo(int bar) { return 42 + 1844; }
\ No newline at end of file
+// CHECK-IFS-DAG: data
+// CHECK-IFS-DAG: foo
+// CHECK-IFS-DAG: strongFunc
+// CHECK-IFS-DAG: weakFunc
+
+// CHECK-SO-DAG: data
+// CHECK-SO-DAG: foo
+// CHECK-SO-DAG: strongFunc
+// CHECK-SO-DAG: weakFunc
+
+int foo(int bar) { return 42 + 1844; }


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


r374061 - [clang][ifs] Clang Interface Stubs ToolChain plumbing.

2019-10-08 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Tue Oct  8 08:23:14 2019
New Revision: 374061

URL: http://llvm.org/viewvc/llvm-project?rev=374061&view=rev
Log:
[clang][ifs] Clang Interface Stubs ToolChain plumbing.

Second Landing Attempt:

This patch enables end to end support for generating ELF interface stubs
directly from clang. Now the following:

clang -emit-interface-stubs -o libfoo.so a.cpp b.cpp c.cpp

will product an ELF binary with visible symbols populated. Visibility attributes
and -fvisibility can be used to control what gets populated.

* Adding ToolChain support for clang Driver IFS Merge Phase
* Implementing a default InterfaceStubs Merge clang Tool, used by ToolChain
* Adds support for the clang Driver to involve llvm-ifs on ifs files.
* Adds -emit-merged-ifs flag, to tell llvm-ifs to emit a merged ifs text file
  instead of the final object format (normally ELF)


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



Added:
cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.cpp
cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.h
cfe/trunk/test/InterfaceStubs/conflict-type.ifs
cfe/trunk/test/InterfaceStubs/driver-test.c
cfe/trunk/test/InterfaceStubs/func.ifs
cfe/trunk/test/InterfaceStubs/merge-conflict-test.c
cfe/trunk/test/InterfaceStubs/object-double.c
cfe/trunk/test/InterfaceStubs/object-float.c
cfe/trunk/test/InterfaceStubs/object.c
cfe/trunk/test/InterfaceStubs/object.ifs
Removed:
cfe/trunk/test/InterfaceStubs/object.cpp
Modified:
cfe/trunk/include/clang/Driver/Action.h
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Driver/Phases.h
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/include/clang/Driver/Types.def
cfe/trunk/lib/Driver/Action.cpp
cfe/trunk/lib/Driver/CMakeLists.txt
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/Phases.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Driver/Types.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/InterfaceStubs/bad-format.cpp
cfe/trunk/test/InterfaceStubs/class-template-specialization.cpp
cfe/trunk/test/InterfaceStubs/externstatic.c
cfe/trunk/test/InterfaceStubs/function-template-specialization.cpp
cfe/trunk/test/InterfaceStubs/inline.c
cfe/trunk/test/InterfaceStubs/template-namespace-function.cpp
cfe/trunk/test/InterfaceStubs/weak.cpp
cfe/trunk/test/lit.cfg.py

Modified: cfe/trunk/include/clang/Driver/Action.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Action.h?rev=374061&r1=374060&r2=374061&view=diff
==
--- cfe/trunk/include/clang/Driver/Action.h (original)
+++ cfe/trunk/include/clang/Driver/Action.h Tue Oct  8 08:23:14 2019
@@ -65,6 +65,7 @@ public:
 BackendJobClass,
 AssembleJobClass,
 LinkJobClass,
+IfsMergeJobClass,
 LipoJobClass,
 DsymutilJobClass,
 VerifyDebugInfoJobClass,
@@ -485,6 +486,17 @@ public:
   }
 };
 
+class IfsMergeJobAction : public JobAction {
+  void anchor() override;
+
+public:
+  IfsMergeJobAction(ActionList &Inputs, types::ID Type);
+
+  static bool classof(const Action *A) {
+return A->getKind() == IfsMergeJobClass;
+  }
+};
+
 class LinkJobAction : public JobAction {
   void anchor() override;
 

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=374061&r1=374060&r2=374061&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Oct  8 08:23:14 2019
@@ -633,6 +633,9 @@ def emit_llvm : Flag<["-"], "emit-llvm">
   HelpText<"Use the LLVM representation for assembler and object files">;
 def emit_iterface_stubs : Flag<["-"], "emit-interface-stubs">, 
Flags<[CC1Option]>, Group,
   HelpText<"Generate Inteface Stub Files.">;
+def emit_merged_ifs : Flag<["-"], "emit-merged-ifs">,
+  Flags<[CC1Option]>, Group,
+  HelpText<"Generate Interface Stub Files, emit merged text not binary.">;
 def iterface_stub_version_EQ : JoinedOrSeparate<["-"], 
"interface-stub-version=">, Flags<[CC1Option]>;
 def exported__symbols__list : Separate<["-"], "exported_symbols_list">;
 def e : JoinedOrSeparate<["-"], "e">, Group;

Modified: cfe/trunk/include/clang/Driver/Phases.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Phases.h?rev=374061&r1=374060&r2=374061&view=diff
==
--- cfe/trunk/include/clang/Driver/Phases.h (original)
+++ cfe/trunk/include/clang/Driver/Phases.h Tue Oct  8 08:23:14 2019
@@ -20,7 +20,8 @@ namespace phases {
 Compile,
 Backend,
 Assemble,
-Link
+Link,
+IfsMerge,
   };
 
   enum {

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.or

r374573 - [clang][IFS] Fixing assert in clang interface stubs for enums, records, typedefs

2019-10-11 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Fri Oct 11 10:24:11 2019
New Revision: 374573

URL: http://llvm.org/viewvc/llvm-project?rev=374573&view=rev
Log:
[clang][IFS] Fixing assert in clang interface stubs for enums, records, typedefs

The clang IFS ASTConsumer was asserting on enums, records (struct definitions in
C), and typedefs. All it needs to do is skip them because the stub just needs to
expose global object instances and functions.

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

Added:
cfe/trunk/test/InterfaceStubs/noninstancetypes.c
Modified:
cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp

Modified: cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp?rev=374573&r1=374572&r2=374573&view=diff
==
--- cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp (original)
+++ cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp Fri Oct 11 
10:24:11 2019
@@ -177,6 +177,10 @@ class InterfaceStubFunctionsConsumer : p
   HandleTemplateSpecializations(*cast(ND), Symbols,
 RDO);
   return true;
+case Decl::Kind::Record:
+case Decl::Kind::Typedef:
+case Decl::Kind::Enum:
+case Decl::Kind::EnumConstant:
 case Decl::Kind::TemplateTypeParm:
   return true;
 case Decl::Kind::Var:

Added: cfe/trunk/test/InterfaceStubs/noninstancetypes.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/noninstancetypes.c?rev=374573&view=auto
==
--- cfe/trunk/test/InterfaceStubs/noninstancetypes.c (added)
+++ cfe/trunk/test/InterfaceStubs/noninstancetypes.c Fri Oct 11 10:24:11 2019
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s
+// TODO: Change clang_cc1 to clang when llvm-ifs can accept empty symbol lists.
+
+// CHECK:  Symbols:
+// CHECK-NEXT: ...
+
+struct a;
+enum { b };
+typedef int c;
+


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


r374632 - [clang][IFS] Updating tests to pass on -fvisibility=hidden builds (NFCi).

2019-10-11 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Fri Oct 11 19:46:57 2019
New Revision: 374632

URL: http://llvm.org/viewvc/llvm-project?rev=374632&view=rev
Log:
[clang][IFS] Updating tests to pass on -fvisibility=hidden builds (NFCi).

Special thanks to JamesNagurne who got to the bottom of this; landing this on
his behalf.

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

Modified:
cfe/trunk/test/InterfaceStubs/externstatic.c
cfe/trunk/test/InterfaceStubs/merge-conflict-test.c
cfe/trunk/test/InterfaceStubs/object-float.c
cfe/trunk/test/InterfaceStubs/object.c

Modified: cfe/trunk/test/InterfaceStubs/externstatic.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/externstatic.c?rev=374632&r1=374631&r2=374632&view=diff
==
--- cfe/trunk/test/InterfaceStubs/externstatic.c (original)
+++ cfe/trunk/test/InterfaceStubs/externstatic.c Fri Oct 11 19:46:57 2019
@@ -1,19 +1,19 @@
-// RUN: %clang -c -DSTORAGE="extern" -o - -emit-interface-stubs -std=c99 -xc 
%s | \
+// RUN: %clang -fvisibility=default -c -DSTORAGE="extern" -o - 
-emit-interface-stubs -std=c99 -xc %s | \
 // RUN: FileCheck -check-prefix=CHECK-EXTERN %s
 
-// RUN: %clang -DSTORAGE="extern" -O0 -o - -c -std=c99 \
+// RUN: %clang -fvisibility=default -DSTORAGE="extern" -O0 -o - -c -std=c99 \
 // RUN: -xc %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-EXTERN %s
 
-// RUN: %clang -c -DSTORAGE="extern" -o - -emit-interface-stubs -std=c99 -xc 
%s | \
+// RUN: %clang -fvisibility=default -c -DSTORAGE="extern" -o - 
-emit-interface-stubs -std=c99 -xc %s | \
 // RUN: FileCheck -check-prefix=CHECK-EXTERN2 %s
 
-// RUN: %clang -DSTORAGE="extern" -O0 -o - -c -std=c99 -xc %s | llvm-nm - 2>&1 
| \
+// RUN: %clang -fvisibility=default -DSTORAGE="extern" -O0 -o - -c -std=c99 
-xc %s | llvm-nm - 2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-EXTERN2 %s
 
-// RUN: %clang -c -DSTORAGE="static" -o - -emit-interface-stubs -std=c99 -xc 
%s | \
+// RUN: %clang -fvisibility=default -c -DSTORAGE="static" -o - 
-emit-interface-stubs -std=c99 -xc %s | \
 // RUN: FileCheck -check-prefix=CHECK-STATIC %s
 
-// RUN: %clang -DSTORAGE="static" -O0 -o - -c -std=c99 -xc %s | llvm-nm - 2>&1 
| \
+// RUN: %clang -fvisibility=default -DSTORAGE="static" -O0 -o - -c -std=c99 
-xc %s | llvm-nm - 2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-STATIC %s
 
 // CHECK-EXTERN-NOT: foo

Modified: cfe/trunk/test/InterfaceStubs/merge-conflict-test.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/merge-conflict-test.c?rev=374632&r1=374631&r2=374632&view=diff
==
--- cfe/trunk/test/InterfaceStubs/merge-conflict-test.c (original)
+++ cfe/trunk/test/InterfaceStubs/merge-conflict-test.c Fri Oct 11 19:46:57 2019
@@ -1,3 +1,3 @@
-// RUN: not %clang -o libfoo.so -emit-interface-stubs %s %S/driver-test.c 2>&1 
| FileCheck %s
+// RUN: not %clang -fvisibility=default -o libfoo.so -emit-interface-stubs %s 
%S/driver-test.c 2>&1 | FileCheck %s
 // CHECK: error: Interface Stub: Type Mismatch
-int foo;
\ No newline at end of file
+int foo;

Modified: cfe/trunk/test/InterfaceStubs/object-float.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/object-float.c?rev=374632&r1=374631&r2=374632&view=diff
==
--- cfe/trunk/test/InterfaceStubs/object-float.c (original)
+++ cfe/trunk/test/InterfaceStubs/object-float.c Fri Oct 11 19:46:57 2019
@@ -1,3 +1,3 @@
-// RUN: not %clang -o - -emit-interface-stubs %s %S/object.c 2>&1 | FileCheck 
%s
+// RUN: not %clang -fvisibility=default -o - -emit-interface-stubs %s 
%S/object.c 2>&1 | FileCheck %s
 // CHECK: error: Interface Stub: Size Mismatch
-double data = 42.0;
\ No newline at end of file
+double data = 42.0;

Modified: cfe/trunk/test/InterfaceStubs/object.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/object.c?rev=374632&r1=374631&r2=374632&view=diff
==
--- cfe/trunk/test/InterfaceStubs/object.c (original)
+++ cfe/trunk/test/InterfaceStubs/object.c Fri Oct 11 19:46:57 2019
@@ -1,6 +1,6 @@
-// RUN: %clang -c -o - -emit-interface-stubs %s | FileCheck 
-check-prefix=CHECK-TAPI %s
-// RUN: %clang -c -o - -emit-interface-stubs %s | FileCheck 
-check-prefix=CHECK-SYMBOLS %s
-// RUN: %clang -c -o - %s | llvm-nm - 2>&1 | FileCheck 
-check-prefix=CHECK-SYMBOLS %s
+// RUN: %clang -fvisibility=default -c -o - -emit-interface-stubs %s | 
FileCheck -check-prefix=CHECK-TAPI %s
+// RUN: %clang -fvisibility=default -c -o - -emit-interface-stubs %s | 
FileCheck -check-prefix=CHECK-SYMBOLS %s
+// RUN: %clang -fvisibility=default -c -o - %s | llvm-nm - 2>&1 | FileCheck 
-check-prefix=CHECK-SYMBOLS %s
 
 // CHECK-TAPI: data: { Type: Object, Size: 4 }
 // CHECK-SYMBOLS: data


___

r374638 - [clang][IFS] Fixing spelling errors in interface-stubs OPT flag (NFC).

2019-10-11 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Fri Oct 11 23:25:07 2019
New Revision: 374638

URL: http://llvm.org/viewvc/llvm-project?rev=374638&view=rev
Log:
[clang][IFS] Fixing spelling errors in interface-stubs OPT flag (NFC).

This is just a long standing spelling error that was found recently.

Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Driver/Types.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=374638&r1=374637&r2=374638&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Oct 11 23:25:07 2019
@@ -631,12 +631,12 @@ def emit_ast : Flag<["-"], "emit-ast">,
   HelpText<"Emit Clang AST files for source inputs">;
 def emit_llvm : Flag<["-"], "emit-llvm">, Flags<[CC1Option]>, 
Group,
   HelpText<"Use the LLVM representation for assembler and object files">;
-def emit_iterface_stubs : Flag<["-"], "emit-interface-stubs">, 
Flags<[CC1Option]>, Group,
+def emit_interface_stubs : Flag<["-"], "emit-interface-stubs">, 
Flags<[CC1Option]>, Group,
   HelpText<"Generate Inteface Stub Files.">;
 def emit_merged_ifs : Flag<["-"], "emit-merged-ifs">,
   Flags<[CC1Option]>, Group,
   HelpText<"Generate Interface Stub Files, emit merged text not binary.">;
-def iterface_stub_version_EQ : JoinedOrSeparate<["-"], 
"interface-stub-version=">, Flags<[CC1Option]>;
+def interface_stub_version_EQ : JoinedOrSeparate<["-"], 
"interface-stub-version=">, Flags<[CC1Option]>;
 def exported__symbols__list : Separate<["-"], "exported_symbols_list">;
 def e : JoinedOrSeparate<["-"], "e">, Group;
 def fPIC : Flag<["-"], "fPIC">, Group;

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=374638&r1=374637&r2=374638&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct 11 23:25:07 2019
@@ -291,7 +291,7 @@ phases::ID Driver::getFinalPhase(const D
 FinalPhase = phases::Compile;
 
   // clang interface stubs
-  } else if ((PhaseArg = DAL.getLastArg(options::OPT_emit_iterface_stubs))) {
+  } else if ((PhaseArg = DAL.getLastArg(options::OPT_emit_interface_stubs))) {
 FinalPhase = phases::IfsMerge;
 
   // -S only runs up to the backend.
@@ -3575,7 +3575,7 @@ Action *Driver::ConstructPhaseAction(
   return C.MakeAction(Input, types::TY_ModuleFile);
 if (Args.hasArg(options::OPT_verify_pch))
   return C.MakeAction(Input, types::TY_Nothing);
-if (Args.hasArg(options::OPT_emit_iterface_stubs))
+if (Args.hasArg(options::OPT_emit_interface_stubs))
   return C.MakeAction(Input, types::TY_IFS_CPP);
 return C.MakeAction(Input, types::TY_LLVM_BC);
   }

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=374638&r1=374637&r2=374638&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Fri Oct 11 23:25:07 2019
@@ -3686,8 +3686,8 @@ void Clang::ConstructJob(Compilation &C,
 } else if (JA.getType() == types::TY_IFS ||
JA.getType() == types::TY_IFS_CPP) {
   StringRef ArgStr =
-  Args.hasArg(options::OPT_iterface_stub_version_EQ)
-  ? Args.getLastArgValue(options::OPT_iterface_stub_version_EQ)
+  Args.hasArg(options::OPT_interface_stub_version_EQ)
+  ? Args.getLastArgValue(options::OPT_interface_stub_version_EQ)
   : "experimental-ifs-v1";
   CmdArgs.push_back("-emit-interface-stubs");
   CmdArgs.push_back(

Modified: cfe/trunk/lib/Driver/Types.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Types.cpp?rev=374638&r1=374637&r2=374638&view=diff
==
--- cfe/trunk/lib/Driver/Types.cpp (original)
+++ cfe/trunk/lib/Driver/Types.cpp Fri Oct 11 23:25:07 2019
@@ -321,7 +321,7 @@ void types::getCompilationPhases(const c
   [](phases::ID Phase) { return Phase <= phases::Precompile; 
});
 
   // Treat Interface Stubs like its own compilation mode.
-  else if (DAL.getLastArg(options::OPT_emit_iterface_stubs)) {
+  else if (DAL.getLastArg(options::OPT_emit_interface_stubs)) {
 llvm::SmallVector IfsModePhaseList;
 llvm::SmallVector &PL = PhaseList;
 phases::ID LastPhase = phases::IfsMerge;

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trun

r374798 - [clang][IFS] Escape mangled names so MS ABI doesn't break YAML parsing.

2019-10-14 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Mon Oct 14 11:03:03 2019
New Revision: 374798

URL: http://llvm.org/viewvc/llvm-project?rev=374798&view=rev
Log:
[clang][IFS] Escape mangled names so  MS ABI doesn't break YAML parsing.

Microsoft's ABI mangles names differently than Itanium and this breaks the LLVM
yaml parser unless the name is escaped in quotes. Quotes are being added to the
mangled names of the IFS file generation so that llvm-ifs doesn't break when
Windows triples are passed to the driver.

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

Added:
cfe/trunk/test/InterfaceStubs/windows.cpp
Modified:
cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
cfe/trunk/test/InterfaceStubs/inline.c
cfe/trunk/test/InterfaceStubs/object.c

Modified: cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp?rev=374798&r1=374797&r2=374798&view=diff
==
--- cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp (original)
+++ cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp Mon Oct 14 
11:03:03 2019
@@ -263,11 +263,11 @@ public:
   for (const auto &E : Symbols) {
 const MangledSymbol &Symbol = E.second;
 for (auto Name : Symbol.Names) {
-  OS << "  "
+  OS << "  \""
  << (Symbol.ParentName.empty() || Instance.getLangOpts().CPlusPlus
  ? ""
  : (Symbol.ParentName + "."))
- << Name << ": { Type: ";
+ << Name << "\" : { Type: ";
   switch (Symbol.Type) {
   default:
 llvm_unreachable(

Modified: cfe/trunk/test/InterfaceStubs/inline.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/inline.c?rev=374798&r1=374797&r2=374798&view=diff
==
--- cfe/trunk/test/InterfaceStubs/inline.c (original)
+++ cfe/trunk/test/InterfaceStubs/inline.c Mon Oct 14 11:03:03 2019
@@ -56,8 +56,8 @@ INLINE int foo() {
 // RUN: -c -std=gnu89 -xc %s | llvm-nm - 2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
 
-// CHECK-TAPI-DAG: foo: { Type: Func }
-// CHECK-TAPI-DAG: foo.var: { Type: Object, Size: 4 }
+// CHECK-TAPI-DAG: "foo" : { Type: Func }
+// CHECK-TAPI-DAG: "foo.var" : { Type: Object, Size: 4 }
 // CHECK-SYMBOLS-DAG: foo
 // CHECK-SYMBOLS-DAG: foo.var
 #include "inline.h"

Modified: cfe/trunk/test/InterfaceStubs/object.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/object.c?rev=374798&r1=374797&r2=374798&view=diff
==
--- cfe/trunk/test/InterfaceStubs/object.c (original)
+++ cfe/trunk/test/InterfaceStubs/object.c Mon Oct 14 11:03:03 2019
@@ -2,6 +2,6 @@
 // RUN: %clang -fvisibility=default -c -o - -emit-interface-stubs %s | 
FileCheck -check-prefix=CHECK-SYMBOLS %s
 // RUN: %clang -fvisibility=default -c -o - %s | llvm-nm - 2>&1 | FileCheck 
-check-prefix=CHECK-SYMBOLS %s
 
-// CHECK-TAPI: data: { Type: Object, Size: 4 }
+// CHECK-TAPI: "data" : { Type: Object, Size: 4 }
 // CHECK-SYMBOLS: data
 int data = 42;

Added: cfe/trunk/test/InterfaceStubs/windows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/windows.cpp?rev=374798&view=auto
==
--- cfe/trunk/test/InterfaceStubs/windows.cpp (added)
+++ cfe/trunk/test/InterfaceStubs/windows.cpp Mon Oct 14 11:03:03 2019
@@ -0,0 +1,7 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang -target x86_64-windows-msvc -o - %s \
+// RUN: -emit-interface-stubs -emit-merged-ifs | FileCheck %s
+
+// CHECK: Symbols:
+// CHECK-NEXT: ?helloWindowsMsvc@@YAHXZ
+int helloWindowsMsvc();


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


r374805 - [clang][IFS][test] Fixing lit test breakages on macOS due to r374798

2019-10-14 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Mon Oct 14 11:57:29 2019
New Revision: 374805

URL: http://llvm.org/viewvc/llvm-project?rev=374805&view=rev
Log:
[clang][IFS][test] Fixing lit test breakages on macOS due to r374798

Adding the quotes breaks tests because on Darwin the name mangling is prefixed
with an underscore.

Modified:
cfe/trunk/test/InterfaceStubs/inline.c
cfe/trunk/test/InterfaceStubs/object.c

Modified: cfe/trunk/test/InterfaceStubs/inline.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/inline.c?rev=374805&r1=374804&r2=374805&view=diff
==
--- cfe/trunk/test/InterfaceStubs/inline.c (original)
+++ cfe/trunk/test/InterfaceStubs/inline.c Mon Oct 14 11:57:29 2019
@@ -56,8 +56,8 @@ INLINE int foo() {
 // RUN: -c -std=gnu89 -xc %s | llvm-nm - 2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
 
-// CHECK-TAPI-DAG: "foo" : { Type: Func }
-// CHECK-TAPI-DAG: "foo.var" : { Type: Object, Size: 4 }
+// CHECK-TAPI-DAG: foo" : { Type: Func }
+// CHECK-TAPI-DAG: foo.var" : { Type: Object, Size: 4 }
 // CHECK-SYMBOLS-DAG: foo
 // CHECK-SYMBOLS-DAG: foo.var
 #include "inline.h"

Modified: cfe/trunk/test/InterfaceStubs/object.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/object.c?rev=374805&r1=374804&r2=374805&view=diff
==
--- cfe/trunk/test/InterfaceStubs/object.c (original)
+++ cfe/trunk/test/InterfaceStubs/object.c Mon Oct 14 11:57:29 2019
@@ -2,6 +2,6 @@
 // RUN: %clang -fvisibility=default -c -o - -emit-interface-stubs %s | 
FileCheck -check-prefix=CHECK-SYMBOLS %s
 // RUN: %clang -fvisibility=default -c -o - %s | llvm-nm - 2>&1 | FileCheck 
-check-prefix=CHECK-SYMBOLS %s
 
-// CHECK-TAPI: "data" : { Type: Object, Size: 4 }
+// CHECK-TAPI: data" : { Type: Object, Size: 4 }
 // CHECK-SYMBOLS: data
 int data = 42;


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


[clang-tools-extra] [llvm] [clang] [LLVM] Add IRNormalizer Pass (PR #68176)

2023-11-28 Thread Puyan Lotfi via cfe-commits

plotfi wrote:

> Pinging @nikic for another round of review.

 @nikic is there more feedback or can this PR be merged? 


https://github.com/llvm/llvm-project/pull/68176
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [WIP][ObjC] objc_direct method visibility ABI (PR #76608)

2023-12-29 Thread Puyan Lotfi via cfe-commits

https://github.com/plotfi created 
https://github.com/llvm/llvm-project/pull/76608

_**Posting this PR for posterity a bit earlier than I had intended because he 
old Phabricator is crashing 
(https://discourse.llvm.org/t/cant-access-https-reviews-llvm-org/75905):**_

This patch adds the ability to expose direct ObjC methods as visible across 
link boundaries (dylibs). It is done so by using existing visibility attributes:

```
@interface C
- (void)testMethod:(int)arg1 bar:(float)arg2
  __attribute__((objc_direct))
  __attribute__((visibility("default")));
@end
```

This is a work in progress and there are a few pieces that should be landed 
with this within an LLVM release cycle so as not to cause any inconsistency in 
the ABI:

  * First, we want some checks that inform the developer when they are using 
this feature as part of a framework that this is potentially brittle. Something 
similar to the following: 
https://github.com/llvm/llvm-project/commit/1b3b69fbda70d

  * Next, we want to move the ObjC method nil checks from the callee side to 
something more useful for analysis and optimization that can be more visible 
from the caller side. Having the nil checks straight up in the caller side 
isn't so great for code size so a good alternative is to have a thunk between 
the call site and the callee for handling nil checks.

  * Finally, any mangling decisions should be finalized before this is landed.

Much of this has been discussed ahead of time, and there is a more extensive 
document on this proposal at:

https://docs.google.com/document/d/16CsNCA2OKWkUM_LCw_qabTcMtPiq9ODVkZHALlDvzR8

>From 5e69de7ad9b67280db6d62a1c77362d37c343f47 Mon Sep 17 00:00:00 2001
From: Puyan Lotfi 
Date: Fri, 29 Dec 2023 23:13:02 -0800
Subject: [PATCH] [WIP][ObjC] objc_direct method visibility ABI

This patch adds the ability to expose direct ObjC methods as visible
across link boundaries (dylibs). It is done so by using existing
visibility attributes:

```
@interface C
- (void)testMethod:(int)arg1 bar:(float)arg2
  __attribute__((objc_direct))
  __attribute__((visibility("default")));
@end
```

This is a work in progress and there are a few pieces that should be
landed with this within an LLVM release cycle so as not to cause any
inconsistency in the ABI:

  * First, we want some checks that inform the developer when they are
using this feature as part of a framework that this is potentially
brittle. Something similar to the following:
https://github.com/llvm/llvm-project/commit/1b3b69fbda70d

  * Next, we want to move the ObjC method nil checks from the callee
side to something more useful for analysis and optimization that can be
more visible from the caller side. Having the nil checks straight up
in the caller side isn't so great for code size so a good
alternative is to have a thunk between the call site and the callee
for handling nil checks.

  * Finally, any mangling decisions should be finalized before this is
landed.

Much of this has been discussed ahead of time, and there is a more
extensive document on this proposal at:

https://docs.google.com/document/d/16CsNCA2OKWkUM_LCw_qabTcMtPiq9ODVkZHALlDvzR8
---
 clang/include/clang/AST/DeclObjC.h   | 14 
 clang/lib/AST/Mangle.cpp | 10 ++-
 clang/lib/CodeGen/CGObjC.cpp |  4 +-
 clang/lib/CodeGen/CGObjCRuntime.cpp  |  3 +-
 clang/test/CodeGenObjC/objc-direct-wrapper.m | 86 
 5 files changed, 113 insertions(+), 4 deletions(-)
 create mode 100644 clang/test/CodeGenObjC/objc-direct-wrapper.m

diff --git a/clang/include/clang/AST/DeclObjC.h 
b/clang/include/clang/AST/DeclObjC.h
index f8f894b4b10d19..9a12b4007f09f6 100644
--- a/clang/include/clang/AST/DeclObjC.h
+++ b/clang/include/clang/AST/DeclObjC.h
@@ -482,6 +482,20 @@ class ObjCMethodDecl : public NamedDecl, public 
DeclContext {
   /// True if the method is tagged as objc_direct
   bool isDirectMethod() const;
 
+  /// True if method is meant to be visible.
+  ///
+  /// TODO: For now this is only true for a very narrow case where the method
+  /// must be direct and must also be explicitly marked as
+  /// __attribute__((visibility("default"))). In the future it may be possible
+  /// to assume that all direct (or even both direct and indirect) methods are
+  /// visible but for the time being it is prudent to provide this default
+  /// visibility behavior as an opt-in only.
+  bool hasMethodVisibilityDefault() const {
+return isDirectMethod() &&
+  getExplicitVisibility(VisibilityForValue)
+  .value_or(HiddenVisibility) == DefaultVisibility;
+  }
+
   /// True if the method has a parameter that's destroyed in the callee.
   bool hasParamDestroyedInCallee() const;
 
diff --git a/clang/lib/AST/Mangle.cpp b/clang/lib/AST/Mangle.cpp
index d3a6b61fd2bec9..ec409da0e5da00 100644
--- a/clang/lib/AST/Mangle.cpp
+++ b/clang/lib/AST/Mangle.cpp
@@ -363,10 +363,16 @@ void MangleContext::mangleObjCMethodNa

[clang] [WIP][ObjC] objc_direct method visibility ABI (PR #76608)

2023-12-29 Thread Puyan Lotfi via cfe-commits

https://github.com/plotfi edited https://github.com/llvm/llvm-project/pull/76608
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [WIP][ObjC] objc_direct method visibility ABI (PR #76608)

2023-12-29 Thread Puyan Lotfi via cfe-commits

https://github.com/plotfi edited https://github.com/llvm/llvm-project/pull/76608
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [WIP][ObjC] objc_direct method visibility ABI (PR #76608)

2023-12-29 Thread Puyan Lotfi via cfe-commits

https://github.com/plotfi edited https://github.com/llvm/llvm-project/pull/76608
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [WIP][ObjC] objc_direct method visibility ABI (PR #76608)

2023-12-29 Thread Puyan Lotfi via cfe-commits

https://github.com/plotfi updated 
https://github.com/llvm/llvm-project/pull/76608

>From 8c13976e842fcbe3446dff43aaf95a4ae6334ae9 Mon Sep 17 00:00:00 2001
From: Puyan Lotfi 
Date: Fri, 29 Dec 2023 23:13:02 -0800
Subject: [PATCH] [WIP][ObjC] objc_direct method visibility ABI

This patch adds the ability to expose direct ObjC methods as visible
across link boundaries (dylibs). It is done so by using existing
visibility attributes:

```
@interface C
- (void)testMethod:(int)arg1 bar:(float)arg2
  __attribute__((objc_direct))
  __attribute__((visibility("default")));
@end
```

This is a work in progress and there are a few pieces that should be
landed with this within an LLVM release cycle so as not to cause any
inconsistency in the ABI:

  * First, we want some checks that inform the developer when they are
using this feature as part of a framework that this is potentially
brittle. Something similar to the following:
https://github.com/llvm/llvm-project/commit/1b3b69fbda70d

  * Next, we want to move the ObjC method nil checks from the callee
side to something more useful for analysis and optimization that can be
more visible from the caller side. Having the nil checks straight up
in the caller side isn't so great for code size so a good
alternative is to have a thunk between the call site and the callee
for handling nil checks.

  * Finally, any mangling decisions should be finalized before this is
landed.

Much of this has been discussed ahead of time, and there is a more
extensive document on this proposal at:

https://docs.google.com/document/d/16CsNCA2OKWkUM_LCw_qabTcMtPiq9ODVkZHALlDvzR8
---
 clang/include/clang/AST/DeclObjC.h   | 14 
 clang/lib/AST/Mangle.cpp | 10 ++-
 clang/lib/CodeGen/CGObjC.cpp |  4 +-
 clang/lib/CodeGen/CGObjCRuntime.cpp  |  7 +-
 clang/test/CodeGenObjC/objc-direct-wrapper.m | 86 
 5 files changed, 115 insertions(+), 6 deletions(-)
 create mode 100644 clang/test/CodeGenObjC/objc-direct-wrapper.m

diff --git a/clang/include/clang/AST/DeclObjC.h 
b/clang/include/clang/AST/DeclObjC.h
index f8f894b4b10d19..4081e5915c0695 100644
--- a/clang/include/clang/AST/DeclObjC.h
+++ b/clang/include/clang/AST/DeclObjC.h
@@ -482,6 +482,20 @@ class ObjCMethodDecl : public NamedDecl, public 
DeclContext {
   /// True if the method is tagged as objc_direct
   bool isDirectMethod() const;
 
+  /// True if method is meant to be visible.
+  ///
+  /// TODO: For now this is only true for a very narrow case where the method
+  /// must be direct and must also be explicitly marked as
+  /// __attribute__((visibility("default"))). In the future it may be possible
+  /// to assume that all direct (or even both direct and indirect) methods are
+  /// visible but for the time being it is prudent to provide this default
+  /// visibility behavior as an opt-in only.
+  bool hasMethodVisibilityDefault() const {
+return isDirectMethod() &&
+   getExplicitVisibility(VisibilityForValue)
+   .value_or(HiddenVisibility) == DefaultVisibility;
+  }
+
   /// True if the method has a parameter that's destroyed in the callee.
   bool hasParamDestroyedInCallee() const;
 
diff --git a/clang/lib/AST/Mangle.cpp b/clang/lib/AST/Mangle.cpp
index d3a6b61fd2bec9..ec409da0e5da00 100644
--- a/clang/lib/AST/Mangle.cpp
+++ b/clang/lib/AST/Mangle.cpp
@@ -363,10 +363,16 @@ void MangleContext::mangleObjCMethodName(const 
ObjCMethodDecl *MD,
   }
 
   // \01+[ContainerName(CategoryName) SelectorName]
+  // Note: If we are mangling for an objc_direct method with external 
visibility
+  //   then the standard mangling scheme will not work. We must replace the
+  //   square braces with angle braces so in the case of visible direct 
objc
+  //   methods it results in: +
+  //   This will include a prefix _ on Darwin.
   if (includePrefixByte) {
 OS << '\01';
   }
-  OS << (MD->isInstanceMethod() ? '-' : '+') << '[';
+  OS << (MD->isInstanceMethod() ? '-' : '+');
+  OS << (MD->hasMethodVisibilityDefault() ? '<' : '[');
   if (const auto *CID = MD->getCategory()) {
 OS << CID->getClassInterface()->getName();
 if (includeCategoryNamespace) {
@@ -380,7 +386,7 @@ void MangleContext::mangleObjCMethodName(const 
ObjCMethodDecl *MD,
   }
   OS << ' ';
   MD->getSelector().print(OS);
-  OS << ']';
+  OS << (MD->hasMethodVisibilityDefault() ? '>' : ']');
 }
 
 void MangleContext::mangleObjCMethodNameAsSourceName(const ObjCMethodDecl *MD,
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index acc85165a470be..3dcd5a8334d102 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -761,7 +761,9 @@ void CodeGenFunction::StartObjCMethod(const ObjCMethodDecl 
*OMD,
 
   const CGFunctionInfo &FI = CGM.getTypes().arrangeObjCMethodDeclaration(OMD);
   if (OMD->isDirectMethod()) {
-Fn->setVisibility(llvm::Function::HiddenVisibility);
+Fn->setV

r369715 - [clang][ifs] New interface stubs format (llvm triple based).

2019-08-22 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Thu Aug 22 16:29:22 2019
New Revision: 369715

URL: http://llvm.org/viewvc/llvm-project?rev=369715&view=rev
Log:
[clang][ifs] New interface stubs format (llvm triple based).

After posting llvm-ifs on phabricator, I made some progress in hardening up how
I think the format for Interface Stubs should look. There are a number of
things I think the TBE format was missing (no endianness, no info about the
Object Format because it assumes ELF), so I have added those and broken off
from being as similar to the TBE schema. In a subsequent commit I can drop the
other formats.

An example of how The format will look is as follows:

--- !experimental-ifs-v1
IfsVersion: 1.0
Triple: x86_64-unknown-linux-gnu
ObjectFileFormat: ELF
Symbols:
  _Z9nothiddenv: { Type: Func }
  _Z10cmdVisiblev: { Type: Func }
...

The format is still marked experimental.

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

Modified:
cfe/trunk/include/clang/Frontend/FrontendActions.h
cfe/trunk/include/clang/Frontend/FrontendOptions.h
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Frontend/FrontendActions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendActions.h?rev=369715&r1=369714&r2=369715&view=diff
==
--- cfe/trunk/include/clang/Frontend/FrontendActions.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendActions.h Thu Aug 22 16:29:22 2019
@@ -139,6 +139,12 @@ protected:
  StringRef InFile) override;
 };
 
+class GenerateInterfaceIfsExpV1Action : public GenerateInterfaceStubAction {
+protected:
+  std::unique_ptr CreateASTConsumer(CompilerInstance &CI,
+ StringRef InFile) override;
+};
+
 class GenerateModuleFromModuleMapAction : public GenerateModuleAction {
 private:
   bool BeginSourceFileAction(CompilerInstance &CI) override;

Modified: cfe/trunk/include/clang/Frontend/FrontendOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendOptions.h?rev=369715&r1=369714&r2=369715&view=diff
==
--- cfe/trunk/include/clang/Frontend/FrontendOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendOptions.h Thu Aug 22 16:29:22 2019
@@ -92,6 +92,7 @@ enum ActionKind {
   /// Generate Interface Stub Files.
   GenerateInterfaceYAMLExpV1,
   GenerateInterfaceTBEExpV1,
+  GenerateInterfaceIfsExpV1,
 
   /// Only execute frontend initialization.
   InitOnly,

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=369715&r1=369714&r2=369715&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Aug 22 16:29:22 2019
@@ -3638,12 +3638,14 @@ void Clang::ConstructJob(Compilation &C,
   : "")
   .Case("experimental-yaml-elf-v1", "experimental-yaml-elf-v1")
   .Case("experimental-tapi-elf-v1", "experimental-tapi-elf-v1")
+  .Case("experimental-ifs-v1", "experimental-ifs-v1")
   .Default("");
 
   if (StubFormat.empty())
 D.Diag(diag::err_drv_invalid_value)
 << "Must specify a valid interface stub format type using "
 << "-interface-stub-version=";
 
   CmdArgs.push_back("-emit-interface-stubs");

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=369715&r1=369714&r2=369715&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Aug 22 16:29:22 2019
@@ -1737,11 +1737,14 @@ static InputKind ParseFrontendArgs(Front
 frontend::GenerateInterfaceYAMLExpV1)
   .Case("experimental-tapi-elf-v1",
 frontend::GenerateInterfaceTBEExpV1)
+  .Case("experimental-ifs-v1",
+frontend::GenerateInterfaceIfsExpV1)
   .Default(llvm::None);
   if (!ProgramAction)
 Diags.Report(diag::err_drv_invalid_value)
 << "Must specify a valid interface stub format type using "
 << "-interface-stub-version=";
   Opts.ProgramAction = *ProgramAction;
   break;
@@ -3185,6 +3188,7 @@ static bool isStrictlyPreprocessorAction
   case frontend::GeneratePCH:
   case frontend::GenerateInterfaceYAMLExpV1:
   case frontend::GenerateInterfaceTBE

r369719 - [clang][ifs] Dropping older experimental interface stub formats.

2019-08-22 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Thu Aug 22 16:44:34 2019
New Revision: 369719

URL: http://llvm.org/viewvc/llvm-project?rev=369719&view=rev
Log:
[clang][ifs] Dropping older experimental interface stub formats.

I've been working on a new tool, llvm-ifs, for merging interface stub files
generated by clang and I've iterated on my derivative format of TBE to a newer
format. llvm-ifs will only support the new format, so I am going to drop the
older experimental interface stubs formats in this commit to make things
simpler.

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

Modified:
cfe/trunk/include/clang/Frontend/FrontendActions.h
cfe/trunk/include/clang/Frontend/FrontendOptions.h
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp
cfe/trunk/test/InterfaceStubs/bad-format.cpp
cfe/trunk/test/InterfaceStubs/class-template-specialization.cpp
cfe/trunk/test/InterfaceStubs/externstatic.c
cfe/trunk/test/InterfaceStubs/function-template-specialization.cpp
cfe/trunk/test/InterfaceStubs/hidden-class-inheritance.cpp
cfe/trunk/test/InterfaceStubs/inline.c
cfe/trunk/test/InterfaceStubs/object.cpp
cfe/trunk/test/InterfaceStubs/template-namespace-function.cpp
cfe/trunk/test/InterfaceStubs/virtual.cpp
cfe/trunk/test/InterfaceStubs/visibility.cpp
cfe/trunk/test/InterfaceStubs/weak.cpp

Modified: cfe/trunk/include/clang/Frontend/FrontendActions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendActions.h?rev=369719&r1=369718&r2=369719&view=diff
==
--- cfe/trunk/include/clang/Frontend/FrontendActions.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendActions.h Thu Aug 22 16:44:34 2019
@@ -126,19 +126,6 @@ protected:
   bool hasASTFileSupport() const override { return false; }
 };
 
-// Support different interface stub formats this way:
-class GenerateInterfaceYAMLExpV1Action : public GenerateInterfaceStubAction {
-protected:
-  std::unique_ptr CreateASTConsumer(CompilerInstance &CI,
- StringRef InFile) override;
-};
-
-class GenerateInterfaceTBEExpV1Action : public GenerateInterfaceStubAction {
-protected:
-  std::unique_ptr CreateASTConsumer(CompilerInstance &CI,
- StringRef InFile) override;
-};
-
 class GenerateInterfaceIfsExpV1Action : public GenerateInterfaceStubAction {
 protected:
   std::unique_ptr CreateASTConsumer(CompilerInstance &CI,

Modified: cfe/trunk/include/clang/Frontend/FrontendOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendOptions.h?rev=369719&r1=369718&r2=369719&view=diff
==
--- cfe/trunk/include/clang/Frontend/FrontendOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendOptions.h Thu Aug 22 16:44:34 2019
@@ -90,8 +90,6 @@ enum ActionKind {
   GeneratePCH,
 
   /// Generate Interface Stub Files.
-  GenerateInterfaceYAMLExpV1,
-  GenerateInterfaceTBEExpV1,
   GenerateInterfaceIfsExpV1,
 
   /// Only execute frontend initialization.

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=369719&r1=369718&r2=369719&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Aug 22 16:44:34 2019
@@ -3631,22 +3631,27 @@ void Clang::ConstructJob(Compilation &C,
JA.getType() == types::TY_LTO_BC) {
   CmdArgs.push_back("-emit-llvm-bc");
 } else if (JA.getType() == types::TY_IFS) {
+  StringRef ArgStr =
+  Args.hasArg(options::OPT_iterface_stub_version_EQ)
+  ? Args.getLastArgValue(options::OPT_iterface_stub_version_EQ)
+  : "";
   StringRef StubFormat =
-  llvm::StringSwitch(
-  Args.hasArg(options::OPT_iterface_stub_version_EQ)
-  ? Args.getLastArgValue(options::OPT_iterface_stub_version_EQ)
-  : "")
-  .Case("experimental-yaml-elf-v1", "experimental-yaml-elf-v1")
-  .Case("experimental-tapi-elf-v1", "experimental-tapi-elf-v1")
+  llvm::StringSwitch(ArgStr)
   .Case("experimental-ifs-v1", "experimental-ifs-v1")
   .Default("");
 
-  if (StubFormat.empty())
+  if (StubFormat.empty()) {
+std::string ErrorMessage =
+"Invalid interface stub format: " + ArgStr.str() +
+((ArgStr == "experimental-yaml-elf-v1" ||
+  ArgStr == "experimental-tapi-elf-v1")
+ ? " is deprecated."
+ : ".");
 D.Diag(di

[clang] b7526cc - [NFC][clang][IFS] Adding braces to if-statement as prep for D71301.

2020-01-13 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2020-01-13T16:04:27-05:00
New Revision: b7526cc21ce55c8b53250df3d659fbdae3f894a7

URL: 
https://github.com/llvm/llvm-project/commit/b7526cc21ce55c8b53250df3d659fbdae3f894a7
DIFF: 
https://github.com/llvm/llvm-project/commit/b7526cc21ce55c8b53250df3d659fbdae3f894a7.diff

LOG: [NFC][clang][IFS] Adding braces to if-statement as prep for D71301.

Just trying to make https://reviews.llvm.org/D71301 look cleaner.

Added: 


Modified: 
clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp

Removed: 




diff  --git a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp 
b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
index 3b0a5668af94..e7d6fee5ac67 100644
--- a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
+++ b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
@@ -52,11 +52,12 @@ class InterfaceStubFunctionsConsumer : public ASTConsumer {
   if (!isVisible(ND))
 return true;
 
-  if (const VarDecl *VD = dyn_cast(ND))
+  if (const VarDecl *VD = dyn_cast(ND)) {
 if ((VD->getStorageClass() == StorageClass::SC_Extern) ||
 (VD->getStorageClass() == StorageClass::SC_Static &&
  VD->getParentFunctionOrMethod() == nullptr))
   return true;
+  }
 
   if (const FunctionDecl *FD = dyn_cast(ND)) {
 if (FD->isInlined() && !isa(FD) &&



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


[clang] bd8c882 - [clang][IFS] Prevent Clang-IFS from Leaking symbols from inside a block.

2020-01-13 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2020-01-13T16:04:27-05:00
New Revision: bd8c8827d96f09be502f0da6897c1aef89e45c30

URL: 
https://github.com/llvm/llvm-project/commit/bd8c8827d96f09be502f0da6897c1aef89e45c30
DIFF: 
https://github.com/llvm/llvm-project/commit/bd8c8827d96f09be502f0da6897c1aef89e45c30.diff

LOG: [clang][IFS] Prevent Clang-IFS from Leaking symbols from inside a block.

Built libdispatch with clang interface stubs. Ran into some block
related issues. Basically VarDecl symbols can leak out because I wasn't
checking the case where a VarDecl is contained inside a BlockDecl
(versus a method or function).

This patch checks that a VarDecl is not a child decl of a BlockDecl.
This patch also does something very similar for c++ lambdas as well.

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

Added: 
clang/test/InterfaceStubs/blocks.c
clang/test/InterfaceStubs/lambda.cpp

Modified: 
clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp

Removed: 




diff  --git a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp 
b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
index e7d6fee5ac67..7241081d6cc0 100644
--- a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
+++ b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
@@ -53,6 +53,10 @@ class InterfaceStubFunctionsConsumer : public ASTConsumer {
 return true;
 
   if (const VarDecl *VD = dyn_cast(ND)) {
+if (const auto *Parent = VD->getParentFunctionOrMethod())
+  if (isa(Parent) || isa(Parent))
+return true;
+
 if ((VD->getStorageClass() == StorageClass::SC_Extern) ||
 (VD->getStorageClass() == StorageClass::SC_Static &&
  VD->getParentFunctionOrMethod() == nullptr))

diff  --git a/clang/test/InterfaceStubs/blocks.c 
b/clang/test/InterfaceStubs/blocks.c
new file mode 100644
index ..927f2bf28869
--- /dev/null
+++ b/clang/test/InterfaceStubs/blocks.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -emit-interface-stubs -fblocks -o - %s | FileCheck %s
+
+// CHECK: --- !experimental-ifs-v1
+// CHECK-NEXT: IfsVersion: 1.0
+// CHECK-NEXT: Triple:
+// CHECK-NEXT: ObjectFileFormat: ELF
+// CHECK-NEXT: Symbols:
+// CHECK-NEXT: ...
+static void (^f)(void*) = ^(void* data) { int i; };

diff  --git a/clang/test/InterfaceStubs/lambda.cpp 
b/clang/test/InterfaceStubs/lambda.cpp
new file mode 100644
index ..f56aeeaab012
--- /dev/null
+++ b/clang/test/InterfaceStubs/lambda.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -emit-interface-stubs -o - %s | FileCheck %s
+
+// CHECK: --- !experimental-ifs-v1
+// CHECK-NEXT: IfsVersion: 1.0
+// CHECK-NEXT: Triple:
+// CHECK-NEXT: ObjectFileFormat: ELF
+// CHECK-NEXT: Symbols:
+// CHECK-NEXT:   "f" : { Type: Object, Size: 1 }
+// CHECK-NEXT: ...
+auto f = [](void* data) { int i; };



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


[clang] a506f7f - [clang][IFS][test] Fixing mangled name of a test for Darwin.

2020-01-13 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2020-01-13T17:01:48-05:00
New Revision: a506f7f9105eec4baac296d21c922457d6f4b52a

URL: 
https://github.com/llvm/llvm-project/commit/a506f7f9105eec4baac296d21c922457d6f4b52a
DIFF: 
https://github.com/llvm/llvm-project/commit/a506f7f9105eec4baac296d21c922457d6f4b52a.diff

LOG: [clang][IFS][test] Fixing mangled name of a test for Darwin.

Darwin adds an extra '_' before every C/global function mangled name and
because of this, this test was breaking on Darwin.

This is a fix for commit: https://reviews.llvm.org/D71301

Added: 


Modified: 
clang/test/InterfaceStubs/lambda.cpp

Removed: 




diff  --git a/clang/test/InterfaceStubs/lambda.cpp 
b/clang/test/InterfaceStubs/lambda.cpp
index f56aeeaab012..00b7fc44a023 100644
--- a/clang/test/InterfaceStubs/lambda.cpp
+++ b/clang/test/InterfaceStubs/lambda.cpp
@@ -5,6 +5,6 @@
 // CHECK-NEXT: Triple:
 // CHECK-NEXT: ObjectFileFormat: ELF
 // CHECK-NEXT: Symbols:
-// CHECK-NEXT:   "f" : { Type: Object, Size: 1 }
+// CHECK-NEXT:   f" : { Type: Object, Size: 1 }
 // CHECK-NEXT: ...
 auto f = [](void* data) { int i; };



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


[clang] f22d276 - [NFC] Fix some spelling errors in clang Driver Options.td

2020-08-26 Thread Puyan Lotfi via cfe-commits

Author: Yang Zhihui
Date: 2020-08-26T04:58:38-04:00
New Revision: f22d27624b6532a5542b283de9ce586c72c6b846

URL: 
https://github.com/llvm/llvm-project/commit/f22d27624b6532a5542b283de9ce586c72c6b846
DIFF: 
https://github.com/llvm/llvm-project/commit/f22d27624b6532a5542b283de9ce586c72c6b846.diff

LOG: [NFC] Fix some spelling errors in clang Driver Options.td

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

Added: 


Modified: 
clang/include/clang/Driver/Options.td

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 5da072ee4cc2..b5a158cd3336 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -698,7 +698,7 @@ def emit_ast : Flag<["-"], "emit-ast">,
 def emit_llvm : Flag<["-"], "emit-llvm">, Flags<[CC1Option]>, 
Group,
   HelpText<"Use the LLVM representation for assembler and object files">;
 def emit_interface_stubs : Flag<["-"], "emit-interface-stubs">, 
Flags<[CC1Option]>, Group,
-  HelpText<"Generate Inteface Stub Files.">;
+  HelpText<"Generate Interface Stub Files.">;
 def emit_merged_ifs : Flag<["-"], "emit-merged-ifs">,
   Flags<[CC1Option]>, Group,
   HelpText<"Generate Interface Stub Files, emit merged text not binary.">;
@@ -1809,7 +1809,7 @@ def fstack_protector : Flag<["-"], "fstack-protector">, 
Group,
"This uses a loose heuristic which considers functions vulnerable 
if they "
"contain a char (or 8bit integer) array or constant sized calls to 
alloca "
", which are of greater size than ssp-buffer-size (default: 8 
bytes). All "
-   "variable sized calls to alloca are considered vulnerable. A 
function with"
+   "variable sized calls to alloca are considered vulnerable. A 
function with "
"a stack protector has a guard value added to the stack frame that 
is "
"checked on function exit. The guard value must be positioned in 
the "
"stack frame such that a buffer overflow from a vulnerable variable 
will "



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


[clang] llvm-canon (PR #68176)

2023-10-05 Thread Puyan Lotfi via cfe-commits

plotfi wrote:

I recall approving the original PR on phab. I can re-review if needed. This 
work was approved to land before, so personally I think it might be overkill to 
RFC it on discourse again but I am not certain of the right process to take. 

> Added @plotfi as a reviewer; one drive-by question is whether adding a new 
> LLVM tool like this requires an RFC to be posted to Discourse or not 
> (https://llvm.org/docs/DeveloperPolicy.html#introducing-new-components-into-llvm).
>  (I don't have any opinions on the tool; just trying to help the review move 
> along.)



https://github.com/llvm/llvm-project/pull/68176
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] llvm-canon (PR #68176)

2023-10-08 Thread Puyan Lotfi via cfe-commits

plotfi wrote:

> Please don't use the term canon/canonicalize for this pass or tool. LLVM has 
> an existing notion of "canonicalization" which does not coincide with what is 
> being done here.

The term comes from an older pass that did similar algorithms on MIR. They are 
only borrowing the term from it. 

https://github.com/llvm/llvm-project/pull/68176
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] llvm-canon (PR #68176)

2023-10-08 Thread Puyan Lotfi via cfe-commits

plotfi wrote:

> Please don't use the term canon/canonicalize for this pass or tool. LLVM has 
> an existing notion of "canonicalization" which does not coincide with what is 
> being done here.

The term comes from an older pass that did similar algorithms on MIR. They are 
only borrowing the term from it. 

https://github.com/llvm/llvm-project/pull/68176
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] e3033c0 - [llvm][clang][IFS] Enhancing the llvm-ifs yaml format for symbol lists.

2020-04-01 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2020-04-01T10:49:06-04:00
New Revision: e3033c0ce5517efddbf92a079ad1e0ca4868591f

URL: 
https://github.com/llvm/llvm-project/commit/e3033c0ce5517efddbf92a079ad1e0ca4868591f
DIFF: 
https://github.com/llvm/llvm-project/commit/e3033c0ce5517efddbf92a079ad1e0ca4868591f.diff

LOG: [llvm][clang][IFS] Enhancing the llvm-ifs yaml format for symbol lists.

Prior to this change the clang interface stubs format resembled
something ending with a symbol list like this:

 Symbols:
   a: { Type: Func }

This was problematic because we didn't actually want a map format and
also because we didn't like that an empty symbol list required
"Symbols: {}". That is to say without the empty {} llvm-ifs would crash
on an empty list.

With this new format it is much more clear which field is the symbol
name, and instead the [] that is used to express an empty symbol vector
is optional, ie:

Symbols:
 - { Name: a, Type: Func }

or

Symbols: []

or

Symbols:

This further diverges the format from existing llvm-elftapi. This is a
good thing because although the format originally came from the same
place, they are not the same in any way.

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

Added: 
clang/test/InterfaceStubs/empty.c
llvm/test/tools/llvm-ifs/empty1.ifs
llvm/test/tools/llvm-ifs/empty2.ifs

Modified: 
clang/include/clang/Frontend/FrontendActions.h
clang/include/clang/Frontend/FrontendOptions.h
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
clang/test/InterfaceStubs/bad-format.cpp
clang/test/InterfaceStubs/blocks.c
clang/test/InterfaceStubs/class-template-partial-specialization.cpp
clang/test/InterfaceStubs/conflict-type.ifs
clang/test/InterfaceStubs/constructor-using-shadow.cpp
clang/test/InterfaceStubs/cxx-conversion.cpp
clang/test/InterfaceStubs/cxxdeduction-guide.cpp
clang/test/InterfaceStubs/driver-test3.c
clang/test/InterfaceStubs/func.ifs
clang/test/InterfaceStubs/hidden-class-inheritance.cpp
clang/test/InterfaceStubs/indirect-field-decl.cpp
clang/test/InterfaceStubs/inline.c
clang/test/InterfaceStubs/lambda.cpp
clang/test/InterfaceStubs/namespace-alias.cpp
clang/test/InterfaceStubs/namespace.cpp
clang/test/InterfaceStubs/non-type-template-parm-decl.cpp
clang/test/InterfaceStubs/object.c
clang/test/InterfaceStubs/object.ifs
clang/test/InterfaceStubs/ppc.cpp
clang/test/InterfaceStubs/template-constexpr.cpp
clang/test/InterfaceStubs/template-namespace-function.cpp
clang/test/InterfaceStubs/template-template-parm-decl.cpp
clang/test/InterfaceStubs/trycatch.cpp
clang/test/InterfaceStubs/unresolved-using-typename.cpp
clang/test/InterfaceStubs/usings.cpp
clang/test/InterfaceStubs/var-template-specialization-decl.cpp
clang/test/InterfaceStubs/weak.cpp
clang/test/InterfaceStubs/windows.cpp
llvm/test/tools/llvm-ifs/Inputs/strong-mismatch-size.ifs
llvm/test/tools/llvm-ifs/Inputs/strong-mismatch-type.ifs
llvm/test/tools/llvm-ifs/conflict-header-format.ifs
llvm/test/tools/llvm-ifs/conflict-header-triple.ifs
llvm/test/tools/llvm-ifs/conflict-header-version.ifs
llvm/test/tools/llvm-ifs/conflict-size.ifs
llvm/test/tools/llvm-ifs/conflict-type.ifs
llvm/test/tools/llvm-ifs/conflict-weak.ifs
llvm/test/tools/llvm-ifs/default-empty.ifs
llvm/test/tools/llvm-ifs/func.ifs
llvm/test/tools/llvm-ifs/ios-tbd.ifs
llvm/test/tools/llvm-ifs/macos-tbd.ifs
llvm/test/tools/llvm-ifs/object-function-size-weak-combo.ifs
llvm/test/tools/llvm-ifs/object.ifs
llvm/test/tools/llvm-ifs/strong.ifs
llvm/test/tools/llvm-ifs/tvos-tbd.ifs
llvm/test/tools/llvm-ifs/version-ok.ifs
llvm/test/tools/llvm-ifs/watchos-tbd.ifs
llvm/test/tools/llvm-ifs/weak-mismatch.ifs
llvm/test/tools/llvm-ifs/weak.ifs
llvm/tools/llvm-ifs/llvm-ifs.cpp

Removed: 




diff  --git a/clang/include/clang/Frontend/FrontendActions.h 
b/clang/include/clang/Frontend/FrontendActions.h
index 89ac20075fa4..9ca2bfda2138 100644
--- a/clang/include/clang/Frontend/FrontendActions.h
+++ b/clang/include/clang/Frontend/FrontendActions.h
@@ -119,17 +119,13 @@ class GenerateModuleAction : public ASTFrontendAction {
   bool hasASTFileSupport() const override { return false; }
 };
 
-class GenerateInterfaceStubAction : public ASTFrontendAction {
-protected:
-  TranslationUnitKind getTranslationUnitKind() override { return TU_Module; }
-
-  bool hasASTFileSupport() const override { return false; }
-};
-
-class GenerateInterfaceIfsExpV1Action : public GenerateInterfaceStubAction {
+class GenerateInterfaceStubsAction : public ASTFrontendAction {
 protected:
   std::unique_ptr CreateASTConsumer(CompilerInstance &CI,

[clang] 79e345f - [clang][IFS] Adds support for more decl types in clang interface stubs.

2019-11-08 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-11-08T20:27:25-05:00
New Revision: 79e345fbcc822e914fac4838dd7a4f2ddbb5fcad

URL: 
https://github.com/llvm/llvm-project/commit/79e345fbcc822e914fac4838dd7a4f2ddbb5fcad
DIFF: 
https://github.com/llvm/llvm-project/commit/79e345fbcc822e914fac4838dd7a4f2ddbb5fcad.diff

LOG: [clang][IFS] Adds support for more decl types in clang interface stubs.

Adding support for processing the following Decls: NonTypeTemplateParmDecl,
CXXConversionDecl, UnresolvedUsingValueDecl, UsingDecl, UsingShadowDecl,
TypeAliasTemplateDecl, TypeAliasDecl, VarTemplateDecl,
VarTemplateSpecializationDecl, UsingDirectiveDecl, TemplateTemplateParmDecl,
ClassTemplatePartialSpecializationDecl, IndirectFieldDecl.

Also, this allows for processing NamedDecls that don't have an identifier and
skips over VarDecls that are dependent on template types.

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

Added: 
clang/test/InterfaceStubs/class-template-partial-specialization.cpp
clang/test/InterfaceStubs/cxx-conversion.cpp
clang/test/InterfaceStubs/indirect-field-decl.cpp
clang/test/InterfaceStubs/namespace.cpp
clang/test/InterfaceStubs/non-type-template-parm-decl.cpp
clang/test/InterfaceStubs/template-constexpr.cpp
clang/test/InterfaceStubs/template-template-parm-decl.cpp
clang/test/InterfaceStubs/trycatch.cpp
clang/test/InterfaceStubs/usings.cpp
clang/test/InterfaceStubs/var-template-specialization-decl.cpp

Modified: 
clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp

Removed: 




diff  --git a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp 
b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
index 0b28b78de3b1..025e6eb1508f 100644
--- a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
+++ b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
@@ -182,8 +182,32 @@ class InterfaceStubFunctionsConsumer : public ASTConsumer {
 case Decl::Kind::Enum:
 case Decl::Kind::EnumConstant:
 case Decl::Kind::TemplateTypeParm:
+case Decl::Kind::NonTypeTemplateParm:
+case Decl::Kind::CXXConversion:
+case Decl::Kind::UnresolvedUsingValue:
+case Decl::Kind::Using:
+case Decl::Kind::UsingShadow:
+case Decl::Kind::TypeAliasTemplate:
+case Decl::Kind::TypeAlias:
+case Decl::Kind::VarTemplate:
+case Decl::Kind::VarTemplateSpecialization:
+case Decl::Kind::UsingDirective:
+case Decl::Kind::TemplateTemplateParm:
+case Decl::Kind::ClassTemplatePartialSpecialization:
+case Decl::Kind::IndirectField:
   return true;
-case Decl::Kind::Var:
+case Decl::Kind::Var: {
+  // Bail on any VarDecl that either has no named symbol.
+  if (!ND->getIdentifier())
+return true;
+  const auto *VD = cast(ND);
+  // Bail on any VarDecl that is a dependent or templated type.
+  if (VD->isTemplated() || VD->getType()->isDependentType())
+return true;
+  if (WriteNamedDecl(ND, Symbols, RDO))
+return true;
+  break;
+}
 case Decl::Kind::ParmVar:
 case Decl::Kind::CXXMethod:
 case Decl::Kind::CXXConstructor:
@@ -251,14 +275,16 @@ class InterfaceStubFunctionsConsumer : public ASTConsumer 
{
 for (const NamedDecl *ND : v.NamedDecls)
   HandleNamedDecl(ND, Symbols, FromTU);
 
-auto writeIfsV1 =
-[this](const llvm::Triple &T, const MangledSymbols &Symbols,
-   const ASTContext &context, StringRef Format,
-   raw_ostream &OS) -> void {
+auto writeIfsV1 = [this](const llvm::Triple &T,
+ const MangledSymbols &Symbols,
+ const ASTContext &context, StringRef Format,
+ raw_ostream &OS) -> void {
   OS << "--- !" << Format << "\n";
   OS << "IfsVersion: 1.0\n";
   OS << "Triple: " << T.str() << "\n";
-  OS << "ObjectFileFormat: " << "ELF" << "\n"; // TODO: For now, just ELF.
+  OS << "ObjectFileFormat: "
+ << "ELF"
+ << "\n"; // TODO: For now, just ELF.
   OS << "Symbols:\n";
   for (const auto &E : Symbols) {
 const MangledSymbol &Symbol = E.second;

diff  --git 
a/clang/test/InterfaceStubs/class-template-partial-specialization.cpp 
b/clang/test/InterfaceStubs/class-template-partial-specialization.cpp
new file mode 100644
index ..ae6e7bf2458a
--- /dev/null
+++ b/clang/test/InterfaceStubs/class-template-partial-specialization.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang -c -o - -emit-interface-stubs %s | FileCheck %s
+
+// CHECK:  --- !experimental-ifs-v1
+// CHECK-NEXT: IfsVersion: 1.0
+// CHECK-NEXT: Triple: x86_64-unknown-linux-gnu
+// CHECK-NEXT: ObjectFileFormat: ELF
+// CHECK-NEXT: Symbols:
+// CHECK-NEXT: ...
+
+template struct S7 { };
+template struct S7 { };
\ No newline at end of file

diff  --git a/clang/test/InterfaceStubs/cxx-conversion.cpp 
b/clang/test/InterfaceStubs/cxx-convers

[clang] 1257146 - [clang][IFS][test] Fixing buildbot test fails for clang-ifs.

2019-11-08 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-11-08T21:06:23-05:00
New Revision: 1257146eb41485e91cb13a6b0ccc2fb7faa68b75

URL: 
https://github.com/llvm/llvm-project/commit/1257146eb41485e91cb13a6b0ccc2fb7faa68b75
DIFF: 
https://github.com/llvm/llvm-project/commit/1257146eb41485e91cb13a6b0ccc2fb7faa68b75.diff

LOG: [clang][IFS][test] Fixing buildbot test fails for clang-ifs.

Checking for the exact triple fails on many bots. Leaving the triple
check blank.

Added: 


Modified: 
clang/test/InterfaceStubs/class-template-partial-specialization.cpp
clang/test/InterfaceStubs/cxx-conversion.cpp
clang/test/InterfaceStubs/indirect-field-decl.cpp
clang/test/InterfaceStubs/namespace.cpp
clang/test/InterfaceStubs/non-type-template-parm-decl.cpp
clang/test/InterfaceStubs/template-constexpr.cpp
clang/test/InterfaceStubs/template-template-parm-decl.cpp
clang/test/InterfaceStubs/usings.cpp

Removed: 




diff  --git 
a/clang/test/InterfaceStubs/class-template-partial-specialization.cpp 
b/clang/test/InterfaceStubs/class-template-partial-specialization.cpp
index ae6e7bf2458a..01734294abdd 100644
--- a/clang/test/InterfaceStubs/class-template-partial-specialization.cpp
+++ b/clang/test/InterfaceStubs/class-template-partial-specialization.cpp
@@ -2,10 +2,10 @@
 
 // CHECK:  --- !experimental-ifs-v1
 // CHECK-NEXT: IfsVersion: 1.0
-// CHECK-NEXT: Triple: x86_64-unknown-linux-gnu
+// CHECK-NEXT: Triple:
 // CHECK-NEXT: ObjectFileFormat: ELF
 // CHECK-NEXT: Symbols:
 // CHECK-NEXT: ...
 
 template struct S7 { };
-template struct S7 { };
\ No newline at end of file
+template struct S7 { };

diff  --git a/clang/test/InterfaceStubs/cxx-conversion.cpp 
b/clang/test/InterfaceStubs/cxx-conversion.cpp
index e1f7b569d59b..70496ce8305e 100644
--- a/clang/test/InterfaceStubs/cxx-conversion.cpp
+++ b/clang/test/InterfaceStubs/cxx-conversion.cpp
@@ -2,7 +2,7 @@
 
 // CHECK:  --- !experimental-ifs-v1
 // CHECK-NEXT: IfsVersion: 1.0
-// CHECK-NEXT: Triple: x86_64-unknown-linux-gnu
+// CHECK-NEXT: Triple:
 // CHECK-NEXT: ObjectFileFormat: ELF
 // CHECK-NEXT: Symbols:
 // CHECK-NEXT: ...
@@ -10,4 +10,4 @@
 template class C1 {
 long a;
 operator long() const { return a; }
-};
\ No newline at end of file
+};

diff  --git a/clang/test/InterfaceStubs/indirect-field-decl.cpp 
b/clang/test/InterfaceStubs/indirect-field-decl.cpp
index 4bad17d70b50..5331a952645e 100644
--- a/clang/test/InterfaceStubs/indirect-field-decl.cpp
+++ b/clang/test/InterfaceStubs/indirect-field-decl.cpp
@@ -2,9 +2,9 @@
 
 // CHECK:  --- !experimental-ifs-v1
 // CHECK-NEXT: IfsVersion: 1.0
-// CHECK-NEXT: Triple: x86_64-unknown-linux-gnu
+// CHECK-NEXT: Triple:
 // CHECK-NEXT: ObjectFileFormat: ELF
 // CHECK-NEXT: Symbols:
 // CHECK-NEXT: ...
 
-template class C2 { union { T c; }; };
\ No newline at end of file
+template class C2 { union { T c; }; };

diff  --git a/clang/test/InterfaceStubs/namespace.cpp 
b/clang/test/InterfaceStubs/namespace.cpp
index c0891a33df41..99ebadfa59ee 100644
--- a/clang/test/InterfaceStubs/namespace.cpp
+++ b/clang/test/InterfaceStubs/namespace.cpp
@@ -2,10 +2,10 @@
 
 // CHECK:  --- !experimental-ifs-v1
 // CHECK-NEXT: IfsVersion: 1.0
-// CHECK-NEXT: Triple: x86_64-unknown-linux-gnu
+// CHECK-NEXT: Triple:
 // CHECK-NEXT: ObjectFileFormat: ELF
 // CHECK-NEXT: Symbols:
 // CHECK-NEXT: ...
 
 namespace NS1 { }
-using namespace NS1;
\ No newline at end of file
+using namespace NS1;

diff  --git a/clang/test/InterfaceStubs/non-type-template-parm-decl.cpp 
b/clang/test/InterfaceStubs/non-type-template-parm-decl.cpp
index c0bfeb90454a..4d3f4d7ced8b 100644
--- a/clang/test/InterfaceStubs/non-type-template-parm-decl.cpp
+++ b/clang/test/InterfaceStubs/non-type-template-parm-decl.cpp
@@ -2,9 +2,9 @@
 
 // CHECK:  --- !experimental-ifs-v1
 // CHECK-NEXT: IfsVersion: 1.0
-// CHECK-NEXT: Triple: x86_64-unknown-linux-gnu
+// CHECK-NEXT: Triple:
 // CHECK-NEXT: ObjectFileFormat: ELF
 // CHECK-NEXT: Symbols:
 // CHECK-NEXT: ...
 
-template struct S1 {};
\ No newline at end of file
+template struct S1 {};

diff  --git a/clang/test/InterfaceStubs/template-constexpr.cpp 
b/clang/test/InterfaceStubs/template-constexpr.cpp
index 770a307b8b34..25d67d378c73 100644
--- a/clang/test/InterfaceStubs/template-constexpr.cpp
+++ b/clang/test/InterfaceStubs/template-constexpr.cpp
@@ -2,10 +2,10 @@
 
 // CHECK:  --- !experimental-ifs-v1
 // CHECK-NEXT: IfsVersion: 1.0
-// CHECK-NEXT: Triple: x86_64-unknown-linux-gnu
+// CHECK-NEXT: Triple:
 // CHECK-NEXT: ObjectFileFormat: ELF
 // CHECK-NEXT: Symbols:
 // CHECK-NEXT: ...
 
 template struct S8 { static constexpr T value = v; };
-template constexpr T S8::value;
\ No newline at end of file
+template constexpr T S8::value;

diff  --git a/clang/test/InterfaceStubs/template-template-parm-decl.cpp 
b/clang/test/InterfaceStubs/template-template-parm-decl.cpp
index d9edf6b0296d..b09d732ea4cd 100644
--

[clang] e782192 - [clang][IFS][test][NFC] Tightening up clang-ifs tests to use -cc1 more often.

2019-11-13 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-11-14T02:25:22-05:00
New Revision: e782192d5e6540b0cbb957a6b738d98e24c88ee3

URL: 
https://github.com/llvm/llvm-project/commit/e782192d5e6540b0cbb957a6b738d98e24c88ee3
DIFF: 
https://github.com/llvm/llvm-project/commit/e782192d5e6540b0cbb957a6b738d98e24c88ee3.diff

LOG: [clang][IFS][test][NFC] Tightening up clang-ifs tests to use -cc1 more 
often.

Unless the test is explicitly testing a driver feature if clang
interface stubs I have changed the tests to use %clang_cc1. This should
make some changes I plan to make to the driver job pipeline cause fewer
test changes and breakages.

Added: 


Modified: 
clang/test/InterfaceStubs/class-template-partial-specialization.cpp
clang/test/InterfaceStubs/class-template-specialization.cpp
clang/test/InterfaceStubs/cxx-conversion.cpp
clang/test/InterfaceStubs/driver-test.c
clang/test/InterfaceStubs/externstatic.c
clang/test/InterfaceStubs/function-template-specialization.cpp
clang/test/InterfaceStubs/hidden-class-inheritance.cpp
clang/test/InterfaceStubs/indirect-field-decl.cpp
clang/test/InterfaceStubs/inline.c
clang/test/InterfaceStubs/namespace.cpp
clang/test/InterfaceStubs/non-type-template-parm-decl.cpp
clang/test/InterfaceStubs/object.c
clang/test/InterfaceStubs/template-constexpr.cpp
clang/test/InterfaceStubs/template-namespace-function.cpp
clang/test/InterfaceStubs/template-template-parm-decl.cpp
clang/test/InterfaceStubs/trycatch.cpp
clang/test/InterfaceStubs/usings.cpp
clang/test/InterfaceStubs/var-template-specialization-decl.cpp
clang/test/InterfaceStubs/virtual.cpp
clang/test/InterfaceStubs/visibility.cpp
clang/test/InterfaceStubs/weak.cpp
clang/test/InterfaceStubs/windows.cpp

Removed: 




diff  --git 
a/clang/test/InterfaceStubs/class-template-partial-specialization.cpp 
b/clang/test/InterfaceStubs/class-template-partial-specialization.cpp
index 01734294abdd..4c0edaa2dd8f 100644
--- a/clang/test/InterfaceStubs/class-template-partial-specialization.cpp
+++ b/clang/test/InterfaceStubs/class-template-partial-specialization.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang -c -o - -emit-interface-stubs %s | FileCheck %s
+// RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s
 
 // CHECK:  --- !experimental-ifs-v1
 // CHECK-NEXT: IfsVersion: 1.0

diff  --git a/clang/test/InterfaceStubs/class-template-specialization.cpp 
b/clang/test/InterfaceStubs/class-template-specialization.cpp
index 0a68d3f1f117..34576546571d 100644
--- a/clang/test/InterfaceStubs/class-template-specialization.cpp
+++ b/clang/test/InterfaceStubs/class-template-specialization.cpp
@@ -1,13 +1,11 @@
 // REQUIRES: x86-registered-target
-// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs 
-emit-merged-ifs \
-// RUN: -interface-stub-version=experimental-ifs-v1 %s | \
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs 
%s | \
 // RUN: FileCheck -check-prefix=CHECK-TAPI %s
 
-// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs 
-emit-merged-ifs \
-// RUN: -interface-stub-version=experimental-ifs-v1 %s | \
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs 
%s | \
 // RUN: FileCheck -check-prefix=CHECK-TAPI2 %s
-// RUN: %clang -target x86_64-unknown-linux-gnu -o - -c %s | \
-// RUN: llvm-readelf -s - 2>&1 | \
+
+// RUN: %clang -target x86_64-unknown-linux-gnu -c -o - %s | llvm-readelf -s - 
2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
 
 // For the following:

diff  --git a/clang/test/InterfaceStubs/cxx-conversion.cpp 
b/clang/test/InterfaceStubs/cxx-conversion.cpp
index 70496ce8305e..96425a42b6fc 100644
--- a/clang/test/InterfaceStubs/cxx-conversion.cpp
+++ b/clang/test/InterfaceStubs/cxx-conversion.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang -c -o - -emit-interface-stubs %s | FileCheck %s
+// RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s
 
 // CHECK:  --- !experimental-ifs-v1
 // CHECK-NEXT: IfsVersion: 1.0

diff  --git a/clang/test/InterfaceStubs/driver-test.c 
b/clang/test/InterfaceStubs/driver-test.c
index d4e50295411a..512745276e5a 100644
--- a/clang/test/InterfaceStubs/driver-test.c
+++ b/clang/test/InterfaceStubs/driver-test.c
@@ -1,11 +1,12 @@
 // REQUIRES: x86-registered-target
 
-// RUN: %clang -target x86_64-unknown-linux-gnu -x c -o %t1.so 
-emit-interface-stubs %s %S/object.c %S/weak.cpp && \
-// RUN: llvm-nm %t1.so 2>&1 | FileCheck --check-prefix=CHECK-IFS %s
+// RUN: %clang -target x86_64-unknown-linux-gnu -shared -x c -o %t1.so 
-emit-interface-stubs %s %S/object.c %S/weak.cpp
+// RUN: llvm-nm %t1.so   2>&1 | FileCheck %s
+// RUN: llvm-nm %t1.ifso 2>&1 | FileCheck %s
 
-// CHECK-IFS-DAG: data
-// CHECK-IFS-DAG: foo
-// CHECK-IFS-DAG: strongFunc
-// CHECK-IFS-DAG: weakFunc
+// CHECK-DAG: data
+// CHECK-DAG: foo
+// CHECK-DAG: strongFunc
+// CHECK-DAG

[clang] c72aef9 - [clang][IFS][test] Removing -shared, fixing triple: driver-test.c/windows.cpp.

2019-11-13 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-11-14T02:43:40-05:00
New Revision: c72aef999c3359f4305bf99116be604e16844aab

URL: 
https://github.com/llvm/llvm-project/commit/c72aef999c3359f4305bf99116be604e16844aab
DIFF: 
https://github.com/llvm/llvm-project/commit/c72aef999c3359f4305bf99116be604e16844aab.diff

LOG: [clang][IFS][test] Removing -shared, fixing triple: 
driver-test.c/windows.cpp.

Removing -shared as it is not used on a lot of targets in order to green failing
bots with this change. Also, tiding up the windows.cpp test as the
triple compile out can look slightly different that what you specified
on a windows bot.

Added: 


Modified: 
clang/test/InterfaceStubs/driver-test.c
clang/test/InterfaceStubs/windows.cpp

Removed: 




diff  --git a/clang/test/InterfaceStubs/driver-test.c 
b/clang/test/InterfaceStubs/driver-test.c
index 512745276e5a..b61bed10e77c 100644
--- a/clang/test/InterfaceStubs/driver-test.c
+++ b/clang/test/InterfaceStubs/driver-test.c
@@ -1,7 +1,7 @@
 // REQUIRES: x86-registered-target
 
-// RUN: %clang -target x86_64-unknown-linux-gnu -shared -x c -o %t1.so 
-emit-interface-stubs %s %S/object.c %S/weak.cpp
-// RUN: llvm-nm %t1.so   2>&1 | FileCheck %s
+// RUN: %clang -target x86_64-unknown-linux-gnu -x c -o %t1 
-emit-interface-stubs %s %S/object.c %S/weak.cpp
+// RUN: llvm-nm %t1   2>&1 | FileCheck %s
 // RUN: llvm-nm %t1.ifso 2>&1 | FileCheck %s
 
 // CHECK-DAG: data

diff  --git a/clang/test/InterfaceStubs/windows.cpp 
b/clang/test/InterfaceStubs/windows.cpp
index 609145b3def0..9ccb771a2f39 100644
--- a/clang/test/InterfaceStubs/windows.cpp
+++ b/clang/test/InterfaceStubs/windows.cpp
@@ -7,7 +7,7 @@
 
  // CHECK-IFS: --- !experimental-ifs-v1
  // CHECK-IFS: IfsVersion:  1.0
- // CHECK-IFS: Triple:  x86_64-unknown-windows-msvc19.11.0
+ // CHECK-IFS: Triple:
  // CHECK-IFS: Symbols:
  // CHECK-IFS:   ?helloWindowsMsvc@@YAHXZ: { Type: Func }
  // CHECK-IFS: ...



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


[clang] 4873319 - [clang][IFS][test] Reverting driver-test.c to what it was prior to e782192d5e6

2019-11-14 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-11-14T03:39:16-05:00
New Revision: 4873319f973ba86c5d1226e87cdc3a7c085451bb

URL: 
https://github.com/llvm/llvm-project/commit/4873319f973ba86c5d1226e87cdc3a7c085451bb
DIFF: 
https://github.com/llvm/llvm-project/commit/4873319f973ba86c5d1226e87cdc3a7c085451bb.diff

LOG: [clang][IFS][test] Reverting driver-test.c to what it was prior to 
e782192d5e6

My mistake. Changes I had in this test were for code changes that are
not landed yet. I am reverting driver-test.c back to what it was
originally.

Added: 


Modified: 
clang/test/InterfaceStubs/driver-test.c

Removed: 




diff  --git a/clang/test/InterfaceStubs/driver-test.c 
b/clang/test/InterfaceStubs/driver-test.c
index b61bed10e77c..d4e50295411a 100644
--- a/clang/test/InterfaceStubs/driver-test.c
+++ b/clang/test/InterfaceStubs/driver-test.c
@@ -1,12 +1,11 @@
 // REQUIRES: x86-registered-target
 
-// RUN: %clang -target x86_64-unknown-linux-gnu -x c -o %t1 
-emit-interface-stubs %s %S/object.c %S/weak.cpp
-// RUN: llvm-nm %t1   2>&1 | FileCheck %s
-// RUN: llvm-nm %t1.ifso 2>&1 | FileCheck %s
+// RUN: %clang -target x86_64-unknown-linux-gnu -x c -o %t1.so 
-emit-interface-stubs %s %S/object.c %S/weak.cpp && \
+// RUN: llvm-nm %t1.so 2>&1 | FileCheck --check-prefix=CHECK-IFS %s
 
-// CHECK-DAG: data
-// CHECK-DAG: foo
-// CHECK-DAG: strongFunc
-// CHECK-DAG: weakFunc
+// CHECK-IFS-DAG: data
+// CHECK-IFS-DAG: foo
+// CHECK-IFS-DAG: strongFunc
+// CHECK-IFS-DAG: weakFunc
 
 int foo(int bar) { return 42 + 1844; }



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


[clang] 58ea00b - [clang][IFS] Driver pipeline: generate interface stubs after standard pipeline.

2019-11-18 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-11-19T01:18:02-05:00
New Revision: 58ea00b51fe9b011301484957556872fced7dd08

URL: 
https://github.com/llvm/llvm-project/commit/58ea00b51fe9b011301484957556872fced7dd08
DIFF: 
https://github.com/llvm/llvm-project/commit/58ea00b51fe9b011301484957556872fced7dd08.diff

LOG: [clang][IFS] Driver pipeline: generate interface stubs after standard 
pipeline.

Up until now, clang interface stubs has replaced the standard
PP -> C -> BE -> ASM -> LNK pipeline. With this change, it will happen in
conjunction with it. So what when you build your code you will get an
a.out or lib.so as well as an interface stub file.

Example:

clang -shared -o libfoo.so -emit-interface-stubs ...

will generate both a libfoo.so and a libfoo.ifso. The .so file will
contain the code from the standard compilation pipeline and the .ifso
file will contain the ELF stub library.

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

Added: 
clang/test/InterfaceStubs/driver-test2.c

Modified: 
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/InterfaceStubs.cpp
clang/lib/Driver/Types.cpp
clang/test/InterfaceStubs/driver-test.c
clang/test/InterfaceStubs/windows.cpp

Removed: 




diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index cdf4a579f431..40cada744d05 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -292,10 +292,6 @@ phases::ID Driver::getFinalPhase(const DerivedArgList &DAL,
  (PhaseArg = DAL.getLastArg(options::OPT_emit_ast))) {
 FinalPhase = phases::Compile;
 
-  // clang interface stubs
-  } else if ((PhaseArg = DAL.getLastArg(options::OPT_emit_interface_stubs))) {
-FinalPhase = phases::IfsMerge;
-
   // -S only runs up to the backend.
   } else if ((PhaseArg = DAL.getLastArg(options::OPT_S))) {
 FinalPhase = phases::Backend;
@@ -3502,6 +3498,68 @@ void Driver::BuildActions(Compilation &C, DerivedArgList 
&Args,
 Actions.push_back(
 C.MakeAction(MergerInputs, types::TY_Image));
 
+  if (Arg *A = Args.getLastArg(options::OPT_emit_interface_stubs)) {
+llvm::SmallVector PhaseList;
+if (Args.hasArg(options::OPT_c)) {
+  llvm::SmallVector 
CompilePhaseList;
+  types::getCompilationPhases(types::TY_IFS_CPP, CompilePhaseList);
+  llvm::copy_if(PhaseList, std::back_inserter(CompilePhaseList),
+[&](phases::ID Phase) { return Phase <= phases::Compile; 
});
+} else {
+  types::getCompilationPhases(types::TY_IFS_CPP, PhaseList);
+}
+
+ActionList MergerInputs;
+
+for (auto &I : Inputs) {
+  types::ID InputType = I.first;
+  const Arg *InputArg = I.second;
+
+  // Currently clang and the llvm assembler do not support generating 
symbol
+  // stubs from assembly, so we skip the input on asm files. For ifs files
+  // we rely on the normal pipeline setup in the pipeline setup code above.
+  if (InputType == types::TY_IFS || InputType == types::TY_PP_Asm ||
+  InputType == types::TY_Asm)
+continue;
+
+  Action *Current = C.MakeAction(*InputArg, InputType);
+
+  for (auto Phase : PhaseList) {
+switch (Phase) {
+default:
+  llvm_unreachable(
+  "IFS Pipeline can only consist of Compile followed by 
IfsMerge.");
+case phases::Compile: {
+  // Only IfsMerge (llvm-ifs) can handle .o files by looking for ifs
+  // files where the .o file is located. The compile action can not
+  // handle this.
+  if (InputType == types::TY_Object)
+break;
+
+  Current = C.MakeAction(Current, types::TY_IFS_CPP);
+  break;
+}
+case phases::IfsMerge: {
+  assert(Phase == PhaseList.back() &&
+ "merging must be final compilation step.");
+  MergerInputs.push_back(Current);
+  Current = nullptr;
+  break;
+}
+}
+  }
+
+  // If we ended with something, add to the output list.
+  if (Current)
+Actions.push_back(Current);
+}
+
+// Add an interface stubs merge action if necessary.
+if (!MergerInputs.empty())
+  Actions.push_back(
+  C.MakeAction(MergerInputs, types::TY_Image));
+  }
+
   // If --print-supported-cpus, -mcpu=? or -mtune=? is specified, build a 
custom
   // Compile phase that prints out supported cpu models and quits.
   if (Arg *A = Args.getLastArg(options::OPT_print_supported_cpus)) {
@@ -3603,8 +3661,6 @@ Action *Driver::ConstructPhaseAction(
   return C.MakeAction(Input, types::TY_ModuleFile);
 if (Args.hasArg(options::OPT_verify_pch))
   return C.MakeAction(Input, types::TY_Nothing);
-if (Args.hasArg(options::OPT_emit_interface_stubs))
-  return C.MakeAction(Input, types::TY_IFS_CPP);
 return C.MakeAction(Input, types::TY_LLVM_BC);
   }
   case phases::Backend: {
@@ -3633,11 +3

[clang] d044dcc - Revert "[clang][IFS] Driver pipeline: generate interface stubs after standard pipeline."

2019-11-18 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-11-19T02:08:22-05:00
New Revision: d044dcc5e492181b1517347013a780d9eda6c3c3

URL: 
https://github.com/llvm/llvm-project/commit/d044dcc5e492181b1517347013a780d9eda6c3c3
DIFF: 
https://github.com/llvm/llvm-project/commit/d044dcc5e492181b1517347013a780d9eda6c3c3.diff

LOG: Revert "[clang][IFS] Driver pipeline: generate interface stubs after 
standard pipeline."

This reverts commit 58ea00b51fe9b011301484957556872fced7dd08.

Test for .o + .ifs sidecar files is brittle and failing on bots.
Reverting to unblock.

Added: 


Modified: 
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/InterfaceStubs.cpp
clang/lib/Driver/Types.cpp
clang/test/InterfaceStubs/driver-test.c
clang/test/InterfaceStubs/windows.cpp

Removed: 
clang/test/InterfaceStubs/driver-test2.c



diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 40cada744d05..cdf4a579f431 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -292,6 +292,10 @@ phases::ID Driver::getFinalPhase(const DerivedArgList &DAL,
  (PhaseArg = DAL.getLastArg(options::OPT_emit_ast))) {
 FinalPhase = phases::Compile;
 
+  // clang interface stubs
+  } else if ((PhaseArg = DAL.getLastArg(options::OPT_emit_interface_stubs))) {
+FinalPhase = phases::IfsMerge;
+
   // -S only runs up to the backend.
   } else if ((PhaseArg = DAL.getLastArg(options::OPT_S))) {
 FinalPhase = phases::Backend;
@@ -3498,68 +3502,6 @@ void Driver::BuildActions(Compilation &C, DerivedArgList 
&Args,
 Actions.push_back(
 C.MakeAction(MergerInputs, types::TY_Image));
 
-  if (Arg *A = Args.getLastArg(options::OPT_emit_interface_stubs)) {
-llvm::SmallVector PhaseList;
-if (Args.hasArg(options::OPT_c)) {
-  llvm::SmallVector 
CompilePhaseList;
-  types::getCompilationPhases(types::TY_IFS_CPP, CompilePhaseList);
-  llvm::copy_if(PhaseList, std::back_inserter(CompilePhaseList),
-[&](phases::ID Phase) { return Phase <= phases::Compile; 
});
-} else {
-  types::getCompilationPhases(types::TY_IFS_CPP, PhaseList);
-}
-
-ActionList MergerInputs;
-
-for (auto &I : Inputs) {
-  types::ID InputType = I.first;
-  const Arg *InputArg = I.second;
-
-  // Currently clang and the llvm assembler do not support generating 
symbol
-  // stubs from assembly, so we skip the input on asm files. For ifs files
-  // we rely on the normal pipeline setup in the pipeline setup code above.
-  if (InputType == types::TY_IFS || InputType == types::TY_PP_Asm ||
-  InputType == types::TY_Asm)
-continue;
-
-  Action *Current = C.MakeAction(*InputArg, InputType);
-
-  for (auto Phase : PhaseList) {
-switch (Phase) {
-default:
-  llvm_unreachable(
-  "IFS Pipeline can only consist of Compile followed by 
IfsMerge.");
-case phases::Compile: {
-  // Only IfsMerge (llvm-ifs) can handle .o files by looking for ifs
-  // files where the .o file is located. The compile action can not
-  // handle this.
-  if (InputType == types::TY_Object)
-break;
-
-  Current = C.MakeAction(Current, types::TY_IFS_CPP);
-  break;
-}
-case phases::IfsMerge: {
-  assert(Phase == PhaseList.back() &&
- "merging must be final compilation step.");
-  MergerInputs.push_back(Current);
-  Current = nullptr;
-  break;
-}
-}
-  }
-
-  // If we ended with something, add to the output list.
-  if (Current)
-Actions.push_back(Current);
-}
-
-// Add an interface stubs merge action if necessary.
-if (!MergerInputs.empty())
-  Actions.push_back(
-  C.MakeAction(MergerInputs, types::TY_Image));
-  }
-
   // If --print-supported-cpus, -mcpu=? or -mtune=? is specified, build a 
custom
   // Compile phase that prints out supported cpu models and quits.
   if (Arg *A = Args.getLastArg(options::OPT_print_supported_cpus)) {
@@ -3661,6 +3603,8 @@ Action *Driver::ConstructPhaseAction(
   return C.MakeAction(Input, types::TY_ModuleFile);
 if (Args.hasArg(options::OPT_verify_pch))
   return C.MakeAction(Input, types::TY_Nothing);
+if (Args.hasArg(options::OPT_emit_interface_stubs))
+  return C.MakeAction(Input, types::TY_IFS_CPP);
 return C.MakeAction(Input, types::TY_LLVM_BC);
   }
   case phases::Backend: {
@@ -3689,16 +3633,11 @@ void Driver::BuildJobs(Compilation &C) const {
   Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o);
 
   // It is an error to provide a -o option if we are making multiple output
-  // files. There is one exception, IfsMergeJob: when generating interface 
stubs
-  // enabled we want to be able to generate the stub file at the same time that
-  // we generate the real library/

[clang] ea8e028 - [clang][IFS] Driver Pipeline: generate stubs after standard pipeline (2)

2019-11-19 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-11-19T17:47:38-05:00
New Revision: ea8e02822341e2421b94167d828d3f224e767424

URL: 
https://github.com/llvm/llvm-project/commit/ea8e02822341e2421b94167d828d3f224e767424
DIFF: 
https://github.com/llvm/llvm-project/commit/ea8e02822341e2421b94167d828d3f224e767424.diff

LOG: [clang][IFS] Driver Pipeline: generate stubs after standard pipeline (2)

Second Landing Attempt:

Up until now, clang interface stubs has replaced the standard
PP -> C -> BE -> ASM -> LNK pipeline. With this change, it will happen in
conjunction with it. So what when you build your code you will get an
a.out or lib.so as well as an interface stub file.

Example:

clang -shared -o libfoo.so -emit-interface-stubs ...

will generate both a libfoo.so and a libfoo.ifso. The .so file will
contain the code from the standard compilation pipeline and the .ifso
file will contain the ELF stub library.

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

Added: 
clang/test/InterfaceStubs/driver-test2.c
clang/test/InterfaceStubs/ppc.cpp

Modified: 
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/InterfaceStubs.cpp
clang/lib/Driver/Types.cpp
clang/test/InterfaceStubs/driver-test.c
clang/test/InterfaceStubs/windows.cpp

Removed: 




diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index cdf4a579f431..83b5db3b2530 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -292,10 +292,6 @@ phases::ID Driver::getFinalPhase(const DerivedArgList &DAL,
  (PhaseArg = DAL.getLastArg(options::OPT_emit_ast))) {
 FinalPhase = phases::Compile;
 
-  // clang interface stubs
-  } else if ((PhaseArg = DAL.getLastArg(options::OPT_emit_interface_stubs))) {
-FinalPhase = phases::IfsMerge;
-
   // -S only runs up to the backend.
   } else if ((PhaseArg = DAL.getLastArg(options::OPT_S))) {
 FinalPhase = phases::Backend;
@@ -3502,6 +3498,68 @@ void Driver::BuildActions(Compilation &C, DerivedArgList 
&Args,
 Actions.push_back(
 C.MakeAction(MergerInputs, types::TY_Image));
 
+  if (Arg *A = Args.getLastArg(options::OPT_emit_interface_stubs)) {
+llvm::SmallVector PhaseList;
+if (Args.hasArg(options::OPT_c)) {
+  llvm::SmallVector 
CompilePhaseList;
+  types::getCompilationPhases(types::TY_IFS_CPP, CompilePhaseList);
+  llvm::copy_if(CompilePhaseList, std::back_inserter(PhaseList),
+[&](phases::ID Phase) { return Phase <= phases::Compile; 
});
+} else {
+  types::getCompilationPhases(types::TY_IFS_CPP, PhaseList);
+}
+
+ActionList MergerInputs;
+
+for (auto &I : Inputs) {
+  types::ID InputType = I.first;
+  const Arg *InputArg = I.second;
+
+  // Currently clang and the llvm assembler do not support generating 
symbol
+  // stubs from assembly, so we skip the input on asm files. For ifs files
+  // we rely on the normal pipeline setup in the pipeline setup code above.
+  if (InputType == types::TY_IFS || InputType == types::TY_PP_Asm ||
+  InputType == types::TY_Asm)
+continue;
+
+  Action *Current = C.MakeAction(*InputArg, InputType);
+
+  for (auto Phase : PhaseList) {
+switch (Phase) {
+default:
+  llvm_unreachable(
+  "IFS Pipeline can only consist of Compile followed by 
IfsMerge.");
+case phases::Compile: {
+  // Only IfsMerge (llvm-ifs) can handle .o files by looking for ifs
+  // files where the .o file is located. The compile action can not
+  // handle this.
+  if (InputType == types::TY_Object)
+break;
+
+  Current = C.MakeAction(Current, types::TY_IFS_CPP);
+  break;
+}
+case phases::IfsMerge: {
+  assert(Phase == PhaseList.back() &&
+ "merging must be final compilation step.");
+  MergerInputs.push_back(Current);
+  Current = nullptr;
+  break;
+}
+}
+  }
+
+  // If we ended with something, add to the output list.
+  if (Current)
+Actions.push_back(Current);
+}
+
+// Add an interface stubs merge action if necessary.
+if (!MergerInputs.empty())
+  Actions.push_back(
+  C.MakeAction(MergerInputs, types::TY_Image));
+  }
+
   // If --print-supported-cpus, -mcpu=? or -mtune=? is specified, build a 
custom
   // Compile phase that prints out supported cpu models and quits.
   if (Arg *A = Args.getLastArg(options::OPT_print_supported_cpus)) {
@@ -3603,8 +3661,6 @@ Action *Driver::ConstructPhaseAction(
   return C.MakeAction(Input, types::TY_ModuleFile);
 if (Args.hasArg(options::OPT_verify_pch))
   return C.MakeAction(Input, types::TY_Nothing);
-if (Args.hasArg(options::OPT_emit_interface_stubs))
-  return C.MakeAction(Input, types::TY_IFS_CPP);
 return C.MakeAction(Input, types::TY_L

[clang] 377d70c - [clang][IFS] Fixing failing bots that do not have PPC target or "orbis-ld"

2019-11-19 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-11-19T18:12:07-05:00
New Revision: 377d70cdea733e36107e99d9148864d24797d51c

URL: 
https://github.com/llvm/llvm-project/commit/377d70cdea733e36107e99d9148864d24797d51c
DIFF: 
https://github.com/llvm/llvm-project/commit/377d70cdea733e36107e99d9148864d24797d51c.diff

LOG: [clang][IFS] Fixing failing bots that do not have PPC target or "orbis-ld"

Added: 


Modified: 
clang/test/InterfaceStubs/driver-test.c
clang/test/InterfaceStubs/ppc.cpp

Removed: 




diff  --git a/clang/test/InterfaceStubs/driver-test.c 
b/clang/test/InterfaceStubs/driver-test.c
index ed5e5a04a226..b34536a29761 100644
--- a/clang/test/InterfaceStubs/driver-test.c
+++ b/clang/test/InterfaceStubs/driver-test.c
@@ -1,3 +1,5 @@
+// REQUIRES: !system-darwin && !system-windows
+
 // RUN: %clang -o %t1 -emit-interface-stubs -emit-merged-ifs %s %S/object.c 
%S/weak.cpp
 // RUN: cat %t1.ifs | FileCheck %s
 

diff  --git a/clang/test/InterfaceStubs/ppc.cpp 
b/clang/test/InterfaceStubs/ppc.cpp
index 3155bbd825c5..9a91697d9506 100644
--- a/clang/test/InterfaceStubs/ppc.cpp
+++ b/clang/test/InterfaceStubs/ppc.cpp
@@ -1,3 +1,5 @@
+// REQUIRES: powerpc-registered-target
+
 // RUN: %clang -x c++ -target powerpc64le-unknown-linux-gnu -o - %s \
 // RUN:   -emit-interface-stubs -emit-merged-ifs -S | \
 // RUN: FileCheck -check-prefix=CHECK-IFS %s



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


[clang] 29fd1e1 - [clang][IFS] Attempting to fix missing 'orbis-ld' on scei-ps4-ubuntu bot.

2019-11-19 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-11-19T18:34:49-05:00
New Revision: 29fd1e1f4a372f3870e054da24b57a4f45861808

URL: 
https://github.com/llvm/llvm-project/commit/29fd1e1f4a372f3870e054da24b57a4f45861808
DIFF: 
https://github.com/llvm/llvm-project/commit/29fd1e1f4a372f3870e054da24b57a4f45861808.diff

LOG: [clang][IFS] Attempting to fix missing 'orbis-ld' on scei-ps4-ubuntu bot.

I want this test to run end to end, but I am still having trouble with
missing linkers on the scei-ps4 bot. Will remove this test if it
continues to be a source of brittle failures. Sorry for the noise.

Added: 


Modified: 
clang/test/InterfaceStubs/driver-test.c

Removed: 




diff  --git a/clang/test/InterfaceStubs/driver-test.c 
b/clang/test/InterfaceStubs/driver-test.c
index b34536a29761..62d522fb7b1f 100644
--- a/clang/test/InterfaceStubs/driver-test.c
+++ b/clang/test/InterfaceStubs/driver-test.c
@@ -1,6 +1,8 @@
+// REQUIRES: x86-registered-target
 // REQUIRES: !system-darwin && !system-windows
 
-// RUN: %clang -o %t1 -emit-interface-stubs -emit-merged-ifs %s %S/object.c 
%S/weak.cpp
+// RUN: %clang -o %t1 -target x86_64-unknown-linux-gnu \
+// RUN:   -emit-interface-stubs -emit-merged-ifs %s %S/object.c %S/weak.cpp
 // RUN: cat %t1.ifs | FileCheck %s
 
 // CHECK-DAG: data



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


[clang] 1b38748 - [clang][IFS] Fixing unsupported emulation mode on clang-ppc64be-linux bot.

2019-11-19 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-11-19T19:27:46-05:00
New Revision: 1b387484b9b38a4a1e98a9d22a9a26065b0d184e

URL: 
https://github.com/llvm/llvm-project/commit/1b387484b9b38a4a1e98a9d22a9a26065b0d184e
DIFF: 
https://github.com/llvm/llvm-project/commit/1b387484b9b38a4a1e98a9d22a9a26065b0d184e.diff

LOG: [clang][IFS] Fixing unsupported emulation mode on clang-ppc64be-linux bot.

I am in another pickle here where if I specify a triple, I get the wrong elf
target arch on the PPC bot (error from the PPC elf Linker). To avoid this I am
going to turn this test off on the PPC bots for now.

Added: 


Modified: 
clang/test/InterfaceStubs/driver-test.c

Removed: 




diff  --git a/clang/test/InterfaceStubs/driver-test.c 
b/clang/test/InterfaceStubs/driver-test.c
index 62d522fb7b1f..425d87271f33 100644
--- a/clang/test/InterfaceStubs/driver-test.c
+++ b/clang/test/InterfaceStubs/driver-test.c
@@ -1,4 +1,5 @@
 // REQUIRES: x86-registered-target
+// REQUIRES: !powerpc-registered-target
 // REQUIRES: !system-darwin && !system-windows
 
 // RUN: %clang -o %t1 -target x86_64-unknown-linux-gnu \



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


[clang] f37356d - [clang][IFS][test] Removing driver-test.c. Test is still too brittle.

2019-11-19 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-11-19T21:42:17-05:00
New Revision: f37356d6f60ae5db978611621d3a375ed87ec0f0

URL: 
https://github.com/llvm/llvm-project/commit/f37356d6f60ae5db978611621d3a375ed87ec0f0
DIFF: 
https://github.com/llvm/llvm-project/commit/f37356d6f60ae5db978611621d3a375ed87ec0f0.diff

LOG: [clang][IFS][test] Removing driver-test.c. Test is still too brittle.

Removing this test because if I add a triple then there are link falures
on targets like ppc and s390x. If I don't add a triple then on PS4
targets the clang driver tries to invoke orbis-ld which ends up being
not found.

Added: 


Modified: 


Removed: 
clang/test/InterfaceStubs/driver-test.c



diff  --git a/clang/test/InterfaceStubs/driver-test.c 
b/clang/test/InterfaceStubs/driver-test.c
deleted file mode 100644
index 425d87271f33..
--- a/clang/test/InterfaceStubs/driver-test.c
+++ /dev/null
@@ -1,15 +0,0 @@
-// REQUIRES: x86-registered-target
-// REQUIRES: !powerpc-registered-target
-// REQUIRES: !system-darwin && !system-windows
-
-// RUN: %clang -o %t1 -target x86_64-unknown-linux-gnu \
-// RUN:   -emit-interface-stubs -emit-merged-ifs %s %S/object.c %S/weak.cpp
-// RUN: cat %t1.ifs | FileCheck %s
-
-// CHECK-DAG: data
-// CHECK-DAG: foo
-// CHECK-DAG: strongFunc
-// CHECK-DAG: weakFunc
-
-int foo(int bar) { return 42 + 1844; }
-int main() { return foo(23); }



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


[clang] 27b229d - Revert "[clang][IFS][test] Removing driver-test.c. Test is still too brittle."

2019-11-19 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-11-19T21:59:10-05:00
New Revision: 27b229dc17b2ea1d06fe566df8631bb2fff7b1c8

URL: 
https://github.com/llvm/llvm-project/commit/27b229dc17b2ea1d06fe566df8631bb2fff7b1c8
DIFF: 
https://github.com/llvm/llvm-project/commit/27b229dc17b2ea1d06fe566df8631bb2fff7b1c8.diff

LOG: Revert "[clang][IFS][test] Removing driver-test.c. Test is still too 
brittle."

This reverts commit f37356d6f60ae5db978611621d3a375ed87ec0f0.

Added: 
clang/test/InterfaceStubs/driver-test.c

Modified: 


Removed: 




diff  --git a/clang/test/InterfaceStubs/driver-test.c 
b/clang/test/InterfaceStubs/driver-test.c
new file mode 100644
index ..425d87271f33
--- /dev/null
+++ b/clang/test/InterfaceStubs/driver-test.c
@@ -0,0 +1,15 @@
+// REQUIRES: x86-registered-target
+// REQUIRES: !powerpc-registered-target
+// REQUIRES: !system-darwin && !system-windows
+
+// RUN: %clang -o %t1 -target x86_64-unknown-linux-gnu \
+// RUN:   -emit-interface-stubs -emit-merged-ifs %s %S/object.c %S/weak.cpp
+// RUN: cat %t1.ifs | FileCheck %s
+
+// CHECK-DAG: data
+// CHECK-DAG: foo
+// CHECK-DAG: strongFunc
+// CHECK-DAG: weakFunc
+
+int foo(int bar) { return 42 + 1844; }
+int main() { return foo(23); }



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


[clang] 6c6d348 - Revert "[clang][IFS] Fixing unsupported emulation mode on clang-ppc64be-linux bot."

2019-11-19 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-11-19T21:59:22-05:00
New Revision: 6c6d34883a3003693cbf0ab3edf19eb999c1a62d

URL: 
https://github.com/llvm/llvm-project/commit/6c6d34883a3003693cbf0ab3edf19eb999c1a62d
DIFF: 
https://github.com/llvm/llvm-project/commit/6c6d34883a3003693cbf0ab3edf19eb999c1a62d.diff

LOG: Revert "[clang][IFS] Fixing unsupported emulation mode on 
clang-ppc64be-linux bot."

This reverts commit 1b387484b9b38a4a1e98a9d22a9a26065b0d184e.

Added: 


Modified: 
clang/test/InterfaceStubs/driver-test.c

Removed: 




diff  --git a/clang/test/InterfaceStubs/driver-test.c 
b/clang/test/InterfaceStubs/driver-test.c
index 425d87271f33..62d522fb7b1f 100644
--- a/clang/test/InterfaceStubs/driver-test.c
+++ b/clang/test/InterfaceStubs/driver-test.c
@@ -1,5 +1,4 @@
 // REQUIRES: x86-registered-target
-// REQUIRES: !powerpc-registered-target
 // REQUIRES: !system-darwin && !system-windows
 
 // RUN: %clang -o %t1 -target x86_64-unknown-linux-gnu \



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


[clang] 7342912 - [clang][IFS] Driver Pipeline: generate stubs after standard pipeline (3)

2019-11-20 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-11-20T16:22:50-05:00
New Revision: 73429126c91c2065c6f6ef29b3eec1b7798502bb

URL: 
https://github.com/llvm/llvm-project/commit/73429126c91c2065c6f6ef29b3eec1b7798502bb
DIFF: 
https://github.com/llvm/llvm-project/commit/73429126c91c2065c6f6ef29b3eec1b7798502bb.diff

LOG: [clang][IFS] Driver Pipeline: generate stubs after standard pipeline (3)

Third Landing Attempt (dropping any linker invocation from clang driver):

Up until now, clang interface stubs has replaced the standard
PP -> C -> BE -> ASM -> LNK pipeline. With this change, it will happen in
conjunction with it. So what when you build your code you will get an
a.out or lib.so as well as an interface stub file.

Example:

clang -shared -o libfoo.so -emit-interface-stubs ...

will generate both a libfoo.so and a libfoo.ifso. The .so file will
contain the code from the standard compilation pipeline and the .ifso
file will contain the ELF stub library.

Note: For driver-test.c I've added -S in order to prevent any bot failures on
bots that don't have the proper linker for their native triple. You could always
specify a triple like x86_64-unknown-linux-gnu and on bots like x86_64-scei-ps4
the clang driver would invoke regular ld instead of getting the error
'Executable "orbis-ld" doesn't exist!' but on bots like ppc64be and s390x you'd
get an error "/usr/bin/ld: unrecognised emulation mode: elf_x86_64"

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

Added: 
clang/test/InterfaceStubs/driver-test2.c
clang/test/InterfaceStubs/ppc.cpp

Modified: 
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/InterfaceStubs.cpp
clang/lib/Driver/Types.cpp
clang/test/InterfaceStubs/driver-test.c
clang/test/InterfaceStubs/windows.cpp

Removed: 




diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index cdf4a579f431..83b5db3b2530 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -292,10 +292,6 @@ phases::ID Driver::getFinalPhase(const DerivedArgList &DAL,
  (PhaseArg = DAL.getLastArg(options::OPT_emit_ast))) {
 FinalPhase = phases::Compile;
 
-  // clang interface stubs
-  } else if ((PhaseArg = DAL.getLastArg(options::OPT_emit_interface_stubs))) {
-FinalPhase = phases::IfsMerge;
-
   // -S only runs up to the backend.
   } else if ((PhaseArg = DAL.getLastArg(options::OPT_S))) {
 FinalPhase = phases::Backend;
@@ -3502,6 +3498,68 @@ void Driver::BuildActions(Compilation &C, DerivedArgList 
&Args,
 Actions.push_back(
 C.MakeAction(MergerInputs, types::TY_Image));
 
+  if (Arg *A = Args.getLastArg(options::OPT_emit_interface_stubs)) {
+llvm::SmallVector PhaseList;
+if (Args.hasArg(options::OPT_c)) {
+  llvm::SmallVector 
CompilePhaseList;
+  types::getCompilationPhases(types::TY_IFS_CPP, CompilePhaseList);
+  llvm::copy_if(CompilePhaseList, std::back_inserter(PhaseList),
+[&](phases::ID Phase) { return Phase <= phases::Compile; 
});
+} else {
+  types::getCompilationPhases(types::TY_IFS_CPP, PhaseList);
+}
+
+ActionList MergerInputs;
+
+for (auto &I : Inputs) {
+  types::ID InputType = I.first;
+  const Arg *InputArg = I.second;
+
+  // Currently clang and the llvm assembler do not support generating 
symbol
+  // stubs from assembly, so we skip the input on asm files. For ifs files
+  // we rely on the normal pipeline setup in the pipeline setup code above.
+  if (InputType == types::TY_IFS || InputType == types::TY_PP_Asm ||
+  InputType == types::TY_Asm)
+continue;
+
+  Action *Current = C.MakeAction(*InputArg, InputType);
+
+  for (auto Phase : PhaseList) {
+switch (Phase) {
+default:
+  llvm_unreachable(
+  "IFS Pipeline can only consist of Compile followed by 
IfsMerge.");
+case phases::Compile: {
+  // Only IfsMerge (llvm-ifs) can handle .o files by looking for ifs
+  // files where the .o file is located. The compile action can not
+  // handle this.
+  if (InputType == types::TY_Object)
+break;
+
+  Current = C.MakeAction(Current, types::TY_IFS_CPP);
+  break;
+}
+case phases::IfsMerge: {
+  assert(Phase == PhaseList.back() &&
+ "merging must be final compilation step.");
+  MergerInputs.push_back(Current);
+  Current = nullptr;
+  break;
+}
+}
+  }
+
+  // If we ended with something, add to the output list.
+  if (Current)
+Actions.push_back(Current);
+}
+
+// Add an interface stubs merge action if necessary.
+if (!MergerInputs.empty())
+  Actions.push_back(
+  C.MakeAction(MergerInputs, types::TY_Image));
+  }
+
   // If --print-supported-cpus, -mcpu=? or -mtune=? is specified, build a 
custom
  

Re: [clang] 7342912 - [clang][IFS] Driver Pipeline: generate stubs after standard pipeline (3)

2019-11-20 Thread Puyan Lotfi via cfe-commits
Looking into this. Thanks for the heads up. 

PL

Sent with ProtonMail Secure Email.

‐‐‐ Original Message ‐‐‐
On Wednesday, November 20, 2019 4:12 PM, Alex L  wrote:

> Hi Puyan,
> 

> This commit caused two Clang failures on Darwin:
> 

>     Clang :: InterfaceStubs/merge-conflict-test.c
>     Clang :: InterfaceStubs/object-float.c
> 

> Here's the build log from out bot:
> http://lab.llvm.org:8080/green/job/clang-stage1-RA/3929/console
> 

> Can you please resolve the issue with the tests?
> Thanks,
> Alex
> 

> On Wed, 20 Nov 2019 at 14:16, Puyan Lotfi via cfe-commits 
>  wrote:
> 

> > Author: Puyan Lotfi
> > Date: 2019-11-20T16:22:50-05:00
> > New Revision: 73429126c91c2065c6f6ef29b3eec1b7798502bb
> > 

> > URL: 
> > https://github.com/llvm/llvm-project/commit/73429126c91c2065c6f6ef29b3eec1b7798502bb
> > DIFF: 
> > https://github.com/llvm/llvm-project/commit/73429126c91c2065c6f6ef29b3eec1b7798502bb.diff
> > 

> > LOG: [clang][IFS] Driver Pipeline: generate stubs after standard pipeline 
> > (3)
> > 

> > Third Landing Attempt (dropping any linker invocation from clang driver):
> > 

> > Up until now, clang interface stubs has replaced the standard
> > PP -> C -> BE -> ASM -> LNK pipeline. With this change, it will happen in
> > conjunction with it. So what when you build your code you will get an
> > a.out or lib.so as well as an interface stub file.
> > 

> > Example:
> > 

> > clang -shared -o libfoo.so -emit-interface-stubs ...
> > 

> > will generate both a libfoo.so and a libfoo.ifso. The .so file will
> > contain the code from the standard compilation pipeline and the .ifso
> > file will contain the ELF stub library.
> > 

> > Note: For driver-test.c I've added -S in order to prevent any bot failures 
> > on
> > bots that don't have the proper linker for their native triple. You could 
> > always
> > specify a triple like x86_64-unknown-linux-gnu and on bots like 
> > x86_64-scei-ps4
> > the clang driver would invoke regular ld instead of getting the error
> > 'Executable "orbis-ld" doesn't exist!' but on bots like ppc64be and s390x 
> > you'd
> > get an error "/usr/bin/ld: unrecognised emulation mode: elf_x86_64"
> > 

> > Differential Revision: https://reviews.llvm.org/D70274
> > 

> > Added:
> >     clang/test/InterfaceStubs/driver-test2.c
> >     clang/test/InterfaceStubs/ppc.cpp
> > 

> > Modified:
> >     clang/lib/Driver/Driver.cpp
> >     clang/lib/Driver/ToolChains/InterfaceStubs.cpp
> >     clang/lib/Driver/Types.cpp
> >     clang/test/InterfaceStubs/driver-test.c
> >     clang/test/InterfaceStubs/windows.cpp
> > 

> > Removed:
> > 

> > 
> > diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
> > index cdf4a579f431..83b5db3b2530 100644
> > --- a/clang/lib/Driver/Driver.cpp
> > +++ b/clang/lib/Driver/Driver.cpp
> > @@ -292,10 +292,6 @@ phases::ID Driver::getFinalPhase(const DerivedArgList 
> > &DAL,
> >               (PhaseArg = DAL.getLastArg(options::OPT_emit_ast))) {
> >      FinalPhase = phases::Compile;
> > 

> > -  // clang interface stubs
> > -  } else if ((PhaseArg = 
> > DAL.getLastArg(options::OPT_emit_interface_stubs))) {
> > -    FinalPhase = phases::IfsMerge;
> > -
> >    // -S only runs up to the backend.
> >    } else if ((PhaseArg = DAL.getLastArg(options::OPT_S))) {
> >      FinalPhase = phases::Backend;
> > @@ -3502,6 +3498,68 @@ void Driver::BuildActions(Compilation &C, 
> > DerivedArgList &Args,
> >      Actions.push_back(
> >          C.MakeAction(MergerInputs, types::TY_Image));
> > 

> > +  if (Arg *A = Args.getLastArg(options::OPT_emit_interface_stubs)) {
> > +    llvm::SmallVector PhaseList;
> > +    if (Args.hasArg(options::OPT_c)) {
> > +      llvm::SmallVector 
> > CompilePhaseList;
> > +      types::getCompilationPhases(types::TY_IFS_CPP, CompilePhaseList);
> > +      llvm::copy_if(CompilePhaseList, std::back_inserter(PhaseList),
> > +                    [&](phases::ID Phase) { return Phase <= 
> > phases::Compile; });
> > +    } else {
> > +      types::getCompilationPhases(types::TY_IFS_CPP, PhaseList);
> > +    }
> > +
> > +    ActionList MergerInputs;
> > +
> > +    for (auto &I : Inputs) {
> > +      types::ID InputType = I.first;
> > +      const Arg *

Re: [clang] 7342912 - [clang][IFS] Driver Pipeline: generate stubs after standard pipeline (3)

2019-11-20 Thread Puyan Lotfi via cfe-commits
I have a solution, stay tuned.

So it turns out since the clang driver has special behavior on Darwin for 
handling Universal apps, there is a different code path that happens during 
BuildActions. clang::driver::Driver::BuildUniversalActions is called instead of 
BuildActions on Darwin, and what BuildUniversalActions ends up doing is it 
calls BuildActions and takes the driver actions returned and wraps them all 
into a BindArchAction each. So when I check for a IfsMergeAction in the driver 
instead I am getting a BindArchAction that has an IfsMergeAction inside of it.

I will post a fix to get Green Dragon and the Fuchsia Darwin bots green again, 
and also post a post-commit review on Phab for good measure. 

Thanks Again for the heads up Alex.

Puyan

Sent with ProtonMail Secure Email.

‐‐‐ Original Message ‐‐‐
On Wednesday, November 20, 2019 4:52 PM, Puyan Lotfi  wrote:

> Looking into this. Thanks for the heads up. 
> 

> PL
> 

> Sent with ProtonMail Secure Email.
> 

> ‐‐‐ Original Message ‐‐‐
> On Wednesday, November 20, 2019 4:12 PM, Alex L  wrote:
> 

> > Hi Puyan,
> > 

> > This commit caused two Clang failures on Darwin:
> > 

> >     Clang :: InterfaceStubs/merge-conflict-test.c
> >     Clang :: InterfaceStubs/object-float.c
> > 

> > Here's the build log from out bot:
> > http://lab.llvm.org:8080/green/job/clang-stage1-RA/3929/console
> > 

> > Can you please resolve the issue with the tests?
> > Thanks,
> > Alex
> > 

> > On Wed, 20 Nov 2019 at 14:16, Puyan Lotfi via cfe-commits 
> >  wrote:
> > 

> > > Author: Puyan Lotfi
> > > Date: 2019-11-20T16:22:50-05:00
> > > New Revision: 73429126c91c2065c6f6ef29b3eec1b7798502bb
> > > 

> > > URL: 
> > > https://github.com/llvm/llvm-project/commit/73429126c91c2065c6f6ef29b3eec1b7798502bb
> > > DIFF: 
> > > https://github.com/llvm/llvm-project/commit/73429126c91c2065c6f6ef29b3eec1b7798502bb.diff
> > > 

> > > LOG: [clang][IFS] Driver Pipeline: generate stubs after standard pipeline 
> > > (3)
> > > 

> > > Third Landing Attempt (dropping any linker invocation from clang driver):
> > > 

> > > Up until now, clang interface stubs has replaced the standard
> > > PP -> C -> BE -> ASM -> LNK pipeline. With this change, it will happen in
> > > conjunction with it. So what when you build your code you will get an
> > > a.out or lib.so as well as an interface stub file.
> > > 

> > > Example:
> > > 

> > > clang -shared -o libfoo.so -emit-interface-stubs ...
> > > 

> > > will generate both a libfoo.so and a libfoo.ifso. The .so file will
> > > contain the code from the standard compilation pipeline and the .ifso
> > > file will contain the ELF stub library.
> > > 

> > > Note: For driver-test.c I've added -S in order to prevent any bot 
> > > failures on
> > > bots that don't have the proper linker for their native triple. You could 
> > > always
> > > specify a triple like x86_64-unknown-linux-gnu and on bots like 
> > > x86_64-scei-ps4
> > > the clang driver would invoke regular ld instead of getting the error
> > > 'Executable "orbis-ld" doesn't exist!' but on bots like ppc64be and s390x 
> > > you'd
> > > get an error "/usr/bin/ld: unrecognised emulation mode: elf_x86_64"
> > > 

> > > Differential Revision: https://reviews.llvm.org/D70274
> > > 

> > > Added:
> > >     clang/test/InterfaceStubs/driver-test2.c
> > >     clang/test/InterfaceStubs/ppc.cpp
> > > 

> > > Modified:
> > >     clang/lib/Driver/Driver.cpp
> > >     clang/lib/Driver/ToolChains/InterfaceStubs.cpp
> > >     clang/lib/Driver/Types.cpp
> > >     clang/test/InterfaceStubs/driver-test.c
> > >     clang/test/InterfaceStubs/windows.cpp
> > > 

> > > Removed:
> > > 

> > > 
> > > diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
> > > index cdf4a579f431..83b5db3b2530 100644
> > > --- a/clang/lib/Driver/Driver.cpp
> > > +++ b/clang/lib/Driver/Driver.cpp
> > > @@ -292,10 +292,6 @@ phases::ID Driver::getFinalPhase(const 
> > > DerivedArgList &DAL,
> > >               (PhaseArg = DAL.getLastArg(options::OPT_emit_ast))) {
> > >      FinalPhase = phases::Compile;
> > > 

> > > -  // clang interface stubs
> > &g

[clang] fec3ca7 - [clang][IFS][test] GreenDragon and Fuchsia Darwin bot fix: BindArchClass Nest.

2019-11-20 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-11-20T22:12:28-05:00
New Revision: fec3ca77bbce6917c103963b7b85b60dfb865c7b

URL: 
https://github.com/llvm/llvm-project/commit/fec3ca77bbce6917c103963b7b85b60dfb865c7b
DIFF: 
https://github.com/llvm/llvm-project/commit/fec3ca77bbce6917c103963b7b85b60dfb865c7b.diff

LOG: [clang][IFS][test] GreenDragon and Fuchsia Darwin bot fix: BindArchClass 
Nest.

On Darwin the clang driver does not invoke Driver::BuildActions directly
due to the need to handle Universal apps. Because of this there is a
difference in code path where Driver::BuildUniversalActions is called
instead of Driver::BuildActions. BuildUniversalActions ends up calling
Driver::BuildAction but what it does differently is it takes the driver
actions returned and wraps them each into a BindArchAction.

In Driver::BuildJobs there is a check for '-o' to determine that
multiple files are not specified when passing -o, except for Clang
Interface Stub this need to be an exception as we actually want to write
out multiple files: for every libfoo.so we have a libfoo.ifso sidecar
ifso file, etc. To allow this to happen there is a check for
IfsMergeAction, which is permitted to write out a secondary file. Except
on Darwin, the IfsMergeAction gets wrapped in the BindArchAction by
Driver::BuildUniversalActions so the check fails.

This patch is to look inside a BindArchAction in Driver::BuildJobs to
determine if there is in fact an IfsMergeAction, and if-so (pun intended)
allow the secondary sidecard ifs/ifso file to be written out.

Added: 


Modified: 
clang/lib/Driver/Driver.cpp

Removed: 




diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 83b5db3b2530..90f3cea5b2af 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -3698,7 +3698,9 @@ void Driver::BuildJobs(Compilation &C) const {
 unsigned NumOutputs = 0;
 for (const Action *A : C.getActions())
   if (A->getType() != types::TY_Nothing &&
-  A->getKind() != Action::IfsMergeJobClass)
+  !(A->getKind() == Action::IfsMergeJobClass ||
+(A->getKind() == Action::BindArchClass && A->getInputs().size() &&
+ A->getInputs().front()->getKind() == Action::IfsMergeJobClass)))
 ++NumOutputs;
 
 if (NumOutputs > 1) {



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


[clang] 07e4451 - [clang][IFS] Adding support for new clang interface stubs decl types.

2019-12-04 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-12-04T19:10:47-05:00
New Revision: 07e445103e363c85ce7313c542dee20b2294fe72

URL: 
https://github.com/llvm/llvm-project/commit/07e445103e363c85ce7313c542dee20b2294fe72
DIFF: 
https://github.com/llvm/llvm-project/commit/07e445103e363c85ce7313c542dee20b2294fe72.diff

LOG: [clang][IFS] Adding support for new clang interface stubs decl types.

NamespaceAliasDecl UnresolvedUsingTypenameDecl CXXDeductionGuideDecl
ConstructorUsingShadowDecl

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

Added: 
clang/test/InterfaceStubs/constructor-using-shadow.cpp
clang/test/InterfaceStubs/cxxdeduction-guide.cpp
clang/test/InterfaceStubs/namespace-alias.cpp
clang/test/InterfaceStubs/unresolved-using-typename.cpp

Modified: 
clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp

Removed: 




diff  --git a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp 
b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
index 025e6eb1508f..3b0a5668af94 100644
--- a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
+++ b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
@@ -195,6 +195,10 @@ class InterfaceStubFunctionsConsumer : public ASTConsumer {
 case Decl::Kind::TemplateTemplateParm:
 case Decl::Kind::ClassTemplatePartialSpecialization:
 case Decl::Kind::IndirectField:
+case Decl::Kind::ConstructorUsingShadow:
+case Decl::Kind::CXXDeductionGuide:
+case Decl::Kind::NamespaceAlias:
+case Decl::Kind::UnresolvedUsingTypename:
   return true;
 case Decl::Kind::Var: {
   // Bail on any VarDecl that either has no named symbol.

diff  --git a/clang/test/InterfaceStubs/constructor-using-shadow.cpp 
b/clang/test/InterfaceStubs/constructor-using-shadow.cpp
new file mode 100644
index ..d4b85ac73e56
--- /dev/null
+++ b/clang/test/InterfaceStubs/constructor-using-shadow.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s
+
+// CHECK:  --- !experimental-ifs-v1
+// CHECK-NEXT: IfsVersion: 1.0
+// CHECK-NEXT: Triple:
+// CHECK-NEXT: ObjectFileFormat: ELF
+// CHECK-NEXT: Symbols:
+// CHECK-NEXT: ...
+
+ // ConstructorUsingShadowDecl
+struct Base { Base(int); };
+struct Derived : public Base { using Base::Base; };

diff  --git a/clang/test/InterfaceStubs/cxxdeduction-guide.cpp 
b/clang/test/InterfaceStubs/cxxdeduction-guide.cpp
new file mode 100644
index ..f09b9d929ca3
--- /dev/null
+++ b/clang/test/InterfaceStubs/cxxdeduction-guide.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -o - -emit-interface-stubs -std=c++17 %s | FileCheck %s
+
+// CHECK:  --- !experimental-ifs-v1
+// CHECK-NEXT: IfsVersion: 1.0
+// CHECK-NEXT: Triple:
+// CHECK-NEXT: ObjectFileFormat: ELF
+// CHECK-NEXT: Symbols:
+// CHECK-NEXT: ...
+
+// CXXDeductionGuideDecl
+template struct A { A(); A(T); };
+A() -> A;

diff  --git a/clang/test/InterfaceStubs/namespace-alias.cpp 
b/clang/test/InterfaceStubs/namespace-alias.cpp
new file mode 100644
index ..6a7f27c9b7b0
--- /dev/null
+++ b/clang/test/InterfaceStubs/namespace-alias.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s
+
+// CHECK:  --- !experimental-ifs-v1
+// CHECK-NEXT: IfsVersion: 1.0
+// CHECK-NEXT: Triple:
+// CHECK-NEXT: ObjectFileFormat: ELF
+// CHECK-NEXT: Symbols:
+// CHECK-NEXT: ...
+
+// NamespaceAliasDecl
+namespace NS { }
+namespace B = NS;

diff  --git a/clang/test/InterfaceStubs/unresolved-using-typename.cpp 
b/clang/test/InterfaceStubs/unresolved-using-typename.cpp
new file mode 100644
index ..e6afc781412a
--- /dev/null
+++ b/clang/test/InterfaceStubs/unresolved-using-typename.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s
+
+// CHECK:  --- !experimental-ifs-v1
+// CHECK-NEXT: IfsVersion: 1.0
+// CHECK-NEXT: Triple:
+// CHECK-NEXT: ObjectFileFormat: ELF
+// CHECK-NEXT: Symbols:
+// CHECK-NEXT: ...
+
+// UnresolvedUsingTypenameDecl
+template class C1 { using ReprType = unsigned; };
+template class C2 : public C1 { using typename C1::Repr; };



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


[clang] 4ef9110 - [clang][IFS] Ignoring -Xlinker/-Xclang arguments in InterfaceStubs pass for now.

2019-12-04 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-12-04T20:03:57-05:00
New Revision: 4ef9110b8d1004840d70477382c6bd10fb487fb6

URL: 
https://github.com/llvm/llvm-project/commit/4ef9110b8d1004840d70477382c6bd10fb487fb6
DIFF: 
https://github.com/llvm/llvm-project/commit/4ef9110b8d1004840d70477382c6bd10fb487fb6.diff

LOG: [clang][IFS] Ignoring -Xlinker/-Xclang arguments in InterfaceStubs pass 
for now.

Many of the inputs to clang driver toolchain tools can be things other
than files such as -Xclang and -Xlinker arguments. For now we don't take
such tool pass-through type arguments (although having an -Xifs would be nice to
have to replace things like -emit-merged-ifs). So because for the moment
we are not doing any sort of argument pass-through, I am going to have
InterfaceStubs Merger ignore any non-file type input arguments.

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

Added: 
clang/test/InterfaceStubs/XlinkerInputArgs.cpp

Modified: 
clang/lib/Driver/ToolChains/InterfaceStubs.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/InterfaceStubs.cpp 
b/clang/lib/Driver/ToolChains/InterfaceStubs.cpp
index f441f4787097..8f947e79bd1f 100644
--- a/clang/lib/Driver/ToolChains/InterfaceStubs.cpp
+++ b/clang/lib/Driver/ToolChains/InterfaceStubs.cpp
@@ -46,6 +46,8 @@ void Merger::ConstructJob(Compilation &C, const JobAction &JA,
   // Here we append the input files. If the input files are object files, then
   // we look for .ifs files present in the same location as the object files.
   for (const auto &Input : Inputs) {
+if (!Input.isFilename())
+  continue;
 SmallString<128> InputFilename(Input.getFilename());
 if (Input.getType() == types::TY_Object)
   llvm::sys::path::replace_extension(InputFilename, ".ifs");

diff  --git a/clang/test/InterfaceStubs/XlinkerInputArgs.cpp 
b/clang/test/InterfaceStubs/XlinkerInputArgs.cpp
new file mode 100644
index ..cb4ef8aca952
--- /dev/null
+++ b/clang/test/InterfaceStubs/XlinkerInputArgs.cpp
@@ -0,0 +1,3 @@
+// RUN: %clang -### -Xlinker -Bsymbolic -emit-interface-stubs 2>&1 | FileCheck 
%s
+// CHECK: Bsymbolic
+// CHECK-NOT: Bsymbolic



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


[clang] d694594 - [clang][IFS] Allow 2 output files when using -o and -c with clang IFS stubs.

2019-12-09 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2019-12-09T14:47:17-05:00
New Revision: d694594d7650571dec40cc0ef9db6087963d62a0

URL: 
https://github.com/llvm/llvm-project/commit/d694594d7650571dec40cc0ef9db6087963d62a0
DIFF: 
https://github.com/llvm/llvm-project/commit/d694594d7650571dec40cc0ef9db6087963d62a0.diff

LOG: [clang][IFS] Allow 2 output files when using -o and -c with clang IFS 
stubs.

This patch allows for -o to be used with -c when compiling with clang
interface stubs enabled. This is because the second file will be an
intermediate ifs stubs file that is the text stub analog of the .o file.
Both get produces in this case, so two files.

Why are we doing this? Because we want to support the case where
interface stubs are used bu first invoking clang like so:

clang -c  -emit-interface-stubs foo.c -o foo.o
...
clang -emit-interface-stubs <.o files> -o libfoo.so

This should generate N .ifs files, and one .ifso file. Prior to this
patch, using -o with the -c invocation was not possible. Currently the
clang driver supports generating a a.out/.so file at the same time as a
merged ifs file / ifso file, but this is done by checking that the final
job is the IfsMerge job. When -c is used, the final job is a Compile job
so what this patch does is check to figure out of the job type is
TY_IFS_CPP.

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

Added: 
clang/test/InterfaceStubs/driver-test3.c

Modified: 
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/Clang.cpp

Removed: 




diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index c1173e3ddbf0..9139915761d1 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -3689,16 +3689,27 @@ void Driver::BuildJobs(Compilation &C) const {
   Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o);
 
   // It is an error to provide a -o option if we are making multiple output
-  // files. There is one exception, IfsMergeJob: when generating interface 
stubs
-  // enabled we want to be able to generate the stub file at the same time that
-  // we generate the real library/a.out. So when a .o, .so, etc are the output,
-  // with clang interface stubs there will also be a .ifs and .ifso at the same
-  // location.
+  // files. There are exceptions:
+  //
+  // IfsMergeJob: when generating interface stubs enabled we want to be able to
+  // generate the stub file at the same time that we generate the real
+  // library/a.out. So when a .o, .so, etc are the output, with clang interface
+  // stubs there will also be a .ifs and .ifso at the same location.
+  //
+  // CompileJob of type TY_IFS_CPP: when generating interface stubs is enabled
+  // and -c is passed, we still want to be able to generate a .ifs file while
+  // we are also generating .o files. So we allow more than one output file in
+  // this case as well.
+  //
   if (FinalOutput) {
 unsigned NumOutputs = 0;
+unsigned NumIfsOutputs = 0;
 for (const Action *A : C.getActions())
   if (A->getType() != types::TY_Nothing &&
   !(A->getKind() == Action::IfsMergeJobClass ||
+(A->getType() == clang::driver::types::TY_IFS_CPP &&
+ A->getKind() == clang::driver::Action::CompileJobClass &&
+ 0 == NumIfsOutputs++) ||
 (A->getKind() == Action::BindArchClass && A->getInputs().size() &&
  A->getInputs().front()->getKind() == Action::IfsMergeJobClass)))
 ++NumOutputs;

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 02a365fa4969..7fb1c846e0b2 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5828,8 +5828,16 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
   if (Output.getType() == types::TY_Dependencies) {
 // Handled with other dependency code.
   } else if (Output.isFilename()) {
-CmdArgs.push_back("-o");
-CmdArgs.push_back(Output.getFilename());
+if (Output.getType() == clang::driver::types::TY_IFS_CPP ||
+Output.getType() == clang::driver::types::TY_IFS) {
+  SmallString<128> OutputFilename(Output.getFilename());
+  llvm::sys::path::replace_extension(OutputFilename, "ifs");
+  CmdArgs.push_back("-o");
+  CmdArgs.push_back(Args.MakeArgString(OutputFilename));
+} else {
+  CmdArgs.push_back("-o");
+  CmdArgs.push_back(Output.getFilename());
+}
   } else {
 assert(Output.isNothing() && "Invalid output.");
   }

diff  --git a/clang/test/InterfaceStubs/driver-test3.c 
b/clang/test/InterfaceStubs/driver-test3.c
new file mode 100644
index ..bccd1c9bccd4
--- /dev/null
+++ b/clang/test/InterfaceStubs/driver-test3.c
@@ -0,0 +1,19 @@
+// REQUIRES: x86-registered-target
+// REQUIRES: shell
+
+// RUN: mkdir -p %t; cd %t
+// RUN: %clang -target x86_64-unknown-linux-gnu -c -emit-interface-stubs %s -o 
%t/driver-test3

[clang] c38e425 - [clang][IFS][test] Temporary work around for in-process cc1 ASAN issues.

2020-01-21 Thread Puyan Lotfi via cfe-commits

Author: Puyan Lotfi
Date: 2020-01-21T22:56:20-05:00
New Revision: c38e42527b21acee8d01a016d5bfa2fb83202e29

URL: 
https://github.com/llvm/llvm-project/commit/c38e42527b21acee8d01a016d5bfa2fb83202e29
DIFF: 
https://github.com/llvm/llvm-project/commit/c38e42527b21acee8d01a016d5bfa2fb83202e29.diff

LOG: [clang][IFS][test] Temporary work around for in-process cc1 ASAN issues.

When using in-process cc1, the Clang Interface Stubs pipeline setup
exposes an ASAN bug. I am still investigating this issue but want to
green the bots for now. I don't think this is a huge issue since the
Clang Interface Stubs Driver setup code is the only code path that sets
up such a pipeline (ie N cc1's for N c files followed by another N cc1's
for to generate stub files for the same N c files).

This issue is being discussed in https://reviews.llvm.org/D69825.
If a resolution is not found soon, a bugzilla filling will be in order.

Added: 


Modified: 
clang/test/InterfaceStubs/driver-test.c
clang/test/InterfaceStubs/driver-test2.c

Removed: 




diff  --git a/clang/test/InterfaceStubs/driver-test.c 
b/clang/test/InterfaceStubs/driver-test.c
index 9ca5577a5c20..894d896bb219 100644
--- a/clang/test/InterfaceStubs/driver-test.c
+++ b/clang/test/InterfaceStubs/driver-test.c
@@ -1,8 +1,17 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: shell
 
+// NOTE: -fno-integrated-cc1 has been added to work around an ASAN failure
+//   caused by in-process cc1 invocation. Clang InterfaceStubs is not the
+//   culprit, but Clang Interface Stubs' Driver pipeline setup uncovers an
+//   existing ASAN issue when invoking multiple normal cc1 jobs along with
+//   multiple Clang Interface Stubs cc1 jobs together.
+//   There is currently a discussion of this going on at:
+// https://reviews.llvm.org/D69825
 // RUN: mkdir -p %t; cd %t
-// RUN: %clang -target x86_64-unknown-linux-gnu -x c -S -emit-interface-stubs 
%s %S/object.c %S/weak.cpp && \
+// RUN: %clang -target x86_64-unknown-linux-gnu -x c -S \
+// RUN:   -fno-integrated-cc1 \
+// RUN: -emit-interface-stubs %s %S/object.c %S/weak.cpp && \
 // RUN: llvm-nm %t/a.out.ifso 2>&1 | FileCheck --check-prefix=CHECK-IFS %s
 
 // CHECK-IFS-DAG: data

diff  --git a/clang/test/InterfaceStubs/driver-test2.c 
b/clang/test/InterfaceStubs/driver-test2.c
index c3a3b31b212d..905b27922264 100644
--- a/clang/test/InterfaceStubs/driver-test2.c
+++ b/clang/test/InterfaceStubs/driver-test2.c
@@ -1,10 +1,19 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: shell
 
+// NOTE: -fno-integrated-cc1 has been added to work around an ASAN failure
+//   caused by in-process cc1 invocation. Clang InterfaceStubs is not the
+//   culprit, but Clang Interface Stubs' Driver pipeline setup uncovers an
+//   existing ASAN issue when invoking multiple normal cc1 jobs along with
+//   multiple Clang Interface Stubs cc1 jobs together.
+//   There is currently a discussion of this going on at:
+// https://reviews.llvm.org/D69825
 // RUN: mkdir -p %t; cd %t
 // RUN: %clang -target x86_64-unknown-linux-gnu -c -emit-interface-stubs \
+// RUN:   -fno-integrated-cc1 \
 // RUN:   %s %S/object.c %S/weak.cpp
 // RUN: %clang -emit-interface-stubs -emit-merged-ifs \
+// RUN:   -fno-integrated-cc1 \
 // RUN:   %t/driver-test2.o %t/object.o %t/weak.o -S -o - 2>&1 | FileCheck %s
 
 // CHECK-DAG: data



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


[clang] [llvm] [LLVM] Add IRNormalizer Pass (PR #68176)

2024-08-30 Thread Puyan Lotfi via cfe-commits

plotfi wrote:

@justinfargnoli Is there anything I can do to help with moving this forward, 
what seems to be the blocker on this at this point (asking to re-attain 
context)? 

https://github.com/llvm/llvm-project/pull/68176
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [LLVM] Add IRNormalizer Pass (PR #68176)

2024-10-17 Thread Puyan Lotfi via cfe-commits

plotfi wrote:

LGTM, I would prefer if we landed this and added improvements as needed

https://github.com/llvm/llvm-project/pull/68176
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits