diff --git a/clang/lib/DPCT/ASTTraversal.cpp b/clang/lib/DPCT/ASTTraversal.cpp index ff178f09ea6e..f1514ad16075 100644 --- a/clang/lib/DPCT/ASTTraversal.cpp +++ b/clang/lib/DPCT/ASTTraversal.cpp @@ -10,16 +10,16 @@ #include "AnalysisInfo.h" #include "RulesAsm/AsmMigration.h" #include "RulesLang/BarrierFenceSpaceAnalyzer.h" -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" #include "RulesDNN/DNNAPIMigration.h" -#include "ExprAnalysis.h" +#include "RuleInfra/ExprAnalysis.h" #include "RulesMathLib/FFTAPIMigration.h" #include "CodePin/GenCodePinHeader.h" #include "RulesLang/GroupFunctionAnalyzer.h" #include "RulesSecurity/Homoglyph.h" #include "RulesLangLib/LIBCUAPIMigration.h" -#include "MemberExprRewriter.h" +#include "RuleInfra/MemberExprRewriter.h" #include "MigrationRuleManager.h" #include "RulesSecurity/MisleadingBidirectional.h" #include "RulesCCL/NCCLAPIMigration.h" diff --git a/clang/lib/DPCT/ASTTraversal.h b/clang/lib/DPCT/ASTTraversal.h index af34ace813a5..023d6f9eab2c 100644 --- a/clang/lib/DPCT/ASTTraversal.h +++ b/clang/lib/DPCT/ASTTraversal.h @@ -14,7 +14,7 @@ #include "Diagnostics/Diagnostics.h" #include "RulesMathLib/FFTAPIMigration.h" #include "RulesInclude/InclusionHeaders.h" -#include "MapNames.h" +#include "RuleInfra/MapNames.h" #include "TextModification.h" #include "Utility.h" @@ -280,103 +280,6 @@ template class NamedMigrationRule : public MigrationRule { } } - void addReplacementForLibraryAPI(LibraryMigrationFlags Flags, - LibraryMigrationStrings &Strings, - LibraryMigrationLocations Locations, - std::string FuncName, const CallExpr *CE) { - if (Flags.NeedUseLambda) { - if (Strings.PrefixInsertStr.empty() && Strings.SuffixInsertStr.empty()) { - // If there is one API call in the migrated code, it is unnecessary to - // use a lambda expression - Flags.NeedUseLambda = false; - } - } - - if (Flags.NeedUseLambda) { - if ((Flags.MoveOutOfMacro && Flags.IsMacroArg) || - (Flags.CanAvoidUsingLambda && !Flags.IsMacroArg)) { - std::string InsertString; - if (DpctGlobalInfo::getUsmLevel() == UsmLevel::UL_None && - !Flags.CanAvoidBrace) - InsertString = std::string("{") + getNL() + Strings.IndentStr + - Strings.PrefixInsertStr + Strings.Repl + ";" + - Strings.SuffixInsertStr + getNL() + Strings.IndentStr + - "}" + getNL() + Strings.IndentStr; - else - InsertString = Strings.PrefixInsertStr + Strings.Repl + ";" + - Strings.SuffixInsertStr + getNL() + Strings.IndentStr; - - if (Flags.MoveOutOfMacro && Flags.IsMacroArg) { - auto IT = new InsertText(Locations.OutOfMacroInsertLoc, - std::move(InsertString)); - IT->setBlockLevelFormatFlag(); - emplaceTransformation(std::move(IT)); - report(Locations.OutOfMacroInsertLoc, Diagnostics::CODE_LOGIC_CHANGED, - true, "function-like macro"); - } else { - auto IT = - new InsertText(Locations.OuterInsertLoc, std::move(InsertString)); - IT->setBlockLevelFormatFlag(); - emplaceTransformation(std::move(IT)); - report(Locations.OuterInsertLoc, Diagnostics::CODE_LOGIC_CHANGED, - true, - Flags.OriginStmtType == "if" ? "an " + Flags.OriginStmtType - : "a " + Flags.OriginStmtType); - } - emplaceTransformation( - new ReplaceText(Locations.PrefixInsertLoc, Locations.Len, "0")); - } else { - if (Flags.IsAssigned) { - report(Locations.PrefixInsertLoc, Diagnostics::NOERROR_RETURN_LAMBDA, - false); - insertAroundRange( - Locations.PrefixInsertLoc, Locations.SuffixInsertLoc, - std::string("[&](){") + getNL() + Strings.IndentStr + - Strings.PrefixInsertStr, - std::string(";") + Strings.SuffixInsertStr + getNL() + - Strings.IndentStr + "return 0;" + getNL() + - Strings.IndentStr + std::string("}()"), - true); - } else { - insertAroundRange( - Locations.PrefixInsertLoc, Locations.SuffixInsertLoc, - std::string("[&](){") + getNL() + Strings.IndentStr + - Strings.PrefixInsertStr, - std::string(";") + Strings.SuffixInsertStr + getNL() + - Strings.IndentStr + std::string("}()"), - true); - } - emplaceTransformation(new ReplaceText( - Locations.PrefixInsertLoc, Locations.Len, std::move(Strings.Repl))); - } - } else { - if (DpctGlobalInfo::getUsmLevel() == UsmLevel::UL_None && - !Flags.CanAvoidBrace) { - if (!Strings.PrefixInsertStr.empty() || - !Strings.SuffixInsertStr.empty()) { - insertAroundRange( - Locations.PrefixInsertLoc, Locations.SuffixInsertLoc, - Strings.PrePrefixInsertStr + std::string("{") + getNL() + - Strings.IndentStr + Strings.PrefixInsertStr, - Strings.SuffixInsertStr + getNL() + Strings.IndentStr + - std::string("}"), - true); - } - } else { - insertAroundRange(Locations.PrefixInsertLoc, Locations.SuffixInsertLoc, - Strings.PrePrefixInsertStr + Strings.PrefixInsertStr, - std::move(Strings.SuffixInsertStr), true); - } - if (Flags.IsAssigned) { - insertAroundRange(Locations.FuncNameBegin, Locations.FuncCallEnd, - MapNames::getCheckErrorMacroName() + "(", ")"); - requestFeature(HelperFeatureEnum::device_ext); - } - - emplaceTransformation(new ReplaceStmt(CE, true, Strings.Repl)); - } - } - std::string makeDevicePolicy(const Stmt *S) { auto UniqueName = [](const Stmt *S) { auto &SM = DpctGlobalInfo::getSourceManager(); diff --git a/clang/lib/DPCT/AnalysisInfo.cpp b/clang/lib/DPCT/AnalysisInfo.cpp index 96bc22768d06..32f5754c2116 100644 --- a/clang/lib/DPCT/AnalysisInfo.cpp +++ b/clang/lib/DPCT/AnalysisInfo.cpp @@ -8,8 +8,8 @@ #include "AnalysisInfo.h" #include "Diagnostics/Diagnostics.h" -#include "ExprAnalysis.h" -#include "MapNames.h" +#include "RuleInfra/ExprAnalysis.h" +#include "RuleInfra/MapNames.h" #include "Statics.h" #include "TextModification.h" #include "Utility.h" diff --git a/clang/lib/DPCT/AnalysisInfo.h b/clang/lib/DPCT/AnalysisInfo.h index 672ce8223a5a..9c516406208a 100644 --- a/clang/lib/DPCT/AnalysisInfo.h +++ b/clang/lib/DPCT/AnalysisInfo.h @@ -10,16 +10,15 @@ #define DPCT_ANALYSIS_INFO_H #include "ErrorHandle/Error.h" -#include "ExprAnalysis.h" +#include "RuleInfra/ExprAnalysis.h" #include "ExtReplacements.h" #include "RulesInclude/InclusionHeaders.h" -#include "LibraryAPIMigration.h" #include "UserDefinedRules/UserDefinedRules.h" #include "FileGenerator/GenFiles.h" #include "Statics.h" #include "TextModification.h" #include "Utility.h" -#include "ValidateArguments.h" +#include "CommandOption/ValidateArguments.h" #include #include #include diff --git a/clang/lib/DPCT/CMakeLists.txt b/clang/lib/DPCT/CMakeLists.txt index e42cbe6e7eb6..e360ae59141a 100644 --- a/clang/lib/DPCT/CMakeLists.txt +++ b/clang/lib/DPCT/CMakeLists.txt @@ -95,7 +95,7 @@ add_custom_target(gen_mapping_register COMMAND "${CMAKE_COMMAND}" -DTARGET="${API_MAPPING_REGISTER_FOLDER}APIMappingRegister.def" -DSRC_DIRECTORY="${CMAKE_CURRENT_SOURCE_DIR}/../../examples/DPCT/" - -P ${CMAKE_CURRENT_SOURCE_DIR}/APIMapping/GenerateRegister.cmake + -P ${CMAKE_CURRENT_SOURCE_DIR}/QueryAPIMapping/GenerateRegister.cmake DEPENDS ${SRC_FILES}) include_directories( ${API_MAPPING_REGISTER_FOLDER} @@ -146,7 +146,7 @@ add_clang_library(DPCT RulesLang/Math/RewriterCXXAPIRoutines.cpp RulesLang/Math/RewriterOverload.cpp RulesLang/RewriterSYCLcompat.cpp - CallExprRewriter.cpp + RuleInfra/CallExprRewriter.cpp RulesLang/CallExprRewriterAtomic.cpp RulesMathLib/CallExprRewriterCUFFT.cpp RulesMathLib/CallExprRewriterCUBLAS.cpp @@ -174,21 +174,20 @@ add_clang_library(DPCT Diagnostics/Diagnostics.cpp ErrorHandle/Error.cpp Statics.cpp - ExprAnalysis.cpp + RuleInfra/ExprAnalysis.cpp ExtReplacements.cpp - MapNames.cpp + RuleInfra/MapNames.cpp FileGenerator/GenFiles.cpp DPCT.cpp - DpctOptions.cpp + CommandOption/DpctOptions.cpp TextModification.cpp Utility.cpp - ValidateArguments.cpp - ExternalReplacement.cpp + CommandOption/ValidateArguments.cpp + IncMigration/ExternalReplacement.cpp Windows/VcxprojParser.cpp - LibraryAPIMigration.cpp MigrateScript/GenMakefile.cpp RulesInclude/InclusionHeaders.cpp - IncrementalMigrationUtility.cpp + IncMigration/IncrementalMigrationUtility.cpp UserDefinedRules/UserDefinedRules.cpp UserDefinedRules/PatternRewriter.cpp MigrateScript/MigrateBuildScript.cpp @@ -201,10 +200,10 @@ add_clang_library(DPCT RulesMathLib/FFTAPIMigration.cpp RulesDNN/DNNAPIMigration.cpp RulesCCL/NCCLAPIMigration.cpp - TypeLocRewriters.cpp + RuleInfra/TypeLocRewriters.cpp Linux/AutoComplete.cpp RulesAsm/AsmMigration.cpp - APIMapping/QueryAPIMapping.cpp + QueryAPIMapping/QueryAPIMapping.cpp RulesAsm/Parser/AsmNodes.cpp RulesAsm/Parser/AsmLexer.cpp RulesAsm/Parser/AsmParser.cpp @@ -212,7 +211,7 @@ add_clang_library(DPCT RulesAsm/Parser/AsmTokenKinds.cpp RulesLangLib/LIBCUAPIMigration.cpp RulesLangLib/CUBAPIMigration.cpp - MemberExprRewriter.cpp + RuleInfra/MemberExprRewriter.cpp MigrationRuleManager.cpp MigrationAction.cpp RulesLangLib/ThrustAPIMigration.cpp diff --git a/clang/lib/DPCT/CodePin/GenCodePinHeader.cpp b/clang/lib/DPCT/CodePin/GenCodePinHeader.cpp index 7c0eb1466b50..8647a7e4c2bd 100644 --- a/clang/lib/DPCT/CodePin/GenCodePinHeader.cpp +++ b/clang/lib/DPCT/CodePin/GenCodePinHeader.cpp @@ -10,7 +10,7 @@ #include "ASTTraversal.h" #include "AnalysisInfo.h" #include "Diagnostics/Diagnostics.h" -#include "MapNames.h" +#include "RuleInfra/MapNames.h" #include "Statics.h" #include "clang/AST/Expr.h" #include "clang/ASTMatchers/ASTMatchFinder.h" diff --git a/clang/lib/DPCT/DpctOptions.cpp b/clang/lib/DPCT/CommandOption/DpctOptions.cpp similarity index 100% rename from clang/lib/DPCT/DpctOptions.cpp rename to clang/lib/DPCT/CommandOption/DpctOptions.cpp diff --git a/clang/lib/DPCT/ValidateArguments.cpp b/clang/lib/DPCT/CommandOption/ValidateArguments.cpp similarity index 99% rename from clang/lib/DPCT/ValidateArguments.cpp rename to clang/lib/DPCT/CommandOption/ValidateArguments.cpp index b368ef94a932..8cb230d3e0f6 100644 --- a/clang/lib/DPCT/ValidateArguments.cpp +++ b/clang/lib/DPCT/CommandOption/ValidateArguments.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "ValidateArguments.h" +#include "CommandOption/ValidateArguments.h" #include "ErrorHandle/Error.h" #include "Statics.h" #include "Utility.h" diff --git a/clang/lib/DPCT/ValidateArguments.h b/clang/lib/DPCT/CommandOption/ValidateArguments.h similarity index 100% rename from clang/lib/DPCT/ValidateArguments.h rename to clang/lib/DPCT/CommandOption/ValidateArguments.h diff --git a/clang/lib/DPCT/DPCT.cpp b/clang/lib/DPCT/DPCT.cpp index 9e21a50c23e2..1ff6d85ab1c8 100644 --- a/clang/lib/DPCT/DPCT.cpp +++ b/clang/lib/DPCT/DPCT.cpp @@ -7,19 +7,19 @@ //===----------------------------------------------------------------------===// #include "clang/DPCT/DPCT.h" -#include "APIMapping/QueryAPIMapping.h" +#include "QueryAPIMapping/QueryAPIMapping.h" #include "ASTTraversal.h" #include "AnalysisInfo.h" #include "Linux/AutoComplete.h" -#include "CallExprRewriter.h" +#include "RuleInfra/CallExprRewriter.h" #include "Config.h" #include "ErrorHandle/CrashRecovery.h" #include "ErrorHandle/Error.h" -#include "ExternalReplacement.h" +#include "IncMigration/ExternalReplacement.h" #include "FileGenerator/GenHelperFunction.h" #include "MigrateScript/GenMakefile.h" -#include "IncrementalMigrationUtility.h" -#include "MemberExprRewriter.h" +#include "IncMigration/IncrementalMigrationUtility.h" +#include "RuleInfra/MemberExprRewriter.h" #include "MigrateScript/MigrateCmakeScript.h" #include "MigrateScript/MigratePythonBuildScript.h" #include "MigrationAction.h" @@ -28,9 +28,9 @@ #include "UserDefinedRules/UserDefinedRules.h" #include "FileGenerator/GenFiles.h" #include "Statics.h" -#include "TypeLocRewriters.h" +#include "RuleInfra/TypeLocRewriters.h" #include "Utility.h" -#include "ValidateArguments.h" +#include "CommandOption/ValidateArguments.h" #include "Windows/VcxprojParser.h" #include "clang/AST/ASTConsumer.h" #include "clang/ASTMatchers/ASTMatchFinder.h" diff --git a/clang/lib/DPCT/FileGenerator/GenFiles.cpp b/clang/lib/DPCT/FileGenerator/GenFiles.cpp index 58967504f23c..791b6bdebd8b 100644 --- a/clang/lib/DPCT/FileGenerator/GenFiles.cpp +++ b/clang/lib/DPCT/FileGenerator/GenFiles.cpp @@ -10,7 +10,7 @@ #include "AnalysisInfo.h" #include "ErrorHandle/CrashRecovery.h" #include "Diagnostics/Diagnostics.h" -#include "ExternalReplacement.h" +#include "IncMigration/ExternalReplacement.h" #include "MigrateScript/GenMakefile.h" #include "UserDefinedRules/PatternRewriter.h" #include "Statics.h" diff --git a/clang/lib/DPCT/ExternalReplacement.cpp b/clang/lib/DPCT/IncMigration/ExternalReplacement.cpp similarity index 99% rename from clang/lib/DPCT/ExternalReplacement.cpp rename to clang/lib/DPCT/IncMigration/ExternalReplacement.cpp index 92abb618b20f..49949a0f9f4b 100644 --- a/clang/lib/DPCT/ExternalReplacement.cpp +++ b/clang/lib/DPCT/IncMigration/ExternalReplacement.cpp @@ -19,7 +19,7 @@ #include "llvm/Support/Path.h" #include "ExternalReplacement.h" -#include "IncrementalMigrationUtility.h" +#include "IncMigration/IncrementalMigrationUtility.h" #include "clang/Tooling/Core/Diagnostic.h" #include "clang/Tooling/Refactoring.h" #include "clang/Tooling/ReplacementsYaml.h" diff --git a/clang/lib/DPCT/ExternalReplacement.h b/clang/lib/DPCT/IncMigration/ExternalReplacement.h similarity index 100% rename from clang/lib/DPCT/ExternalReplacement.h rename to clang/lib/DPCT/IncMigration/ExternalReplacement.h diff --git a/clang/lib/DPCT/IncrementalMigrationUtility.cpp b/clang/lib/DPCT/IncMigration/IncrementalMigrationUtility.cpp similarity index 100% rename from clang/lib/DPCT/IncrementalMigrationUtility.cpp rename to clang/lib/DPCT/IncMigration/IncrementalMigrationUtility.cpp diff --git a/clang/lib/DPCT/IncrementalMigrationUtility.h b/clang/lib/DPCT/IncMigration/IncrementalMigrationUtility.h similarity index 100% rename from clang/lib/DPCT/IncrementalMigrationUtility.h rename to clang/lib/DPCT/IncMigration/IncrementalMigrationUtility.h diff --git a/clang/lib/DPCT/LibraryAPIMigration.cpp b/clang/lib/DPCT/LibraryAPIMigration.cpp deleted file mode 100644 index 7ea1408efba4..000000000000 --- a/clang/lib/DPCT/LibraryAPIMigration.cpp +++ /dev/null @@ -1,85 +0,0 @@ -//===--------------- LibraryAPIMigration.cpp ------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "LibraryAPIMigration.h" -#include "AnalysisInfo.h" -#include "Diagnostics/Diagnostics.h" -#include "MapNames.h" -#include "Utility.h" - -#include "clang/AST/Attr.h" -#include "clang/AST/Expr.h" -#include "clang/ASTMatchers/ASTMatchFinder.h" -#include "clang/Basic/LangOptions.h" - -namespace clang { -namespace dpct { - -void initVars(const CallExpr *CE, const VarDecl *VD, const BinaryOperator *BO, - LibraryMigrationFlags &Flags, - LibraryMigrationStrings &ReplaceStrs, - LibraryMigrationLocations &Locations) { - auto &SM = DpctGlobalInfo::getSourceManager(); - - Locations.FuncNameBegin = CE->getBeginLoc(); - Locations.FuncCallEnd = CE->getEndLoc(); - - Locations.OutOfMacroInsertLoc = SM.getExpansionLoc(CE->getBeginLoc()); - - // Below code can distinguish this kind of function like macro - // For case like: - // #define CHECK_STATUS(x) fun(c) - // CHECK_STATUS(anAPICall()); - Flags.IsMacroArg = SM.isMacroArgExpansion(CE->getBeginLoc()) && - SM.isMacroArgExpansion(CE->getEndLoc()); - - // Offset 1 is the length of the last token ")" - Locations.FuncCallEnd = - SM.getExpansionLoc(Locations.FuncCallEnd).getLocWithOffset(1); - auto SR = - getScopeInsertRange(CE, Locations.FuncNameBegin, Locations.FuncCallEnd); - Locations.PrefixInsertLoc = SR.getBegin(); - Locations.SuffixInsertLoc = SR.getEnd(); - - Flags.CanAvoidUsingLambda = false; - Flags.NeedUseLambda = isConditionOfFlowControl(CE, Flags.OriginStmtType, - Flags.CanAvoidUsingLambda, - Locations.OuterInsertLoc); - bool IsInReturnStmt = isInReturnStmt(CE, Locations.OuterInsertLoc); - Flags.CanAvoidBrace = false; - const CompoundStmt *CS = findImmediateBlock(CE); - if (CS && (CS->size() == 1)) { - const Stmt *S = *(CS->child_begin()); - if (CE == S || dyn_cast(S)) - Flags.CanAvoidBrace = true; - } - - if (Flags.NeedUseLambda || Flags.IsMacroArg || IsInReturnStmt) { - Flags.NeedUseLambda = true; - SourceRange SR = getFunctionRange(CE); - Locations.PrefixInsertLoc = SR.getBegin(); - Locations.SuffixInsertLoc = SR.getEnd(); - if (IsInReturnStmt) { - Flags.OriginStmtType = "return"; - Flags.CanAvoidUsingLambda = true; - } - } - - ReplaceStrs.IndentStr = getIndent(Locations.PrefixInsertLoc, SM).str(); - - // This length should be used only when NeedUseLambda is true. - // If NeedUseLambda is false, Len may longer than the function call length, - // because in this case, PrefixInsertLoc and SuffixInsertLoc are the begin - // location of the whole statement and the location after the semi of the - // statement. - Locations.Len = SM.getDecomposedLoc(Locations.SuffixInsertLoc).second - - SM.getDecomposedLoc(Locations.PrefixInsertLoc).second; -} - -} // namespace dpct -} // namespace clang diff --git a/clang/lib/DPCT/LibraryAPIMigration.h b/clang/lib/DPCT/LibraryAPIMigration.h deleted file mode 100644 index d08527a8b30c..000000000000 --- a/clang/lib/DPCT/LibraryAPIMigration.h +++ /dev/null @@ -1,101 +0,0 @@ -//===--------------- LibraryAPIMigration.h --------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef DPCT_LIBRARY_API_MIGRATION_H -#define DPCT_LIBRARY_API_MIGRATION_H - -#include "ExprAnalysis.h" -#include "MapNames.h" - -#include "clang/AST/Attr.h" -#include "clang/AST/Decl.h" -#include "clang/AST/DeclTemplate.h" -#include "clang/AST/ExprCXX.h" -#include "clang/AST/ParentMapContext.h" -#include "clang/Format/Format.h" -#include "clang/Frontend/CompilerInstance.h" - -#include -#include - -namespace clang { -namespace dpct { - -struct LibraryAPIStmts { - LibraryAPIStmts() {} - - LibraryAPIStmts &operator<<(const LibraryAPIStmts &InputStmts) { - S.insert(S.end(), InputStmts.S.begin(), InputStmts.S.end()); - return *this; - } - LibraryAPIStmts &operator<<(const std::vector &InputStmts) { - S.insert(S.end(), InputStmts.begin(), InputStmts.end()); - return *this; - } - LibraryAPIStmts &operator<<(const std::string &InputStmt) { - if (InputStmt.empty()) - return *this; - - S.push_back(InputStmt); - return *this; - } - - std::string getAsString(std::string IndentStr, bool IsNLAtBegin) { - std::ostringstream OS; - for (const auto &Stmt : S) { - if (IsNLAtBegin) - OS << getNL() << IndentStr << Stmt; // For suffix string - else - OS << Stmt << getNL() << IndentStr; // For prefix string - } - return OS.str(); - } - std::vector S; -}; - -struct LibraryMigrationFlags { - bool NeedUseLambda = false; - bool CanAvoidUsingLambda = false; - bool IsMacroArg = false; - bool CanAvoidBrace = false; - bool IsAssigned = false; - bool MoveOutOfMacro = false; - std::string OriginStmtType; - bool IsPrefixEmpty = false; - bool IsSuffixEmpty = false; - bool IsPrePrefixEmpty = false; -}; -struct LibraryMigrationLocations { - SourceLocation PrefixInsertLoc; - SourceLocation SuffixInsertLoc; - SourceLocation OuterInsertLoc; - SourceLocation FuncNameBegin; - SourceLocation FuncCallEnd; - SourceLocation OutOfMacroInsertLoc; - unsigned int Len = 0; - SourceLocation FuncPtrDeclBegin; - SourceLocation FuncPtrDeclHandleTypeBegin; - unsigned int FuncPtrDeclLen = 0; -}; -struct LibraryMigrationStrings { - std::string PrePrefixInsertStr; - std::string PrefixInsertStr; - std::string Repl; - std::string SuffixInsertStr; - std::string IndentStr; -}; - -void initVars(const CallExpr *CE, const VarDecl *VD, const BinaryOperator *BO, - LibraryMigrationFlags &Flags, - LibraryMigrationStrings &ReplaceStrs, - LibraryMigrationLocations &Locations); - -} // namespace dpct -} // namespace clang - -#endif // !DPCT_LIBRARY_API_MIGRATION_H diff --git a/clang/lib/DPCT/MigrateScript/GenMakefile.cpp b/clang/lib/DPCT/MigrateScript/GenMakefile.cpp index 69a1c83e74ea..6cf166a9a149 100644 --- a/clang/lib/DPCT/MigrateScript/GenMakefile.cpp +++ b/clang/lib/DPCT/MigrateScript/GenMakefile.cpp @@ -10,7 +10,7 @@ #include "Diagnostics/Diagnostics.h" #include "FileGenerator/GenFiles.h" #include "Utility.h" -#include "ValidateArguments.h" +#include "CommandOption/ValidateArguments.h" #include "ToolChains/Cuda.h" #include "clang/Driver/Driver.h" diff --git a/clang/lib/DPCT/APIMapping/GenerateRegister.cmake b/clang/lib/DPCT/QueryAPIMapping/GenerateRegister.cmake similarity index 100% rename from clang/lib/DPCT/APIMapping/GenerateRegister.cmake rename to clang/lib/DPCT/QueryAPIMapping/GenerateRegister.cmake diff --git a/clang/lib/DPCT/APIMapping/QueryAPIMapping.cpp b/clang/lib/DPCT/QueryAPIMapping/QueryAPIMapping.cpp similarity index 100% rename from clang/lib/DPCT/APIMapping/QueryAPIMapping.cpp rename to clang/lib/DPCT/QueryAPIMapping/QueryAPIMapping.cpp diff --git a/clang/lib/DPCT/APIMapping/QueryAPIMapping.h b/clang/lib/DPCT/QueryAPIMapping/QueryAPIMapping.h similarity index 100% rename from clang/lib/DPCT/APIMapping/QueryAPIMapping.h rename to clang/lib/DPCT/QueryAPIMapping/QueryAPIMapping.h diff --git a/clang/lib/DPCT/APINamesTemplateType.inc b/clang/lib/DPCT/RuleInfra/APINamesTemplateType.inc similarity index 100% rename from clang/lib/DPCT/APINamesTemplateType.inc rename to clang/lib/DPCT/RuleInfra/APINamesTemplateType.inc diff --git a/clang/lib/DPCT/APINames_removed.inc b/clang/lib/DPCT/RuleInfra/APINames_removed.inc similarity index 100% rename from clang/lib/DPCT/APINames_removed.inc rename to clang/lib/DPCT/RuleInfra/APINames_removed.inc diff --git a/clang/lib/DPCT/CallExprRewriter.cpp b/clang/lib/DPCT/RuleInfra/CallExprRewriter.cpp similarity index 98% rename from clang/lib/DPCT/CallExprRewriter.cpp rename to clang/lib/DPCT/RuleInfra/CallExprRewriter.cpp index f60331458e60..8591eda20744 100644 --- a/clang/lib/DPCT/CallExprRewriter.cpp +++ b/clang/lib/DPCT/RuleInfra/CallExprRewriter.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" #include namespace clang { diff --git a/clang/lib/DPCT/CallExprRewriter.h b/clang/lib/DPCT/RuleInfra/CallExprRewriter.h similarity index 100% rename from clang/lib/DPCT/CallExprRewriter.h rename to clang/lib/DPCT/RuleInfra/CallExprRewriter.h diff --git a/clang/lib/DPCT/CallExprRewriterCommon.h b/clang/lib/DPCT/RuleInfra/CallExprRewriterCommon.h similarity index 99% rename from clang/lib/DPCT/CallExprRewriterCommon.h rename to clang/lib/DPCT/RuleInfra/CallExprRewriterCommon.h index a934a9f5e69d..b9cbb1bec8c5 100644 --- a/clang/lib/DPCT/CallExprRewriterCommon.h +++ b/clang/lib/DPCT/RuleInfra/CallExprRewriterCommon.h @@ -12,10 +12,10 @@ #include "ASTTraversal.h" #include "AnalysisInfo.h" #include "RulesMathLib/BLASAPIMigration.h" -#include "CallExprRewriter.h" +#include "RuleInfra/CallExprRewriter.h" #include "Config.h" -#include "ExprAnalysis.h" -#include "MapNames.h" +#include "RuleInfra/ExprAnalysis.h" +#include "RuleInfra/MapNames.h" #include "Utility.h" #include "ToolChains/Cuda.h" #include "clang/AST/Attr.h" diff --git a/clang/lib/DPCT/ExprAnalysis.cpp b/clang/lib/DPCT/RuleInfra/ExprAnalysis.cpp similarity index 99% rename from clang/lib/DPCT/ExprAnalysis.cpp rename to clang/lib/DPCT/RuleInfra/ExprAnalysis.cpp index fbb35ead3834..96d1b29c4ae4 100644 --- a/clang/lib/DPCT/ExprAnalysis.cpp +++ b/clang/lib/DPCT/RuleInfra/ExprAnalysis.cpp @@ -6,16 +6,16 @@ // //===----------------------------------------------------------------------===// -#include "ExprAnalysis.h" +#include "RuleInfra/ExprAnalysis.h" #include "ASTTraversal.h" #include "AnalysisInfo.h" #include "RulesLangLib/CUBAPIMigration.h" -#include "CallExprRewriter.h" +#include "RuleInfra/CallExprRewriter.h" #include "Config.h" #include "RulesDNN/DNNAPIMigration.h" -#include "MemberExprRewriter.h" -#include "TypeLocRewriters.h" +#include "RuleInfra/MemberExprRewriter.h" +#include "RuleInfra/TypeLocRewriters.h" #include "clang/AST/DeclTemplate.h" #include "clang/AST/Expr.h" #include "clang/AST/ExprConcepts.h" diff --git a/clang/lib/DPCT/ExprAnalysis.h b/clang/lib/DPCT/RuleInfra/ExprAnalysis.h similarity index 100% rename from clang/lib/DPCT/ExprAnalysis.h rename to clang/lib/DPCT/RuleInfra/ExprAnalysis.h diff --git a/clang/lib/DPCT/MapNames.cpp b/clang/lib/DPCT/RuleInfra/MapNames.cpp similarity index 99% rename from clang/lib/DPCT/MapNames.cpp rename to clang/lib/DPCT/RuleInfra/MapNames.cpp index d6a54b34c538..16d594612e67 100644 --- a/clang/lib/DPCT/MapNames.cpp +++ b/clang/lib/DPCT/RuleInfra/MapNames.cpp @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "MapNames.h" +#include "RuleInfra/MapNames.h" #include "ASTTraversal.h" -#include "CallExprRewriter.h" +#include "RuleInfra/CallExprRewriter.h" #include "RulesDNN/DNNAPIMigration.h" #include "FileGenerator/GenFiles.h" #include diff --git a/clang/lib/DPCT/MapNames.h b/clang/lib/DPCT/RuleInfra/MapNames.h similarity index 99% rename from clang/lib/DPCT/MapNames.h rename to clang/lib/DPCT/RuleInfra/MapNames.h index 3920f02f5cd0..e8fd31d73cc0 100644 --- a/clang/lib/DPCT/MapNames.h +++ b/clang/lib/DPCT/RuleInfra/MapNames.h @@ -11,7 +11,7 @@ #include "UserDefinedRules/UserDefinedRules.h" #include "Utility.h" -#include "ValidateArguments.h" +#include "CommandOption/ValidateArguments.h" #include #include diff --git a/clang/lib/DPCT/MemberExprRewriter.cpp b/clang/lib/DPCT/RuleInfra/MemberExprRewriter.cpp similarity index 99% rename from clang/lib/DPCT/MemberExprRewriter.cpp rename to clang/lib/DPCT/RuleInfra/MemberExprRewriter.cpp index 63d9eb647a7b..4b24cf85bda4 100644 --- a/clang/lib/DPCT/MemberExprRewriter.cpp +++ b/clang/lib/DPCT/RuleInfra/MemberExprRewriter.cpp @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "MemberExprRewriter.h" +#include "RuleInfra/MemberExprRewriter.h" #include "AnalysisInfo.h" -#include "MapNames.h" +#include "RuleInfra/MapNames.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/MemberExprRewriter.h b/clang/lib/DPCT/RuleInfra/MemberExprRewriter.h similarity index 98% rename from clang/lib/DPCT/MemberExprRewriter.h rename to clang/lib/DPCT/RuleInfra/MemberExprRewriter.h index c41b4db3abb4..3c7a37015048 100644 --- a/clang/lib/DPCT/MemberExprRewriter.h +++ b/clang/lib/DPCT/RuleInfra/MemberExprRewriter.h @@ -9,7 +9,7 @@ #ifndef DPCT_MEMBEREXPR_H #define DPCT_MEMBEREXPR_H -#include "CallExprRewriter.h" +#include "RuleInfra/CallExprRewriter.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/TypeLocRewriters.cpp b/clang/lib/DPCT/RuleInfra/TypeLocRewriters.cpp similarity index 99% rename from clang/lib/DPCT/TypeLocRewriters.cpp rename to clang/lib/DPCT/RuleInfra/TypeLocRewriters.cpp index 9652d3be83d7..46c4ca6e8cc1 100644 --- a/clang/lib/DPCT/TypeLocRewriters.cpp +++ b/clang/lib/DPCT/RuleInfra/TypeLocRewriters.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "TypeLocRewriters.h" +#include "RuleInfra/TypeLocRewriters.h" #include "UserDefinedRules/UserDefinedRules.h" #include "clang/AST/TypeLoc.h" diff --git a/clang/lib/DPCT/TypeLocRewriters.h b/clang/lib/DPCT/RuleInfra/TypeLocRewriters.h similarity index 99% rename from clang/lib/DPCT/TypeLocRewriters.h rename to clang/lib/DPCT/RuleInfra/TypeLocRewriters.h index 1c9e35ba0fa7..623b0e0d2332 100644 --- a/clang/lib/DPCT/TypeLocRewriters.h +++ b/clang/lib/DPCT/RuleInfra/TypeLocRewriters.h @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" +#include "RuleInfra/CallExprRewriter.h" #include namespace clang { diff --git a/clang/lib/DPCT/RulesAsm/AsmMigration.cpp b/clang/lib/DPCT/RulesAsm/AsmMigration.cpp index 7887ccba7924..dfbd488beeb6 100644 --- a/clang/lib/DPCT/RulesAsm/AsmMigration.cpp +++ b/clang/lib/DPCT/RulesAsm/AsmMigration.cpp @@ -13,7 +13,7 @@ #include "RulesAsm/Parser/AsmTokenKinds.h" #include "ErrorHandle/CrashRecovery.h" #include "Diagnostics/Diagnostics.h" -#include "MapNames.h" +#include "RuleInfra/MapNames.h" #include "TextModification.h" #include "Utility.h" #include "clang/AST/Expr.h" diff --git a/clang/lib/DPCT/RulesCCL/CallExprRewriterNccl.cpp b/clang/lib/DPCT/RulesCCL/CallExprRewriterNccl.cpp index 0e4bbd8fb939..45562a19d61c 100644 --- a/clang/lib/DPCT/RulesCCL/CallExprRewriterNccl.cpp +++ b/clang/lib/DPCT/RulesCCL/CallExprRewriterNccl.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesCCL/NCCLAPIMigration.cpp b/clang/lib/DPCT/RulesCCL/NCCLAPIMigration.cpp index 67a03c955fef..9bd13c737aa6 100644 --- a/clang/lib/DPCT/RulesCCL/NCCLAPIMigration.cpp +++ b/clang/lib/DPCT/RulesCCL/NCCLAPIMigration.cpp @@ -9,7 +9,7 @@ #include "NCCLAPIMigration.h" #include "ASTTraversal.h" -#include "ExprAnalysis.h" +#include "RuleInfra/ExprAnalysis.h" #include "MigrationRuleManager.h" using namespace clang::dpct; diff --git a/clang/lib/DPCT/RulesDNN/CallExprRewriterCUDNN.cpp b/clang/lib/DPCT/RulesDNN/CallExprRewriterCUDNN.cpp index 8cf754b8271b..2540c101f9d0 100644 --- a/clang/lib/DPCT/RulesDNN/CallExprRewriterCUDNN.cpp +++ b/clang/lib/DPCT/RulesDNN/CallExprRewriterCUDNN.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesDNN/DNNAPIMigration.cpp b/clang/lib/DPCT/RulesDNN/DNNAPIMigration.cpp index dc8105b1ec61..fc7db10be875 100644 --- a/clang/lib/DPCT/RulesDNN/DNNAPIMigration.cpp +++ b/clang/lib/DPCT/RulesDNN/DNNAPIMigration.cpp @@ -11,7 +11,7 @@ #include "AnalysisInfo.h" #include "Diagnostics/Diagnostics.h" #include "Statics.h" -#include "MapNames.h" +#include "RuleInfra/MapNames.h" #include "clang/AST/Expr.h" #include "clang/ASTMatchers/ASTMatchFinder.h" #include "clang/Lex/Preprocessor.h" diff --git a/clang/lib/DPCT/RulesLang/CallExprRewriterAtomic.cpp b/clang/lib/DPCT/RulesLang/CallExprRewriterAtomic.cpp index 642c1f088863..9e9a1c31d635 100644 --- a/clang/lib/DPCT/RulesLang/CallExprRewriterAtomic.cpp +++ b/clang/lib/DPCT/RulesLang/CallExprRewriterAtomic.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesLang/CallExprRewriterCG.cpp b/clang/lib/DPCT/RulesLang/CallExprRewriterCG.cpp index 45ee4ac7c885..1933ccbdc4bf 100644 --- a/clang/lib/DPCT/RulesLang/CallExprRewriterCG.cpp +++ b/clang/lib/DPCT/RulesLang/CallExprRewriterCG.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesLang/CallExprRewriterComplex.cpp b/clang/lib/DPCT/RulesLang/CallExprRewriterComplex.cpp index dcff2979405b..a31fb3a11c6e 100644 --- a/clang/lib/DPCT/RulesLang/CallExprRewriterComplex.cpp +++ b/clang/lib/DPCT/RulesLang/CallExprRewriterComplex.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesLang/CallExprRewriterDriver.cpp b/clang/lib/DPCT/RulesLang/CallExprRewriterDriver.cpp index 4c279191fb2c..23a72fa2a628 100644 --- a/clang/lib/DPCT/RulesLang/CallExprRewriterDriver.cpp +++ b/clang/lib/DPCT/RulesLang/CallExprRewriterDriver.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesLang/CallExprRewriterErrorHandling.cpp b/clang/lib/DPCT/RulesLang/CallExprRewriterErrorHandling.cpp index 8aee0582957a..6cc2b8047134 100644 --- a/clang/lib/DPCT/RulesLang/CallExprRewriterErrorHandling.cpp +++ b/clang/lib/DPCT/RulesLang/CallExprRewriterErrorHandling.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesLang/CallExprRewriterEvent.cpp b/clang/lib/DPCT/RulesLang/CallExprRewriterEvent.cpp index e9f82998f095..37c774fa987b 100644 --- a/clang/lib/DPCT/RulesLang/CallExprRewriterEvent.cpp +++ b/clang/lib/DPCT/RulesLang/CallExprRewriterEvent.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesLang/CallExprRewriterGraph.cpp b/clang/lib/DPCT/RulesLang/CallExprRewriterGraph.cpp index e39e8b1c9ffa..8781fe6c3158 100644 --- a/clang/lib/DPCT/RulesLang/CallExprRewriterGraph.cpp +++ b/clang/lib/DPCT/RulesLang/CallExprRewriterGraph.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesLang/CallExprRewriterGraphicsInterop.cpp b/clang/lib/DPCT/RulesLang/CallExprRewriterGraphicsInterop.cpp index 4e6268273161..93f91ac5ca97 100644 --- a/clang/lib/DPCT/RulesLang/CallExprRewriterGraphicsInterop.cpp +++ b/clang/lib/DPCT/RulesLang/CallExprRewriterGraphicsInterop.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesLang/CallExprRewriterMemory.cpp b/clang/lib/DPCT/RulesLang/CallExprRewriterMemory.cpp index fd5e985b114e..8056950a37f9 100644 --- a/clang/lib/DPCT/RulesLang/CallExprRewriterMemory.cpp +++ b/clang/lib/DPCT/RulesLang/CallExprRewriterMemory.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesLang/CallExprRewriterMisc.cpp b/clang/lib/DPCT/RulesLang/CallExprRewriterMisc.cpp index 06291e05b6bb..d0ae38375240 100644 --- a/clang/lib/DPCT/RulesLang/CallExprRewriterMisc.cpp +++ b/clang/lib/DPCT/RulesLang/CallExprRewriterMisc.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesLang/CallExprRewriterStream.cpp b/clang/lib/DPCT/RulesLang/CallExprRewriterStream.cpp index 16e9ea625133..51679bdf2cd2 100644 --- a/clang/lib/DPCT/RulesLang/CallExprRewriterStream.cpp +++ b/clang/lib/DPCT/RulesLang/CallExprRewriterStream.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesLang/CallExprRewriterTexture.cpp b/clang/lib/DPCT/RulesLang/CallExprRewriterTexture.cpp index cae9e50b18a0..ad0c9bb3f06e 100644 --- a/clang/lib/DPCT/RulesLang/CallExprRewriterTexture.cpp +++ b/clang/lib/DPCT/RulesLang/CallExprRewriterTexture.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" #include "Utility.h" namespace clang { diff --git a/clang/lib/DPCT/RulesLang/CallExprRewriterWarp.cpp b/clang/lib/DPCT/RulesLang/CallExprRewriterWarp.cpp index 9a6276ecf479..b0c91b5308c7 100644 --- a/clang/lib/DPCT/RulesLang/CallExprRewriterWarp.cpp +++ b/clang/lib/DPCT/RulesLang/CallExprRewriterWarp.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesLang/CallExprRewriterWmma.cpp b/clang/lib/DPCT/RulesLang/CallExprRewriterWmma.cpp index a9c583f0ccec..93c998787e57 100644 --- a/clang/lib/DPCT/RulesLang/CallExprRewriterWmma.cpp +++ b/clang/lib/DPCT/RulesLang/CallExprRewriterWmma.cpp @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include "ASTTraversal.h" -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" -#include "MapNames.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" +#include "RuleInfra/MapNames.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesLang/Math/CallExprRewriterMath.h b/clang/lib/DPCT/RulesLang/Math/CallExprRewriterMath.h index b60c30763971..9a0bc87acfba 100644 --- a/clang/lib/DPCT/RulesLang/Math/CallExprRewriterMath.h +++ b/clang/lib/DPCT/RulesLang/Math/CallExprRewriterMath.h @@ -9,8 +9,8 @@ #ifndef DPCT_REWRITERS_MATH_CALL_EXPR_REWRITER_MATH_H #define DPCT_REWRITERS_MATH_CALL_EXPR_REWRITER_MATH_H -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" #include "Config.h" #include diff --git a/clang/lib/DPCT/RulesLang/OptimizeMigration.cpp b/clang/lib/DPCT/RulesLang/OptimizeMigration.cpp index 3aef2df4029e..c4fbd48a8342 100644 --- a/clang/lib/DPCT/RulesLang/OptimizeMigration.cpp +++ b/clang/lib/DPCT/RulesLang/OptimizeMigration.cpp @@ -11,7 +11,7 @@ #include "AnalysisInfo.h" #include "Diagnostics/Diagnostics.h" #include "Statics.h" -#include "MapNames.h" +#include "RuleInfra/MapNames.h" #include "clang/AST/Expr.h" #include "clang/ASTMatchers/ASTMatchFinder.h" #include "clang/Lex/Preprocessor.h" diff --git a/clang/lib/DPCT/RulesLang/RewriterSYCLcompat.cpp b/clang/lib/DPCT/RulesLang/RewriterSYCLcompat.cpp index 678364ff7663..a95047aaec21 100644 --- a/clang/lib/DPCT/RulesLang/RewriterSYCLcompat.cpp +++ b/clang/lib/DPCT/RulesLang/RewriterSYCLcompat.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "../CallExprRewriter.h" +#include "RuleInfra/CallExprRewriter.h" namespace clang { namespace dpct { @@ -121,7 +121,7 @@ SYCLCOMPAT_UNSUPPORT("cub::BlockStore.Store") #undef MULTI_STMTS_FACTORY_ENTRY #undef WARNING_FACTORY_ENTRY -#include "../CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriterCommon.h" void dpct::initRewriterMethodMapCooperativeGroupsSYCLcompat( std::unordered_map namespace clang { diff --git a/clang/lib/DPCT/RulesMathLib/CallExprRewriterCUFFT.cpp b/clang/lib/DPCT/RulesMathLib/CallExprRewriterCUFFT.cpp index 663c6d8ffb7d..a33eaa25e5ea 100644 --- a/clang/lib/DPCT/RulesMathLib/CallExprRewriterCUFFT.cpp +++ b/clang/lib/DPCT/RulesMathLib/CallExprRewriterCUFFT.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesMathLib/CallExprRewriterCURAND.cpp b/clang/lib/DPCT/RulesMathLib/CallExprRewriterCURAND.cpp index dbb8cea43aa8..6549c6db6b0a 100644 --- a/clang/lib/DPCT/RulesMathLib/CallExprRewriterCURAND.cpp +++ b/clang/lib/DPCT/RulesMathLib/CallExprRewriterCURAND.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesMathLib/CallExprRewriterCUSOLVER.cpp b/clang/lib/DPCT/RulesMathLib/CallExprRewriterCUSOLVER.cpp index f997732a4b3c..f24e8b7ede0b 100644 --- a/clang/lib/DPCT/RulesMathLib/CallExprRewriterCUSOLVER.cpp +++ b/clang/lib/DPCT/RulesMathLib/CallExprRewriterCUSOLVER.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesMathLib/CallExprRewriterCUSPARSE.cpp b/clang/lib/DPCT/RulesMathLib/CallExprRewriterCUSPARSE.cpp index bd726c15f990..ae07d8d88da6 100644 --- a/clang/lib/DPCT/RulesMathLib/CallExprRewriterCUSPARSE.cpp +++ b/clang/lib/DPCT/RulesMathLib/CallExprRewriterCUSPARSE.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "CallExprRewriter.h" -#include "CallExprRewriterCommon.h" +#include "RuleInfra/CallExprRewriter.h" +#include "RuleInfra/CallExprRewriterCommon.h" namespace clang { namespace dpct { diff --git a/clang/lib/DPCT/RulesMathLib/FFTAPIMigration.h b/clang/lib/DPCT/RulesMathLib/FFTAPIMigration.h index 2d21d1a71118..15a5766d505a 100644 --- a/clang/lib/DPCT/RulesMathLib/FFTAPIMigration.h +++ b/clang/lib/DPCT/RulesMathLib/FFTAPIMigration.h @@ -9,7 +9,7 @@ #ifndef DPCT_FFT_API_MIGRATION_H #define DPCT_FFT_API_MIGRATION_H -#include "MapNames.h" +#include "RuleInfra/MapNames.h" #include "TextModification.h" #include "clang/AST/Decl.h" #include "clang/AST/Stmt.h" diff --git a/clang/lib/DPCT/TextModification.cpp b/clang/lib/DPCT/TextModification.cpp index 87b26eb13a69..136bd2d94ff3 100644 --- a/clang/lib/DPCT/TextModification.cpp +++ b/clang/lib/DPCT/TextModification.cpp @@ -671,7 +671,7 @@ ReplaceText::getReplacement(const ASTContext &Context) const { const std::unordered_map TextModification::TMNameMap = { #define TRANSFORMATION(TYPE) {(int)TMID::TYPE, #TYPE}, -#include "Transformations.inc" +#include "TextModificationKind.inc" #undef TRANSFORMATION }; diff --git a/clang/lib/DPCT/TextModification.h b/clang/lib/DPCT/TextModification.h index ecfdae6596d3..5ddad89d3705 100644 --- a/clang/lib/DPCT/TextModification.h +++ b/clang/lib/DPCT/TextModification.h @@ -9,7 +9,7 @@ #ifndef DPCT_TEXT_MODIFICATION_H #define DPCT_TEXT_MODIFICATION_H -#include "MapNames.h" +#include "RuleInfra/MapNames.h" #include "Utility.h" #include "clang/Tooling/Core/Replacement.h" #include "clang/Tooling/Tooling.h" @@ -134,7 +134,7 @@ class ExtReplacement : public tooling::Replacement { enum class TextModificationID : int { #define TRANSFORMATION(TYPE) TYPE, -#include "Transformations.inc" +#include "TextModificationKind.inc" #undef TRANSFORMATION }; diff --git a/clang/lib/DPCT/Transformations.inc b/clang/lib/DPCT/TextModificationKind.inc similarity index 91% rename from clang/lib/DPCT/Transformations.inc rename to clang/lib/DPCT/TextModificationKind.inc index f61196e24990..2fd67af49dce 100644 --- a/clang/lib/DPCT/Transformations.inc +++ b/clang/lib/DPCT/TextModificationKind.inc @@ -1,4 +1,4 @@ -//===--------------- Transformations.inc ----------------------------------===// +//===--------------- TextModificationKind.inc ----------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/clang/lib/DPCT/UserDefinedRules/UserDefinedRules.cpp b/clang/lib/DPCT/UserDefinedRules/UserDefinedRules.cpp index 5b878dd28e53..5a3abdada959 100644 --- a/clang/lib/DPCT/UserDefinedRules/UserDefinedRules.cpp +++ b/clang/lib/DPCT/UserDefinedRules/UserDefinedRules.cpp @@ -7,13 +7,13 @@ //===----------------------------------------------------------------------===// #include "UserDefinedRules/UserDefinedRules.h" #include "ASTTraversal.h" -#include "CallExprRewriter.h" +#include "RuleInfra/CallExprRewriter.h" #include "ErrorHandle/Error.h" -#include "MapNames.h" +#include "RuleInfra/MapNames.h" #include "MigrateScript/MigrateCmakeScript.h" #include "MigrateScript/MigratePythonBuildScript.h" #include "MigrationRuleManager.h" -#include "TypeLocRewriters.h" +#include "RuleInfra/TypeLocRewriters.h" #include "Utility.h" #include "llvm/Support/YAMLTraits.h" diff --git a/clang/lib/DPCT/Utility.cpp b/clang/lib/DPCT/Utility.cpp index d91c912d2383..64a259a24f80 100644 --- a/clang/lib/DPCT/Utility.cpp +++ b/clang/lib/DPCT/Utility.cpp @@ -11,8 +11,8 @@ #include "AnalysisInfo.h" #include "Config.h" #include "RulesDNN/DNNAPIMigration.h" -#include "ExprAnalysis.h" -#include "MapNames.h" +#include "RuleInfra/ExprAnalysis.h" +#include "RuleInfra/MapNames.h" #include "FileGenerator/GenFiles.h" #include "Statics.h" #include "clang/AST/ASTContext.h" diff --git a/clang/tools/dpct/CMakeLists.txt b/clang/tools/dpct/CMakeLists.txt index 9bcec9bc2789..a8046215b25e 100644 --- a/clang/tools/dpct/CMakeLists.txt +++ b/clang/tools/dpct/CMakeLists.txt @@ -11,7 +11,7 @@ set(LLVM_LINK_COMPONENTS ) add_clang_tool(dpct-binary - DPCT.cpp NO_INSTALL_RPATH + DPCTMain.cpp NO_INSTALL_RPATH ) set_target_properties(dpct-binary PROPERTIES OUTPUT_NAME "dpct") include_directories( diff --git a/clang/tools/dpct/DPCT.cpp b/clang/tools/dpct/DPCTMain.cpp similarity index 81% rename from clang/tools/dpct/DPCT.cpp rename to clang/tools/dpct/DPCTMain.cpp index 8fd18b202993..187f01455a84 100644 --- a/clang/tools/dpct/DPCT.cpp +++ b/clang/tools/dpct/DPCTMain.cpp @@ -1,4 +1,4 @@ -//===--------------- DPCT.cpp ---------------------------------------------===// +//===--------------- DPCTMain.cpp ---------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information.