[llvm-bugs] [Bug 33394] New: Editor placeholder check is too lax

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 9 17:04:36 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33394

            Bug ID: 33394
           Summary: Editor placeholder check is too lax
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mistydemeo at github.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18606
  --> https://bugs.llvm.org/attachment.cgi?id=18606&action=edit
Proposed patch to improve editor placeholder check

The new support for editor placeholders, added in
aac41bcdb19f21fb20a2efdc19494b622ba29171, is too lax in its definition of
editor placeholders. I noticed this when the current check (begins with "<#"
and ends with "#>") caught <#> (a Haskell operator) in some Haskell with GHC,
uses the C preprocessor for certain Haskell code. According to the comment in
IdentifierTable.h, editor placeholders are "characters between '<#' and '#>'",
for example "<#int x#>" - this shouldn't be matching <#>.

The attached patch adds an extra check to see if the matched code has more than
one #, in addition to checking the beginning and ending of the string. I'm not
sure if the additions to the test in my patch are an appropriate way to check
for this - please let me know if there's something else you'd rather see.

A sample error, as reported at https://ghc.haskell.org/trac/ghc/ticket/13805
(before I identified the source of the problem) is:

utils/ghc-pkg/Main.hs:1269:40: error:
     error: editor placeholder in source file
               then termText (location db) <#> termText "\n    (no packages)\n"
                                           ^

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170610/5548035a/attachment-0001.html>


More information about the llvm-bugs mailing list