-
Notifications
You must be signed in to change notification settings - Fork 39
fix common namespaces for public API and internals #766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -92,8 +92,8 @@ static inline char* GetEnv(const char* Var_Name) { | |||||
| #include <regex> | ||||||
| #include <vector> | ||||||
|
|
||||||
| namespace Cpp { | ||||||
| namespace Cpp_utils = cling::utils; | ||||||
| namespace CppInternal { | ||||||
| namespace utils = cling::utils; | ||||||
| } | ||||||
|
|
||||||
| namespace compat { | ||||||
|
|
@@ -434,12 +434,8 @@ inline void codeComplete(std::vector<std::string>& Results, | |||||
|
|
||||||
| #include "CppInterOpInterpreter.h" | ||||||
|
|
||||||
| namespace Cpp { | ||||||
| namespace Cpp_utils = Cpp::utils; | ||||||
| } | ||||||
|
|
||||||
| namespace compat { | ||||||
| using Interpreter = Cpp::Interpreter; | ||||||
| using Interpreter = CppInternal::Interpreter; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no type named 'Interpreter' in namespace 'CppInternal'; did you mean 'clang::Interpreter'? [clang-diagnostic-error]
Suggested change
Additional contextllvm/include/clang/Interpreter/Interpreter.h:85: 'clang::Interpreter' declared here class Interpreter {
^ |
||||||
|
|
||||||
| class SynthesizingCodeRAII { | ||||||
| private: | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -769,7 +769,7 @@ TCppScope_t GetNamed(const std::string& name, | |
| Within = llvm::dyn_cast<clang::DeclContext>(D); | ||
| } | ||
|
|
||
| auto* ND = Cpp_utils::Lookup::Named(&getSema(), name, Within); | ||
| auto* ND = CppInternal::utils::Lookup::Named(&getSema(), name, Within); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "CppInternal::utils::Lookup::Named" is directly included [misc-include-cleaner] lib/CppInterOp/CppInterOp.cpp:12: + #include "CppInterOpInterpreter.h" |
||
| if (ND && ND != (clang::NamedDecl*)-1) { | ||
| return (TCppScope_t)(ND->getCanonicalDecl()); | ||
| } | ||
|
|
@@ -1025,7 +1025,7 @@ std::vector<TCppFunction_t> GetFunctionsUsingName(TCppScope_t scope, | |
| clang::LookupResult R(S, DName, SourceLocation(), Sema::LookupOrdinaryName, | ||
| For_Visible_Redeclaration); | ||
|
|
||
| Cpp_utils::Lookup::Named(&S, R, Decl::castToDeclContext(D)); | ||
| CppInternal::utils::Lookup::Named(&S, R, Decl::castToDeclContext(D)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "CppInternal::utils::Lookup::Named" is directly included [misc-include-cleaner] CppInternal::utils::Lookup::Named(&S, R, Decl::castToDeclContext(D));
^ |
||
|
|
||
| if (R.empty()) | ||
| return funcs; | ||
|
|
@@ -1169,7 +1169,7 @@ bool ExistsFunctionTemplate(const std::string& name, TCppScope_t parent) { | |
| Within = llvm::dyn_cast<DeclContext>(D); | ||
| } | ||
|
|
||
| auto* ND = Cpp_utils::Lookup::Named(&getSema(), name, Within); | ||
| auto* ND = CppInternal::utils::Lookup::Named(&getSema(), name, Within); | ||
|
|
||
| if ((intptr_t)ND == (intptr_t)0) | ||
| return false; | ||
|
|
@@ -1214,7 +1214,7 @@ bool GetClassTemplatedMethods(const std::string& name, TCppScope_t parent, | |
| clang::LookupResult R(S, DName, SourceLocation(), Sema::LookupOrdinaryName, | ||
| For_Visible_Redeclaration); | ||
| auto* DC = clang::Decl::castToDeclContext(D); | ||
| Cpp_utils::Lookup::Named(&S, R, DC); | ||
| CppInternal::utils::Lookup::Named(&S, R, DC); | ||
|
|
||
| if (R.getResultKind() == clang::LookupResult::NotFound && funcs.empty()) | ||
| return false; | ||
|
|
@@ -1508,7 +1508,7 @@ TCppScope_t LookupDatamember(const std::string& name, TCppScope_t parent) { | |
| Within = llvm::dyn_cast<clang::DeclContext>(D); | ||
| } | ||
|
|
||
| auto* ND = Cpp_utils::Lookup::Named(&getSema(), name, Within); | ||
| auto* ND = CppInternal::utils::Lookup::Named(&getSema(), name, Within); | ||
| if (ND && ND != (clang::NamedDecl*)-1) { | ||
| if (llvm::isa_and_nonnull<clang::FieldDecl>(ND)) { | ||
| return (TCppScope_t)ND; | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -67,7 +67,7 @@ template <typename D> static D* LookupResult2Decl(clang::LookupResult& R) { | |||||||||
| } | ||||||||||
| } // namespace | ||||||||||
|
|
||||||||||
| namespace Cpp { | ||||||||||
| namespace CppInternal { | ||||||||||
| namespace utils { | ||||||||||
| namespace Lookup { | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
Suggested change
lib/CppInterOp/CppInterOpInterpreter.h:141: - } // namespace Lookup
- } // namespace utils
- } // namespace CppInternal
+ } // namespace CppInternal::utils::Lookup
+ |
||||||||||
|
|
||||||||||
|
|
@@ -141,9 +141,9 @@ inline clang::NamedDecl* Named(clang::Sema* S, const char* Name, | |||||||||
|
|
||||||||||
| } // namespace Lookup | ||||||||||
| } // namespace utils | ||||||||||
| } // namespace Cpp | ||||||||||
| } // namespace CppInternal | ||||||||||
|
|
||||||||||
| namespace Cpp { | ||||||||||
| namespace CppInternal { | ||||||||||
|
|
||||||||||
| /// CppInterOp Interpreter | ||||||||||
| /// | ||||||||||
|
|
@@ -494,7 +494,7 @@ class Interpreter { | |||||||||
|
|
||||||||||
| // Save the current number of entries | ||||||||||
| size_t Idx = HOpts.UserEntries.size(); | ||||||||||
| Cpp::utils::AddIncludePaths(PathsStr, HOpts, Delim); | ||||||||||
| CppInternal::utils::AddIncludePaths(PathsStr, HOpts, Delim); | ||||||||||
|
|
||||||||||
| clang::Preprocessor& PP = CI->getPreprocessor(); | ||||||||||
| clang::SourceManager& SM = PP.getSourceManager(); | ||||||||||
|
|
@@ -532,8 +532,8 @@ class Interpreter { | |||||||||
| /// | ||||||||||
| void GetIncludePaths(llvm::SmallVectorImpl<std::string>& incpaths, | ||||||||||
| bool withSystem, bool withFlags) const { | ||||||||||
| utils::CopyIncludePaths(getCI()->getHeaderSearchOpts(), incpaths, | ||||||||||
| withSystem, withFlags); | ||||||||||
| CppInternal::utils::CopyIncludePaths(getCI()->getHeaderSearchOpts(), | ||||||||||
| incpaths, withSystem, withFlags); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| CompilationResult loadLibrary(const std::string& filename, bool lookup) { | ||||||||||
|
|
@@ -587,6 +587,6 @@ class Interpreter { | |||||||||
| } | ||||||||||
|
|
||||||||||
| }; // Interpreter | ||||||||||
| } // namespace Cpp | ||||||||||
| } // namespace CppInternal | ||||||||||
|
|
||||||||||
| #endif // CPPINTEROP_INTERPRETER_H | ||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -458,6 +458,8 @@ | |
|
|
||
| } // namespace | ||
|
|
||
| namespace CppInternal { | ||
|
|
||
| // This function isn't referenced outside its translation unit, but it | ||
| // can't use the "static" keyword because its address is used for | ||
| // GetMainExecutable (since some platforms don't support taking the | ||
|
|
@@ -466,10 +468,9 @@ | |
| std::string GetExecutablePath() { | ||
| // This just needs to be some symbol in the binary; C++ doesn't | ||
| // allow taking the address of ::main however. | ||
| return Cpp::DynamicLibraryManager::getSymbolLocation(&GetExecutablePath); | ||
| return DynamicLibraryManager::getSymbolLocation(&GetExecutablePath); | ||
| } | ||
|
|
||
| namespace Cpp { | ||
| class Dyld { | ||
| struct BasePathHashFunction { | ||
| size_t operator()(const BasePath& item) const { | ||
|
|
@@ -508,7 +509,7 @@ | |
| bool m_UseBloomFilter = true; | ||
| bool m_UseHashTable = true; | ||
|
|
||
| const Cpp::DynamicLibraryManager& m_DynamicLibraryManager; | ||
| const DynamicLibraryManager& m_DynamicLibraryManager; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: member 'm_DynamicLibraryManager' of type 'const DynamicLibraryManager &' is a reference [cppcoreguidelines-avoid-const-or-ref-data-members] const DynamicLibraryManager& m_DynamicLibraryManager;
^ |
||
|
|
||
| /// The basename of `/home/.../lib/libA.so`, | ||
| /// m_BasePaths will contain `/home/.../lib/` | ||
|
|
@@ -548,7 +549,7 @@ | |
| void dumpDebugInfo() const; | ||
|
|
||
| public: | ||
| Dyld(const Cpp::DynamicLibraryManager& DLM, | ||
| Dyld(const DynamicLibraryManager& DLM, | ||
| PermanentlyIgnoreCallbackProto shouldIgnore, StringRef execFormat) | ||
| : m_DynamicLibraryManager(DLM), | ||
| m_ShouldPermanentlyIgnoreCallback(shouldIgnore), | ||
|
|
@@ -594,12 +595,14 @@ | |
| Deps.push_back(Data + Dyn.d_un.d_val); | ||
| break; | ||
| case ELF::DT_RPATH: | ||
| SplitPaths(Data + Dyn.d_un.d_val, RPath, utils::kAllowNonExistent, | ||
| Cpp::utils::platform::kEnvDelim, false); | ||
| SplitPaths(Data + Dyn.d_un.d_val, RPath, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access] SplitPaths(Data + Dyn.d_un.d_val, RPath,
^ |
||
| utils::SplitMode::kAllowNonExistent, | ||
| utils::platform::kEnvDelim, false); | ||
| break; | ||
| case ELF::DT_RUNPATH: | ||
| SplitPaths(Data + Dyn.d_un.d_val, RunPath, utils::kAllowNonExistent, | ||
| Cpp::utils::platform::kEnvDelim, false); | ||
| SplitPaths(Data + Dyn.d_un.d_val, RunPath, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access] SplitPaths(Data + Dyn.d_un.d_val, RunPath,
^ |
||
| utils::SplitMode::kAllowNonExistent, | ||
| utils::platform::kEnvDelim, false); | ||
| break; | ||
| case ELF::DT_FLAGS_1: | ||
| // Check if this is not a pie executable. | ||
|
|
@@ -757,8 +760,8 @@ | |
| } else if (Command.C.cmd == MachO::LC_RPATH) { | ||
| MachO::rpath_command rpathCmd = Obj->getRpathCommand(Command); | ||
| SplitPaths(Command.Ptr + rpathCmd.path, RPath, | ||
| utils::kAllowNonExistent, | ||
| Cpp::utils::platform::kEnvDelim, false); | ||
| utils::SplitMode::kAllowNonExistent, | ||
| utils::platform::kEnvDelim, false); | ||
| } | ||
| } | ||
| } else if (BinObjF->isCOFF()) { | ||
|
|
@@ -1112,7 +1115,7 @@ | |
| #define DEBUG_TYPE "Dyld:" | ||
| assert(!m_ExecutableFormat.empty() && "Failed to find the object format!"); | ||
|
|
||
| if (!Cpp::DynamicLibraryManager::isSharedLibrary(FileName)) | ||
| if (!DynamicLibraryManager::isSharedLibrary(FileName)) | ||
| return true; | ||
|
|
||
| // No need to check linked libraries, as this function is only invoked | ||
|
|
@@ -1381,4 +1384,4 @@ | |
| #endif | ||
| } | ||
|
|
||
| } // namespace Cpp | ||
| } // namespace CppInternal | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,7 +23,7 @@ | |||||||
| #include <dlfcn.h> | ||||||||
| #endif | ||||||||
|
|
||||||||
| namespace Cpp { | ||||||||
| namespace CppInternal { | ||||||||
| namespace utils { | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
Suggested change
lib/CppInterOp/Paths.cpp:400: - } // namespace utils
- } // namespace CppInternal
+ } // namespace CppInternal::utils |
||||||||
|
|
||||||||
| namespace platform { | ||||||||
|
|
@@ -361,7 +361,7 @@ bool SplitPaths(llvm::StringRef PathStr, | |||||||
|
|
||||||||
| void AddIncludePaths( | ||||||||
| llvm::StringRef PathStr, clang::HeaderSearchOptions& HOpts, | ||||||||
| const char* Delim /* = Cpp::utils::platform::kEnvDelim */) { | ||||||||
| const char* Delim /* = CppInternal::utils::platform::kEnvDelim */) { | ||||||||
| #define DEBUG_TYPE "AddIncludePaths" | ||||||||
|
|
||||||||
| llvm::SmallVector<llvm::StringRef, 10> Paths; | ||||||||
|
|
@@ -399,4 +399,4 @@ void AddIncludePaths( | |||||||
| } | ||||||||
|
|
||||||||
| } // namespace utils | ||||||||
| } // namespace Cpp | ||||||||
| } // namespace CppInternal | ||||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,7 +24,7 @@ class HeaderSearchOptions; | |||||||
| class FileManager; | ||||||||
| } // namespace clang | ||||||||
|
|
||||||||
| namespace Cpp { | ||||||||
| namespace CppInternal { | ||||||||
| namespace utils { | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
Suggested change
lib/CppInterOp/Paths.h:119: - } // namespace utils
- } // namespace CppInternal
+ } // namespace CppInternal::utils |
||||||||
|
|
||||||||
| namespace platform { | ||||||||
|
|
@@ -80,7 +80,7 @@ enum SplitMode { | |||||||
| bool SplitPaths(llvm::StringRef PathStr, | ||||||||
| llvm::SmallVectorImpl<llvm::StringRef>& Paths, | ||||||||
| SplitMode Mode = kPruneNonExistent, | ||||||||
| llvm::StringRef Delim = Cpp::utils::platform::kEnvDelim, | ||||||||
| llvm::StringRef Delim = CppInternal::utils::platform::kEnvDelim, | ||||||||
| bool Verbose = false); | ||||||||
|
|
||||||||
| ///\brief Adds multiple include paths separated by a delimiter into the | ||||||||
|
|
@@ -92,8 +92,9 @@ bool SplitPaths(llvm::StringRef PathStr, | |||||||
| ///\param[in] Opts - HeaderSearchOptions to add paths into | ||||||||
| ///\param[in] Delim - Delimiter to separate paths or NULL if a single path | ||||||||
| /// | ||||||||
| void AddIncludePaths(llvm::StringRef PathStr, clang::HeaderSearchOptions& HOpts, | ||||||||
| const char* Delim = Cpp::utils::platform::kEnvDelim); | ||||||||
| void AddIncludePaths( | ||||||||
| llvm::StringRef PathStr, clang::HeaderSearchOptions& HOpts, | ||||||||
| const char* Delim = CppInternal::utils::platform::kEnvDelim); | ||||||||
|
|
||||||||
| ///\brief Write to cling::errs that directory does not exist in a format | ||||||||
| /// matching what 'clang -v' would do | ||||||||
|
|
@@ -117,6 +118,6 @@ void CopyIncludePaths(const clang::HeaderSearchOptions& Opts, | |||||||
| bool WithSystem, bool WithFlags); | ||||||||
|
|
||||||||
| } // namespace utils | ||||||||
| } // namespace Cpp | ||||||||
| } // namespace CppInternal | ||||||||
|
|
||||||||
| #endif // CPPINTEROP_UTILS_PATHS_H | ||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "CppInternal::utils::Lookup::Named" is directly included [misc-include-cleaner]
lib/CppInterOp/CXCppInterOp.cpp:4: