コード例 #1
0
ファイル: ClangFormat.cpp プロジェクト: zygoloid/clang
static FormatStyle getStyle() {
  FormatStyle TheStyle = getGoogleStyle();
  if (Style == "LLVM")
    TheStyle = getLLVMStyle();
  if (Style == "Chromium")
    TheStyle = getChromiumStyle();
  return TheStyle;
}
コード例 #2
0
TEST_F(FormatTest, IncorrectCodeErrorDetection) {
  EXPECT_EQ("{\n{\n}\n", format("{\n{\n}\n"));
  EXPECT_EQ("{\n  {\n}\n", format("{\n  {\n}\n"));
  EXPECT_EQ("{\n  {\n  }\n", format("{\n  {\n  }\n"));
  EXPECT_EQ("{\n  {\n    }\n  }\n}\n", format("{\n  {\n    }\n  }\n}\n"));

  FormatStyle Style = getLLVMStyle();
  Style.ColumnLimit = 10;
  EXPECT_EQ("{\n"
            "    {\n"
            " breakme(\n"
            "     qwe);\n"
            "}\n", format("{\n"
                          "    {\n"
                          " breakme(qwe);\n"
                          "}\n", Style));

}
コード例 #3
0
 std::string format(llvm::StringRef Code,
                    const FormatStyle &Style = getLLVMStyle()) {
   return format(Code, 0, Code.size(), Style);
 }