[llvm-bugs] [Bug 31427] New: clang-format confused by initializer lists with embedded preprocessor directives

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Dec 19 03:48:58 PST 2016


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

            Bug ID: 31427
           Summary: clang-format confused by initializer lists with
                    embedded preprocessor directives
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dcheng at google.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

Here's the code before formatting:
std::vector<content::ContentBrowserClient::ServiceManifestInfo>
ChromeContentBrowserClient::GetExtraServiceManifests() {
  return std::vector<content::ContentBrowserClient::ServiceManifestInfo>({
#if !defined(DISABLE_NACL)
      {nacl::kNaClLoaderServiceName, IDR_NACL_LOADER_MANIFEST},
#if defined(OS_WIN)
      {nacl::kNaClBrokerServiceName, IDR_NACL_BROKER_MANIFEST},
#endif  // defined(OS_WIN)
#endif  // !defined(DISABLE_NACL)
  });
}

Here's the code after formatting:
std::vector<content::ContentBrowserClient::ServiceManifestInfo>
ChromeContentBrowserClient::GetExtraServiceManifests() {
  return std::vector<content::ContentBrowserClient::ServiceManifestInfo>({
#if !defined(DISABLE_NACL)
    {nacl::kNaClLoaderServiceName, IDR_NACL_LOADER_MANIFEST},
#if defined(OS_WIN)
        {nacl::kNaClBrokerServiceName, IDR_NACL_BROKER_MANIFEST},
#endif  // defined(OS_WIN)
#endif  // !defined(DISABLE_NACL)
  });
}

Here's how it ought to look:
std::vector<content::ContentBrowserClient::ServiceManifestInfo>
ChromeContentBrowserClient::GetExtraServiceManifests() {
  return std::vector<content::ContentBrowserClient::ServiceManifestInfo>({
#if !defined(DISABLE_NACL)
      {nacl::kNaClLoaderServiceName, IDR_NACL_LOADER_MANIFEST},
#if defined(OS_WIN)
      {nacl::kNaClBrokerServiceName, IDR_NACL_BROKER_MANIFEST},
#endif  // defined(OS_WIN)
#endif  // !defined(DISABLE_NACL)
  });
}

Code review link for full files/context:
https://codereview.chromium.org/2501913002/diff/320001/chrome/browser/chrome_content_browser_client.cc

Reported in https://bugs.chromium.org/p/chromium/issues/detail?id=675554

-- 
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/20161219/8a1755a1/attachment.html>


More information about the llvm-bugs mailing list