From 6c2ab5c9d296c80baf89facefbcc68a03cabddfc Mon Sep 17 00:00:00 2001 From: Roman Zulak Date: Thu, 15 Sep 2016 14:55:14 -0400 Subject: [PATCH] Reformat includes and remove Windows.h dependency. Signed-off-by: Vassil Vassilev --- lib/Interpreter/IncrementalParser.cpp | 42 +++++++-------------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/lib/Interpreter/IncrementalParser.cpp b/lib/Interpreter/IncrementalParser.cpp index 0d5b4a45..4c9c7981 100644 --- a/lib/Interpreter/IncrementalParser.cpp +++ b/lib/Interpreter/IncrementalParser.cpp @@ -9,6 +9,7 @@ #include "IncrementalParser.h" +#include "ASTTransformer.h" #include "AutoSynthesizer.h" #include "BackendPasses.h" #include "CheckEmptyTransactionTransformer.h" @@ -18,25 +19,25 @@ #include "DynamicLookup.h" #include "IncrementalExecutor.h" #include "NullDerefProtectionTransformer.h" -#include "ValueExtractionSynthesizer.h" #include "TransactionPool.h" -#include "ASTTransformer.h" +#include "ValueExtractionSynthesizer.h" #include "ValuePrinterSynthesizer.h" #include "cling/Interpreter/CIFactory.h" #include "cling/Interpreter/Interpreter.h" #include "cling/Interpreter/InterpreterCallbacks.h" #include "cling/Interpreter/Transaction.h" +#include "cling/Utils/Platform.h" -#include "clang/AST/Attr.h" #include "clang/AST/ASTContext.h" +#include "clang/AST/Attr.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclGroup.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/Basic/FileManager.h" #include "clang/CodeGen/ModuleBuilder.h" -#include "clang/Parse/Parser.h" -#include "clang/Lex/Preprocessor.h" #include "clang/Frontend/CompilerInstance.h" +#include "clang/Lex/Preprocessor.h" +#include "clang/Parse/Parser.h" #include "clang/Sema/Sema.h" #include "clang/Sema/SemaDiagnostic.h" #include "clang/Serialization/ASTWriter.h" @@ -48,23 +49,8 @@ #include "llvm/Support/raw_os_ostream.h" #include -#include #include - -// Include the necessary headers to interface with the Windows registry and -// environment. -#ifdef _MSC_VER - #define WIN32_LEAN_AND_MEAN - #define NOGDI - #ifndef NOMINMAX - #define NOMINMAX - #endif - #include - #include - #define popen _popen - #define pclose _pclose - #pragma comment(lib, "Advapi32.lib") -#endif +#include using namespace clang; @@ -89,18 +75,12 @@ namespace { return; #endif #ifdef _MSC_VER - HKEY regVS; -#if (_MSC_VER >= 1900) - int VSVersion = (_MSC_VER / 100) - 5; -#else - int VSVersion = (_MSC_VER / 100) - 6; -#endif + const int VSVersion = cling::platform::GetVisualStudioVersionCompiledWith(); std::stringstream subKey; subKey << "VisualStudio.DTE." << VSVersion << ".0"; - if (RegOpenKeyEx(HKEY_CLASSES_ROOT, subKey.str().c_str(), 0, KEY_READ, ®VS) == ERROR_SUCCESS) { - RegCloseKey(regVS); - } - else { + std::string Value; + if (!cling::platform::GetSystemRegistryString("HKEY_CLASSES_ROOT", + subKey.str().c_str(), Value) || Value.empty()) { llvm::errs() << "Warning in cling::IncrementalParser::CheckABICompatibility():\n " "Possible C++ standard library mismatch, compiled with Visual Studio v"