CppInterOp
C++ Language Interoperability Layer
Loading...
Searching...
No Matches
Namespaces | Enumerations | Functions
CppInternal::utils Namespace Reference

Namespaces

namespace  Lookup
 
namespace  platform
 

Enumerations

enum  SplitMode { kPruneNonExistent , kFailNonExistent , kAllowNonExistent }
 

Functions

void CopyIncludePaths (const clang::HeaderSearchOptions &Opts, llvm::SmallVectorImpl< std::string > &Paths, bool WithSystem, bool WithFlags)
 Copies the current include paths into the HeaderSearchOptions.
 
void LogNonExistentDirectory (llvm::StringRef Path)
 Write to cling::errs that directory does not exist in a format matching what 'clang -v' would do.
 
bool SplitPaths (llvm::StringRef PathStr, llvm::SmallVectorImpl< llvm::StringRef > &Paths, SplitMode Mode=kPruneNonExistent, llvm::StringRef Delim=CppInternal::utils::platform::kEnvDelim, bool Verbose=false)
 Collect the constituent paths from a PATH string.
 
void AddIncludePaths (llvm::StringRef PathStr, clang::HeaderSearchOptions &HOpts, const char *Delim=CppInternal::utils::platform::kEnvDelim)
 Adds multiple include paths separated by a delimiter into the given HeaderSearchOptions.
 

Enumeration Type Documentation

◆ SplitMode

Enumerator
kPruneNonExistent 

Don't add non-existent paths into output.

kFailNonExistent 

Fail on any non-existent paths.

kAllowNonExistent 

Add all paths whether they exist or not.

Definition at line 62 of file Paths.h.

Function Documentation

◆ AddIncludePaths()

void CppInternal::utils::AddIncludePaths ( llvm::StringRef  PathStr,
clang::HeaderSearchOptions &  HOpts,
const char *  Delim = CppInternal::utils::platform::kEnvDelim 
)

Adds multiple include paths separated by a delimiter into the given HeaderSearchOptions.

This adds the paths but does no further processing. See Interpreter::AddIncludePaths or CIFactory::createCI for examples of what needs to be done once the paths have been added.

Parameters
[in]PathStr- Path(s)
[in]Opts- HeaderSearchOptions to add paths into
[in]Delim- Delimiter to separate paths or NULL if a single path

Definition at line 337 of file Paths.cpp.

References kAllowNonExistent, and SplitPaths().

Referenced by CppInternal::Interpreter::AddIncludePaths().

◆ CopyIncludePaths()

void CppInternal::utils::CopyIncludePaths ( const clang::HeaderSearchOptions &  Opts,
llvm::SmallVectorImpl< std::string > &  Paths,
bool  WithSystem,
bool  WithFlags 
)

Copies the current include paths into the HeaderSearchOptions.

Parameters
[in]Opts- HeaderSearchOptions to read from
[out]Paths- Vector to output elements into
[in]WithSystem- if true, incpaths will also contain system include paths (framework, STL etc).
[in]WithFlags- if true, each element in incpaths will be prefixed with a "-I" or similar, and some entries of incpaths will signal a new include path region (e.g. "-cxx-isystem"). Also, flags defining header search behavior will be included in incpaths, e.g. "-nostdinc".

User specified include entries.

Definition at line 150 of file Paths.cpp.

Referenced by CppInternal::Interpreter::GetIncludePaths().

◆ LogNonExistentDirectory()

void CppInternal::utils::LogNonExistentDirectory ( llvm::StringRef  Path)

Write to cling::errs that directory does not exist in a format matching what 'clang -v' would do.

Definition at line 244 of file Paths.cpp.

Referenced by SplitPaths().

◆ SplitPaths()

bool CppInternal::utils::SplitPaths ( llvm::StringRef  PathStr,
llvm::SmallVectorImpl< llvm::StringRef > &  Paths,
SplitMode  Mode = kPruneNonExistent,
llvm::StringRef  Delim = CppInternal::utils::platform::kEnvDelim,
bool  Verbose = false 
)

Collect the constituent paths from a PATH string.

/bin:/usr/bin:/usr/local/bin -> {/bin, /usr/bin, /usr/local/bin}

All paths returned existed at the time of the call

Parameters
[in]PathStr- The PATH string to be split
[out]Paths- All the paths in the string that exist
[in]Mode- If any path doesn't exist stop and return false
[in]Delim- The delimiter to use
[in]Verbose- Whether to print out details as 'clang -v' would
Returns
true if all paths existed, otherwise false

Definition at line 250 of file Paths.cpp.

References kAllowNonExistent, kFailNonExistent, and LogNonExistentDirectory().

Referenced by AddIncludePaths(), CppInternal::DynamicLibraryManager::DynamicLibraryManager(), CppInternal::utils::platform::GetSystemLibraryPaths(), and CppInternal::HandleDynTab().