[PATCH] D79293: [clang-format] [PR45218] Fix an issue where < and > and >> in a for loop gets incorrectly interpreted at a TemplateOpener/Closer

2020-05-02 Thread Ryan Mansfield via Phabricator via cfe-commits
rmansfield added a comment.

Couple examples:

void foo(int x) { 
 for (unsigned int i = 0; i < x >> 1; i++) { }
}

and

int i = 0;

if (i < x >> 1) {}

}


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79293/new/

https://reviews.llvm.org/D79293



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


[PATCH] D79293: [clang-format] [PR45218] Fix an issue where < and > and >> in a for loop gets incorrectly interpreted at a TemplateOpener/Closer

2020-05-02 Thread Ryan Mansfield via Phabricator via cfe-commits
rmansfield added a comment.

They're overly reduced examples ;) but embedded programmers tend to make heavy 
use of shift operators, including within for loops and if stmts


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79293/new/

https://reviews.llvm.org/D79293



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


[PATCH] D106889: [examples] Fix the clang-interpreter example for changes in 2487db1f2862

2021-07-27 Thread Ryan Mansfield via Phabricator via cfe-commits
rmansfield created this revision.
rmansfield added a reviewer: lhames.
rmansfield requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106889

Files:
  clang/examples/clang-interpreter/main.cpp

Index: clang/examples/clang-interpreter/main.cpp
===
--- clang/examples/clang-interpreter/main.cpp
+++ clang/examples/clang-interpreter/main.cpp
@@ -50,31 +50,37 @@
 
 class SimpleJIT {
 private:
-  ExecutionSession ES;
+  std::unique_ptr ES;
   std::unique_ptr TM;
   const DataLayout DL;
-  MangleAndInterner Mangle{ES, DL};
-  JITDylib &MainJD{ES.createBareJITDylib("")};
-  RTDyldObjectLinkingLayer ObjectLayer{ES, createMemMgr};
-  IRCompileLayer CompileLayer{ES, ObjectLayer,
-  std::make_unique(*TM)};
+  MangleAndInterner Mangle;
+  JITDylib &MainJD;
+  RTDyldObjectLinkingLayer ObjectLayer;
+  IRCompileLayer CompileLayer;
 
   static std::unique_ptr createMemMgr() {
 return std::make_unique();
   }
 
   SimpleJIT(
-  std::unique_ptr TM, DataLayout DL,
+  std::unique_ptr ES, std::unique_ptr TM,
+  DataLayout DL,
   std::unique_ptr ProcessSymbolsGenerator)
-  : TM(std::move(TM)), DL(std::move(DL)) {
+  : ES(std::move(ES)), TM(std::move(TM)), DL(std::move(DL)),
+Mangle(*this->ES, this->DL),
+MainJD(this->ES->createBareJITDylib("")),
+ObjectLayer(*this->ES, createMemMgr),
+CompileLayer(*this->ES, ObjectLayer,
+ std::make_unique(*this->TM)) {
+
 llvm::sys::DynamicLibrary::LoadLibraryPermanently(nullptr);
 MainJD.addGenerator(std::move(ProcessSymbolsGenerator));
   }
 
 public:
   ~SimpleJIT() {
-if (auto Err = ES.endSession())
-  ES.reportError(std::move(Err));
+if (auto Err = ES->endSession())
+  ES->reportError(std::move(Err));
   }
 
   static Expected> Create() {
@@ -86,6 +92,12 @@
 if (!TM)
   return TM.takeError();
 
+auto EPC = SelfExecutorProcessControl::Create();
+if (!EPC)
+  return EPC.takeError();
+
+auto ES = std::make_unique(std::move(*EPC));
+
 auto DL = (*TM)->createDataLayout();
 
 auto ProcessSymbolsGenerator =
@@ -95,8 +107,9 @@
 if (!ProcessSymbolsGenerator)
   return ProcessSymbolsGenerator.takeError();
 
-return std::unique_ptr(new SimpleJIT(
-std::move(*TM), std::move(DL), std::move(*ProcessSymbolsGenerator)));
+return std::unique_ptr(
+new SimpleJIT(std::move(ES), std::move(*TM), std::move(DL),
+  std::move(*ProcessSymbolsGenerator)));
   }
 
   const TargetMachine &getTargetMachine() const { return *TM; }
@@ -106,7 +119,7 @@
   }
 
   Expected findSymbol(const StringRef &Name) {
-return ES.lookup({&MainJD}, Mangle(Name));
+return ES->lookup({&MainJD}, Mangle(Name));
   }
 
   Expected getSymbolAddress(const StringRef &Name) {
@@ -125,11 +138,11 @@
 int main(int argc, const char **argv) {
   // This just needs to be some symbol in the binary; C++ doesn't
   // allow taking the address of ::main however.
-  void *MainAddr = (void*) (intptr_t) GetExecutablePath;
+  void *MainAddr = (void *)(intptr_t)GetExecutablePath;
   std::string Path = GetExecutablePath(argv[0], MainAddr);
   IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions();
   TextDiagnosticPrinter *DiagClient =
-new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts);
+  new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts);
 
   IntrusiveRefCntPtr DiagID(new DiagnosticIDs());
   DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagClient);
@@ -204,7 +217,7 @@
   if (Clang.getHeaderSearchOpts().UseBuiltinIncludes &&
   Clang.getHeaderSearchOpts().ResourceDir.empty())
 Clang.getHeaderSearchOpts().ResourceDir =
-  CompilerInvocation::GetResourcesPath(argv[0], MainAddr);
+CompilerInvocation::GetResourcesPath(argv[0], MainAddr);
 
   // Create and execute the frontend to generate an LLVM bitcode module.
   std::unique_ptr Act(new EmitLLVMOnlyAction());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106889: [examples] Fix the clang-interpreter example for changes in 2487db1f2862

2021-08-13 Thread Ryan Mansfield via Phabricator via cfe-commits
rmansfield abandoned this revision.
rmansfield added a comment.

This got fixed by b4c0307d598004cfd96c770d2a4a84a37c838ba9 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106889/new/

https://reviews.llvm.org/D106889

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