diff options
| author | Adrian Prantl <aprantl@apple.com> | 2018-04-30 16:49:04 +0000 |
|---|---|---|
| committer | Adrian Prantl <aprantl@apple.com> | 2018-04-30 16:49:04 +0000 |
| commit | 05097246f352eca76207c9ebb08656c88bdf751a (patch) | |
| tree | bfc4ec8250a939aaf4ade6fc6c528726183e5367 /lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp | |
| parent | add59c052dd6768fd54431e6a3bf045e7f25cb59 (diff) | |
| download | bcm5719-llvm-05097246f352eca76207c9ebb08656c88bdf751a.tar.gz bcm5719-llvm-05097246f352eca76207c9ebb08656c88bdf751a.zip | |
Reflow paragraphs in comments.
This is intended as a clean up after the big clang-format commit
(r280751), which unfortunately resulted in many of the comment
paragraphs in LLDB being very hard to read.
FYI, the script I used was:
import textwrap
import commands
import os
import sys
import re
tmp = "%s.tmp"%sys.argv[1]
out = open(tmp, "w+")
with open(sys.argv[1], "r") as f:
header = ""
text = ""
comment = re.compile(r'^( *//) ([^ ].*)$')
special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$')
for line in f:
match = comment.match(line)
if match and not special.match(match.group(2)):
# skip intentionally short comments.
if not text and len(match.group(2)) < 40:
out.write(line)
continue
if text:
text += " " + match.group(2)
else:
header = match.group(1)
text = match.group(2)
continue
if text:
filled = textwrap.wrap(text, width=(78-len(header)),
break_long_words=False)
for l in filled:
out.write(header+" "+l+'\n')
text = ""
out.write(line)
os.rename(tmp, sys.argv[1])
Differential Revision: https://reviews.llvm.org/D46144
llvm-svn: 331197
Diffstat (limited to 'lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp')
| -rw-r--r-- | lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp | 86 |
1 files changed, 39 insertions, 47 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp index 76f08dc426a..5a970aadd4f 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -213,8 +213,8 @@ private: m_exporter.getFromContext().getSourceManager().getFileID(loc); if (file != m_file) return false; - // We are assuming the Decl was parsed in this very expression, so it should - // not have external storage. + // We are assuming the Decl was parsed in this very expression, so it + // should not have external storage. lldbassert(!llvm::cast<DeclContext>(decl)->hasExternalLexicalStorage()); return true; } @@ -591,8 +591,8 @@ bool ClangExpressionDeclMap::GetFunctionInfo(const NamedDecl *decl, if (!entity) return false; - // We know m_parser_vars is valid since we searched for the variable by - // its NamedDecl + // We know m_parser_vars is valid since we searched for the variable by its + // NamedDecl ClangExpressionVariable::ParserVars *parser_vars = entity->GetParserVars(GetParserID()); @@ -867,8 +867,8 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls( if (IgnoreName(name, false)) return; - // Only look for functions by name out in our symbols if the function - // doesn't start with our phony prefix of '$' + // Only look for functions by name out in our symbols if the function doesn't + // start with our phony prefix of '$' Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr(); StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr(); SymbolContext sym_ctx; @@ -977,13 +977,11 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls( m_struct_vars->m_object_pointer_type = self_user_type; } } else { - // This branch will get hit if we are executing code in the context of a - // function that - // claims to have an object pointer (through DW_AT_object_pointer?) but - // is not formally a - // method of the class. In that case, just look up the "this" variable - // in the current - // scope and use its type. + // This branch will get hit if we are executing code in the context of + // a function that claims to have an object pointer (through + // DW_AT_object_pointer?) but is not formally a method of the class. + // In that case, just look up the "this" variable in the current scope + // and use its type. // FIXME: This code is formally correct, but clang doesn't currently // emit DW_AT_object_pointer // for C++ so it hasn't actually been tested. @@ -1093,13 +1091,11 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls( return; } else { - // This branch will get hit if we are executing code in the context of a - // function that - // claims to have an object pointer (through DW_AT_object_pointer?) but - // is not formally a - // method of the class. In that case, just look up the "self" variable - // in the current - // scope and use its type. + // This branch will get hit if we are executing code in the context of + // a function that claims to have an object pointer (through + // DW_AT_object_pointer?) but is not formally a method of the class. + // In that case, just look up the "self" variable in the current scope + // and use its type. VariableList *vars = frame->GetVariableList(false); @@ -1217,9 +1213,8 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls( vars->GetVariableAtIndex(i)->GetDecl(); // Search for declarations matching the name. Do not include imported - // decls - // in the search if we are looking for decls in the artificial namespace - // $__lldb_local_vars. + // decls in the search if we are looking for decls in the artificial + // namespace $__lldb_local_vars. std::vector<CompilerDecl> found_decls = compiler_decl_context.FindDeclByName(name, namespace_decl.IsValid()); @@ -1285,15 +1280,15 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls( append, sc_list); } - // If we found more than one function, see if we can use the - // frame's decl context to remove functions that are shadowed - // by other functions which match in type but are nearer in scope. + // If we found more than one function, see if we can use the frame's decl + // context to remove functions that are shadowed by other functions which + // match in type but are nearer in scope. // // AddOneFunction will not add a function whose type has already been - // added, so if there's another function in the list with a matching - // type, check to see if their decl context is a parent of the current - // frame's or was imported via a and using statement, and pick the - // best match according to lookup rules. + // added, so if there's another function in the list with a matching type, + // check to see if their decl context is a parent of the current frame's or + // was imported via a and using statement, and pick the best match + // according to lookup rules. if (sc_list.GetSize() > 1) { // Collect some info about our frame's context. StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr(); @@ -1321,11 +1316,10 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls( SymbolContext m_sym_ctx; }; - // First, symplify things by looping through the symbol contexts - // to remove unwanted functions and separate out the functions we - // want to compare and prune into a separate list. - // Cache the info needed about the function declarations in a - // vector for efficiency. + // First, symplify things by looping through the symbol contexts to + // remove unwanted functions and separate out the functions we want to + // compare and prune into a separate list. Cache the info needed about + // the function declarations in a vector for efficiency. SymbolContextList sc_sym_list; uint32_t num_indices = sc_list.GetSize(); std::vector<FuncDeclInfo> fdi_cache; @@ -1335,16 +1329,16 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls( SymbolContext sym_ctx; sc_list.GetContextAtIndex(index, sym_ctx); - // We don't know enough about symbols to compare them, - // but we should keep them in the list. + // We don't know enough about symbols to compare them, but we should + // keep them in the list. Function *function = sym_ctx.function; if (!function) { sc_sym_list.Append(sym_ctx); continue; } // Filter out functions without declaration contexts, as well as - // class/instance methods, since they'll be skipped in the - // code that follows anyway. + // class/instance methods, since they'll be skipped in the code that + // follows anyway. CompilerDeclContext func_decl_context = function->GetDeclContext(); if (!func_decl_context || func_decl_context.IsClassMethod(nullptr, nullptr, nullptr)) @@ -1363,11 +1357,10 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls( fdi.m_copied_type = copied_func_type; fdi.m_decl_lvl = LLDB_INVALID_DECL_LEVEL; if (fdi.m_copied_type && func_decl_context) { - // Call CountDeclLevels to get the number of parent scopes we - // have to look through before we find the function declaration. - // When comparing functions of the same type, the one with a - // lower count will be closer to us in the lookup scope and - // shadows the other. + // Call CountDeclLevels to get the number of parent scopes we have + // to look through before we find the function declaration. When + // comparing functions of the same type, the one with a lower count + // will be closer to us in the lookup scope and shadows the other. clang::DeclContext *func_decl_ctx = (clang::DeclContext *)func_decl_context.GetOpaqueDeclContext(); fdi.m_decl_lvl = ast->CountDeclLevels( @@ -1536,9 +1529,8 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls( } if (target && !context.m_found.variable && !namespace_decl) { - // We couldn't find a non-symbol variable for this. Now we'll hunt for - // a generic - // data symbol, and -- if it is found -- treat it as a variable. + // We couldn't find a non-symbol variable for this. Now we'll hunt for a + // generic data symbol, and -- if it is found -- treat it as a variable. Status error; const Symbol *data_symbol = |

