using namespace lldb_private;
namespace {
-// Any Clang compiler requires a consumer for diagnostics. This one stores
-// them as strings so we can provide them to the user in case a module failed
-// to load.
+/// Any Clang compiler requires a consumer for diagnostics. This one stores
+/// them as strings so we can provide them to the user in case a module failed
+/// to load.
class StoringDiagnosticConsumer : public clang::DiagnosticConsumer {
public:
StoringDiagnosticConsumer();
Log *m_log;
};
-// The private implementation of our ClangModulesDeclVendor. Contains all the
-// Clang state required to load modules.
+/// The private implementation of our ClangModulesDeclVendor. Contains all the
+/// Clang state required to load modules.
class ClangModulesDeclVendorImpl : public ClangModulesDeclVendor {
public:
ClangModulesDeclVendorImpl(
module->getExportedModules(sub_exports);
- for (clang::Module *module : sub_exports) {
+ for (clang::Module *module : sub_exports)
ReportModuleExportsHelper(exports, module);
- }
}
void ClangModulesDeclVendorImpl::ReportModuleExports(
ReportModuleExportsHelper(exports_set, module);
- for (ModuleID module : exports_set) {
+ for (ModuleID module : exports_set)
exports.push_back(module);
- }
}
bool ClangModulesDeclVendorImpl::AddModule(const SourceModule &module,
std::vector<ConstString> imported_module;
- for (ConstString path_component : module.path) {
+ for (ConstString path_component : module.path)
imported_module.push_back(path_component);
- }
{
ImportedModuleMap::iterator mi = m_imported_modules.find(imported_module);
if (mi != m_imported_modules.end()) {
- if (exported_modules) {
+ if (exported_modules)
ReportModuleExports(*exported_modules, mi->second);
- }
return true;
}
}
clang::Module *requested_module = DoGetModule(clang_path, true);
if (requested_module != nullptr) {
- if (exported_modules) {
+ if (exported_modules)
ReportModuleExports(*exported_modules, requested_module);
- }
m_imported_modules[imported_module] = requested_module;
ClangModulesDeclVendorImpl::FindDecls(ConstString name, bool append,
uint32_t max_matches,
std::vector<CompilerDecl> &decls) {
- if (!m_enabled) {
+ if (!m_enabled)
return 0;
- }
if (!append)
decls.clear();
void ClangModulesDeclVendorImpl::ForEachMacro(
const ClangModulesDeclVendor::ModuleVector &modules,
std::function<bool(llvm::StringRef, llvm::StringRef)> handler) {
- if (!m_enabled) {
+ if (!m_enabled)
return;
- }
typedef std::map<ModuleID, ssize_t> ModulePriorityMap;
ModulePriorityMap module_priorities;
ssize_t priority = 0;
- for (ModuleID module : modules) {
+ for (ModuleID module : modules)
module_priorities[module] = priority++;
- }
if (m_compiler_instance->getPreprocessor().getExternalSource()) {
m_compiler_instance->getPreprocessor()
.getExternalIdentifierLookup()) {
lookup->get(mi->first->getName());
}
- if (!ii) {
+ if (!ii)
ii = mi->first;
- }
}
ssize_t found_priority = -1;
for (auto pi = macro_info->param_begin(),
pe = macro_info->param_end();
pi != pe; ++pi) {
- if (!first_arg) {
+ if (!first_arg)
macro_expansion.append(", ");
- } else {
+ else
first_arg = false;
- }
macro_expansion.append((*pi)->getName().str());
}
if (macro_info->isC99Varargs()) {
- if (first_arg) {
+ if (first_arg)
macro_expansion.append("...");
- } else {
+ else
macro_expansion.append(", ...");
- }
- } else if (macro_info->isGNUVarargs()) {
+ } else if (macro_info->isGNUVarargs())
macro_expansion.append("...");
- }
macro_expansion.append(")");
}
for (clang::MacroInfo::tokens_iterator ti = macro_info->tokens_begin(),
te = macro_info->tokens_end();
ti != te; ++ti) {
- if (!first_token) {
+ if (!first_token)
macro_expansion.append(" ");
- } else {
+ else
first_token = false;
- }
if (ti->isLiteral()) {
if (const char *literal_data = ti->getLiteralData()) {